Sierra Toolkit Version of the Day
stk::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 <WriterParser.hpp>

Inheritance diagram for stk::diag::Option:
Collaboration diagram for stk::diag::Option:

List of all members.

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.
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.
 operator std::string & ()

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 44 of file WriterParser.hpp.


Constructor & Destructor Documentation

stk::diag::Option::Option ( ) [inline]

Creates a new Option instance.

Definition at line 50 of file WriterParser.hpp.

stk::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 78 of file WriterParser.hpp.

stk::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 95 of file WriterParser.hpp.

virtual stk::diag::Option::~Option ( ) [inline, virtual]

Destroys a Option instance.

Definition at line 125 of file WriterParser.hpp.


Member Function Documentation

Option& stk::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 111 of file WriterParser.hpp.

virtual std::ostream& stk::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::diag::OptionDescription.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends