[Assorted-commits] SF.net SVN: assorted:[1517] cpp-commons/trunk/src/commons/streams.h
Brought to you by:
yangzhang
From: <yan...@us...> - 2009-11-23 08:00:27
|
Revision: 1517 http://assorted.svn.sourceforge.net/assorted/?rev=1517&view=rev Author: yangzhang Date: 2009-11-23 08:00:21 +0000 (Mon, 23 Nov 2009) Log Message: ----------- added ostream formatter wchar_t and wostream formatter for char Modified Paths: -------------- cpp-commons/trunk/src/commons/streams.h Modified: cpp-commons/trunk/src/commons/streams.h =================================================================== --- cpp-commons/trunk/src/commons/streams.h 2009-11-23 07:59:25 UTC (rev 1516) +++ cpp-commons/trunk/src/commons/streams.h 2009-11-23 08:00:21 UTC (rev 1517) @@ -36,15 +36,27 @@ * Allow wstrings to be printed to ostreams. */ inline ostream &operator<<(ostream &o, const wstring &s) - { return o << to_string(s); } + { return o << to_utf8(s); } /** * Allow strings to be printed to wostreams. */ inline wostream &operator<<(wostream &o, const string &s) - { return o << to_wstring(s); } + { return o << to_utf16(s); } /** + * Allow wchar_t* to be printed to ostreams. + */ + inline ostream &operator<<(ostream &o, const wchar_t *s) + { return o << wstring(s); } + + /** + * Allow char* to be printed to wostreams. + */ + inline wostream &operator<<(wostream &o, const char *s) + { return o << string(s); } + + /** * Wrapper around integral types that enables pretty printing as hex numbers. */ template<typename T> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |