// file : xsd/cxx/xml/string.hxx // author : Boris Kolpackov // copyright : Copyright (c) 2005-2009 Code Synthesis Tools CC // license : GNU GPL v2 + exceptions; see accompanying LICENSE file #ifndef XSD_CXX_XML_STRING_HXX #define XSD_CXX_XML_STRING_HXX #include #include #include // XMLCh namespace xsd { namespace cxx { namespace xml { // // struct invalid_utf8_string {}; struct invalid_utf16_string {}; // Transcode a null-terminated string. // template std::basic_string transcode (const XMLCh* s); // Transcode a potentially non-null-terminated string. // template std::basic_string transcode (const XMLCh* s, std::size_t length); // For VC7.1 wchar_t and XMLCh are the same type so we cannot // overload the transcode name. You should not use these functions // anyway and instead use the xml::string class below. // template XMLCh* transcode_to_xmlch (const C*); template XMLCh* transcode_to_xmlch (const std::basic_string& s); // // class string { public : template string (const std::basic_string& s) : s_ (transcode_to_xmlch (s)) { } template string (const C* s) : s_ (transcode_to_xmlch (s)) { } const XMLCh* c_str () const { return s_.get (); } private: string (const string&); string& operator= (const string&); private: auto_array s_; }; } } } #endif // XSD_CXX_XML_STRING_HXX #include #include