MyGUI 3.2.2

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
15 namespace MyGUI
16 {
17
18 // инфо об одной операции
19 struct TextCommandInfo
20 {
21 // типы операций
22 enum CommandType
23 {
24 COMMAND_POSITION,
25 COMMAND_INSERT,
26 COMMAND_ERASE
27 };
28
29 // для удаления и вставки текста
30 TextCommandInfo(const UString& _text, size_t _start, CommandType _type) :
31 text(_text),
32 type(_type),
33 start(_start),
34 undo(ITEM_NONE),
35 redo(ITEM_NONE),
36 length(ITEM_NONE)
37 {
38 }
39
40 // для указания позиции
41 TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
42 type(COMMAND_POSITION),
43 start(ITEM_NONE),
44 undo(_undo),
45 redo(_redo),
46 length(_length)
47 {
48 }
49
50 // строка харрактиризуещая изменения
51 UString text;
52 // тип операции
53 CommandType type;
54 // инфа о начале позиции
55 size_t start;
56 // инфа о псевдо позиции
57 size_t undo, redo, length;
58 };
59
60 typedef std::vector<TextCommandInfo> VectorChangeInfo;
61 typedef std::deque<VectorChangeInfo> DequeUndoRedoInfo;
62
63 } // namespace MyGUI
64
65 #endif // MYGUI_TEXT_CHANGE_HISTORY_H_
MyGUI_UString.h
MyGUI_Prerequest.h
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition: MyGUI_TextChangeHistory.h:60
MyGUI::TextCommandInfo::CommandType
CommandType
Definition: MyGUI_TextChangeHistory.h:22
MyGUI::TextCommandInfo::type
CommandType type
Definition: MyGUI_TextChangeHistory.h:53
MyGUI::TextCommandInfo::text
UString text
Definition: MyGUI_TextChangeHistory.h:51
MyGUI_Macros.h
MyGUI::ITEM_NONE
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:17
MyGUI::TextCommandInfo::length
size_t length
Definition: MyGUI_TextChangeHistory.h:57
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(size_t _undo, size_t _redo, size_t _length)
Definition: MyGUI_TextChangeHistory.h:41
MyGUI::TextCommandInfo::start
size_t start
Definition: MyGUI_TextChangeHistory.h:55
MyGUI::TextCommandInfo::undo
size_t undo
Definition: MyGUI_TextChangeHistory.h:57
MyGUI::TextCommandInfo
Definition: MyGUI_TextChangeHistory.h:19
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::TextCommandInfo::COMMAND_POSITION
Definition: MyGUI_TextChangeHistory.h:24
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition: MyGUI_TextChangeHistory.h:61
MyGUI::TextCommandInfo::redo
size_t redo
Definition: MyGUI_TextChangeHistory.h:57
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(const UString &_text, size_t _start, CommandType _type)
Definition: MyGUI_TextChangeHistory.h:30
MyGUI::TextCommandInfo::COMMAND_ERASE
Definition: MyGUI_TextChangeHistory.h:26
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::TextCommandInfo::COMMAND_INSERT
Definition: MyGUI_TextChangeHistory.h:25