VPTissue Reference Manual
UndoStack.h
Go to the documentation of this file.
1 #ifndef SIMPT_EDITOR_UNDO_STACK_H_INCLUDED
2 #define SIMPT_EDITOR_UNDO_STACK_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include "EditControlLogic.h"
23 
24 #include <boost/property_tree/ptree.hpp>
25 
26 namespace SimPT_Editor {
27 
31 class UndoStack
32 {
33 public:
37  UndoStack();
38 
42  virtual ~UndoStack();
43 
49  void Initialize(const boost::property_tree::ptree& tissue);
50 
56  void Push(const boost::property_tree::ptree& tissue);
57 
61  bool CanUndo() const;
62 
66  bool CanRedo() const;
67 
73  const boost::property_tree::ptree& Undo();
74 
80  const boost::property_tree::ptree& Redo();
81 
82 private:
83  std::list<boost::property_tree::ptree> m_stack;
84  std::list<boost::property_tree::ptree>::iterator m_current;
85 
86 private:
87  const unsigned int m_max_tissues = 25;
88 };
89 
90 } // namespace
91 
92 #endif // end_of_include_guard
const boost::property_tree::ptree & Redo()
Redo an action.
Definition: UndoStack.cpp:67
Namespace for SimPT tissue editor package.
Definition: Cell.h:32
void Push(const boost::property_tree::ptree &tissue)
Push a tissue to the stack.
Definition: UndoStack.cpp:35
void Initialize(const boost::property_tree::ptree &tissue)
Initialize the undo stack with a given tissue.
Definition: UndoStack.cpp:28
const boost::property_tree::ptree & Undo()
Undo an action.
Definition: UndoStack.cpp:58
Undo Stack for actions performed on a tissue.
Definition: UndoStack.h:31
virtual ~UndoStack()
Destructor.
Definition: UndoStack.cpp:26
bool CanUndo() const
True if the current action can be undone.
Definition: UndoStack.cpp:48
UndoStack()
Constructor.
Definition: UndoStack.cpp:24
bool CanRedo() const
True if the current action can be redone.
Definition: UndoStack.cpp:53
Interface for LeafControlLogic.