00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __MYGUI_TEXT_ITERATOR_H__
00024 #define __MYGUI_TEXT_ITERATOR_H__
00025
00026 #include "MyGUI_Prerequest.h"
00027 #include "MyGUI_Colour.h"
00028 #include "MyGUI_TextChangeHistory.h"
00029 #include "MyGUI_IFont.h"
00030
00031 namespace MyGUI
00032 {
00033
00034 class MYGUI_EXPORT TextIterator
00035 {
00036 private:
00037 TextIterator();
00038
00039 public:
00040 TextIterator(const UString& _text, VectorChangeInfo * _history = nullptr);
00041
00042 bool moveNext();
00043
00044
00045 UString getTagColour(bool _clear = false);
00046
00047
00048 bool getTagColour(UString& _colour);
00049
00050
00051 void clearTagColour() { getTagColour(true); }
00052
00053 bool setTagColour(const Colour& _colour);
00054
00055 bool setTagColour(UString _colour);
00056
00057
00058 bool saveStartPoint();
00059
00060
00061 UString getFromStart();
00062
00063
00064 bool eraseFromStart();
00065
00066
00067 size_t getPosition() const { return mPosition; }
00068
00069 const UString& getText() const { return mText; }
00070
00071 void insertText(const UString& _insert, bool _multiLine);
00072
00073 void clearNewLine(UString& _text);
00074
00075
00076 void clearText() { clear(); }
00077
00078
00079 size_t getSize() const;
00080
00081 void setText(const UString& _text, bool _multiLine);
00082
00083 void cutMaxLength(size_t _max);
00084
00085 void cutMaxLengthFromBeginning(size_t _max);
00086
00087
00088 static UString getOnlyText(const UString& _text);
00089
00090 static UString getTextNewLine() { return L"\n"; }
00091
00092 static UString getTextCharInfo(Char _char);
00093
00094
00095 static UString convertTagColour(const Colour& _colour);
00096
00097 static UString toTagsString(const UString& _text);
00098
00099 private:
00100
00101
00102 bool getTagColour(UString& _colour, UString::iterator& _iter);
00103
00104 void insert(UString::iterator& _start, UString& _insert);
00105
00106 UString::iterator erase(UString::iterator _start, UString::iterator _end);
00107
00108 void clear();
00109
00110 private:
00111 UString mText;
00112 UString::iterator mCurrent, mEnd, mSave;
00113
00114
00115 size_t mPosition;
00116 mutable size_t mSize;
00117 bool mFirst;
00118
00119 VectorChangeInfo * mHistory;
00120
00121 };
00122
00123 }
00124
00125 #endif // __MYGUI_TEXT_ITERATOR_H__