]> git.tdb.fi Git - libs/core.git/blobdiff - source/stringcodec/ustring.h
Put unichar and ustring in their own file
[libs/core.git] / source / stringcodec / ustring.h
diff --git a/source/stringcodec/ustring.h b/source/stringcodec/ustring.h
new file mode 100644 (file)
index 0000000..1a0a64e
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef MSP_STRINGCODEC_USTRING_H_
+#define MSP_STRINGCODEC_USTRING_H_
+
+#include <string>
+
+namespace Msp {
+namespace StringCodec {
+
+typedef int unichar;
+
+typedef std::basic_string<unichar> ustring;
+
+inline bool is_valid_unichar(unichar ch)
+{ return ch>=0 && ch<=0x10FFFF && (ch<0xD800 || ch>0xDFFF) && (ch&0xFFFE)!=0xFFFE; }
+
+} // namespace StringCodec
+} // namespace Msp
+
+#endif