MyGUI  3.4.1
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  // information about single text change operation
20  {
22  {
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),
36  {
37  }
38 
39  // for COMMAND_POSITION
40  TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
43  undo(_undo),
44  redo(_redo),
45  length(_length)
46  {
47  }
48 
49  // inserted/erased string
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_
std::basic_string< unicode_char > utf32string
string type used for returning UTF-32 formatted data
const size_t ITEM_NONE
Definition: MyGUI_Macros.h:17
std::deque< VectorChangeInfo > DequeUndoRedoInfo
std::vector< TextCommandInfo > VectorChangeInfo
TextCommandInfo(const UString::utf32string &_text, size_t _start, CommandType _type)
TextCommandInfo(size_t _undo, size_t _redo, size_t _length)