Stream operators (Unicode string operator is an experiment)
[shibboleth/cpp-xmltooling.git] / xmltooling / unicode.h
index f8888d3..163b8d3 100644 (file)
@@ -26,6 +26,7 @@
 #include <xmltooling/base.h>
 
 #include <string>
+#include <iostream>
 #include <xercesc/util/XMLString.hpp>
 
 using namespace xercesc;
@@ -55,6 +56,15 @@ namespace xmltooling {
     extern XMLTOOL_API XMLCh* fromUTF8(const char* src);
 
     /**
+     * Writes a Unicode string to an ASCII stream by transcoding to UTF8.
+     * 
+     * @param ostr  stream to write to
+     * @param s     string to write
+     * @return      reference to output stream
+     */
+    extern XMLTOOL_API std::ostream& operator<<(std::ostream& ostr, const XMLCh* s);
+
+    /**
      * A minimal auto_ptr-like class that can copy or transcode a buffer into
      * the local code page and free the result automatically.
      *