00001 #ifndef _STRING_ITERATOR_H_ 00002 #define _STRING_ITERATOR_H_ 00003 00004 #include <nds.h> 00005 00006 namespace WoopsiUI { 00007 00008 class WoopsiString; 00009 00017 class StringIterator { 00018 public: 00019 00024 StringIterator(const WoopsiString* string); 00025 00029 inline ~StringIterator() { }; 00030 00034 void moveToFirst(); 00035 00039 void moveToLast(); 00040 00045 bool moveToNext(); 00046 00051 bool moveToPrevious(); 00052 00058 bool moveTo(s32 index); 00059 00064 inline s32 getIndex() const { return _currentIndex; }; 00065 00070 u32 getCodePoint() const; 00071 00072 protected: 00073 00078 u8 getCodePointSize(); 00079 00084 void iterateForwardsTo(s32 index); 00085 00090 void iterateBackwardsTo(s32 index); 00091 00092 private: 00093 const WoopsiString* _string; 00094 const char* _currentChar; 00095 s32 _currentIndex; 00096 }; 00097 } 00098 00099 #endif