information about single text change operation
| 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>; |
no outgoing calls
no test coverage detected