Hide menu
Loading...
Searching...
No Matches
cadex::UTF16String Class Reference

Defines a Unicode (UTF-16) string wrapping a standard string. More...

#include <cadex/UTF16String.hxx>

Public Types

typedef std::u16string::value_type ValueType
 

Public Member Functions

 UTF16String (const char *theOther)
 Constructor.
 
 UTF16String (const ValueType *theOther)
 
 UTF16String (const ValueType *theOther, size_t theLength)
 
 UTF16String (const wchar_t *theOther)
 Constructor.
 
 UTF16String (const std::wstring &theOther)
 Constructor.
 
 UTF16String (const std::string &theOther)
 
const ValueType * Data () const
 Returns an internal string buffer.
 
std::string ToString () const
 
std::wstring ToWString () const
 Converts to standard wstring.
 
void Clear ()
 Clears the contents.
 
size_t Length () const
 Returns a string length in UTF16 characters.
 
bool IsEmpty () const
 Returns true if the string is empty.
 
UTF16Stringoperator= (const char *theOther)
 Assignment operator.
 
UTF16Stringoperator= (const ValueType *theOther)
 
UTF16Stringoperator= (const std::wstring &theOther)
 Assignment operator.
 
UTF16Stringoperator= (const std::string &theOther)
 Assignment operator.
 
bool operator== (const UTF16String &theOther) const
 Returns true if this equals theOther.
 
bool operator!= (const UTF16String &theOther) const
 Returns true if this does equal theOther.
 
UTF16String operator+ (const UTF16String &theOther) const
 '+' operator.
 
UTF16Stringoperator+= (const UTF16String &theOther)
 Concatenate operator.
 

Detailed Description

Constructor & Destructor Documentation

◆ UTF16String() [1/3]

cadex::UTF16String::UTF16String ( const char * theOther)

Constructor.

Copies contents from another string.

◆ UTF16String() [2/3]

cadex::UTF16String::UTF16String ( const wchar_t * theOther)

Constructor.

Copies contents from another string.

◆ UTF16String() [3/3]

cadex::UTF16String::UTF16String ( const std::wstring & theOther)

Constructor.

Copies contents from another string.

Note
in C# accepts a native string type, in Java - a native String type.
See also
ToWString().

Member Function Documentation

◆ Clear()

void cadex::UTF16String::Clear ( )

Clears the contents.

IsEmpty() will return true after calling this method.

◆ Data()

const UTF16String::ValueType * cadex::UTF16String::Data ( ) const

Returns an internal string buffer.

◆ IsEmpty()

◆ Length()

size_t cadex::UTF16String::Length ( ) const

Returns a string length in UTF16 characters.

Examples
exploring/bom/Program.cs.

◆ operator!=()

bool cadex::UTF16String::operator!= ( const UTF16String & theOther) const

Returns true if this does equal theOther.

◆ operator+()

UTF16String cadex::UTF16String::operator+ ( const UTF16String & theOther) const

'+' operator.

◆ operator+=()

UTF16String & cadex::UTF16String::operator+= ( const UTF16String & theOther)

Concatenate operator.

◆ operator=() [1/3]

UTF16String & cadex::UTF16String::operator= ( const char * theOther)

Assignment operator.

Copies contents from another string.

◆ operator=() [2/3]

UTF16String & cadex::UTF16String::operator= ( const std::string & theOther)

Assignment operator.

Copies contents from another string.

◆ operator=() [3/3]

UTF16String & cadex::UTF16String::operator= ( const std::wstring & theOther)

Assignment operator.

Copies contents from another wstring.

◆ operator==()

bool cadex::UTF16String::operator== ( const UTF16String & theOther) const

Returns true if this equals theOther.

◆ ToWString()

std::wstring cadex::UTF16String::ToWString ( ) const

Converts to standard wstring.

Note
in C# converts to native string type, in Java - to native String type.