40 #ifndef _uitexttoken_cpp
41 #define _uitexttoken_cpp
43 #include "UI/texttoken.h"
46 #include "exception.h"
57 Int32 BytesAdvance = 0;
59 UInt32 CurrRenderIndex = 0;
60 while( CurrRawIndex < this->
Text.size() && CurrRenderIndex < Index )
65 CurrRawIndex += BytesAdvance;
73 {
return this->
Text; }
76 {
return this->
Type; }
79 {
return this->
Text.size(); }
101 Int32 BytesAdvance = 0;
103 while( BufPos < Size )
108 BufPos +=
static_cast<UInt32>(BytesAdvance);
111 this->
Text.insert(RawIndex,Characters[0],Size);
126 Int32 BytesAdvance = 0;
129 UInt32 ConvBufSize = Size * 4;
130 Char8* ConversionBuffer =
new Char8[ConvBufSize];
131 while( SourceBufPos < Size )
134 if( BytesAdvance < 0 ) {
138 ConvBufPos +=
static_cast<UInt32>(BytesAdvance);
142 this->
Text.insert(RawIndex,ConversionBuffer,ConvBufPos);
143 delete[] ConversionBuffer;
158 Int32 BytesAdvance = 0;
159 if( RawIndex < this->
Text.size() ) {
163 this->
Text.erase(RawIndex,BytesAdvance);
180 Int32 BytesAdvance = 0;
182 UInt32 CurrRenderLength = 0;
183 while( RawIndex + CurrRawLength < this->
Text.size() && CurrRenderLength < Length )
188 CurrRawLength +=
static_cast<UInt32>(BytesAdvance);
192 this->
Text.erase(RawIndex,CurrRawLength);
193 return CurrRenderLength;
216 NameValuePairMap::const_iterator ParamIt = this->
Params.find(Param);
217 if( ParamIt != this->
Params.end() )
return (*ParamIt).second;
322 if( this->
RenderSize != 0 && Index == 0 && Length > 0 ) {
355 if( IndexCount + (*TokIt)->GetRenderCharacterSize() < Index ) {
356 IndexCount += (*TokIt)->GetRenderCharacterSize();
360 Ret.second = Index - IndexCount;
366 Ret.first = --(this->
Tokens.end());
367 Ret.second = (*Ret.first)->GetRenderCharacterSize();
379 Ret.append( (*TokIt)->GetRawCharacterString() );
385 {
return this->
Tokens.begin(); }
388 {
return this->
Tokens.end(); }
391 {
return this->
Tokens.begin(); }
394 {
return this->
Tokens.end(); }
397 {
return this->
Tokens.rbegin(); }
400 {
return this->
Tokens.rend(); }
403 {
return this->
Tokens.rbegin(); }
406 {
return this->
Tokens.rend(); }
412 { this->
Tokens.push_back(ToBePushed); }
415 { this->
Tokens.insert(this->
Tokens.end(),ToBePushed.begin(),ToBePushed.end()); }
437 this->
Tokens.insert(Result.first,NewToken);
451 this->
Tokens.insert(Result.first,NewToken);
465 this->
Tokens.insert(Result.first,NewToken);
474 return (*Result.first)->RemoveCharacter(Result.second);
481 while( Removed < Length ) {
483 if( Result.first == this->Tokens.end() )
486 Removed += (*Result.first)->
RemoveCharacters(Result.second,Length - Removed);
496 Ret += (*TokIt)->ClearAllCharacters();