]> git.lyx.org Git - lyx.git/blobdiff - src/support/docstream.h
get rid of MSVC warning (signed/unsigned comparison)
[lyx.git] / src / support / docstream.h
index 1783fd4271b92fcde6db53dc56ee74ab2e12bbd3..c3db04c58a3a2d2083c55160f6fccc01ee3bdaad 100644 (file)
@@ -77,6 +77,25 @@ odocstream & operator<<(odocstream & os, char c)
     return os;
 }
 
+/// Helper struct for changing stream encoding
+struct SetEnc {
+       SetEnc(std::string const & e) : encoding(e) {}
+       std::string encoding;
+};
+
+/// Helper function for changing stream encoding
+SetEnc setEncoding(std::string const & encoding);
+
+/** Change the encoding of \p os to \p e.encoding.
+    \p e.encoding must be a valid iconv name of an 8bit encoding.
+    This does nothing if the stream is not a file stream, since only
+    file streams do have an associated 8bit encoding.
+    Usage: \code
+    os << setEncoding("ISO-8859-1");
+    \endcode
+ */
+odocstream & operator<<(odocstream & os, SetEnc e);
+
 }
 
 #endif