diff options
author | Neil <nyamatongwe@gmail.com> | 2017-04-29 11:52:49 +1000 |
---|---|---|
committer | Neil <nyamatongwe@gmail.com> | 2017-04-29 11:52:49 +1000 |
commit | 102a874a3a8ca376e08d1319b36833297bea39ae (patch) | |
tree | 1ca446e24494a212cce099f3f6b479109025c94f /src/CellBuffer.h | |
parent | 1cc39b2c7bc22ae8aaddefd382c621474732b8c1 (diff) | |
download | scintilla-mirror-102a874a3a8ca376e08d1319b36833297bea39ae.tar.gz |
Use std::unique_ptr, std::vector, and move construction to simplify UndoHistory
and make it easier to modify.
Remove out of date warning suppression.
Diffstat (limited to 'src/CellBuffer.h')
-rw-r--r-- | src/CellBuffer.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/CellBuffer.h b/src/CellBuffer.h index 8667b8bfa..8e670aca5 100644 --- a/src/CellBuffer.h +++ b/src/CellBuffer.h @@ -61,26 +61,28 @@ class Action { public: actionType at; Sci::Position position; - char *data; + std::unique_ptr<char[]> data; Sci::Position lenData; bool mayCoalesce; Action(); // Deleted so Action objects can not be copied. - Action(const Action &) = delete; - void operator=(const Action &) = delete; + Action(const Action &other) = delete; + Action &operator=(const Action &other) = delete; + Action &operator=(const Action &&other) = delete; + // Move constructor allows vector to be resized without reallocating. + // Could use =default but MSVC 2013 warns. + Action(Action &&other); ~Action(); void Create(actionType at_, Sci::Position position_=0, const char *data_=0, Sci::Position lenData_=0, bool mayCoalesce_=true); - void Destroy(); - void Grab(Action *source); + void Clear(); }; /** * */ class UndoHistory { - Action *actions; - int lenActions; + std::vector<Action> actions; int maxAction; int currentAction; int undoSequenceDepth; |