hoa_utils::ustring Class Reference

Implements unicode strings with uint16 as the character type. More...

#include <utils.h>

Collaboration diagram for hoa_utils::ustring:

Collaboration graph
[legend]
List of all members.

Public Member Functions

const uint16c_str () const
void clear ()
bool empty () const
size_t find (const ustring &s, size_t pos=0) const
size_t find (uint16 c, size_t pos=0) const
size_t length () const
ustringoperator+ (const ustring &s)
ustringoperator+= (const ustring &s)
ustringoperator+= (uint16 c)
ustringoperator= (const ustring &s)
const uint16operator[] (size_t pos) const
uint16operator[] (size_t pos)
size_t size () const
ustring substr (size_t pos=0, size_t n=npos) const
 ustring (const uint16 *)
 ustring ()

Static Public Attributes

static const size_t npos

Private Attributes

std::vector< uint16_str
 The structure containing the unicode string data.

Detailed Description

Implements unicode strings with uint16 as the character type.

****************************************************************************

This class functions identically to the std::string class provided in the C++ standard library. The critical difference is that each character is 2 bytes (16 bits) wide instead of 1 byte (8 bits) wide so that it may implement the full unicode character set.

Note:
This class intentionally ignores the code standard convention for class names because the class objects are to be used as if they were a standard C++ type.

This class does not implement a destructor because the only data member (a std::vector) will automatically destroy itself when the no-arg destructor is invoked.

The member functions of this class are not documented because they function in the exact same manner that the C++ string class does.

There are some libstdc++ compatability problems with simply defining basic_string<uint16>, so this class is a custom version of it.

Currently not all functionality of basic_string has been implemented, but instead only the functions that we typically use in Allacrost. If you need a basic_string function available that isn't already implemented in this class, go ahead and add it yourself.

This class does not use wchar_t because it has poor compatibility.

Definition at line 194 of file utils.h.


Constructor & Destructor Documentation

hoa_utils::ustring::ustring (  ) 

Definition at line 85 of file utils.cpp.

References _str.

hoa_utils::ustring::ustring ( const uint16  ) 

Definition at line 91 of file utils.cpp.

References _str.


Member Function Documentation

const uint16* hoa_utils::ustring::c_str (  )  const [inline]

Definition at line 215 of file utils.h.

References _str.

Referenced by hoa_video::GameVideo::CalculateTextWidth(), and hoa_video::GameVideo::RenderText().

void hoa_utils::ustring::clear (  )  [inline]

Definition at line 202 of file utils.h.

References _str.

Referenced by hoa_video::OptionBox::_ConstructOption(), and operator=().

bool hoa_utils::ustring::empty (  )  const [inline]

Definition at line 205 of file utils.h.

References _str.

Referenced by hoa_video::TextBox::_AddLine(), hoa_video::OptionBox::_ConstructOption(), hoa_video::GameVideo::DrawText(), operator+(), operator+=(), and hoa_video::GameVideo::RenderText().

size_t hoa_utils::ustring::find ( const ustring s,
size_t  pos = 0 
) const

Definition at line 204 of file utils.cpp.

References _str, length(), and npos.

Here is the call graph for this function:

size_t hoa_utils::ustring::find ( uint16  c,
size_t  pos = 0 
) const

Definition at line 191 of file utils.cpp.

References _str, length(), and npos.

Referenced by hoa_video::OptionBox::_ConstructOption(), and hoa_video::TextBox::_ReformatText().

Here is the call graph for this function:

size_t hoa_utils::ustring::length (  )  const [inline]

Definition at line 208 of file utils.h.

References _str.

Referenced by hoa_video::TextBox::_AddLine(), hoa_video::OptionBox::_ConstructOption(), hoa_video::GameVideo::DrawText(), find(), hoa_utils::MakeStandardString(), operator+(), operator+=(), size(), and substr().

ustring & hoa_utils::ustring::operator+ ( const ustring s  ) 

Definition at line 128 of file utils.cpp.

References _str, empty(), and length().

Here is the call graph for this function:

ustring & hoa_utils::ustring::operator+= ( const ustring s  ) 

Definition at line 160 of file utils.cpp.

References _str, empty(), and length().

Here is the call graph for this function:

ustring & hoa_utils::ustring::operator+= ( uint16  c  ) 

Definition at line 151 of file utils.cpp.

References _str, and length().

Referenced by operator=().

Here is the call graph for this function:

ustring & hoa_utils::ustring::operator= ( const ustring s  ) 

Definition at line 182 of file utils.cpp.

References clear(), and operator+=().

Here is the call graph for this function:

const uint16& hoa_utils::ustring::operator[] ( size_t  pos  )  const [inline]

Definition at line 235 of file utils.h.

References _str.

uint16& hoa_utils::ustring::operator[] ( size_t  pos  )  [inline]

Definition at line 232 of file utils.h.

References _str.

size_t hoa_utils::ustring::size (  )  const [inline]

Definition at line 212 of file utils.h.

References length().

Referenced by hoa_video::TextBox::_AddLine(), and hoa_video::GameVideo::RenderText().

Here is the call graph for this function:

ustring hoa_utils::ustring::substr ( size_t  pos = 0,
size_t  n = npos 
) const

Definition at line 109 of file utils.cpp.

References _str, and length().

Referenced by hoa_video::TextBox::_AddLine(), hoa_video::OptionBox::_ConstructOption(), and hoa_video::TextBox::_ReformatText().

Here is the call graph for this function:


Member Data Documentation

std::vector<uint16> hoa_utils::ustring::_str [private]

The structure containing the unicode string data.

Definition at line 240 of file utils.h.

Referenced by c_str(), clear(), empty(), find(), length(), operator+(), operator+=(), operator[](), substr(), and ustring().

const size_t hoa_utils::ustring::npos [static]

Definition at line 200 of file utils.h.

Referenced by hoa_video::OptionBox::_ConstructOption(), hoa_video::TextBox::_ReformatText(), and find().


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 23:16:11 2007 for Hero of Allacrost by  doxygen 1.5.1