MyGUI_TextChangeHistory.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_CHANGE_HISTORY_H_
#define MYGUI_TEXT_CHANGE_HISTORY_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Macros.h"
#include "MyGUI_UString.h"
#include <deque>
namespace MyGUI
{
// information about single text change operation
struct TextCommandInfo
{
enum CommandType
{
COMMAND_POSITION,
COMMAND_INSERT,
COMMAND_ERASE
};
// for COMMAND_INSERT and COMMAND_ERASE
TextCommandInfo(const UString::utf32string& _text, size_t _start, CommandType _type) :
text(_text),
type(_type),
start(_start),
undo(ITEM_NONE),
redo(ITEM_NONE),
length(ITEM_NONE)
{
}
// for COMMAND_POSITION
TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
type(COMMAND_POSITION),
start(ITEM_NONE),
undo(_undo),
redo(_redo),
length(_length)
{
}
// inserted/erased string
UString::utf32string text;
CommandType type;
// text start position
size_t start;
// pseudo position
size_t undo, redo, length;
};
using VectorChangeInfo = std::vector<TextCommandInfo>;
using DequeUndoRedoInfo = std::deque<VectorChangeInfo>;
} // namespace MyGUI
#endif // MYGUI_TEXT_CHANGE_HISTORY_H_
MyGUI_Macros.h
MyGUI_Prerequest.h
MyGUI_UString.h
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::ITEM_NONE
constexpr size_t ITEM_NONE
Definition MyGUI_Macros.h:19
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition MyGUI_TextChangeHistory.h:59
MyGUI::TextCommandInfo::text
UString::utf32string text
Definition MyGUI_TextChangeHistory.h:50
MyGUI::TextCommandInfo::redo
size_t redo
Definition MyGUI_TextChangeHistory.h:55
MyGUI::TextCommandInfo::CommandType
CommandType
Definition MyGUI_TextChangeHistory.h:22
MyGUI::TextCommandInfo::COMMAND_POSITION
@ COMMAND_POSITION
Definition MyGUI_TextChangeHistory.h:23
MyGUI::TextCommandInfo::COMMAND_INSERT
@ COMMAND_INSERT
Definition MyGUI_TextChangeHistory.h:24
MyGUI::TextCommandInfo::COMMAND_ERASE
@ COMMAND_ERASE
Definition MyGUI_TextChangeHistory.h:25
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(const UString::utf32string &_text, size_t _start, CommandType _type)
Definition MyGUI_TextChangeHistory.h:29
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(size_t _undo, size_t _redo, size_t _length)
Definition MyGUI_TextChangeHistory.h:40
MyGUI::TextCommandInfo::start
size_t start
Definition MyGUI_TextChangeHistory.h:53
MyGUI::TextCommandInfo::type
CommandType type
Definition MyGUI_TextChangeHistory.h:51
MyGUI::TextCommandInfo::undo
size_t undo
Definition MyGUI_TextChangeHistory.h:55
MyGUI::TextCommandInfo::length
size_t length
Definition MyGUI_TextChangeHistory.h:55