diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-18 18:48:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-01-13 22:32:43 +0300 |
commit | 2615896faa646e5830abf2c269150e1165c66515 (patch) | |
tree | 7d95978ec0a83094c9462ed4e1f59d42f4ff8ddb /libxsd/libxsd/cxx/xml/char-lcp.hxx | |
parent | 7420f85ea19b0562ffdd8123442f32bc8bac1267 (diff) |
Switch to build2
Diffstat (limited to 'libxsd/libxsd/cxx/xml/char-lcp.hxx')
-rw-r--r-- | libxsd/libxsd/cxx/xml/char-lcp.hxx | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/libxsd/libxsd/cxx/xml/char-lcp.hxx b/libxsd/libxsd/cxx/xml/char-lcp.hxx new file mode 100644 index 0000000..33e421f --- /dev/null +++ b/libxsd/libxsd/cxx/xml/char-lcp.hxx @@ -0,0 +1,54 @@ +// file : libxsd/cxx/xml/char-lcp.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_LCP + +#include <string> +#include <cstddef> // std::size_t + +#include <xercesc/util/XercesDefs.hpp> // XMLCh + +namespace xsd +{ + namespace cxx + { + namespace xml + { + // UTF-16 to/from Xerces-C++ local code page (LCP) transcoder. + // + // Note that this transcoder has a custom interface due to Xerces-C++ + // idiosyncrasies. Don't use it as a base for your custom transcoder. + // + template <typename C> + struct char_lcp_transcoder + { + static std::basic_string<C> + to (const XMLCh* s); + + static std::basic_string<C> + to (const XMLCh* s, std::size_t length); + + static XMLCh* + from (const C* s); + }; + + typedef char_lcp_transcoder<char> char_transcoder; + } + } +} + +#include <libxsd/cxx/xml/char-lcp.txx> + +#else +# ifndef XSD_CXX_XML_TRANSCODER_CHAR_LCP + // + // 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 |