cxxtools::ArgBaseT< T > Class Template Reference

#include <cxxtools/arg.h>

Inheritance diagram for cxxtools::ArgBaseT< T >:
cxxtools::ArgBase cxxtools::Arg< T >

Public Member Functions

const T & getValue () const
 returns the value.
 operator T () const
 Read and extract commandline parameters from argc/argv.
ArgBaseT< T > & operator= (const T &value)
- Public Member Functions inherited from cxxtools::ArgBase
 ArgBase ()
bool isSet () const
 returns true if the option was found and the default value was not used

Protected Member Functions

 ArgBaseT (const T &def)
bool extract (const char *str, int &argc, char *argv[], int i, int n)

Additional Inherited Members

- Static Protected Member Functions inherited from cxxtools::ArgBase
static void removeArg (int &argc, char *argv[], int pos, int n)
- Protected Attributes inherited from cxxtools::ArgBase
bool m_isset

Constructor & Destructor Documentation

template<typename T >
cxxtools::ArgBaseT< T >::ArgBaseT ( const T &  def)
inlineexplicitprotected

Member Function Documentation

template<typename T >
bool cxxtools::ArgBaseT< T >::extract ( const char *  str,
int &  argc,
char *  argv[],
int  i,
int  n 
)
inlineprotected
template<typename T >
const T& cxxtools::ArgBaseT< T >::getValue ( ) const
inline

returns the value.

template<typename T >
cxxtools::ArgBaseT< T >::operator T ( ) const
inline

Read and extract commandline parameters from argc/argv.

Programs usually need some parameters. Usually they start with a '-' followed by a single character and optionally a value. Arg<T> extracts these and other parameters.

This default class processes paramters with a value, which defines a input-extractor-operator operator>> (istream&, T&).

Options are removed from the option-list, so programs can easily check after all options are extracted, if there are parameters left.

example:

int main(int argc, char* argv[])
{
cxxtools::Arg<int> option_n(argc, argv, 'n', 0);
std::cout << "value for -n: " << option_n << endl;
}
template<typename T >
ArgBaseT<T>& cxxtools::ArgBaseT< T >::operator= ( const T &  value)
inline

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