From b3adc199b6fbf3460d709934de5d92668d75a6cf Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 25 Oct 2011 05:40:33 +0000 Subject: Bu::print and Bu::println are added, they just take a string, but you can use string formatting no problem. I'll add some that can take unicode strings too. --- src/sio.cpp | 23 +++++++++++++++++++++++ src/sio.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/src/sio.cpp b/src/sio.cpp index 0fe60d9..5f8e234 100644 --- a/src/sio.cpp +++ b/src/sio.cpp @@ -10,3 +10,26 @@ Bu::StdStream Bu::sioRaw; Bu::Formatter Bu::sio( Bu::sioRaw ); +Bu::size Bu::print( Bu::Stream &s, const Bu::String &str ) +{ + return s.write( str.getStr(), str.getSize() ); +} + +Bu::size Bu::print( const Bu::String &str ) +{ + return print( sioRaw, str ); +} + +Bu::size Bu::println( Bu::Stream &s, const Bu::String &str ) +{ + Bu::size sRet = s.write( str.getStr(), str.getSize() ); + sRet += s.write("\n", 1 ); + s.flush(); + return sRet; +} + +Bu::size Bu::println( const Bu::String &str ) +{ + return println( sioRaw, str ); +} + diff --git a/src/sio.h b/src/sio.h index ad3000a..9f2cd05 100644 --- a/src/sio.h +++ b/src/sio.h @@ -15,6 +15,12 @@ namespace Bu { extern Bu::StdStream sioRaw; extern Bu::Formatter sio; + + Bu::size print( Bu::Stream &s, const Bu::String &str ); + Bu::size print( const Bu::String &str ); + + Bu::size println( Bu::Stream &s, const Bu::String &str ); + Bu::size println( const Bu::String &str ); }; #endif -- cgit v1.2.3