// file : xsd/cxx/xml/string.hxx // author : Boris Kolpackov // copyright : Copyright (c) 2005-2011 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 // std::size_t #include // XMLCh #include // XSD_CXX11 #ifdef XSD_CXX11 # include // std::unique_ptr #else # include #endif namespace xsd { namespace cxx { namespace xml { // 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 VC 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: #ifdef XSD_CXX11 std::unique_ptr s_; #else auto_array s_; #endif }; } } } #endif // XSD_CXX_XML_STRING_HXX #include #include