119 #include <sys/ioctl.h> 271 name(
const std::string& value);
358 usage(std::ostream& os)
const;
591 error(std::ostream& os);
609 bool autoProcessing=
true);
671 getArg(
char shortName)
const;
685 getArg(
const std::string& keyword)
const;
693 unsigned int pNArgsParsed;
695 std::string pLongName;
696 std::string pDescription;
698 std::list<CmdArg*> pArguments;
733 const std::string& src,
734 const std::string& attempt,
761 const std::string& title,
763 const std::string& text);
776 basename(
const std::string& filename);
795 pUsageArg(0,
"help",
"Display usage message."),
796 pUsageHTMLArg(0,
"usagehtml",
"Display HTML usage message."),
797 pUsageXMLArg(0,
"usagexml",
"Display XML usage message.")
820 USAGE_SHORT_ONLY = 0,
841 const char*& endptr);
886 matchShort(
char optchar)
const;
902 const std::string& kwd,
904 bool& is_ambiguous)
const;
927 isShort(
const char* s);
940 isLong(
const char* s);
953 isEndOfOptions(
const char* s);
968 parseShort(
const char* arg);
983 parseLong(
const char* arg);
999 parseValue(
const char* arg);
1014 const std::string& error_str,
1015 const CmdArg* cmdarg)
const;
1031 std::ostream& os)
const;
1047 unsigned int longest)
const;
1064 const std::string& replacedText,
1065 const std::string& replacedBy);
1069 #include "CmdLine.icc" void clearState(CmdLine::CmdLineState s=STATE_ALL)
Clear only the given state flags.
unsigned int nargsParsed() const
Find out the number of arguments parsed so far.
CmdLine::CmdLineState state() const
Return CmdLine's state.
A required argument value was not specified.
An invalid value was specified for an arg.
std::ostream & error() const
Return CmdLine's error output stream.
No options after positional parameters.
std::string longname() const
Return previously specified program long name.
The CmdArg class is the abstract base class for all command line arguments.
CmdLine::CmdLineFlags flags() const
Return CmdLine's flags.
std::ostream & usage() const
Print usage message on CmdLine's error output stream.
The last parsed CmdArg may optionally get a value.
The last parsed CmdArg requires a value.
CmdLine::CmdLineStatus status() const
Return CmdLine's status.
std::string description() const
Return previously specified program description.
Don't quit upon syntax error.
An ambiguous keyword prefix was specified.
CmdLine(std::string name, std::string longname, bool help=true)
Constructor.
std::ostream & usageLATEX(std::ostream &os) const
Print LATEX usage message on the given output stream.
The CmdLine class is a parser for command line arguments.
std::ostream & usageHTML(std::ostream &os) const
Print HTML usage message on the given output stream.
CmdLine::CmdLineStatus parse(ArgIter &argiter, bool autoProcessing=true)
Parse a set of arguments.
bool hasState(CmdLine::CmdLineState s) const
Checks if the given state flags are set.
void setState(CmdLine::CmdLineState s)
Set only given state flags.
CmdLine::CmdLineStatus epilogue()
Perform the necessary post-processing.
std::string name() const
Return previously specified program name.
Don't print syntax error messages.
CmdLine & append(CmdArg *cmdarg)
Append specified CmdArg to the list of CmdArgs.
Value needs to be in separate token.
CmdArg * getArg(char shortName) const
Retrieve an argument based on its short name.
End of options (–) occured.
An invalid keyword was specified.
A required argument was not specified.
Prompt the user for missing required args.
bool hasStatus(CmdLine::CmdLineStatus s) const
Checks if the given status flags are set.
Ignore character-case for short-options.
Value needs to be in same token.
CmdLine::CmdLineStatus prologue()
Perform the necessary pre-processing.
CmdLine::CmdLineStatus parseArg(const char *arg)
Parse a single argument.
CmdLineState
State flags for CmdLine.
The next token is required.
CmdLineParseState
Parsing state flags for CmdLine.
void clearFlags(CmdLine::CmdLineFlags f=FLAG_ALL)
Clear only the given flags.
The ArgIter class is an abstract class used by the CmdLine class for fetching command line arguments...
void setStatus(CmdLine::CmdLineStatus s)
Set only given status flags.
Parsing of a CmdArg is completely finished.
Too many positional args were specified.
virtual ~CmdLine()
Destructor.
CmdLineFlags
Configuration flags for CmdLine.
An invalid option was specified.
bool hasFlag(CmdLine::CmdLineFlags f) const
Checks if the given flags are set.
std::ostream & usageXML(std::ostream &os) const
Print XML usage information on the given output stream.
void setFlags(CmdLine::CmdLineFlags f)
Set only the given flags.
CmdLineStatus
Status flags for CmdLine.