ISIS Core Library 0.7.2 (api 3.0.0)
Public Member Functions

isis::util::ProgParameter Class Reference

Container class for programm parameters (commandline parameters) given to applications derived from isis. More...

#include <progparameter.hpp>

Inheritance diagram for isis::util::ProgParameter:
isis::util::PropertyValue isis::util::_internal::GenericReference< TYPE_TYPE >

Public Member Functions

const std::string & description () const
bool & hidden ()
bool isHidden () const
 returns true for hidden parameters, false otherwise
bool isSet () const
 operator boost::scoped_ptr< ValueBase >::unspecified_bool_type () const
template<typename T >
 operator const T () const
 Implicit cast to Value T.
bool parse (const isis::util::Value< std::string > &props)
 Put the given value into this parameter.
bool parse_list (const isis::util::Value< util::slist > &props_list)
template<typename T >
 ProgParameter (const T &ref, bool is_needed=true)
 Create a programm parameter using an initial value/type.
 ProgParameter ()
 Default constructor.
void setDescription (const std::string &desc)

Detailed Description

Container class for programm parameters (commandline parameters) given to applications derived from isis.

It is derived from PropertyValue, and thus can store any known type. Additionally, it holds a description of the parameter and parses the given strings to cast them to correct internal parameter types.

Definition at line 36 of file progparameter.hpp.


Constructor & Destructor Documentation

isis::util::ProgParameter::ProgParameter ( )

Default constructor.

This creates an empty/typeless parameter container. Note that empty containers cannot parse a value because they dont have a type they could parse into. Thus parameters created using this must be set to any type/value before parse() is called.

Definition at line 27 of file progparameter.cpp.

template<typename T >
isis::util::ProgParameter::ProgParameter ( const T &  ref,
bool  is_needed = true 
) [inline]

Create a programm parameter using an initial value/type.

Parameters:
refthe intial value/type the programm parameter should get (The value is used as default value if the parameter never gets to parse any other value)
is_neededflag if parameter is a needed one (default: true)

Definition at line 54 of file progparameter.hpp.


Member Function Documentation

const std::string & isis::util::ProgParameter::description ( ) const
Returns:
the description string

Definition at line 82 of file progparameter.cpp.

bool & isis::util::ProgParameter::hidden ( )

returns true for hidden parameters, false otherwise

Definition at line 36 of file progparameter.cpp.

bool isis::util::ProgParameter::isHidden ( ) const

returns true for hidden parameters, false otherwise

Definition at line 32 of file progparameter.cpp.

bool isis::util::ProgParameter::isSet ( ) const
Returns:
true, if the parameter was ever successfully parsed

Definition at line 90 of file progparameter.cpp.

isis::util::ProgParameter::operator boost::scoped_ptr< ValueBase >::unspecified_bool_type ( ) const

Definition at line 182 of file progparameter.cpp.

template<typename T >
isis::util::ProgParameter::operator const T ( ) const [inline]

Implicit cast to Value T.

If the parameter does not contain T, a rutime error will be raised

Definition at line 74 of file progparameter.hpp.

bool isis::util::ProgParameter::parse ( const isis::util::Value< std::string > &  props)

Put the given value into this parameter.

The parsing is done by automatic (!) type-conversion from std::string to the type of the parameter. Parameters of type bool will be set true in any case. Important: you cannot parse into empty parameters because they dont have a type.

Parameters:
propsthe value as string written on commandline to be put into this parameter
Returns:
true if parsing was succesful, false otherwise

Definition at line 41 of file progparameter.cpp.

bool isis::util::ProgParameter::parse_list ( const isis::util::Value< util::slist > &  props_list)

Definition at line 61 of file progparameter.cpp.

void isis::util::ProgParameter::setDescription ( const std::string &  desc)

Definition at line 86 of file progparameter.cpp.


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