58 using size_type = std::string::size_type ;
60 GetOpt(
const Arg & arg ,
const std::string & spec , std::size_t ignore_non_options = 0U ) ;
64 GetOpt(
const StringArray & arg ,
const std::string & spec , std::size_t ignore_non_options = 0U ) ;
69 GetOpt(
const Arg & arg ,
const Options & spec , std::size_t ignore_non_options = 0U ) ;
80 const std::string & varkey = std::string() ,
const std::string & varvalue = std::string() ) ;
109 void showErrors( std::ostream & stream ,
const std::string & prefix_1 ,
110 const std::string & prefix_2 = std::string(
": ") )
const ;
115 void showErrors( std::ostream & stream )
const ;
118 bool contains(
char option_letter )
const ;
122 bool contains(
const std::string & option_name )
const ;
126 std::size_t
count(
const std::string & option_name )
const ;
129 std::string
value(
const std::string & option_name ,
const std::string & default_ = std::string() )
const ;
136 std::string
value(
char option_letter ,
const std::string & default_ = std::string() )
const ;
145 void operator=(
const GetOpt & ) = delete ;
146 void operator=(
GetOpt && ) = delete ;
149 void parseArgs( std::size_t ) ;
A class which holds a represention of the argc/argv command line array, and supports simple command-l...
A command-line option parser.
const OptionMap & map() const
Returns a reference to the OptionMap sub-object.
void reload(const StringArray &arg, std::size_t ignore_non_options=0U)
Reinitialises the object with the given command-line arguments.
bool contains(char option_letter) const
Returns true if the command-line contains the option identified by its short-form letter.
const Options & options() const
Returns a reference to the option specification sub-object.
GetOpt(const Arg &arg, const std::string &spec, std::size_t ignore_non_options=0U)
Constructor taking a Arg object and a G::Options specification string.
void addOptionsFromFile(size_type n=1U, const std::string &varkey=std::string(), const std::string &varvalue=std::string())
Adds options from the config file named by the n'th non-option command-line argument (zero-based and ...
bool hasErrors() const
Returns true if there are errors.
std::size_t count(const std::string &option_name) const
Returns the option's repeat count.
Arg args() const
Returns the G::Arg command-line, excluding options.
void showErrors(std::ostream &stream, const std::string &prefix_1, const std::string &prefix_2=std::string(": ")) const
A convenience function which streams out each errorList() item to the given stream,...
StringArray errorList() const
Returns the list of errors.
std::string value(const std::string &option_name, const std::string &default_=std::string()) const
Returns the value for the option identified by its long-form name.
A multimap-like container for command-line options and their values.
A class to represent allowed command-line options and to provide command-line usage text.
A Path object represents a file system path.
std::vector< std::string > StringArray
A std::vector of std::strings.