You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
454B

  1. #pragma once
  2. #include <memory>
  3. #include <list>
  4. class SqCommand;
  5. class UndoRedoStack
  6. {
  7. public:
  8. bool canUndo() const;
  9. bool canRedo() const;
  10. // execute the command, make undo record
  11. void execute(std::shared_ptr<SqCommand>);
  12. void undo();
  13. void redo();
  14. private:
  15. std::list<std::shared_ptr<SqCommand>> undoList;
  16. std::list<std::shared_ptr<SqCommand>> redoList;
  17. };
  18. using UndoRedoStackPtr = std::shared_ptr<UndoRedoStack>;