Image Component Library (ICL)
|
Programm argument utility class. More...
#include <ProgArg.h>
Public Member Functions | |
int | n () const throw (ProgArgException) |
returns the count of actually given sub arguments | |
Any | operator[] (int subArgIdx) const throw (ProgArgException) |
returns the given sub-argument in shape of an utils::Any | |
template<class T > | |
operator T () const throw (ProgArgException) | |
this is the main conversion function. It returns the associated sub argument as given T | |
template<class T > | |
T | as () const throw (ProgArgException) |
this template function can be used to explicitly cast a program argument into a given type | |
std::string | operator* () const throw (ProgArgException) |
important convenience operator for using a ProgArg instance as string | |
const std::string & | getID () const |
returns the prog-arg id | |
Private Member Functions | |
ProgArg (const std::string &id, unsigned int subargidx) | |
private constructor | |
ProgArg (unsigned int idx, bool danglingOnly) |
Programm argument utility class.
icl::utils::ProgArg::ProgArg | ( | const std::string & | id, |
unsigned int | subargidx | ||
) | [inline, private] |
private constructor
Use the functions icl::utils::pa(const std::string&,unsigned int) and icl::utils::pa(unsigned int,bool) to create an instance of this class in order to access program arguments
icl::utils::ProgArg::ProgArg | ( | unsigned int | idx, |
bool | danglingOnly | ||
) | [inline, private] |
T icl::utils::ProgArg::as | ( | ) | const throw (ProgArgException) [inline] |
this template function can be used to explicitly cast a program argument into a given type
const std::string& icl::utils::ProgArg::getID | ( | ) | const [inline] |
returns the prog-arg id
int icl::utils::ProgArg::n | ( | ) | const throw (ProgArgException) |
returns the count of actually given sub arguments
If this argument was not given, this function returns 0.
icl::utils::ProgArg::operator T | ( | ) | const throw (ProgArgException) [inline] |
this is the main conversion function. It returns the associated sub argument as given T
If T is bool, this operator returns whether the arg was given rather than its value
std::string icl::utils::ProgArg::operator* | ( | ) | const throw (ProgArgException) [inline] |
important convenience operator for using a ProgArg instance as string
*pa("-x")
is the same as pa("-x").as<std::string>()
. However, the first version is much shorter.
Any icl::utils::ProgArg::operator[] | ( | int | subArgIdx | ) | const throw (ProgArgException) |
returns the given sub-argument in shape of an utils::Any