Ustr Class Reference

Class to handle unicode strings. More...

#include <ustr.h>

List of all members.

Public Types

typedef unsigned int UChar
 Single Unicode character value.

Public Member Functions

 Ustr ()
 Construct an empty Ustr.
 Ustr (const Ustr &b)
 Construct a copy of an existing Ustr.
 Ustr (const std::string &str)
 Construct a Ustr based on a std::string.
Exceptions:
UstrNonAsciiError If str contained non-ASCII characters.

 Ustr (UChar chr, int num=1)
 Construct a Ustr based on a single UChar.
virtual ~Ustr ()
 Destructor is declared virtual, as it always should be.
unsigned int GetLength () const
 Get the length (in unicode characters) of this string.
UstrAppend (const Ustr &src)
 Append the given string to this one.
UstrAppend (UChar ch)
 Append the given unicode character to this one.
Utf8Chars AsUtf8 () const
 Return a string of UTF-8 characters.
std::string AsString () const
 Return an ASCII string.
const char * c_str () const
 Return an ASCII string as a C-style string.
UChar CharAt (unsigned int i) const
 Gets the unicode character at the specified index.
Ustroperator= (const Ustr &src)
 Assign the value of src to this Ustr.
Ustroperator+= (const Ustr &src)
 Append the value of src to this Ustr.
Ustroperator+= (const std::string &src)
 Append the value of src to this Ustr.
Ustroperator+= (UChar ch)
 Append the value of src to this Ustr.
Ustr operator+ (const Ustr &s2) const
 Return the result of appending s2 to this string.
Ustr operator+ (const std::string &s2) const
 Return the result of appending s2 to this string.
Ustr operator+ (UChar ch) const
 Return the result of appending ch to this string.
bool operator== (const Ustr &rhs) const
 Compare two Ustrs.
bool operator== (const std::string &rhs) const
 Compare a Ustr to a string.
bool operator!= (const Ustr &rhs) const
 Compare two Ustrs.
bool operator!= (const std::string &rhs) const
 Compare a Ustr to a string.
bool operator> (const Ustr &rhs) const
 Compare two Ustrs.
bool operator> (const std::string &rhs) const
 Compare a Ustr to a string.
bool operator< (const Ustr &rhs) const
 Compare two Ustrs.
bool operator< (const std::string &rhs) const
 Compare a Ustr to a string.
bool operator>= (const Ustr &rhs) const
 Compare two Ustrs.
bool operator>= (const std::string &rhs) const
 Compare a Ustr to a string.
bool operator<= (const Ustr &rhs) const
 Compare two Ustrs.
bool operator<= (const std::string &rhs) const
 Compare a Ustr to a string.
UChar operator[] (unsigned int i) const
 Gets the unicode character at the specified index.

Classes

struct  StringInternals


Detailed Description

Class to handle unicode strings.

Author:
Matthew Welch


Member Typedef Documentation

typedef unsigned int Ustr::UChar

Single Unicode character value.


Constructor & Destructor Documentation

Ustr::Ustr (  ) 

Construct an empty Ustr.

Ustr::Ustr ( const Ustr b  ) 

Construct a copy of an existing Ustr.

Ustr::Ustr ( const std::string &  str  ) 

Construct a Ustr based on a std::string.

Exceptions:
UstrNonAsciiError If str contained non-ASCII characters.

Assumes that str is ASCII only.

Ustr::Ustr ( UChar  chr,
int  num = 1 
)

Construct a Ustr based on a single UChar.

Parameters:
chr The character to build the string with.
num The number of times to repeat the character (default 1).

virtual Ustr::~Ustr (  )  [virtual]

Destructor is declared virtual, as it always should be.


Member Function Documentation

unsigned int Ustr::GetLength (  )  const [inline]

Get the length (in unicode characters) of this string.

Ustr& Ustr::Append ( const Ustr src  ) 

Append the given string to this one.

Ustr& Ustr::Append ( UChar  ch  ) 

Append the given unicode character to this one.

Utf8Chars Ustr::AsUtf8 (  )  const

Return a string of UTF-8 characters.

std::string Ustr::AsString (  )  const

Return an ASCII string.

Exceptions:
UstrNonAsciiError If this Ustr contains non-ASCII characters.

const char* Ustr::c_str (  )  const [inline]

Return an ASCII string as a C-style string.

Exceptions:
UstrNonAsciiError If this Ustr contains non-ASCII characters.

UChar Ustr::CharAt ( unsigned int  i  )  const

Gets the unicode character at the specified index.

Ustr& Ustr::operator= ( const Ustr src  ) 

Assign the value of src to this Ustr.

Ustr& Ustr::operator+= ( const Ustr src  )  [inline]

Append the value of src to this Ustr.

Ustr& Ustr::operator+= ( const std::string &  src  )  [inline]

Append the value of src to this Ustr.

Ustr& Ustr::operator+= ( UChar  ch  )  [inline]

Append the value of src to this Ustr.

Ustr Ustr::operator+ ( const Ustr s2  )  const [inline]

Return the result of appending s2 to this string.

Ustr Ustr::operator+ ( const std::string &  s2  )  const [inline]

Return the result of appending s2 to this string.

Ustr Ustr::operator+ ( UChar  ch  )  const [inline]

Return the result of appending ch to this string.

bool Ustr::operator== ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator== ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

bool Ustr::operator!= ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator!= ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

bool Ustr::operator> ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator> ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

bool Ustr::operator< ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator< ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

bool Ustr::operator>= ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator>= ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

bool Ustr::operator<= ( const Ustr rhs  )  const

Compare two Ustrs.

bool Ustr::operator<= ( const std::string &  rhs  )  const [inline]

Compare a Ustr to a string.

UChar Ustr::operator[] ( unsigned int  i  )  const [inline]

Gets the unicode character at the specified index.


The documentation for this class was generated from the following file:
Generated on Wed Apr 18 15:50:12 2007 for JSON Parser by  doxygen 1.5.2