MyGUI_TextIterator.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_TEXT_ITERATOR_H_
#define MYGUI_TEXT_ITERATOR_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Colour.h"
#include "MyGUI_TextChangeHistory.h"
#include "MyGUI_IFont.h"
namespace MyGUI
{
class MYGUI_EXPORT TextIterator
{
private:
TextIterator();
public:
TextIterator(const UString& _text, VectorChangeInfo* _history = nullptr);
bool moveNext();
// возвращает цвет
bool getTagColour(UString& _colour) const;
// удаляет цвет
void clearTagColour();
bool setTagColour(const Colour& _colour);
bool setTagColour(const UString& _colour);
// сохраняет текущий итератор
bool saveStartPoint();
// возвращает строку от сохраненного итератора до текущего
UString getFromStart() const;
// удаляет от запомненной точки до текущей
bool eraseFromStart();
// возвращает текущую псевдо позицию
size_t getPosition() const;
UString getText() const;
void insertText(const UString& _insert, bool _multiLine);
void clearNewLine(UString& _text);
//очищает весь текст
void clearText();
// возвращает размер строки
size_t getSize() const;
void setText(const UString& _text, bool _multiLine);
void cutMaxLength(size_t _max);
void cutMaxLengthFromBeginning(size_t _max);
// возвращает текст без тегов
static UString getOnlyText(const UString& _text);
static UString getTextNewLine();
static UString getTextCharInfo(Char _char);
// просто конвертируем цвет в строку
static UString convertTagColour(const Colour& _colour);
static UString toTagsString(const UString& _text);
private:
bool getTagColour(UString& _colour, UString::utf32string::iterator& _iter) const;
bool setTagColour(const UString::utf32string& _colour);
void insert(UString::utf32string::iterator& _start, const UString::utf32string& _insert);
UString::utf32string::iterator erase(
UString::utf32string::iterator _start,
UString::utf32string::iterator _end);
void clear();
void normaliseNewLine(UString& _text);
private:
UString::utf32string mText;
UString::utf32string::iterator mCurrent, mEnd, mSave;
// позиция и размер
size_t mPosition;
mutable size_t mSize;
bool mFirst;
VectorChangeInfo* mHistory;
};
} // namespace MyGUI
#endif // MYGUI_TEXT_ITERATOR_H_
MyGUI_Colour.h
MyGUI_IFont.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MyGUI_TextChangeHistory.h
MyGUI::TextIterator::eraseFromStart
bool eraseFromStart()
Definition MyGUI_TextIterator.cpp:317
MyGUI::TextIterator::getOnlyText
static UString getOnlyText(const UString &_text)
Definition MyGUI_TextIterator.cpp:219
MyGUI::TextIterator::clearTagColour
void clearTagColour()
Definition MyGUI_TextIterator.cpp:572
MyGUI::TextIterator::clearNewLine
void clearNewLine(UString &_text)
Definition MyGUI_TextIterator.cpp:289
MyGUI::TextIterator::getText
UString getText() const
Definition MyGUI_TextIterator.cpp:593
MyGUI::TextIterator::getTextNewLine
static UString getTextNewLine()
Definition MyGUI_TextIterator.cpp:603
MyGUI::TextIterator::getTextCharInfo
static UString getTextCharInfo(Char _char)
Definition MyGUI_TextIterator.cpp:355
MyGUI::TextIterator::cutMaxLength
void cutMaxLength(size_t _max)
Definition MyGUI_TextIterator.cpp:450
MyGUI::TextIterator::setTagColour
bool setTagColour(const Colour &_colour)
Definition MyGUI_TextIterator.cpp:123
MyGUI::TextIterator::moveNext
bool moveNext()
Definition MyGUI_TextIterator.cpp:33
MyGUI::TextIterator::getFromStart
UString getFromStart() const
Definition MyGUI_TextIterator.cpp:309
MyGUI::TextIterator::convertTagColour
static UString convertTagColour(const Colour &_colour)
Definition MyGUI_TextIterator.cpp:364
MyGUI::TextIterator::clearText
void clearText()
Definition MyGUI_TextIterator.cpp:598
MyGUI::TextIterator::saveStartPoint
bool saveStartPoint()
Definition MyGUI_TextIterator.cpp:301
MyGUI::TextIterator::toTagsString
static UString toTagsString(const UString &_text)
Definition MyGUI_TextIterator.cpp:388
MyGUI::TextIterator::cutMaxLengthFromBeginning
void cutMaxLengthFromBeginning(size_t _max)
Definition MyGUI_TextIterator.cpp:505
MyGUI::TextIterator::setText
void setText(const UString &_text, bool _multiLine)
Definition MyGUI_TextIterator.cpp:338
MyGUI::TextIterator::getPosition
size_t getPosition() const
Definition MyGUI_TextIterator.cpp:588
MyGUI::TextIterator::getSize
size_t getSize() const
Definition MyGUI_TextIterator.cpp:179
MyGUI::TextIterator::insertText
void insertText(const UString &_insert, bool _multiLine)
Definition MyGUI_TextIterator.cpp:326
MyGUI::TextIterator::getTagColour
bool getTagColour(UString &_colour) const
Definition MyGUI_TextIterator.cpp:106
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::UString::utf32string
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
Definition MyGUI_UString.h:177
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition MyGUI_TextChangeHistory.h:58
MyGUI::Char
unsigned int Char
Definition MyGUI_Types.h:50
MyGUI::Colour
Definition MyGUI_Colour.h:17