pgStr< T, N > Class Template Reference
[pgGen -- General purpose module]

A string with fixed length. More...

#include <pg_str.h>

List of all members.

Public Member Functions

 pgDefineException (ExceptionOutOfRange)
 pgStr ()
 Constructs and initializes a pgStr whose length is zero.
 pgStr (T ch)
 Constructs and initializes a pgStr from the specified character.
 pgStr (const T *str)
 Constructs and initializes a pgStr from the specified string.
 pgStr (const pgStr< T, N > &str)
 Constructs and initializes a pgStr from the specified pgStr.
template<u8 N2>
 pgStr (const pgStr< T, N2 > &str)
 Constructs and initializes a pgStr from the specified pgStr with different length.
pgStr< T, N > & operator= (T ch)
 Assigns the right hand side character to this pgStr.
pgStr< T, N > & operator= (const T *str)
 Assigns the right hand side string to this pgStr.
pgStr< T, N > & operator= (const pgStr< T, N > &str)
 Assigns the right hand side pgStr to this pgStr.
template<u8 N2>
pgStr< T, N > & operator= (const pgStr< T, N2 > &str)
 Assigns the right hand side pgStr with different length to this pgStr.
bool operator== (T ch) const
 Returns whether this pgStr is equal to the right hand side character.
bool operator== (const T *str) const
 Returns whether this pgStr is equal to the right hand side string.
template<u8 N2>
bool operator== (const pgStr< T, N2 > &str) const
 Returns whether this pgStr is equal to the right hand side pgStr with different length.
bool operator!= (T ch) const
 Returns whether this pgStr is unequal to the right hand side character.
bool operator!= (const T *str) const
 Returns whether this pgStr is unequal to the right hand side string.
template<u8 N2>
bool operator!= (const pgStr< T, N2 > &str) const
 Returns whether this pgStr is unequal to the right hand side pgStr with different length.
T & operator[] (u8 index)
 Returns a reference to the character of this pgStr at the position specified by the parameter index.
pgStr< T, N > operator+ (T ch) const
 Returns a pgStr which is the concatenation of this pgStr and the right hand side character.
pgStr< T, N > operator+ (const T *str) const
 Returns a pgStr which is the concatenation of this pgStr and the right hand side string.
template<u8 N2>
pgStr< T, N > operator+ (const pgStr< T, N2 > &str) const
 Returns a pgStr which is the concatenation of this pgStr and the right hand side pgStr width differenct length.
void operator+= (T ch)
 Concatenates the right hand side character to the end of this pgStr.
void operator+= (const T *str)
 Concatenates the right hand side string to the end of this pgStr.
template<u8 N2>
void operator+= (const pgStr< T, N2 > &str)
 Concatenates the right hand side pgStr with different length to the end of this pgStr.
u32 operator% (u32 n) const
 Returns a hash value which is less than the specified value.
const T * getString () const
 Returns the pointer to the c-string of this pgStr.
u8 getLength () const
 Returns the length of this pgStr.
pgStr< T, N > getSubStr (u8 index, u8 length=0) const
 Returns the extracted pgStr from this pgStr in the specified range.


Detailed Description

template<class T, u8 N>
class pgStr< T, N >

A string with fixed length.

Template Parameters:
T The type of the elements of pgStr. Typically, either char or wchar_t is used.
N The length of pgStr. This value must be more than zero.

Constructor & Destructor Documentation

template<class T, u8 N>
pgStr< T, N >::pgStr ( ch  )  [inline]

Constructs and initializes a pgStr from the specified character.

Parameters:
[in] ch A character.

template<class T, u8 N>
pgStr< T, N >::pgStr ( const T *  str  )  [inline]

Constructs and initializes a pgStr from the specified string.

Parameters:
[in] str A string. NULL is allowed.

template<class T, u8 N>
pgStr< T, N >::pgStr ( const pgStr< T, N > &  str  )  [inline]

Constructs and initializes a pgStr from the specified pgStr.

Parameters:
[in] str A pgStr.

template<class T, u8 N>
template<u8 N2>
pgStr< T, N >::pgStr ( const pgStr< T, N2 > &  str  )  [inline]

Constructs and initializes a pgStr from the specified pgStr with different length.

Template Parameters:
N2 The length of a pgStr.
Parameters:
[in] str A pgStr with different length.


Member Function Documentation

template<class T, u8 N>
u8 pgStr< T, N >::getLength (  )  const [inline]

Returns the length of this pgStr.

Returns:
The length of this pgStr.

template<class T, u8 N>
const T* pgStr< T, N >::getString (  )  const [inline]

Returns the pointer to the c-string of this pgStr.

Returns:
The pointer to the c-string of this pgStr.

template<class T, u8 N>
pgStr<T, N> pgStr< T, N >::getSubStr ( u8  index,
u8  length = 0 
) const [inline]

Returns the extracted pgStr from this pgStr in the specified range.

Parameters:
[in] index The index of the position of the element to be extracted.
[in] length The length of the extracted pgStr. If not specified, the length of this pgStr is used.
Returns:
The extracted pgStr from this pgStr in the specified range.

template<class T, u8 N>
template<u8 N2>
bool pgStr< T, N >::operator!= ( const pgStr< T, N2 > &  str  )  const [inline]

Returns whether this pgStr is unequal to the right hand side pgStr with different length.

Template Parameters:
N2 The length of the right hand side pgStr.
Parameters:
[in] str The right hand side pgStr with defferent length.
Returns:
Whether this pgStr is unequal to the right hand side pgStr.

template<class T, u8 N>
bool pgStr< T, N >::operator!= ( const T *  str  )  const [inline]

Returns whether this pgStr is unequal to the right hand side string.

Parameters:
[in] str The right hand side string.
Returns:
Whether this pgStr is unequal to the right hand side string.

template<class T, u8 N>
bool pgStr< T, N >::operator!= ( ch  )  const [inline]

Returns whether this pgStr is unequal to the right hand side character.

Parameters:
[in] ch The right hand side character.
Returns:
Whether this pgStr is unequal to the right hand side character.

template<class T, u8 N>
u32 pgStr< T, N >::operator% ( u32  n  )  const [inline]

Returns a hash value which is less than the specified value.

This method is used when pgStr is used as the key type of pgMap.

Parameters:
[in] n A value.
Returns:
A hash value.

template<class T, u8 N>
template<u8 N2>
pgStr<T, N> pgStr< T, N >::operator+ ( const pgStr< T, N2 > &  str  )  const [inline]

Returns a pgStr which is the concatenation of this pgStr and the right hand side pgStr width differenct length.

Template Parameters:
N2 The length of the right hand side pgStr.
Parameters:
[in] str The right hand side pgStr with different length.
Returns:
A pgStr which is the concatenation of this pgStr and the right hand side pgStr width differenct length.

template<class T, u8 N>
pgStr<T, N> pgStr< T, N >::operator+ ( const T *  str  )  const [inline]

Returns a pgStr which is the concatenation of this pgStr and the right hand side string.

Parameters:
[in] str The right hand side string.
Returns:
A pgStr which is the concatenation of this pgStr and the right hand side string.

template<class T, u8 N>
pgStr<T, N> pgStr< T, N >::operator+ ( ch  )  const [inline]

Returns a pgStr which is the concatenation of this pgStr and the right hand side character.

Parameters:
[in] ch The right hand side character.
Returns:
A pgStr which is the concatenation of this pgStr and the right hand side character.

template<class T, u8 N>
template<u8 N2>
void pgStr< T, N >::operator+= ( const pgStr< T, N2 > &  str  )  [inline]

Concatenates the right hand side pgStr with different length to the end of this pgStr.

Template Parameters:
N2 The length of the right hand side pgStr.
Parameters:
[in] str The right hand side pgStr with different length.

template<class T, u8 N>
void pgStr< T, N >::operator+= ( const T *  str  )  [inline]

Concatenates the right hand side string to the end of this pgStr.

Parameters:
[in] str The right hand side string.

template<class T, u8 N>
void pgStr< T, N >::operator+= ( ch  )  [inline]

Concatenates the right hand side character to the end of this pgStr.

Parameters:
[in] ch The right hand side character.

template<class T, u8 N>
template<u8 N2>
pgStr<T, N>& pgStr< T, N >::operator= ( const pgStr< T, N2 > &  str  )  [inline]

Assigns the right hand side pgStr with different length to this pgStr.

Template Parameters:
N2 The length of the right hand side pgStr.
Parameters:
[in] str The right hand side pgStr with different length.
Returns:
A referenct to this pgStr.

template<class T, u8 N>
pgStr<T, N>& pgStr< T, N >::operator= ( const pgStr< T, N > &  str  )  [inline]

Assigns the right hand side pgStr to this pgStr.

Parameters:
[in] str The right hand side pgStr.
Returns:
A reference to this pgStr.

template<class T, u8 N>
pgStr<T, N>& pgStr< T, N >::operator= ( const T *  str  )  [inline]

Assigns the right hand side string to this pgStr.

Parameters:
[in] str The right hand side string.
Returns:
A reference to this pgStr.

template<class T, u8 N>
pgStr<T, N>& pgStr< T, N >::operator= ( ch  )  [inline]

Assigns the right hand side character to this pgStr.

Parameters:
[in] ch The right hand side character.
Returns:
A reference to this pgStr.

template<class T, u8 N>
template<u8 N2>
bool pgStr< T, N >::operator== ( const pgStr< T, N2 > &  str  )  const [inline]

Returns whether this pgStr is equal to the right hand side pgStr with different length.

Template Parameters:
N2 The length of the right hand side pgStr.
Parameters:
[in] str The right hand side pgStr with defferent length.
Returns:
Whether this pgStr is equal to the right hand side pgStr.

template<class T, u8 N>
bool pgStr< T, N >::operator== ( const T *  str  )  const [inline]

Returns whether this pgStr is equal to the right hand side string.

Parameters:
[in] str The right hand side string.
Returns:
Whether this pgStr is equal to the right hand side string.

template<class T, u8 N>
bool pgStr< T, N >::operator== ( ch  )  const [inline]

Returns whether this pgStr is equal to the right hand side character.

Parameters:
[in] ch The right hand side character.
Returns:
Whether this pgStr is equal to the right hand side character.

template<class T, u8 N>
T& pgStr< T, N >::operator[] ( u8  index  )  [inline]

Returns a reference to the character of this pgStr at the position specified by the parameter index.

Parameters:
[in] index The index of the position of the element to be referenced.
Returns:
A reference to the character of this pgStr at the position specified by the parameter index.


The documentation for this class was generated from the following file:

Generated on Sat Aug 15 11:24:38 2009 for Pogolyn by  doxygen 1.5.8