From 2615896faa646e5830abf2c269150e1165c66515 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 18 Dec 2020 18:48:46 +0300 Subject: Switch to build2 --- libxsd/libxsd/cxx/xml/char-utf8.hxx | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 libxsd/libxsd/cxx/xml/char-utf8.hxx (limited to 'libxsd/libxsd/cxx/xml/char-utf8.hxx') diff --git a/libxsd/libxsd/cxx/xml/char-utf8.hxx b/libxsd/libxsd/cxx/xml/char-utf8.hxx new file mode 100644 index 0000000..0541100 --- /dev/null +++ b/libxsd/libxsd/cxx/xml/char-utf8.hxx @@ -0,0 +1,55 @@ +// file : libxsd/cxx/xml/char-utf8.hxx +// 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 +#include // std::size_t + +#include // XMLCh + +#include // invalid_utf16_string + +namespace xsd +{ + namespace cxx + { + namespace xml + { + struct invalid_utf8_string {}; + + // UTF-16 to/from UTF-8 transcoder. + // + template + struct char_utf8_transcoder + { + static std::basic_string + 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_transcoder; + } + } +} + +#include + +#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 -- cgit v1.1