summaryrefslogtreecommitdiff
path: root/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2025-05-02 07:42:02 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-05-02 07:42:02 +0200
commitfc486627a4ecbae797fa6856d8a9204ea85f4db8 (patch)
treeff3dae4c0e5d980d8e2da4fc6256ae839269bbcd /xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
parent1c188393cd2e271ed2581471b601fb5960777fd8 (diff)
parentecba0bbd9947036dd82f16ab95252f8db445e149 (diff)
Merge tag 'debian/4.0.0-10' into developdevelop
Bugfix release
Diffstat (limited to 'xsd/libxsd/xsd/cxx/xml/char-utf8.hxx')
-rw-r--r--xsd/libxsd/xsd/cxx/xml/char-utf8.hxx56
1 files changed, 56 insertions, 0 deletions
diff --git a/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx b/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
new file mode 100644
index 0000000..afc923a
--- /dev/null
+++ b/xsd/libxsd/xsd/cxx/xml/char-utf8.hxx
@@ -0,0 +1,56 @@
+// file : xsd/cxx/xml/char-utf8.hxx
+// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#ifndef XSD_CXX_XML_TRANSCODER
+#define XSD_CXX_XML_TRANSCODER
+#define XSD_CXX_XML_TRANSCODER_CHAR_UTF8
+
+#include <string>
+#include <cstddef> // std::size_t
+
+#include <xercesc/util/XercesDefs.hpp> // XMLCh
+
+#include <xsd/cxx/xml/exceptions.hxx> // invalid_utf16_string
+
+namespace xsd
+{
+ namespace cxx
+ {
+ namespace xml
+ {
+ struct invalid_utf8_string {};
+
+ // UTF-16 to/from UTF-8 transcoder.
+ //
+ template <typename C>
+ struct char_utf8_transcoder
+ {
+ static std::basic_string<C>
+ to (const XMLCh* s, std::size_t length);
+
+ static XMLCh*
+ from (const C* s, std::size_t length);
+
+ private:
+ static const unsigned char first_byte_mask_[5];
+ };
+
+ typedef char_utf8_transcoder<char> char_transcoder;
+ }
+ }
+}
+
+#include <xsd/cxx/xml/char-utf8.txx>
+
+#else
+# ifndef XSD_CXX_XML_TRANSCODER_CHAR_UTF8
+ //
+ // If you get this error, it usually means that either you compiled
+ // your schemas with different --char-encoding values or you included
+ // some of the libxsd headers (e.g., xsd/cxx/xml/string.hxx) directly
+ // without first including the correct xsd/cxx/xml/char-*.hxx header.
+ //
+# error conflicting character encoding detected
+# endif
+#endif // XSD_CXX_XML_TRANSCODER