Image Component Library (ICL)
Public Member Functions | Private Member Functions | List of all members
icl::utils::ProgArg Class Reference

Programm argument utility class. More...

#include <ProgArg.h>

Inheritance diagram for icl::utils::ProgArg:

Public Member Functions

ICLUtils_API int n () const
 returns the count of actually given sub arguments More...
 
ICLUtils_API Any operator[] (int subArgIdx) const
 returns the given sub-argument in shape of an utils::Any More...
 
template<class T >
 operator T () const
 this is the main conversion function. It returns the associated sub argument as given T More...
 
bool operator! () const
 negation operator More...
 
template<class T >
as () const
 this template function can be used to explicitly cast a program argument into a given type More...
 
std::string operator * () const
 important convenience operator for using a ProgArg instance as string More...
 
const std::string & getID () const
 returns the prog-arg id More...
 

Private Member Functions

 ProgArg (const std::string &id, unsigned int subargidx)
 private constructor More...
 
 ProgArg (unsigned int idx, bool danglingOnly)
 

Detailed Description

Programm argument utility class.

See also
icl::pa(const std::string&,unsigned int)

Constructor & Destructor Documentation

◆ ProgArg() [1/2]

icl::utils::ProgArg::ProgArg ( const std::string &  id,
unsigned int  subargidx 
)
inlineprivate

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

◆ ProgArg() [2/2]

icl::utils::ProgArg::ProgArg ( unsigned int  idx,
bool  danglingOnly 
)
inlineprivate

Member Function Documentation

◆ as()

template<class T >
T icl::utils::ProgArg::as ( ) const
inline

this template function can be used to explicitly cast a program argument into a given type

◆ getID()

const std::string& icl::utils::ProgArg::getID ( ) const
inline

returns the prog-arg id

◆ n()

ICLUtils_API int icl::utils::ProgArg::n ( ) const

returns the count of actually given sub arguments

If this argument was not given, this function returns 0.

◆ operator *()

std::string icl::utils::ProgArg::operator * ( ) const
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.

◆ operator T()

template<class T >
icl::utils::ProgArg::operator T ( ) const
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

◆ operator!()

bool icl::utils::ProgArg::operator! ( ) const
inline

negation operator

◆ operator[]()

ICLUtils_API Any icl::utils::ProgArg::operator[] ( int  subArgIdx) const

returns the given sub-argument in shape of an utils::Any


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