CmdLine

File : <CmdLine.h>

The CmdLine class provides a usefull set of methods for consulting or extracting arguments from an array of strings.

It is initalized whith an array of strings and a reference to a counter. The counter mut be initialized whith the size of the array of strings.

Each access (get or peek) method searches for a (case sensitive) key in the argument list. If a match is found, the xxxInt(), xxxLong(), xxxDouble() or xxxString() methods return the argument found (where xxx can be either peek or get).

If a getXX() method succeds, the arguments are extracted from the array. In contrast, peekXX() methods simply read arguments, but never extract them from the argument list.

Construction/destruction - public members

CmdLine( int& argc, char** argv )
CmdLine( unsigned& argc, char** argv )
CmdLine( int& argc, const char** argv )
CmdLine( unsigned& argc, cosnt char** argv )

operations - public members

	const char* get( unsigned pos, const char *defaultValue)
	bool getFlag( const char *key, bool *defaultValue)
	const char* getString( const char *key, const char* defaultValue)
	int getInt( const char *key, int defaultValue)
	long getLong( const char *key, long defaultValue);
	double getDouble( const char *key, double defaultValue)
	int getStringArray( const char* key, char** array, int size )
	int getDoubleArray( const char* key, double* array, int size )
	int getIntArray( const char* key, int* array, int size )
	int getLongArray( const char* key, long* array, int size )
 
	const char* peek( unsigned pos, const char *defaultValue) const
	bool peekFlag( const char *key) const
	const char* peekString( const char *key, const char *defaultValue) const
	int peekInt( const char *key, int defaultValue) const
	long peekLong( const char *key, long defaultValue) const
	double peekDouble( const char *key, double defaultValue) const
	int peekStringArray( const char* key, char** array, int size ) const
	int peekDoubleArray( const char* key, double* array, int size ) const
	int peekIntArray( const char* key, int* array, int size ) const
	int peekLongArray( const char* key, long* array, int size ) const

Status/Information - Public Members

int size() const { return _size; }


Copyright © 1999 TCTS LAB, Faculté Polytechnique de Mons, Belgium