64 virtual const char *
curr(
void) = 0;
67 virtual void next(
void) = 0;
84 virtual const char *
curr(
void)
override = 0;
86 virtual void next(
void)
override = 0;
88 virtual const char *
operator()(
void)
override = 0;
91 virtual void rewind(
void) = 0;
102 const char *
const *av;
105 explicit OptArgvIter(
const char *
const argv[]) : ndx(0), ac(-1), av(argv) {}
107 OptArgvIter(
int argc,
const char *
const argv[]) : ndx(0), ac(argc), av(argv) {}
111 virtual const char *
curr(
void)
override;
113 virtual void next(
void)
override;
115 virtual const char *
operator()(
void)
override;
117 virtual void rewind(
void)
override;
134 static const char *default_delims;
137 explicit OptStrTokIter(
const char *tokens,
const char *delimiters = 0);
141 virtual const char *
curr(
void)
override;
143 virtual void next(
void)
override;
145 virtual const char *
operator()(
void)
override;
147 virtual void rewind(
void)
override;
153 void delimiters(
const char *delims) { seps = (delims) ? delims : default_delims; }
180 static const unsigned MAX_LINE_LEN;
186 virtual const char *
curr(
void)
override;
188 virtual void next(
void)
override;
190 virtual const char *
operator()(
void)
override;
358 unsigned explicit_end : 1;
359 unsigned optctrls : 7;
360 const char *
const *optvec;
361 const char *nextchar;
365 void check_syntax(
void)
const;
367 const char *match_opt(
char opt,
int ignore_case = 0)
const;
369 const char *match_longopt(
const char *opt,
int len,
int &ambiguous)
const;
371 int parse_opt(
OptIter &iter,
const char *&optarg);
373 int parse_longopt(
OptIter &iter,
const char *&optarg);
412 Options(
const char *name,
const char *
const optv[]);
417 const char *
name(
void)
const {
return cmdname; }
420 unsigned ctrls(
void)
const {
return optctrls; }
423 void ctrls(
unsigned newctrls) { optctrls = newctrls; }
426 void reset(
void) { nextchar = listopt = NULL; }
430 void usage(std::ostream &os,
const char *positionals)
const;
Definition: options.hpp:125
parse command-line options
Definition: options.hpp:355
Definition: options.hpp:97
const char * delimiters(void)
Definition: options.hpp:151
Definition: options.hpp:171
const char * name(void) const
name() returns the command name
Definition: options.hpp:417
int index(void)
index returns the current index to use for argv[]
Definition: options.hpp:120
virtual const char * operator()(void)
Definition: options.cpp:116
virtual void next(void)=0
next() advances to the next item.
OptRC
Definition: options.hpp:403
Definition: options.hpp:77
int explicit_endopts() const
Definition: options.hpp:466
unsigned ctrls(void) const
ctrls() (with no arguments) returns the existing control settings
Definition: options.hpp:420
void ctrls(unsigned newctrls)
ctrls() (with 1 argument) sets new control settings
Definition: options.hpp:423
virtual const char * curr(void)=0
OptCtrl
Definition: options.hpp:376
void reset(void)
reset for another pass to parse for options
Definition: options.hpp:426
Definition: options.hpp:54