|
From: <ric...@us...> - 2011-10-21 23:09:55
|
Revision: 1160
http://loki-lib.svn.sourceforge.net/loki-lib/?rev=1160&view=rev
Author: rich_sposato
Date: 2011-10-21 23:09:48 +0000 (Fri, 21 Oct 2011)
Log Message:
-----------
Added functions that print directly to cout.
Modified Paths:
--------------
trunk/include/loki/SafeFormat.h
trunk/src/SafeFormat.cpp
Modified: trunk/include/loki/SafeFormat.h
===================================================================
--- trunk/include/loki/SafeFormat.h 2011-10-20 07:25:44 UTC (rev 1159)
+++ trunk/include/loki/SafeFormat.h 2011-10-21 23:09:48 UTC (rev 1160)
@@ -605,7 +605,15 @@
LOKI_EXPORT
PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const std::string& format);
+ /// Prints to cout.
LOKI_EXPORT
+ PrintfState<std::ostream&, char> FPrintf( const char * format );
+
+ /// Prints to cout.
+ LOKI_EXPORT
+ PrintfState<std::ostream&, char> FPrintf( const std::string & format );
+
+ LOKI_EXPORT
PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format);
LOKI_EXPORT
Modified: trunk/src/SafeFormat.cpp
===================================================================
--- trunk/src/SafeFormat.cpp 2011-10-20 07:25:44 UTC (rev 1159)
+++ trunk/src/SafeFormat.cpp 2011-10-21 23:09:48 UTC (rev 1160)
@@ -99,6 +99,22 @@
return printState2;
}
+ PrintfState< std::ostream &, char > FPrintf( const char * format ) {
+ ::std::string buffer;
+ const PrintfState< ::std::string &, char > state1( buffer, format );
+ ::std::cout << buffer.c_str();
+ PrintfState< ::std::ostream &, char > printState2 = state1.ChangeDevice< ::std::ostream & >( ::std::cout );
+ return printState2;
+ }
+
+ PrintfState< std::ostream &, char > FPrintf( const std::string & format ) {
+ ::std::string buffer;
+ const PrintfState< ::std::string &, char > state1( buffer, format.c_str() );
+ ::std::cout << buffer.c_str();
+ PrintfState< std::ostream &, char > printState2 = state1.ChangeDevice< ::std::ostream & >( ::std::cout );
+ return printState2;
+ }
+
PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format) {
::std::string buffer;
const PrintfState< ::std::string &, char > state1( buffer, format );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|