CommandLine.h
Go to the documentation of this file.
73 const RawLongOption *longOptions() const { return longOptions_.size() ? longOptions_.data() : nullptr; }
Manages arguments passed to a program (i.e., main(argc, argv) parameters).
Definition: CommandLine.h:35
std::vector< char * > argv_
raw main() parameters, including argv[0] and a nil argv[argc]
Definition: CommandLine.h:77
bool hasOption(const int optId, const char **optValue=nullptr) const
Definition: CommandLine.cc:71
void forEachOption(Visitor) const
calls Visitor for each of the configured command line option
Definition: CommandLine.cc:89
void resetArg0(const char *programName)
replaces argv[0] with the new value
Definition: CommandLine.cc:115
CommandLine(int argc, char *argv[], const char *shortRules, const RawLongOption *longRules)
expects main() input plus getopt_long(3) grammar rules for parsing argv
Definition: CommandLine.cc:24
void pushFrontOption(const char *name, const char *value=nullptr)
inserts a (possibly duplicated) option at the beginning of options (just after argv[0])
Definition: CommandLine.cc:123
A struct option C++ wrapper, helps with option::name copying/freeing.
Definition: CommandLine.h:21