#include <maxchar.h>
Iterate intelligently inside a string.
This class should be used to iterate through characters of a string. It guarantees that the string pointer never points to the end of a character. The template parameter should be either char, wchar_t, const wchar_t etc...
Public Member Functions |
|
CharIterator () | |
Construct this iterator with a NULL pointer.
|
|
CharIterator (ChType *ptr) | |
Construct this iterator with a string
pointer. |
|
CharIterator (const CharIterator< ChType > &p) | |
Copy an existing character iterator.
|
|
int | CharLength () const |
Gets the number of elements of the current
template type, for the current character pointed to by the
iterator. |
|
CharIterator< ChType > & | operator= (const CharIterator< ChType > &p) |
Assignment operator. |
|
CharIterator< ChType > & | operator= (ChType *ptr) |
Assignment operator. |
|
CharIterator< ChType > & | operator++ () |
Move to the next character. |
|
CharIterator< ChType > | operator++ (int) |
CharIterator< ChType > & | operator+= (size_t s) |
Move the iterator character forward by a
specified amount. |
|
CharIterator< ChType > | operator+ (size_t s) const |
Move the iterator character forward by a
specified amount. |
|
const Char | operator* () const |
Return the current character. |
|
const Char | operator[] (size_t index) const |
Return the nth character from the iterator.
|
|
bool | AtEnd () const |
Determine if the iterator has reached the
end of the string. |
|
ChType * | Get () const |
Obtain the current string pointer. |
|
const Char | Get (size_t index) const |
Return the nth character from the iterator.
|
|
operator ChType * () const | |
Obtain the current string pointer. |
|
template<> | |
UtilExport int | CharLength () const |
template<> | |
UtilExport CharIterator< char > & | operator++ () |
template<> | |
UtilExport CharIterator< char > | operator++ (int) |
template<> | |
UtilExport CharIterator< char > & | operator+= (size_t s) |
template<> | |
UtilExport CharIterator< char > | operator+ (size_t s) const |
template<> | |
UtilExport const Char | operator* () const |
template<> | |
UtilExport int | CharLength () const |
template<> | |
UtilExport
CharIterator<
const char > & |
operator++ () |
template<> | |
UtilExport
CharIterator<
const char > |
operator++ (int) |
template<> | |
UtilExport
CharIterator<
const char > & |
operator+= (size_t s) |
template<> | |
UtilExport
CharIterator<
const char > |
operator+ (size_t s) const |
template<> | |
UtilExport const Char | operator* () const |
template<> | |
UtilExport int | CharLength () const |
template<> | |
UtilExport
CharIterator < wchar_t > & |
operator++ () |
template<> | |
UtilExport CharIterator< wchar_t > | operator++ (int) |
template<> | |
UtilExport
CharIterator < wchar_t > & |
operator+= (size_t s) |
template<> | |
UtilExport CharIterator< wchar_t > | operator+ (size_t s) const |
template<> | |
UtilExport const Char | operator* () const |
template<> | |
UtilExport int | CharLength () const |
template<> | |
UtilExport
CharIterator<
const wchar_t > & |
operator++ () |
template<> | |
UtilExport
CharIterator<
const wchar_t > |
operator++ (int) |
template<> | |
UtilExport
CharIterator<
const wchar_t > & |
operator+= (size_t s) |
template<> | |
UtilExport
CharIterator<
const wchar_t > |
operator+ (size_t s) const |
template<> | |
UtilExport const Char | operator* () const |
Protected Attributes |
|
ChType * | _ptr |
CharIterator | ( | ) | [inline] |
CharIterator | ( | ChType * | ptr | ) | [inline] |
Construct this iterator with a string pointer.
: _ptr(ptr) { }
CharIterator | ( | const CharIterator< ChType > & | p | ) | [inline] |
Copy an existing character iterator.
: _ptr(p._ptr) { }
int CharLength | ( | ) | const |
Gets the number of elements of the current template type, for the current character pointed to by the iterator.
CharIterator<ChType>& operator= | ( | const CharIterator< ChType > & | p | ) | [inline] |
CharIterator<ChType>& operator= | ( | ChType * | ptr | ) | [inline] |
Assignment operator.
Copies another character as the templated type as this iterator.
{ _ptr = ptr; return *this; }
CharIterator<ChType>& operator++ | ( | ) |
Move to the next character.
CharIterator<ChType> operator++ | ( | int | ) |
CharIterator<ChType>& operator+= | ( | size_t | s | ) |
Move the iterator character forward by a specified amount.
(It will stop at the first null character.)
CharIterator<ChType> operator+ | ( | size_t | s | ) | const |
Move the iterator character forward by a specified amount.
(It will stop at the first null character.)
const Char operator* | ( | ) | const |
Return the current character.
const Char operator[] | ( | size_t | index | ) | const [inline] |
Return the nth character from the iterator.
index | - The index of the character to retrieve from the string |
{ CharIterator<ChType> it(*this); it += index; return *it; }
bool AtEnd | ( | ) | const [inline] |
Determine if the iterator has reached the end of the string.
{ return *_ptr == 0; }
ChType* Get | ( | ) | const [inline] |
const Char Get | ( | size_t | index | ) | const [inline] |
Return the nth character from the iterator.
index | - The index of the character to retrieve from the string |
{ CharIterator<ChType> it(*this); it += index; return *it; }
operator ChType * | ( | ) | const [inline] |
Obtain the current string pointer.
{ return _ptr; }
UtilExport int CharLength | ( | ) | const |
UtilExport CharIterator< char > & operator++ | ( | ) |
UtilExport CharIterator< char > operator++ | ( | int | ) |
UtilExport CharIterator< char > & operator+= | ( | size_t | s | ) |
UtilExport CharIterator< char > operator+ | ( | size_t | s | ) | const |
UtilExport const Char operator* | ( | ) | const |
UtilExport int CharLength | ( | ) | const |
UtilExport CharIterator< const char > & operator++ | ( | ) |
UtilExport CharIterator< const char > operator++ | ( | int | ) |
UtilExport CharIterator< const char > & operator+= | ( | size_t | s | ) |
UtilExport CharIterator< const char > operator+ | ( | size_t | s | ) | const |
UtilExport const Char operator* | ( | ) | const |
UtilExport int CharLength | ( | ) | const |
UtilExport CharIterator< wchar_t > & operator++ | ( | ) |
UtilExport CharIterator< wchar_t > operator++ | ( | int | ) |
UtilExport CharIterator< wchar_t > & operator+= | ( | size_t | s | ) |
UtilExport CharIterator< wchar_t > operator+ | ( | size_t | s | ) | const |
UtilExport const Char operator* | ( | ) | const |
UtilExport int CharLength | ( | ) | const |
UtilExport CharIterator< const wchar_t > & operator++ | ( | ) |
UtilExport CharIterator< const wchar_t > operator++ | ( | int | ) |
UtilExport CharIterator< const wchar_t > & operator+= | ( | size_t | s | ) |
UtilExport CharIterator< const wchar_t > operator+ | ( | size_t | s | ) | const |
UtilExport const Char operator* | ( | ) | const |
ChType*
_ptr [protected] |