diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-20 08:52:55 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-07-20 08:52:55 +0200 |
commit | bffe85ae4c01f126c47ab7ea7b220b91d7c65dac (patch) | |
tree | f08c6bae79151cf0d1c36ecee46573e586490af8 | |
parent | f089a1a2321e77bfb5f60c2cd79dac14eac9bf63 (diff) |
Make slightly more interesting
-rw-r--r-- | libhello/libhello/buildfile | 2 | ||||
-rw-r--r-- | libhello/libhello/hello.cxx | 2 | ||||
-rw-r--r-- | libhello/libhello/hello.hxx | 13 | ||||
-rw-r--r-- | libhello/tests/test/driver.cxx | 5 | ||||
-rw-r--r-- | libhello/tests/test/test.out | 2 |
5 files changed, 15 insertions, 9 deletions
diff --git a/libhello/libhello/buildfile b/libhello/libhello/buildfile index e65edde..0f84ca6 100644 --- a/libhello/libhello/buildfile +++ b/libhello/libhello/buildfile @@ -23,4 +23,4 @@ lib{hello}: cxx.export.libs = $int_libs # Install into the libhello/ subdirectory of, say, /usr/include/. # -install.include = $install.include/libhello/ +install.include = $install.include/$project/ diff --git a/libhello/libhello/hello.cxx b/libhello/libhello/hello.cxx index f7e3b7f..ee5c555 100644 --- a/libhello/libhello/hello.cxx +++ b/libhello/libhello/hello.cxx @@ -11,6 +11,6 @@ namespace hello void say_formatted (const string& m) { - print (m); + print::to_stdout (m); } } diff --git a/libhello/libhello/hello.hxx b/libhello/libhello/hello.hxx index ccc43c2..d9e41d9 100644 --- a/libhello/libhello/hello.hxx +++ b/libhello/libhello/hello.hxx @@ -11,18 +11,19 @@ namespace hello { // If you compare this interface to version 1.0, then you will notice that - // while it is API/source-compatible (the signature of say() is unchanged) - // it is not ABI/binary-compatible (say() is now inline). + // while it is API/source-compatible (the call via the old signature of + // say() is still valid) it is not ABI/binary-compatible (say() now has an + // extra argument and is inline). // - // Notice also that inline say() calls format() which means libformat is an - // interface dependency of libhello. + // Notice also that inline say() now uses a type and calls a function from + // format which means libformat is an "interface dependency" of libhello. LIBHELLO_EXPORT void say_formatted (const std::string& message); inline void - say (const std::string& name) + say (const std::string& name, format::volume v = format::volume::normal) { - say_formatted (format ("Hello", name)); + say_formatted (format::message ("Hello", name, v)); } } diff --git a/libhello/tests/test/driver.cxx b/libhello/tests/test/driver.cxx index 38937f0..1c08bca 100644 --- a/libhello/tests/test/driver.cxx +++ b/libhello/tests/test/driver.cxx @@ -1,11 +1,14 @@ // file: tests/test/driver.cxx -*- C++ -*- #include <libhello/hello.hxx> +#include <libformat/format.hxx> // volume int main () { - using hello::say; + using namespace hello; say ("World"); + say ("World", format::volume::loud); + say_formatted ("Hi, World!"); } diff --git a/libhello/tests/test/test.out b/libhello/tests/test/test.out index 8ab686e..a9ec19f 100644 --- a/libhello/tests/test/test.out +++ b/libhello/tests/test/test.out @@ -1 +1,3 @@ Hello, World! +HELLO, World! +Hi, World! |