MyGUI  3.2.1
MyGUI_TextChangeHistory.h
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #ifndef __MYGUI_TEXT_CHANGE_HISTORY_H__
00008 #define __MYGUI_TEXT_CHANGE_HISTORY_H__
00009 
00010 #include "MyGUI_Prerequest.h"
00011 #include "MyGUI_Macros.h"
00012 #include "MyGUI_UString.h"
00013 #include <deque>
00014 
00015 namespace MyGUI
00016 {
00017 
00018     // инфо об одной операции
00019     struct TextCommandInfo
00020     {
00021         // типы операций
00022         enum CommandType
00023         {
00024             COMMAND_POSITION,
00025             COMMAND_INSERT,
00026             COMMAND_ERASE
00027         };
00028 
00029         // для удаления и вставки текста
00030         TextCommandInfo(const UString& _text, size_t _start, CommandType _type) :
00031             text(_text),
00032             type(_type),
00033             start(_start),
00034             undo(ITEM_NONE),
00035             redo(ITEM_NONE),
00036             length(ITEM_NONE)
00037         {
00038         }
00039 
00040         // для указания позиции
00041         TextCommandInfo(size_t _undo, size_t _redo, size_t _length) :
00042             type(COMMAND_POSITION),
00043             start(ITEM_NONE),
00044             undo(_undo),
00045             redo(_redo),
00046             length(_length)
00047         {
00048         }
00049 
00050         // строка харрактиризуещая изменения
00051         UString text;
00052         // тип операции
00053         CommandType type;
00054         // инфа о начале позиции
00055         size_t start;
00056         // инфа о псевдо позиции
00057         size_t undo, redo, length;
00058     };
00059 
00060     typedef std::vector<TextCommandInfo> VectorChangeInfo;
00061     typedef std::deque<VectorChangeInfo> DequeUndoRedoInfo;
00062 
00063 } // namespace MyGUI
00064 
00065 #endif // __MYGUI_TEXT_CHANGE_HISTORY_H__