NXWidgets  1.19
Public Member Functions | Private Attributes | List of all members
NXWidgets::CStringIterator Class Reference

#include <cstringiterator.hxx>

Public Member Functions

 CStringIterator (FAR const CNxString *string)
 
 ~CStringIterator (void)
 
bool moveToFirst (void)
 
bool moveToLast (void)
 
bool moveToNext (void)
 
bool moveToPrevious (void)
 
bool moveTo (int index)
 
int getIndex (void) const
 
nxwidget_char_t getChar (void) const
 

Private Attributes

const CNxStringm_pString
 
const nxwidget_char_tm_pCurrentChar
 
int m_currentIndex
 

Detailed Description

Class used to efficiently iterate over the characters in a CNxString object. The CNxString is a Unicode string that uses the fixed-width 16-bit encoding to represent its characters.

Definition at line 102 of file cstringiterator.hxx.

Constructor & Destructor Documentation

◆ CStringIterator()

CStringIterator::CStringIterator ( FAR const CNxString string)

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

Parameters
stringPointer to the string that will be iterated over.

Definition at line 98 of file cstringiterator.cxx.

◆ ~CStringIterator()

NXWidgets::CStringIterator::~CStringIterator ( void  )
inline

Destructor.

Definition at line 123 of file cstringiterator.hxx.

Member Function Documentation

◆ getChar()

nxwidget_char_t NXWidgets::CStringIterator::getChar ( void  ) const
inline

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

Returns
The current character in the string.

Definition at line 183 of file cstringiterator.hxx.

◆ getIndex()

int NXWidgets::CStringIterator::getIndex ( void  ) const
inline

Get the current position of the iterator within the string.

Returns
The current character index of the iterator.

Definition at line 172 of file cstringiterator.hxx.

◆ moveTo()

bool CStringIterator::moveTo ( int  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).

Definition at line 185 of file cstringiterator.cxx.

◆ moveToFirst()

bool CStringIterator::moveToFirst ( void  )

Moves the iterator to the first character in the string.

Parameters
Returnsfalse if the string is empty

Definition at line 111 of file cstringiterator.cxx.

◆ moveToLast()

bool CStringIterator::moveToLast ( void  )

Moves the iterator to the last character in the string.

Parameters
Returnsfalse if the string is empty

Definition at line 130 of file cstringiterator.cxx.

◆ moveToNext()

bool CStringIterator::moveToNext ( void  )

Move the iterator to the next character in the string.

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

Definition at line 149 of file cstringiterator.cxx.

◆ moveToPrevious()

bool CStringIterator::moveToPrevious ( void  )

Move the iterator to the previous character in the string.

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

Definition at line 167 of file cstringiterator.cxx.

Member Data Documentation

◆ m_currentIndex

int NXWidgets::CStringIterator::m_currentIndex
private

Iterator's current index within the string.

Definition at line 107 of file cstringiterator.hxx.

◆ m_pCurrentChar

const nxwidget_char_t* NXWidgets::CStringIterator::m_pCurrentChar
private

Pointer to the current position of the iterator.

Definition at line 106 of file cstringiterator.hxx.

◆ m_pString

const CNxString* NXWidgets::CStringIterator::m_pString
private

String being iterated over.

Definition at line 105 of file cstringiterator.hxx.


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