DUNE: Uniform Navigational Environment  2019.02.0
DUNE::Utils::OptionParser Class Reference

Public Member Functions

 OptionParser (void)
 
 ~OptionParser (void)
 
bool parse (int argc, char **argv)
 
OptionParserprogram (const char *prog)
 
OptionParserexecutable (const char *exe)
 
OptionParserarch (const char *arc)
 
OptionParsercopyright (const char *cright)
 
OptionParserdate (const char *build_time)
 
OptionParserversion (const char *vers)
 
OptionParseremail (const char *contact)
 
OptionParserdescription (const char *desc)
 
OptionParseradd (const char *short_opt, const char *long_opt, const char *description, const char *argument=0)
 
void usage (void)
 
bool bad (void)
 
const char * error (void)
 
const std::string & value (std::string option)
 

Constructor & Destructor Documentation

DUNE::Utils::OptionParser::OptionParser ( void  )

References add().

DUNE::Utils::OptionParser::~OptionParser ( void  )

Destructor.

Member Function Documentation

OptionParser & DUNE::Utils::OptionParser::add ( const char *  short_opt,
const char *  long_opt,
const char *  description,
const char *  argument = 0 
)

Add a new option to the parser.

Parameters
short_optshort option, usually one hiffen and a character (eg. -x).
long_optlong option, usually two hiffens and a string (eg. –xxxx).
descriptionoption description.
argumenta label for describing the option argument.
Returns
object.

References description(), and DUNE::Utils::String::str().

Referenced by OptionParser().

OptionParser& DUNE::Utils::OptionParser::arch ( const char *  arc)
inline

Set program's architecture.

Parameters
arcprogram's architecture.
Returns
object.
bool DUNE::Utils::OptionParser::bad ( void  )
inline
OptionParser& DUNE::Utils::OptionParser::copyright ( const char *  cright)
inline

Set program's copyright.

Parameters
crightprograms copyright.
Returns
object.
OptionParser& DUNE::Utils::OptionParser::date ( const char *  build_time)
inline

Set program's build time/date.

Parameters
build_timeprogram's build time/date.
Returns
object.
OptionParser& DUNE::Utils::OptionParser::description ( const char *  desc)
inline

Set program's description.

Parameters
descprogram's description.
Returns
object.

Referenced by add().

OptionParser& DUNE::Utils::OptionParser::email ( const char *  contact)
inline

Set program's email contact.

Parameters
contactprogram's email contact.
Returns
object.
const char* DUNE::Utils::OptionParser::error ( void  )
inline
OptionParser& DUNE::Utils::OptionParser::executable ( const char *  exe)
inline

Set program's executable file name.

Parameters
exeprogram's executable file name.
Returns
object.
bool DUNE::Utils::OptionParser::parse ( int  argc,
char **  argv 
)

References usage(), and value().

OptionParser& DUNE::Utils::OptionParser::program ( const char *  prog)
inline

Set program's name.

Parameters
progprogram's name.
Returns
object.
void DUNE::Utils::OptionParser::usage ( void  )

Referenced by parse().

const std::string& DUNE::Utils::OptionParser::value ( std::string  option)
inline

Referenced by parse().

OptionParser& DUNE::Utils::OptionParser::version ( const char *  vers)
inline

Set program's version.

Parameters
versprogram's version.
Returns
object.
Collaboration diagram for DUNE::Utils::OptionParser:
Collaboration graph