WoopsiGfx 1.4
Nintendo DS 2D Graphics Library
Public Member Functions | Protected Member Functions
WoopsiGfx::StringIterator Class Reference

#include <libwoopsigfx/include/stringiterator.h>

List of all members.

Public Member Functions

 StringIterator (const WoopsiString *string)
 ~StringIterator ()
void moveToFirst ()
void moveToLast ()
bool moveToNext ()
bool moveToPrevious ()
bool moveTo (s32 index)
s32 getIndex () const
u32 getCodePoint () const
u32 getInteger (u32 *charCount=NULL)

Protected Member Functions

u8 getCodePointSize ()
void iterateForwardsTo (s32 index)
void iterateBackwardsTo (s32 index)

Detailed Description

Class used to efficiently iterate over the characters in a WoopsiString object. The WoopsiString is a Unicode string that uses the variable-width UTF-8 encoding to represent its characters. This means that it is not possible to iterate over a WoopsiString in the same way that you would iterate over a char array.


Constructor & Destructor Documentation

StringIterator::StringIterator ( const WoopsiString string)

Constructor. Moves the iterator to the first character in the string.

Parameters:
stringPointer to the string that will be iterated over.
WoopsiGfx::StringIterator::~StringIterator ( ) [inline]

Destructor.


Member Function Documentation

u32 StringIterator::getCodePoint ( ) const

Get the codepoint in the string at the iterator's current point.

Returns:
The current character in the string.
u8 StringIterator::getCodePointSize ( ) [protected]

Get the size of the current codepoint in bytes.

Returns:
The size of the current codepoint.
s32 WoopsiGfx::StringIterator::getIndex ( ) const [inline]

Get the current position of the iterator within the string.

Returns:
The current character index of the iterator.
u32 StringIterator::getInteger ( u32 *  charCount = NULL)

Get the integer value represented by the sequence of digits at the current point.

Parameters:
charCountIf set to anything other than NULL, the pointer will be populated with the number of characters in the integer. A value of 0 indicates that no digits were found at the current point.
Returns:
The integer value represented by the current string position.
void StringIterator::iterateBackwardsTo ( s32  index) [protected]

Move backwards from the current index to the specified index.

Parameters:
indexThe index to move to.
void StringIterator::iterateForwardsTo ( s32  index) [protected]

Move forwards from the current index to the specified index.

Parameters:
indexThe index to move to.
bool StringIterator::moveTo ( s32  index)

Move the iterator to the specified index.

Parameters:
indexThe index to move to.
Returns:
True if the iterator moved; false if not (indicates end of string).
void StringIterator::moveToFirst ( )

Moves the iterator to the first character in the string.

void StringIterator::moveToLast ( )

Moves the iterator to the last character in the string.

bool StringIterator::moveToNext ( )

Move the iterator to the next character in the string.

Returns:
True if the iterator moved; false if not (indicates end of string).
bool StringIterator::moveToPrevious ( )

Move the iterator to the previous character in the string.

Returns:
True if the iterator moved; false if not (indicates start of string).

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