CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
XercesString.h
Go to the documentation of this file.
1 #ifndef XERCES_STRINGS_H
2 #define XERCES_STRINGS_H
3 
4 #include <string>
5 #include <boost/scoped_array.hpp>
6 #include <xercesc/util/XMLString.hpp>
7 #include <iostream>
8 
9 
25 namespace xuti {
26 
28  typedef std::basic_string<XMLCh> XercesString;
29 
30  // Converts from a narrow-character string to a wide-character string.
31  inline XercesString fromNative(const char* str){
32  boost::scoped_array<XMLCh> ptr(xercesc::XMLString::transcode(str));
33  return XercesString(ptr.get( ));
34  }
35 
36  // Converts from a narrow-character string to a wide-charactr string.
37  inline XercesString fromNative(const std::string& str){
38  return fromNative(str.c_str( ));
39  }
40 
41  // Converts from a wide-character string to a narrow-character string.
42  inline std::string toNative(const XMLCh* str){
43  boost::scoped_array<char> ptr(xercesc::XMLString::transcode(str));
44  return std::string(ptr.get( ));
45  }
46 
47  // Converts from a wide-character string to a narrow-character string.
48  inline std::string toNative(const XercesString& str){
49  return toNative(str.c_str( ));
50  }
51 
52 
53 } // namespace
54 
55 #endif // #ifndef XERCES_STRINGS_H
std::basic_string< XMLCh > XercesString
Define an intermediate type.
Definition: XercesString.h:28
XercesString fromNative(const char *str)
Definition: XercesString.h:31
std::string toNative(const XMLCh *str)
Definition: XercesString.h:42