MyGUI 3.2.0

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

- File List
- Globals

MyGUI_TextChangeHistory.h
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_TEXT_CHANGE_HISTORY_H__
23 #define __MYGUI_TEXT_CHANGE_HISTORY_H__
24
25 #include "MyGUI_Prerequest.h"
26 #include "MyGUI_Macros.h"
27 #include "MyGUI_UString.h"
28 #include <deque>
29
30 namespace MyGUI
31 {
32
33 // инфо об одной операции
34 struct TextCommandInfo
35 {
36 // типы операций
37 enum CommandType
38 {
39 COMMAND_POSITION,
40 COMMAND_INSERT,
41 COMMAND_ERASE
42 };
43
44 // для удаления и вставки текста
45 TextCommandInfo(const UString& _text, size_t _start, CommandType _type) :
46 text(_text),
47 type(_type),
48 start(_start),
49 undo(ITEM_NONE),
50 redo(ITEM_NONE),
51 length(ITEM_NONE)
52 {
53 }
54
55 // для указания позиции
56 TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
57 type(COMMAND_POSITION),
58 start(ITEM_NONE),
59 undo(_undo),
60 redo(_redo),
61 length(_length)
62 {
63 }
64
65 // строка харрактиризуещая изменения
66 UString text;
67 // тип операции
68 CommandType type;
69 // инфа о начале позиции
70 size_t start;
71 // инфа о псевдо позиции
72 size_t undo, redo, length;
73 };
74
75 typedef std::vector<TextCommandInfo> VectorChangeInfo;
76 typedef std::deque<VectorChangeInfo> DequeUndoRedoInfo;
77
78 } // namespace MyGUI
79
80 #endif // __MYGUI_TEXT_CHANGE_HISTORY_H__
MyGUI_UString.h
MyGUI_Prerequest.h
MyGUI::VectorChangeInfo
std::vector< TextCommandInfo > VectorChangeInfo
Definition: MyGUI_TextChangeHistory.h:75
MyGUI::TextCommandInfo::CommandType
CommandType
Definition: MyGUI_TextChangeHistory.h:37
MyGUI::TextCommandInfo::type
CommandType type
Definition: MyGUI_TextChangeHistory.h:68
MyGUI::TextCommandInfo::text
UString text
Definition: MyGUI_TextChangeHistory.h:66
MyGUI_Macros.h
MyGUI::ITEM_NONE
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:32
MyGUI::TextCommandInfo::length
size_t length
Definition: MyGUI_TextChangeHistory.h:72
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(size_t _undo, size_t _redo, size_t _length)
Definition: MyGUI_TextChangeHistory.h:56
MyGUI::TextCommandInfo::start
size_t start
Definition: MyGUI_TextChangeHistory.h:70
MyGUI::TextCommandInfo::undo
size_t undo
Definition: MyGUI_TextChangeHistory.h:72
MyGUI::TextCommandInfo
Definition: MyGUI_TextChangeHistory.h:34
MyGUI::TextCommandInfo::COMMAND_POSITION
Definition: MyGUI_TextChangeHistory.h:39
MyGUI::DequeUndoRedoInfo
std::deque< VectorChangeInfo > DequeUndoRedoInfo
Definition: MyGUI_TextChangeHistory.h:76
MyGUI::TextCommandInfo::redo
size_t redo
Definition: MyGUI_TextChangeHistory.h:72
MyGUI::TextCommandInfo::TextCommandInfo
TextCommandInfo(const UString &_text, size_t _start, CommandType _type)
Definition: MyGUI_TextChangeHistory.h:45
MyGUI::TextCommandInfo::COMMAND_ERASE
Definition: MyGUI_TextChangeHistory.h:41
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:169
MyGUI::TextCommandInfo::COMMAND_INSERT
Definition: MyGUI_TextChangeHistory.h:40