diff options
Diffstat (limited to '')
-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 ) |