diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-09-06 12:38:44 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-09-06 12:38:44 +0000 |
commit | 17829dc5722c5811912dd7dc8806d79cf562893a (patch) | |
tree | 76cea0cea89f39037c75286848442c04260ce0ce /src | |
parent | 7d850e5e8d79c9ca4485adf5602d3002ac1cae4e (diff) | |
download | libbu++-17829dc5722c5811912dd7dc8806d79cf562893a.tar.gz libbu++-17829dc5722c5811912dd7dc8806d79cf562893a.tar.bz2 libbu++-17829dc5722c5811912dd7dc8806d79cf562893a.tar.xz libbu++-17829dc5722c5811912dd7dc8806d79cf562893a.zip |
Just made the PrintEndAction private class a part of the Bu namespace. It
really doesn't matter, but it's nicer for doxygen.
Diffstat (limited to 'src')
-rw-r--r-- | src/stable/sio.cpp | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/src/stable/sio.cpp b/src/stable/sio.cpp index 8ecb4ad..6a650ed 100644 --- a/src/stable/sio.cpp +++ b/src/stable/sio.cpp | |||
@@ -14,36 +14,39 @@ Bu::Formatter Bu::sio( Bu::sioRaw ); | |||
14 | Bu::StreamStack Bu::serrRaw( new Bu::StdStream( Bu::StdStream::StdError ) ); | 14 | Bu::StreamStack Bu::serrRaw( new Bu::StdStream( Bu::StdStream::StdError ) ); |
15 | Bu::Formatter Bu::serr( Bu::serrRaw ); | 15 | Bu::Formatter Bu::serr( Bu::serrRaw ); |
16 | 16 | ||
17 | class PrintEndAction : public Bu::String::FormatProxyEndAction | 17 | namespace Bu |
18 | { | 18 | { |
19 | public: | 19 | class PrintEndAction : public Bu::String::FormatProxyEndAction |
20 | PrintEndAction( Bu::Stream &s, bool bEndLn ) : | ||
21 | s( s ), | ||
22 | bEndLn( bEndLn ) | ||
23 | { | 20 | { |
24 | } | 21 | public: |
22 | PrintEndAction( Bu::Stream &s, bool bEndLn ) : | ||
23 | s( s ), | ||
24 | bEndLn( bEndLn ) | ||
25 | { | ||
26 | } | ||
25 | 27 | ||
26 | virtual ~PrintEndAction() | 28 | virtual ~PrintEndAction() |
27 | { | 29 | { |
28 | } | 30 | } |
29 | 31 | ||
30 | virtual void operator()( const Bu::String &sFinal ) | 32 | virtual void operator()( const Bu::String &sFinal ) |
31 | { | ||
32 | s.write( sFinal.getStr(), sFinal.getSize() ); | ||
33 | if( bEndLn ) | ||
34 | { | 33 | { |
35 | s.write("\n", 1); | 34 | s.write( sFinal.getStr(), sFinal.getSize() ); |
36 | s.flush(); | 35 | if( bEndLn ) |
36 | { | ||
37 | s.write("\n", 1); | ||
38 | s.flush(); | ||
39 | } | ||
37 | } | 40 | } |
38 | } | ||
39 | 41 | ||
40 | Bu::Stream &s; | 42 | Bu::Stream &s; |
41 | bool bEndLn; | 43 | bool bEndLn; |
42 | }; | 44 | }; |
45 | } | ||
43 | 46 | ||
44 | Bu::String::FormatProxy Bu::print( Bu::Stream &s, const Bu::String &str ) | 47 | Bu::String::FormatProxy Bu::print( Bu::Stream &s, const Bu::String &str ) |
45 | { | 48 | { |
46 | return str.format( new PrintEndAction( s, false ) ); | 49 | return str.format( new Bu::PrintEndAction( s, false ) ); |
47 | } | 50 | } |
48 | 51 | ||
49 | Bu::String::FormatProxy Bu::print( const Bu::String &str ) | 52 | Bu::String::FormatProxy Bu::print( const Bu::String &str ) |
@@ -53,7 +56,7 @@ Bu::String::FormatProxy Bu::print( const Bu::String &str ) | |||
53 | 56 | ||
54 | Bu::String::FormatProxy Bu::println( Bu::Stream &s, const Bu::String &str ) | 57 | Bu::String::FormatProxy Bu::println( Bu::Stream &s, const Bu::String &str ) |
55 | { | 58 | { |
56 | return str.format( new PrintEndAction( s, true ) ); | 59 | return str.format( new Bu::PrintEndAction( s, true ) ); |
57 | } | 60 | } |
58 | 61 | ||
59 | Bu::String::FormatProxy Bu::println( const Bu::String &str ) | 62 | Bu::String::FormatProxy Bu::println( const Bu::String &str ) |