24 #ifndef __TextIterator__ 25 #define __TextIterator__ 29 #include "DataWrapper.h" 30 #include "WideString.h" 43 TextChunk() : fTextModelPtr(nil), fLength(0), fStartingIndex(0)
51 void ForceContainTextIndex(TextIndex index);
52 bool16 Contains(TextIndex index)
53 {
return index >= fStartingIndex && index < fStartingIndex + fLength; }
64 ForceContainTextIndex(fStartingIndex + fLength);
69 ForceContainTextIndex(fStartingIndex - 1);
75 ASSERT(index >= fStartingIndex && index < fStartingIndex + fLength);
76 numCharsLeft = (fStartingIndex + fLength) - index;
79 const UTF16TextChar* IndexToPointer(TextIndex index, int32 &numUTF16sLeft)
const 81 ASSERT(index >= fStartingIndex && index < fStartingIndex + fLength);
84 numUTF16sLeft = (iter + numChars).PtrAt() - iter.
PtrAt();
89 {
return fTextModelPtr; }
94 friend class ComposeScannerCache;
97 void Normalize(TextIndex chunkBegin);
103 TextIndex fStartingIndex;
114 typedef std::ptrdiff_t difference_type;
117 typedef std::bidirectional_iterator_tag iterator_category;
123 TextIndex Position()
const 124 {
return fPosition; }
125 bool16 IsNull()
const 126 {
return fCurrent.
PtrAt() == nil; }
128 void AppendToStringAndIncrement(
WideString * str, int32 numChars);
132 { ASSERT(fCurrent.
PtrAt() != nil);
return *fCurrent; }
134 { ASSERT(fCurrent.
PtrAt() != nil);
return fCurrent; }
148 {
return int32(fPosition - rhs.fPosition); }
155 {
return x.fCurrent.
PtrAt() == y.fCurrent.
PtrAt(); }
157 {
return x.fCurrent.
PtrAt() != y.fCurrent.
PtrAt(); }
159 {
return x.fPosition < y.fPosition; }
161 {
return x.fPosition <= y.fPosition; }
163 {
return x.fPosition > y.fPosition; }
165 {
return x.fPosition >= y.fPosition; }
171 {
return fChunk.GetTextModel(); }
174 friend class ComposeScannerCache;