PumpkinBrush
Command.hpp
Go to the documentation of this file.
1 
7 #ifndef COMMAND_HPP
8 #define COMMAND_HPP
9 
10 // Include our Third-Party SFML header
11 // #include ...
12 // Include standard library C++ libraries.
13 #include <string>
14 // Project header files
15 // #include ...
16 
17 // The command class
18 class Command{
19 private:
20  std::string m_commandDescription;
21 
22 public:
23  int m_cmdFlag;
24  // Constructor of a command
25  Command(int cmdFlag, std::string m_commandDescriptionP): m_cmdFlag(cmdFlag), m_commandDescription(m_commandDescriptionP){};
26  // Destructor for a command
27  virtual ~Command();
28 
29  // Returns true or false if the command was able to succssfully
30  // execute.
31  // If it executes successfully, then that command is added to the
32  // undo stack.
33  // Each parameters also takes in a string name. While this may not be optimal,
34  // it allows us to easily debug what each command is doing in a textual form.
35  virtual bool execute() = 0;
36  virtual bool undo() = 0;
37  std::string getCommand();
38 };
39 
40 
41 
42 #endif
Command::Command
Command(int cmdFlag, std::string m_commandDescriptionP)
Definition: Command.hpp:25
Command::~Command
virtual ~Command()
N/A.
Definition: Command.cpp:18
Command
Definition: Command.hpp:18
Command::execute
virtual bool execute()=0
Command::undo
virtual bool undo()=0
Command::getCommand
std::string getCommand()
Definition: Command.cpp:22
Command::m_cmdFlag
int m_cmdFlag
Definition: Command.hpp:23