MyGUI: MyGUI_TextChangeHistory.h Source File

MyGUI 3.4.2

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_TextChangeHistory.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_CHANGE_HISTORY_H_
8#define MYGUI_TEXT_CHANGE_HISTORY_H_
9
10#include "MyGUI_Prerequest.h"
11#include "MyGUI_Macros.h"
12#include "MyGUI_UString.h"
13#include <deque>
14
15namespace MyGUI
16{
17
18 // information about single text change operation
19 struct TextCommandInfo
20 {
21 enum CommandType
22 {
23 COMMAND_POSITION,
24 COMMAND_INSERT,
25 COMMAND_ERASE
26 };
27
28 // for COMMAND_INSERT and COMMAND_ERASE
29 TextCommandInfo(const UString::utf32string& _text, size_t _start, CommandType _type) :
30 text(_text),
31 type(_type),
32 start(_start),
33 undo(ITEM_NONE),
34 redo(ITEM_NONE),
35 length(ITEM_NONE)
36 {
37 }
38
39 // for COMMAND_POSITION
40 TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
41 type(COMMAND_POSITION),
42 start(ITEM_NONE),
43 undo(_undo),
44 redo(_redo),
45 length(_length)
46 {
47 }
48
49 // inserted/erased string
50 UString::utf32string text;
51 CommandType type;
52 // text start position
53 size_t start;
54 // pseudo position
55 size_t undo, redo, length;
56 };
57
58 using VectorChangeInfo = std::vector<TextCommandInfo>;
59 using DequeUndoRedoInfo = std::deque<VectorChangeInfo>;
60
61} // namespace MyGUI
62
63#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:178
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition MyGUI_TextChangeHistory.h:58
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition MyGUI_TextChangeHistory.h:59
MyGUI::ITEM_NONE
const size_t ITEM_NONE
Definition MyGUI_Macros.h:18
MyGUI::TextCommandInfo
Definition MyGUI_TextChangeHistory.h:20
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