MyGUI 3.5.3
MyGUI_TextIterator.h
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#ifndef MYGUI_TEXT_ITERATOR_H_
8#define MYGUI_TEXT_ITERATOR_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Colour.h"
13#include "MyGUI_IFont.h"
14
15namespace MyGUI
16{
17
18 class MYGUI_EXPORT TextIterator
19 {
20 private:
21 TextIterator();
22
23 public:
24 TextIterator(const UString& _text, VectorChangeInfo* _history = nullptr);
25
26 bool moveNext();
27
28 bool getTagColour(UString& _colour) const;
29
30 void clearTagColour();
31
32 bool setTagColour(const Colour& _colour);
33
34 bool setTagColour(const UString& _colour);
35
36 bool saveStartPoint();
37
38 UString getFromStart() const;
39
40 // Delete from saved position to current
41 bool eraseFromStart();
42
43 size_t getPosition() const;
44
45 const UString& getText() const;
46
47 void insertText(const UString& _insert, bool _multiLine);
48
49 void clearNewLine(UString& _text);
50
51 void clearText();
52
53 size_t getSize() const;
54
55 void setText(const UString& _text, bool _multiLine);
56
57 void cutMaxLength(size_t _max);
58
59 void cutMaxLengthFromBeginning(size_t _max);
60
61 static UString getOnlyText(const UString& _text);
62
63 static UString getTextNewLine();
64
65 static UString getTextCharInfo(Char _char);
66
67 static UString convertTagColour(const Colour& _colour);
68
69 static UString toTagsString(const UString& _text);
70
71 private:
72 bool skipColourTag(UString::iterator& _iter) const;
73
74 void insert(UString::iterator& _start, const UString& _insert);
75
76 UString::iterator erase(UString::iterator _start, UString::iterator _end);
77
78 void clear();
79
80 void normaliseNewLine(UString& _text);
81
82 private:
83 UString mText;
84 UString::iterator mCurrent, mEnd, mSave;
85
86 size_t mPosition;
87 mutable size_t mSize;
88 bool mFirst;
89
90 VectorChangeInfo* mHistory;
91 };
92
93} // namespace MyGUI
94
95#endif // MYGUI_TEXT_ITERATOR_H_
#define MYGUI_EXPORT
std::vector< TextCommandInfo > VectorChangeInfo