command.h
Go to the documentation of this file.
1 #ifndef COMMAND_H
2 #define COMMAND_H
3 #include <QInputEvent>
4 
6 
7 namespace dnai
8 {
9  namespace commands
10  {
11  class Command : public QEvent, public interfaces::ICommand
12  {
13  static const QEvent::Type CommandEvent;
14  public:
15  explicit Command(const QString &name, bool save = false);
16 
17  //Implementation of ICommand
18  public:
19  virtual void execute() const override;
20  virtual void executeSave() override;
21  virtual void unExcute() const override;
22  virtual QString infos() const override;
23  virtual bool isSave() const override;
24 
29  const QString& name() const;
30 
31  protected:
32  const QString m_name;
33  const bool m_save;
34  };
35  }
36 }
37 
38 #endif // COMMAND_H
virtual void execute() const override
Execute the command.
Definition: command.cpp:15
virtual bool isSave() const override
Is the command is in a save state.
Definition: command.cpp:29
static const QEvent::Type CommandEvent
Definition: command.h:13
Command(const QString &name, bool save=false)
Definition: command.cpp:8
Definition: command.h:11
const bool m_save
Definition: command.h:33
Definition: api.h:13
virtual QString infos() const override
Get display info for this command.
Definition: command.cpp:39
virtual void executeSave() override
Save current state of the command for the reverse unExcute()
Definition: command.cpp:25
virtual void unExcute() const override
Reverse the execute() function.
Definition: command.cpp:20
const QString m_name
Definition: command.h:32
Definition: icommand.h:15
const QString & name() const
Get the command name.
Definition: command.cpp:34