Class ArgumentParser
Defined in File ArgumentParser.h
Class Documentation
-
class ArgumentParser
Public Functions
-
ArgumentParser(int argc, const char *argv[])
Parses command line arguments.
- Parameters:
argc – The number of command line arguments.
argv – An array of C-style strings representing the command line arguments.
-
const map<string, string> &getOptions() const
Gets all parsed options.
- Returns:
A map where keys are option names and values are option values.
-
optional<string> getOption(const string &name) const
Gets the value of a specific option.
- Parameters:
name – The name of the option.
- Returns:
An optional containing the option value if found, otherwise nullopt.
-
bool hasOption(const string &name) const
Checks if a specific option exists.
- Parameters:
name – The name of the option.
- Returns:
True if the option exists, false otherwise.
-
optional<long> getInt(const string &name) const
-
optional<vector<string>> getListOption(const string &name) const
Gets the option value as a list separated by comma.
- Parameters:
name – The name of the option.
- Returns:
An optional containing a vector of strings if the option is found, otherwise nullopt.
-
const vector<string> &getPositionalArgs() const
Gets the positional arguments.
- Returns:
A vector of strings containing the positional arguments.
-
ArgumentParser(int argc, const char *argv[])