Sierra Toolkit  Version of the Day
stk_classic::diag::Option Struct Reference

Class Option holds the command line name, environment variable name and the current value of an option. It implements the OptionDescription interface so that a help description may be generated. More...

#include <Option.hpp>

Inheritance diagram for stk_classic::diag::Option:
Collaboration diagram for stk_classic::diag::Option:

Public Member Functions

 Option ()
 
 Option (const std::string &name, const std::string &env_name, const std::string &value=std::string(), const std::string &description="No description available", const OptionDescription *sub_option_description=0)
 
 Option (const Option &option)
 
Optionoperator= (const Option &option)
 Member function operator= assigns an option from another option. More...
 
virtual ~Option ()
 
const std::string & getName () const
 
const std::string & getValue () const
 
virtual std::ostream & describe (std::ostream &os) const
 Member function describe prints a description of the option to the stream. More...
 
 operator std::string & ()
 
- Public Member Functions inherited from stk_classic::diag::OptionDescription
virtual ~OptionDescription ()
 

Public Attributes

std::string m_name
 Name/Command line option name.
 
std::string m_envName
 Environment variable name.
 
std::string m_description
 Brief '-h' description.
 
std::string m_value
 Value of option.
 
const OptionDescriptionm_subOptionDescription
 Suboptions (used for '-h' parsing)
 

Detailed Description

Class Option holds the command line name, environment variable name and the current value of an option. It implements the OptionDescription interface so that a help description may be generated.

Definition at line 47 of file Option.hpp.

Constructor & Destructor Documentation

◆ Option() [1/3]

stk_classic::diag::Option::Option ( )
inline

Creates a new Option instance.

Definition at line 53 of file Option.hpp.

◆ Option() [2/3]

stk_classic::diag::Option::Option ( const std::string &  name,
const std::string &  env_name,
const std::string &  value = std::string(),
const std::string &  description = "No description available",
const OptionDescription sub_option_description = 0 
)
inline

Creates a new Option instance.

Parameters
namea std::string const reference to the name of the option. This is used for the command line option argument.
env_namea std::string const reference to the environment variable name.
valuea std::string const reference to the default/initial value of the option.
descriptiona std::string const reference to the description of the option. This is printed when the -h option is parsed.
sub_option_descriptionan OptionDescription const pointer to sub options which are available for the option.

Definition at line 81 of file Option.hpp.

◆ Option() [3/3]

stk_classic::diag::Option::Option ( const Option option)
inline

Creates a new Option instance.

Parameters
optionan Option const reference to the Option to copy.

Definition at line 98 of file Option.hpp.

◆ ~Option()

virtual stk_classic::diag::Option::~Option ( )
inlinevirtual

Destroys a Option instance.

Definition at line 128 of file Option.hpp.

Member Function Documentation

◆ operator=()

Option& stk_classic::diag::Option::operator= ( const Option option)
inline

Member function operator= assigns an option from another option.

Parameters
optionan Option const reference to the rhs option.
Returns
an Option reference to the lhs option.

Definition at line 114 of file Option.hpp.

◆ describe()

virtual std::ostream& stk_classic::diag::Option::describe ( std::ostream &  os) const
virtual

Member function describe prints a description of the option to the stream.

Parameters
osa std::ostream reference to print to description to.
Returns
a std::ostream reference to the output stream.

Implements stk_classic::diag::OptionDescription.


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