21#ifndef G_OPTION_PARSER_H
22#define G_OPTION_PARSER_H
56 std::size_t ignore_non_options = 0U ,
57 std::function<std::string(
const std::string&,
bool)> callback_fn = {} ) ;
103 std::size_t start_position = 1U , std::size_t ignore_non_options = 0U ,
104 std::function<std::string(
const std::string&,
bool)> callback_fn = {} ) ;
117 bool haveSeen(
const std::string & )
const ;
118 bool haveSeenSame(
const std::string & ,
const std::string & )
const ;
119 static std::string::size_type eqPos(
const std::string & ) ;
120 static std::string eqValue(
const std::string & , std::string::size_type ) ;
121 void processOptionOn(
char c ) ;
122 void processOption(
char c ,
const std::string & value ) ;
123 void processOptionOn(
const std::string & s ) ;
124 void processOptionOff(
const std::string & s ) ;
125 void processOption(
const std::string & s ,
const std::string & value ,
bool ) ;
126 void errorNoValue(
char ) ;
127 void errorNoValue(
const std::string & ) ;
128 void errorUnknownOption(
char ) ;
129 void errorUnknownOption(
const std::string & ) ;
130 void errorDubiousValue(
const std::string & ,
const std::string & ) ;
132 void errorExtraValue(
char ,
const std::string & ) ;
133 void errorExtraValue(
const std::string & ,
const std::string & ) ;
134 void errorConflict(
const std::string & ) ;
135 void error(
const std::string & ) ;
136 bool haveSeenOn(
const std::string & name )
const ;
137 bool haveSeenOff(
const std::string & name )
const ;
138 static bool isOldOption(
const std::string & ) ;
139 static bool isNewOption(
const std::string & ) ;
140 static bool isAnOptionSet(
const std::string & ) ;
141 static std::size_t valueCount(
const std::string & ) ;
A multimap-like container for command-line options and their values.
A parser for command-line arguments that operates according to an Options specification and returns a...
void errorDuplicate(const std::string &)
Adds a 'duplicate' error in the constructor's error list for the given option.
StringArray parse(const StringArray &args_in, std::size_t start_position=1U, std::size_t ignore_non_options=0U, std::function< std::string(const std::string &, bool)> callback_fn={})
Parses the given command-line arguments into the value map and/or error list defined by the construct...
OptionParser(const Options &spec, OptionMap &values_out, StringArray &errors_out)
Constructor.
A class to assemble a list of command-line options and provide access by name.
std::vector< std::string > StringArray
A std::vector of std::strings.