Added functions that print directly to cout.

git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@1160 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
rich_sposato 2011-10-21 23:09:48 +00:00
parent 59530e538a
commit 62d74d47f8
2 changed files with 24 additions and 0 deletions

View file

@ -605,6 +605,14 @@ namespace Loki
LOKI_EXPORT LOKI_EXPORT
PrintfState<std::FILE*, char> FPrintf(std::FILE* f, const std::string& format); 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 LOKI_EXPORT
PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format); PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format);

View file

@ -99,6 +99,22 @@ namespace Loki
return printState2; 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) { PrintfState<std::ostream&, char> FPrintf(std::ostream& f, const char* format) {
::std::string buffer; ::std::string buffer;
const PrintfState< ::std::string &, char > state1( buffer, format ); const PrintfState< ::std::string &, char > state1( buffer, format );