8 #ifndef SRC_USERCOMMAND_H_ 9 #define SRC_USERCOMMAND_H_ 15 #include "tools/Token.h" 39 UserCommand (
const std::string &inputCommand, std::istream &in,
51 UserCommand (
const Token &inputCommand, std::istream &in, std::ostream &out);
117 bool hasOption (
const std::string &opt)
const;
169 std::istream &m_stdin;
170 std::ostream &m_stdout;
171 std::vector<std::string> m_commandParts;
bool hasOption(char opt) const
Returns whether the given single-letter option was specified by the user.
Definition: UserCommand.cpp:79
std::istream & getStdin() const
Gets a reference to the input stream to be used as stdin for this command invocation.
Definition: UserCommand.cpp:145
std::vector< std::string > getOptions() const
Returns all of the options/flags that the user specified (arguments with a leading - or --)...
Definition: UserCommand.cpp:57
const std::vector< std::string > & getWholeCommand() const
Returns the entire command (including the command name), parsed into arguments as a vector...
Definition: UserCommand.cpp:39
UserCommand(const std::string &inputCommand, std::istream &in, std::ostream &out)
Constructs a new UserCommand object with the given command, input, and output.
std::ostream & getStdout() const
Gets a reference to the output stream to be used as stdout for this command invocation.
Definition: UserCommand.cpp:150
Used to retain command arguments and the proper input and output streams for a command call...
Definition: UserCommand.h:28
Represents a single unit of a command language.
Definition: Token.h:23
std::string getContextualArgument(char opt) const
Finds the argument following the specified single-letter option or flag.
Definition: UserCommand.cpp:109
std::vector< std::string > getArguments() const
Returns all arguments passed by the user that are not options/switches (arguments identified with a -...
Definition: UserCommand.cpp:44