yat  0.21pre
Public Member Functions | Protected Member Functions | List of all members
theplu::yat::utility::Option Class Referenceabstract

Container of variables for an option. More...

#include <yat/utility/Option.h>

Inheritance diagram for theplu::yat::utility::Option:
theplu::yat::utility::OptionArg< std::string > theplu::yat::utility::OptionArg< T > theplu::yat::utility::OptionSwitch theplu::yat::utility::OptionFile theplu::yat::utility::OptionHelp theplu::yat::utility::OptionVersion theplu::yat::utility::OptionInFile theplu::yat::utility::OptionOutFile

Public Member Functions

 Option (CommandLine &cmd, std::string name, std::string desc)
 Constructor. More...
 
virtual ~Option (void)
 destructor
 
std::string description (void) const
 
void description (const std::string &description)
 set description More...
 
std::string long_name (void) const
 
void parse (std::vector< std::string >::iterator &, const std::vector< std::string >::iterator &)
 parsing the commandline
 
bool present (void) const
 Get if option was found in cmd. More...
 
std::string print (void)
 print help output More...
 
void reset (void)
 sets present to false
 
char short_name (void) const
 
void validate (void)
 Validate the Option. More...
 

Protected Member Functions

const CommandLinecmd (void) const
 

Detailed Description

Container of variables for an option.

See also
CommandLine

Constructor & Destructor Documentation

◆ Option()

theplu::yat::utility::Option::Option ( CommandLine cmd,
std::string  name,
std::string  desc 
)

Constructor.

Parameters
cmdCommandline to be hooked up with.
namestring such as "help" for –help, "h" for -h or "h,help" for having both short and long option name
descstring used in help display

Member Function Documentation

◆ cmd()

const CommandLine& theplu::yat::utility::Option::cmd ( void  ) const
protected
Returns
const reference to CommandLine Option belongs to.

◆ description() [1/2]

std::string theplu::yat::utility::Option::description ( void  ) const
Returns
description

◆ description() [2/2]

void theplu::yat::utility::Option::description ( const std::string &  description)

set description

Since
New in yat 0.7

◆ long_name()

std::string theplu::yat::utility::Option::long_name ( void  ) const
Returns
long name e.g. 'help' for –help option.

◆ present()

bool theplu::yat::utility::Option::present ( void  ) const

Get if option was found in cmd.

Returns
true if option has been detected in parsing

◆ print()

std::string theplu::yat::utility::Option::print ( void  )

print help output

This function calls the four virtual private functions print1, print2, print3, and print4. This allows an inherited class to implement one (or several) of these functions and keep the default output of the others. The default behavior is that:

◆ short_name()

char theplu::yat::utility::Option::short_name ( void  ) const
Returns
short name e.g. 'h' for -h option.

◆ validate()

void theplu::yat::utility::Option::validate ( void  )

Validate the Option.

This function is called by CommandLine::parse() after all options have been detected and parsed (see Option::parse()).


The documentation for this class was generated from the following file:

Generated on Wed Jan 25 2023 03:34:29 for yat by  doxygen 1.8.14