62 #ifndef support_CmdLineParser_hpp 63 #define support_CmdLineParser_hpp 192 {
return !(*
this == x); }
207 # define CmdLineParser_OptArgDesc_NULL_MACRO \ 208 { 0, NULL, CmdLineParser::ARG_NULL, CmdLineParser::DUPOPT_NULL, NULL } 218 const char* filenm =
NULL,
unsigned int lineno = 0)
223 const char* filenm =
NULL,
unsigned int lineno = 0)
233 const char* filenm =
NULL,
unsigned int lineno = 0)
238 const char* filenm =
NULL,
unsigned int lineno = 0)
243 return "[CmdLineParser::ParseError]: " + what();
250 const char* filenm =
NULL,
unsigned int lineno = 0)
255 const char* filenm =
NULL,
unsigned int lineno = 0)
260 return "[CmdLineParser::InternalError]: " + what();
272 int argc,
const char*
const argv[]);
284 int argc,
const char*
const argv[]);
307 isOpt(
const std::string& sw)
const;
319 isOptArg(
const std::string& sw)
const;
340 getArg(
unsigned int i)
const;
347 toLong(
const std::string& str);
353 toDbl(
const std::string& str);
371 dump(std::ostream& os = std::cerr)
const;
396 SwDesc(
const char* sw_,
bool isLong_,
const char* arg_)
397 : sw(sw_), isLong(isLong_), arg(arg_)
400 SwDesc(
const std::string& sw_,
bool isLong_,
const std::string& arg_)
401 : sw(sw_), isLong(isLong_), arg(arg_)
432 bool errOnMultipleMatches =
true);
439 const std::string& sw,
const std::string& arg);
449 #endif // support_CmdLineParser_hpp bool(* IsOptArg_fn_t)(const char *str)
bool isOpt(const char swShort) const
static OptArgDesc OptArgDesc_NULL
virtual std::string message() const
const OptArgDesc * createSortedCopy(const OptArgDesc *optArgDescs)
const std::string & getOptArg(const char swShort) const
const std::string & getCmd() const
static uint64_t toUInt64(const std::string &str)
CmdLineParser & operator=(const CmdLineParser &GCC_ATTR_UNUSED x)
static double toDbl(const std::string &str)
bool isOptArg(const char swShort) const
CmdLineParser(const CmdLineParser &GCC_ATTR_UNUSED x)
void parse(const OptArgDesc *optArgDescs, int argc, const char *const argv[])
std::map< std::string, std::string * > SwitchToArgMap
bool operator==(const OptArgDesc &x) const
bool operator!=(const OptArgDesc &x) const
unsigned int getNumArgs() const
static bool isOptArg_long(const char *option)
ParseError(std::string x, const char *filenm=NULL, unsigned int lineno=0)
ParseError(const char *x, const char *filenm=NULL, unsigned int lineno=0)
void dump(std::ostream &os=std::cerr) const
InternalError(const char *x, const char *filenm=NULL, unsigned int lineno=0)
void checkForErrors(const OptArgDesc *optArgDescs)
SwDesc(const char *sw_, bool isLong_, const char *arg_)
std::vector< std::string > ArgVec
const OptArgDesc * findOptDesc(const OptArgDesc *optArgDescs, const SwDesc &swdesc, bool errOnMultipleMatches=true)
SwDesc makeSwitchDesc(const char *str)
SwitchToArgMap switchToArgMap
const std::string & getArg(unsigned int i) const
Exception(const char *x, const char *filenm=NULL, unsigned int lineno=0)
InternalError(std::string x, const char *filenm=NULL, unsigned int lineno=0)
Exception(std::string x, const char *filenm=NULL, unsigned int lineno=0)
static bool parseArg_bool(const std::string &value, const char *errTag)
virtual std::string message() const
static long toLong(const std::string &str)
void addOption(const OptArgDesc &odesc, const SwDesc &swdesc)
SwDesc(const std::string &sw_, bool isLong_, const std::string &arg_)