Pakman
Command.h
1 #ifndef COMMAND_H
2 #define COMMAND_H
3 
4 #include <string>
5 #include <vector>
6 
16 class Command
17 {
18  public:
19 
21  Command();
22 
27  Command(const std::string& raw_command);
28 
33  Command(const char raw_command[]);
34 
39  Command(const Command& command);
40 
45  Command(Command&& command);
46 
53  Command& operator=(const Command& command);
54 
61  Command& operator=(Command&& command);
62 
64  ~Command();
65 
67  const std::string& str() const;
68 
74  char** argv() const;
75 
77  bool isExecutable() const;
78 
79  private:
80 
81  // Copy command tokens to argv
82  void copyCommandTokensToArgv();
83 
84  // Free argv
85  void freeArgv();
86 
87  // Save raw command as string
88  std::string m_raw_command;
89 
90  // Save command tokens
91  std::vector<std::string> m_cmd_tokens;
92 
93  // Save parsed command as argv
94  char **m_argv;
95 };
96 
97 #endif // COMMAND_H
~Command()
Definition: Command.cc:103
bool isExecutable() const
Definition: Command.cc:153
const std::string & str() const
Definition: Command.cc:111
Command & operator=(const Command &command)
Definition: Command.cc:59
Command()
Definition: Command.cc:13
char ** argv() const
Definition: Command.cc:117