Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::program_options::variable_value Class Reference

Class holding value of option. More...

#include <variables_map.hpp>

Public Member Functions

 variable_value ()
 
 variable_value (const boost::any &xv, bool xdefaulted)
 
template<class T >
const Tas () const
 If stored value if of type T, returns that value. More...
 
template<class T >
Tas ()
 
bool empty () const
 Returns true if no value is stored. More...
 
bool defaulted () const
 Returns true if the value was not explicitly given, but has default value. More...
 
const boost::anyvalue () const
 Returns the contained value. More...
 
boost::anyvalue ()
 Returns the contained value. More...
 

Friends

class BOOST_PROGRAM_OPTIONS_DECL variables_map
 
BOOST_PROGRAM_OPTIONS_DECL void store (const basic_parsed_options< char > &options, variables_map &m, bool)
 Stores in 'm' all options that are defined in 'options'. More...
 

Detailed Description

Class holding value of option.

Contains details about how the value is set and allows to conveniently obtain the value.

Constructor & Destructor Documentation

boost::program_options::variable_value::variable_value ( )
inline
boost::program_options::variable_value::variable_value ( const boost::any xv,
bool  xdefaulted 
)
inline

Member Function Documentation

template<class T >
const T& boost::program_options::variable_value::as ( ) const
inline

If stored value if of type T, returns that value.

Otherwise, throws boost::bad_any_cast exception.

References boost::any_cast(), and T.

template<class T >
T& boost::program_options::variable_value::as ( )
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References boost::any_cast(), and T.

bool boost::program_options::variable_value::defaulted ( ) const
inline

Returns true if the value was not explicitly given, but has default value.

bool boost::program_options::variable_value::empty ( void  ) const
inline

Returns true if no value is stored.

References boost::any::empty().

const boost::any & boost::program_options::variable_value::value ( ) const
inline

Returns the contained value.

boost::any & boost::program_options::variable_value::value ( )
inline

Returns the contained value.

Friends And Related Function Documentation

BOOST_PROGRAM_OPTIONS_DECL void store ( const basic_parsed_options< char > &  options,
variables_map m,
bool   
)
friend

Stores in 'm' all options that are defined in 'options'.

If 'm' already has a non-defaulted value of an option, that value is not changed, even if 'options' specify some value.


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