Spinning Topp Logo BlackTopp Studios
inc
texttoken.cpp
1 // © Copyright 2010 - 2016 BlackTopp Studios Inc.
2 /* This file is part of The Mezzanine Engine.
3 
4  The Mezzanine Engine is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  The Mezzanine Engine is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with The Mezzanine Engine. If not, see <http://www.gnu.org/licenses/>.
16 */
17 /* The original authors have included a copy of the license specified above in the
18  'Docs' folder. See 'gpl.txt'
19 */
20 /* We welcome the use of the Mezzanine engine to anyone, including companies who wish to
21  Build professional software and charge for their product.
22 
23  However there are some practical restrictions, so if your project involves
24  any of the following you should contact us and we will try to work something
25  out:
26  - DRM or Copy Protection of any kind(except Copyrights)
27  - Software Patents You Do Not Wish to Freely License
28  - Any Kind of Linking to Non-GPL licensed Works
29  - Are Currently In Violation of Another Copyright Holder's GPL License
30  - If You want to change our code and not add a few hundred MB of stuff to
31  your distribution
32 
33  These and other limitations could cause serious legal problems if you ignore
34  them, so it is best to simply contact us or the Free Software Foundation, if
35  you have any questions.
36 
37  Joseph Toppi - toppij@gmail.com
38  John Blackwood - makoenergy02@gmail.com
39 */
40 #ifndef _uitexttoken_cpp
41 #define _uitexttoken_cpp
42 
43 #include "UI/texttoken.h"
44 
45 #include "unicode.h"
46 #include "exception.h"
47 
48 namespace Mezzanine
49 {
50  namespace UI
51  {
52  ///////////////////////////////////////////////////////////////////////////////
53  // TextToken Methods
54 
56  Type(TT_Error),
57  RenderSize(0)
58  { }
59 
60  TextToken::TextToken(const String& RawText, const TokenType TType) :
61  Type(TType),
62  RenderSize(0),
63  Text(RawText)
64  { }
65 
66  TextToken::TextToken(const Char8* Characters, const UInt32 Size) :
67  Type(TT_Text),
68  RenderSize(0)
69  { this->InsertCharacters(0,Characters,Size); }
70 
71  TextToken::TextToken(const UInt32* Characters, const UInt32 Size) :
72  Type(TT_Text),
73  RenderSize(0)
74  { this->InsertCharacters(0,Characters,Size); }
75 
77  { }
78 
80  {
81  Int32 BytesAdvance = 0;
82  UInt32 CurrRawIndex = 0;
83  UInt32 CurrRenderIndex = 0;
84  while( CurrRawIndex < this->Text.size() && CurrRenderIndex < Index )
85  {
86  if( Unicode::GetIntFromCharacter(BytesAdvance,this->Text.data() + CurrRawIndex) < 0 ) {
87  return -1;
88  }
89  CurrRawIndex += BytesAdvance;
90  ++CurrRenderIndex;
91  }
92 
93  return CurrRawIndex;
94  }
95 
97  { return this->Text; }
98 
100  { return this->Type; }
101 
103  { return this->Text.size(); }
104 
106  { return this->RenderSize; }
107 
109  {
110  return this->InsertCharacters(Index,&UChar,1);
111  }
112 
113  UInt32 TextToken::InsertCharacters(const UInt32 Index, const Char8* Characters, const UInt32 Size)
114  {
115  if( this->RenderSize >= Index )
116  {
117  UInt32 RawIndex = this->ConvertRenderIndexToRawIndex(Index);
118  if( RawIndex < 0 ) {
119  return 0;
120  }
121 
122  UInt32 Ret = 0;
123  // Verify the encoding and count the characters
124  UInt32 BufPos = 0;
125  Int32 BytesAdvance = 0;
126  //Char8 ConversionBuffer[4];
127  while( BufPos < Size )
128  {
129  if( Unicode::GetIntFromCharacter(BytesAdvance,Characters + BufPos) < 0 ) {
130  return 0;
131  }
132  BufPos += static_cast<UInt32>(BytesAdvance);
133  ++Ret;
134  }
135  this->Text.insert(RawIndex,Characters[0],Size);
136  return Ret;
137  }
138  return 0;
139  }
140 
141  UInt32 TextToken::InsertCharacters(const UInt32 Index, const UInt32* Characters, const UInt32 Size)
142  {
143  if( this->RenderSize >= Index )
144  {
145  UInt32 RawIndex = this->ConvertRenderIndexToRawIndex(Index);
146  if( RawIndex < 0 ) {
147  return 0;
148  }
149 
150  Int32 BytesAdvance = 0;
151  UInt32 SourceBufPos = 0;
152  UInt32 ConvBufPos = 0;
153  UInt32 ConvBufSize = Size * 4; // Max size needed
154  Char8* ConversionBuffer = new Char8[ConvBufSize];
155  while( SourceBufPos < Size )
156  {
157  BytesAdvance = Unicode::GetCharacterFromInt(&(ConversionBuffer[ConvBufPos]),ConvBufSize - ConvBufPos,Characters[SourceBufPos]);
158  if( BytesAdvance < 0 ) {
159  return 0;
160  }
161 
162  ConvBufPos += static_cast<UInt32>(BytesAdvance);
163  ++SourceBufPos;
164  }
165 
166  this->Text.insert(RawIndex,ConversionBuffer,ConvBufPos);
167  delete[] ConversionBuffer;
168  return Size;
169  }
170  return 0;
171  }
172 
174  {
175  if( this->RenderSize >= Index )
176  {
177  UInt32 RawIndex = this->ConvertRenderIndexToRawIndex(Index);
178  if( RawIndex < 0 ) {
179  return 0;
180  }
181 
182  Int32 BytesAdvance = 0;
183  if( RawIndex < this->Text.size() ) { //possibly redundent check
184  if( Unicode::GetIntFromCharacter(BytesAdvance,(this->Text.data() + RawIndex)) < 0 ) {
185  return 0;
186  }
187  this->Text.erase(RawIndex,BytesAdvance);
188  return 1;
189  }
190  }
191  return 0;
192  }
193 
194  UInt32 TextToken::RemoveCharacters(const UInt32 Index, const UInt32 Length)
195  {
196  if( this->RenderSize >= Index )
197  {
198  UInt32 RawIndex = this->ConvertRenderIndexToRawIndex(Index);
199  if( RawIndex < 0 ) {
200  return 0;
201  }
202 
203  // Start another loop to find the length
204  Int32 BytesAdvance = 0;
205  UInt32 CurrRawLength = 0;
206  UInt32 CurrRenderLength = 0;
207  while( RawIndex + CurrRawLength < this->Text.size() && CurrRenderLength < Length )
208  {
209  if( Unicode::GetIntFromCharacter(BytesAdvance,(this->Text.data() + RawIndex) + CurrRawLength) < 0 ) {
210  return 0;
211  }
212  CurrRawLength += static_cast<UInt32>(BytesAdvance);
213  ++CurrRenderLength;
214  }
215 
216  this->Text.erase(RawIndex,CurrRawLength);
217  return CurrRenderLength;
218  }
219  return 0;
220  }
221 
223  {
224  UInt32 PrevSize = this->RenderSize;
225  this->Text.clear();
226  this->RenderSize = 0;
227  return PrevSize;
228  }
229 
230  ///////////////////////////////////////////////////////////////////////////////
231  // TagToken Methods
232 
234  { }
235 
236  TagToken::TagToken(const String& RawText, const String& Name, const TokenType TType) :
237  TextToken(RawText,TType),
238  TagName(Name)
239  { }
240 
242  { }
243 
245  { return this->TagName; }
246 
248  {
249  NameValuePairMap::const_iterator ParamIt = this->Params.find(Param);
250  if( ParamIt != this->Params.end() ) return (*ParamIt).second;
251  else return "";
252  }
253 
254  ///////////////////////////////////////////////////////////////////////////////
255  // RangeTagToken Methods
256 
258  PartnerTag(NULL)
259  { }
260 
261  RangeTagToken::RangeTagToken(const String& RawText, const String& Name, const TokenType TType) :
262  TagToken(RawText,Name,TType),
263  PartnerTag(NULL)
264  { }
265 
267  { }
268 
270  { return this->PartnerTag; }
271 
273  {
274  if( this->PartnerTag == NULL ) {
275  if( this->RenderSize != 0 ) {
276  return this->TextToken::InsertCharacter(Index,UChar);
277  }
278  }
279  return 0;
280  }
281 
282  UInt32 RangeTagToken::InsertCharacters(const UInt32 Index, const Char8* Characters, const UInt32 Size)
283  {
284  if( this->PartnerTag == NULL ) {
285  if( this->RenderSize != 0 ) {
286  return this->TextToken::InsertCharacters(Index,Characters,Size);
287  }
288  }
289  return 0;
290  }
291 
292  UInt32 RangeTagToken::InsertCharacters(const UInt32 Index, const UInt32* Characters, const UInt32 Size)
293  {
294  if( this->PartnerTag == NULL ) {
295  if( this->RenderSize != 0 ) {
296  return this->TextToken::InsertCharacters(Index,Characters,Size);
297  }
298  }
299  return 0;
300  }
301 
303  {
304  if( this->PartnerTag == NULL ) {
305  if( this->RenderSize != 0 ) {
306  return this->TextToken::RemoveCharacter(Index);
307  }
308  }
309  return 0;
310  }
311 
313  {
314  if( this->PartnerTag == NULL ) {
315  if( this->RenderSize != 0 ) {
316  return this->TextToken::RemoveCharacters(Index,Length);
317  }
318  }
319  return 0;
320  }
321 
323  {
324  if( this->PartnerTag == NULL ) {
325  if( this->RenderSize != 0 ) {
326  return this->TextToken::ClearAllCharacters();
327  }
328  }
329  return 0;
330  }
331 
332  ///////////////////////////////////////////////////////////////////////////////
333  // InsertTagToken Methods
334 
336  { }
337 
338  InsertTagToken::InsertTagToken(const String& RawText, const String& Name) :
339  TagToken(RawText,Name,TextToken::TT_InsertTag)
340  { }
341 
343  { }
344 
346  {
347  // Glyphs can't be inserted into this type of token.
348  return 0;
349  }
350 
351  UInt32 InsertTagToken::InsertCharacters(const UInt32 Index, const Char8* Characters, const UInt32 Size)
352  {
353  // Glyphs can't be inserted into this type of token.
354  return 0;
355  }
356 
357  UInt32 InsertTagToken::InsertCharacters(const UInt32 Index, const UInt32* Characters, const UInt32 Size)
358  {
359  // Glyphs can't be inserted into this type of token.
360  return 0;
361  }
362 
364  {
365  if( this->RenderSize != 0 && Index == 0 ) {
366  this->Text.clear();
367  this->RenderSize = 0;
368  return 1;
369  }
370  return 0;
371  }
372 
374  {
375  if( this->RenderSize != 0 && Index == 0 && Length > 0 ) {
376  this->Text.clear();
377  this->RenderSize = 0;
378  return 1;
379  }
380  return 0;
381  }
382 
384  {
385  if( this->RenderSize != 0 ) {
386  this->Text.clear();
387  this->RenderSize = 0;
388  return 1;
389  }
390  return 0;
391  }
392 
393  ///////////////////////////////////////////////////////////////////////////////
394  // TokenString Methods
395 
397  { }
398 
400  { this->DestroyAllTokens(); }
401 
403  {
404  TokenIndexPair Ret;
405  if( this->GetNumTokens() > 0 ) {
406  UInt32 IndexCount = 0;
407  for( TokenIterator TokIt = this->Tokens.begin() ; TokIt != this->Tokens.end() ; ++TokIt )
408  {
409  if( IndexCount + (*TokIt)->GetRenderCharacterSize() < Index ) {
410  IndexCount += (*TokIt)->GetRenderCharacterSize();
411  continue;
412  }else{
413  Ret.first = TokIt;
414  Ret.second = Index - IndexCount;
415  return Ret;
416  }
417  }
418  }else{
419  // Fix for manipulating empty strings.
420  this->Tokens.push_back( new TextToken(String(""),TextToken::TT_Text) );
421  }
422  // If we get to this point, then the index requested is out of bounds.
423  // Just return the last token and it's max index.
424  Ret.first = --(this->Tokens.end());
425  Ret.second = (*Ret.first)->GetRenderCharacterSize();
426  return Ret;
427  }
428 
429  ///////////////////////////////////////////////////////////////////////////////
430  // Utility
431 
433  {
434  String Ret;
435  for( ConstTokenIterator TokIt = this->Tokens.begin() ; TokIt != this->Tokens.end() ; ++TokIt )
436  {
437  Ret.append( (*TokIt)->GetRawCharacterString() );
438  }
439  return Ret;
440  }
441 
443  {
444  Whole Ret = 0;
445  for( ConstTokenIterator TokIt = this->Tokens.begin() ; TokIt != this->Tokens.end() ; ++TokIt )
446  {
447  Ret += (*TokIt)->GetRenderCharacterSize();
448  }
449  return Ret;
450  }
451 
453  {
454  return this->Tokens.size();
455  }
456 
458  { return this->Tokens.begin(); }
459 
461  { return this->Tokens.end(); }
462 
464  { return this->Tokens.begin(); }
465 
467  { return this->Tokens.end(); }
468 
470  { return this->Tokens.rbegin(); }
471 
473  { return this->Tokens.rend(); }
474 
476  { return this->Tokens.rbegin(); }
477 
479  { return this->Tokens.rend(); }
480 
481  ///////////////////////////////////////////////////////////////////////////////
482  // Generating the String
483 
485  { this->Tokens.push_back(ToBePushed); }
486 
487  void TokenString::PushTokens(const TokenContainer& ToBePushed)
488  { this->Tokens.insert(this->Tokens.end(),ToBePushed.begin(),ToBePushed.end()); }
489 
491  {
492  for( TokenIterator TokIt = this->Tokens.begin() ; TokIt != this->Tokens.end() ; ++TokIt )
493  {
494  delete (*TokIt);
495  }
496  this->Tokens.clear();
497  }
498 
499  ///////////////////////////////////////////////////////////////////////////////
500  // Inserting and Removing
501 
503  {
504  TokenIndexPair Result = this->GetTokenIndex(Index);
505  UInt32 Ret = (*Result.first)->InsertCharacter(Result.second,UChar);
506  if( Ret == 0 ) {
507  // If we're here, then we're probably on a token that isn't a text token, or behaving like one.
508  // There are a number of conditions depending on tag types that could cause this, so instead of trying to troubleshoot them, lets just insert a new text token.
509  TextToken* NewToken = new TextToken(&UChar,1);
510  this->Tokens.insert(Result.first,NewToken);
511  Ret = 1;
512  }
513  return Ret;
514  }
515 
516  UInt32 TokenString::InsertCharacters(const UInt32 Index, const Char8* Characters, const UInt32 Size)
517  {
518  TokenIndexPair Result = this->GetTokenIndex(Index);
519  UInt32 Ret = (*Result.first)->InsertCharacters(Result.second,Characters,Size);
520  if( Ret == 0 ) {
521  // If we're here, then we're probably on a token that isn't a text token, or behaving like one.
522  // There are a number of conditions depending on tag types that could cause this, so instead of trying to troubleshoot them, lets just insert a new text token.
523  TextToken* NewToken = new TextToken(Characters,Size);
524  this->Tokens.insert(Result.first,NewToken);
525  Ret = Size;
526  }
527  return Ret;
528  }
529 
530  UInt32 TokenString::InsertCharacters(const UInt32 Index, const UInt32* Characters, const UInt32 Size)
531  {
532  TokenIndexPair Result = this->GetTokenIndex(Index);
533  UInt32 Ret = (*Result.first)->InsertCharacters(Result.second,Characters,Size);
534  if( Ret == 0 ) {
535  // If we're here, then we're probably on a token that isn't a text token, or behaving like one.
536  // There are a number of conditions depending on tag types that could cause this, so instead of trying to troubleshoot them, lets just insert a new text token.
537  TextToken* NewToken = new TextToken(Characters,Size);
538  this->Tokens.insert(Result.first,NewToken);
539  Ret = Size;
540  }
541  return Ret;
542  }
543 
545  {
546  TokenIndexPair Result = this->GetTokenIndex(Index);
547  return (*Result.first)->RemoveCharacter(Result.second);
548  }
549 
551  {
552  TokenIndexPair Result = this->GetTokenIndex(Index);
553  UInt32 Removed = (*Result.first)->RemoveCharacters(Result.second,Length);
554  while( Removed < Length ) {
555  ++(Result.first);
556  if( Result.first == this->Tokens.end() )
557  break;
558 
559  Removed += (*Result.first)->RemoveCharacters(Result.second,Length - Removed);
560  }
561  return Removed;
562  }
563 
565  {
566  UInt32 Ret = 0;
567  for( TokenIterator TokIt = this->Tokens.begin() ; TokIt != this->Tokens.end() ; ++TokIt )
568  {
569  Ret += (*TokIt)->ClearAllCharacters();
570  }
571  return Ret;
572  }
573  }//UI
574 }//Mezzanine
575 
576 #endif
TokenContainer Tokens
Container for TextToken storage.
Definition: texttoken.h:300
int32_t Int32
An 32-bit integer.
Definition: datatypes.h:124
This contains simple tools for indexing with UTF8 characters swiftly.
This class represents a normal text segment from the source string.
Definition: texttoken.h:56
TokenString()
Class constructor.
Definition: texttoken.cpp:396
NameValuePairMap Params
The parameters provided for this tag, if any.
Definition: texttoken.h:170
TokenIndexPair GetTokenIndex(const UInt32 Index)
Gets the token at the string index, and it's local index.
Definition: texttoken.cpp:402
String TagName
Unconverted version of the tag name.
Definition: texttoken.h:168
virtual UInt32 RemoveCharacters(const UInt32 Index, const UInt32 Length)
Removes rendered characters from this string.
Definition: texttoken.cpp:550
virtual UInt32 RemoveCharacter(const UInt32 Index)
Removes a single rendered character from this token.
Definition: texttoken.cpp:302
virtual ~TextToken()
Class destructor.
Definition: texttoken.cpp:76
virtual UInt32 ClearAllCharacters()
Removes all the rendered characters from this token.
Definition: texttoken.cpp:383
virtual UInt32 RemoveCharacters(const UInt32 Index, const UInt32 Length)
Removes rendered characters from this token.
Definition: texttoken.cpp:194
virtual UInt32 ClearAllCharacters()
Removes all the rendered characters from this string.
Definition: texttoken.cpp:564
UInt32 RenderSize
The number of rendered characters this token produced.
Definition: texttoken.h:76
UInt32 ConvertRenderIndexToRawIndex(const UInt32 Index)
Takes a position of a renderable char and converts it to the respective position in the raw string...
Definition: texttoken.cpp:79
virtual UInt32 InsertCharacters(const UInt32 Index, const Char8 *Characters, const UInt32 Size)
Definition: texttoken.cpp:351
virtual UInt32 InsertCharacter(const UInt32 Index, UInt32 UChar)
Inserts a single UTF-32 size character into this string.
Definition: texttoken.cpp:502
ReverseTokenIterator ReverseBeginToken()
Gets a reverse iterator to the last TextToken.
Definition: texttoken.cpp:469
const String & GetTagName() const
Gets the name of the tag this token represents.
Definition: texttoken.cpp:244
virtual ~RangeTagToken()
Class destructor.
Definition: texttoken.cpp:266
std::pair< TokenIterator, UInt32 > TokenIndexPair
An std::pair used to report the result of a TextToken and it's local index.
Definition: texttoken.h:296
virtual const String & GetRawCharacterString() const
Gets the raw string for this token used to render or manipulate characters.
Definition: texttoken.cpp:96
RangeTagToken()
Class constructor.
Definition: texttoken.cpp:257
This implements the exception hiearchy for Mezzanine.
virtual ~TokenString()
Class destructor.
Definition: texttoken.cpp:399
RangeTagToken * GetPartnerTag() const
Gets the partner tag to this RangeTag.
Definition: texttoken.cpp:269
virtual UInt32 RemoveCharacter(const UInt32 Index)
Removes a single rendered character from this token.
Definition: texttoken.cpp:173
virtual void PushToken(TextToken *ToBePushed)
Appends a new token to the end of this string.
Definition: texttoken.cpp:484
char Char8
A datatype to represent one character.
Definition: datatypes.h:169
Whole GetNumCharacters() const
Gets the number of renderable characters that exist in this string.
Definition: texttoken.cpp:442
TokenContainer::reverse_iterator ReverseTokenIterator
Reverse Iterator type for TextToken instances being stored by this class.
Definition: texttoken.h:292
InsertTagToken()
Class constructor.
Definition: texttoken.cpp:335
virtual UInt32 RemoveCharacters(const UInt32 Index, const UInt32 Length)
Removes rendered characters from this token.
Definition: texttoken.cpp:312
TextToken()
Class constructor.
Definition: texttoken.cpp:55
virtual UInt32 InsertCharacter(const UInt32 Index, UInt32 UChar)
Inserts a single UTF-32 size character into this token.
Definition: texttoken.cpp:272
virtual UInt32 InsertCharacters(const UInt32 Index, const Char8 *Characters, const UInt32 Size)
Inserts multiple characters into this token.
Definition: texttoken.cpp:113
virtual UInt32 RemoveCharacter(const UInt32 Index)
Removes a single rendered character from this token.
Definition: texttoken.cpp:363
uint32_t UInt32
An 32-bit unsigned integer.
Definition: datatypes.h:126
String GetParameter(const String &Param) const
Gets a parameter specified in this token by name.
Definition: texttoken.cpp:247
virtual void PushTokens(const TokenContainer &ToBePushed)
Appends a group of tokens to the end of this string.
Definition: texttoken.cpp:487
virtual UInt32 RemoveCharacter(const UInt32 Index)
Removes a single rendered character from this string.
Definition: texttoken.cpp:544
std::vector< TextToken * > TokenContainer
Basic container type for the storage of TextToken instances by this class.
Definition: texttoken.h:286
virtual TextToken::TokenType GetTokenType() const
Gets the type of token this is.
Definition: texttoken.cpp:99
virtual UInt32 GetRenderCharacterSize() const
Gets the number of rendered characters this token generates.
Definition: texttoken.cpp:105
virtual UInt32 ClearAllCharacters()
Removes all the rendered characters from this token.
Definition: texttoken.cpp:222
TokenType
The type of token this class represents.
Definition: texttoken.h:60
TokenIterator EndToken()
Gets an iterator to one passed the last TextToken.
Definition: texttoken.cpp:460
TokenIterator BeginToken()
Gets an iterator to the first TextToken.
Definition: texttoken.cpp:457
Int32 GetIntFromCharacter(Int32 &BytesUsed, const char *CurrentCharacter)
Get a number suitable for using in an index from a character string.
Definition: unicode.cpp:86
This struct represents a markup tag segment from the source string.
Definition: texttoken.h:200
This struct represents a markup tag segment from the source string.
Definition: texttoken.h:163
virtual ~TagToken()
Class destructor.
Definition: texttoken.cpp:241
virtual ~InsertTagToken()
Class destructor.
Definition: texttoken.cpp:342
RangeTagToken * PartnerTag
Pointer to the opening/closing tag for this tag.
Definition: texttoken.h:205
virtual UInt32 GetRawCharacterSize() const
Gets the number of Char8's that comprise the source text for this tag.
Definition: texttoken.cpp:102
The bulk of the engine components go in this namspace.
Definition: actor.cpp:56
TokenContainer::iterator TokenIterator
Iterator type for TextToken instances being stored by this class.
Definition: texttoken.h:288
virtual UInt32 InsertCharacters(const UInt32 Index, const Char8 *Characters, const UInt32 Size)
Inserts multiple characters into this token.
Definition: texttoken.cpp:282
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Definition: datatypes.h:151
ReverseTokenIterator ReverseEndToken()
Gets a reverse iterator to one before the first TextToken.
Definition: texttoken.cpp:472
TokenContainer::const_iterator ConstTokenIterator
Const Iterator type for TextToken instances being stored by this class.
Definition: texttoken.h:290
virtual UInt32 InsertCharacters(const UInt32 Index, const Char8 *Characters, const UInt32 Size)
Inserts multiple characters into this string.
Definition: texttoken.cpp:516
virtual UInt32 InsertCharacter(const UInt32 Index, UInt32 UChar)
Inserts a single UTF-32 size character into this token.
Definition: texttoken.cpp:108
Used to describe a normal text token with plain text.
Definition: texttoken.h:63
virtual UInt32 InsertCharacter(const UInt32 Index, UInt32 UChar)
Inserts a single UTF-32 size character into this token.
Definition: texttoken.cpp:345
virtual UInt32 ClearAllCharacters()
Removes all the rendered characters from this token.
Definition: texttoken.cpp:322
virtual void DestroyAllTokens()
Destroys all tokens currently in this string.
Definition: texttoken.cpp:490
TokenType Type
Type of token this is.
Definition: texttoken.h:73
TagToken()
Class constructor.
Definition: texttoken.cpp:233
Whole GetNumTokens() const
Gets the number of text tokens in this string.
Definition: texttoken.cpp:452
String Text
Container for the converted text.
Definition: texttoken.h:79
virtual UInt32 RemoveCharacters(const UInt32 Index, const UInt32 Length)
Removes rendered characters from this token.
Definition: texttoken.cpp:373
std::string String
A datatype used to a series of characters.
Definition: datatypes.h:159
virtual String GetRawString() const
Gets a string containing all the raw characters of the tokens in this string.
Definition: texttoken.cpp:432
Int32 GetCharacterFromInt(char *Destination, Int32 BytesUsable, Int32 ByteSequence)
Convert a number that represents any valid unicode value into its UTF8 representation.
Definition: unicode.cpp:116
TokenContainer::const_reverse_iterator ConstReverseTokenIterator
Const Reverse Iterator type for TextToken instances being stored by this class.
Definition: texttoken.h:294