ome-common
5.2.0
|
Xerces string wrapper. More...
#include <ome/common/xml/String.h>
Public Member Functions | |
String (const XMLCh *str) | |
Construct a String from an XMLCh * string. More... | |
String (const char *str) | |
Construct a String from a NUL-terminated string. More... | |
String (std::string const &str) | |
Construct a String from a std::string. More... | |
~String () | |
Destructor. More... | |
operator const XMLCh * () const | |
Cast String to XMLCh *. More... | |
operator::std::string () const | |
Cast String to a std::string. More... | |
inline::std::string | str () const |
Get the String content as a std::string. More... | |
bool | operator== (const char *rhs) |
Compare a String for equality with a C string. More... | |
bool | operator== (const std::string &rhs) |
Compare a String for equality with a std::string. More... | |
bool | operator== (const String &rhs) |
Compare a String for equality with a String. More... | |
bool | operator!= (const char *rhs) |
Compare a String for inequality with a C string. More... | |
bool | operator!= (const std::string &rhs) |
Compare a String for inequality with a std::string. More... | |
bool | operator!= (const String &rhs) |
Compare a String for inequality with a String. More... | |
Private Attributes | |
char * | narrow |
The char * string representation. | |
XMLCh * | wide |
The XMLCh * string representation. | |
Xerces string wrapper.
Xerces uses UTF-16 internally, which is incompatible with the standard library string and stream classes. This class interconverts between std::string and XMLCh *, as well as managing the memory of XMLCh * objects. All Xerces functions and class methods which take XMLCh * inputs may be transparently called with instances of this class, and likewise functions and methods returning XMLCh * may directly construct instances of this class using the return value.
This class does have an overhead of maintaining two copies of the string (char * and XMLCh *), as well as the cost of transcoding between the two forms upon construction.
Assignment of std::string or XMLCh * is not supported. This class is only intended to transiently transcode between the two types and manage the memory for this.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Compare a String for inequality with a C string.
rhs | the string to compare. |
true
if not equal, false
otherwise.
|
inline |
Compare a String for inequality with a std::string.
rhs | the string to compare. |
true
if not equal, false
otherwise.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Get the String content as a std::string.
References narrow.
Referenced by ome::common::xml::operator<<().