Woopsi 1.0
GUI Framework for Nintendo DS Homebrew
Public Member Functions | Protected Member Functions

WoopsiUI::StringIterator Class Reference

#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

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

WoopsiUI::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.
WoopsiUI::StringIterator::~StringIterator ( ) [inline]

Destructor.


Member Function Documentation

u32 WoopsiUI::StringIterator::getCodePoint ( ) const

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

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

Get the size of the current codepoint in bytes.

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

Get the current position of the iterator within the string.

Returns:
The current character index of the iterator.
void WoopsiUI::StringIterator::iterateBackwardsTo ( s32  index) [protected]

Move backwards from the current index to the specified index.

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

Move forwards from the current index to the specified index.

Parameters:
indexThe index to move to.
bool WoopsiUI::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 WoopsiUI::StringIterator::moveToFirst ( )

Moves the iterator to the first character in the string.

void WoopsiUI::StringIterator::moveToLast ( )

Moves the iterator to the last character in the string.

bool WoopsiUI::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 WoopsiUI::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 file: