StArgs Class Reference

#include <stargs.h>

List of all members.

Public Member Functions

 StArgs ()
 StArgs (int argc, char *argv[])
void setArgs (int argc, char *argv[])
void addOption (const StString &name, SmartTools::OptionValues valueNum=SmartTools::None, bool allowMultipleOccurrence=false)
bool linkOption (const StString &linkName, const StString &linkTo)
bool disallowTogether (const StStringList options)
void allowFreeArgs (bool opt)
void clear ()
bool validate ()
bool optionExists (const StString &name)
StStringList getValues (const StString &optionName="")
StString getValue (const StString &optionName)

Private Member Functions

void init ()
int findOption (const StString &name)
int findOptionInArgs (const StString &name)
StValueList< int > getDisallowTogetherOptions (const StString &withOption)

Private Attributes

StStringList args
StStringList nonOptionValues
StValueList< Optionoptions
StValueList< StValueList<
int > > 
disallow
bool allowFree
bool validated

Classes

struct  Option


Constructor & Destructor Documentation

StArgs::StArgs (  )  [inline]

StArgs::StArgs ( int  argc,
char *  argv[] 
) [inline]


Member Function Documentation

void StArgs::addOption ( const StString name,
SmartTools::OptionValues  valueNum = SmartTools::None,
bool  allowMultipleOccurrence = false 
)

Adds option to validate list. If option with given name already exists it valueNum and allowMultipleValues will be updated.

See also:
linkOption()
Parameters:
name Name of option like -no-deps
valueNum Do option have value? One or more?
allowMultipleOccurrence If true option can be used multiple times

void StArgs::allowFreeArgs ( bool  opt  )  [inline]

Free args are arguments without option in first place

void StArgs::clear (  )  [inline]

bool StArgs::disallowTogether ( const StStringList  options  ) 

Disallow presence of more than one option from options at time.

Returns:
false if one or more options not recognized.

int StArgs::findOption ( const StString name  )  [private]

int StArgs::findOptionInArgs ( const StString name  )  [private]

StValueList< int > StArgs::getDisallowTogetherOptions ( const StString withOption  )  [private]

StString StArgs::getValue ( const StString optionName  ) 

StStringList StArgs::getValues ( const StString optionName = ""  ) 

Parameters:
optionName Option name that arguments will be returned. If empty function will return free arguments
Returns:
List of values of given option.
See also:
optionExists()

void StArgs::init (  )  [inline, private]

bool StArgs::linkOption ( const StString linkName,
const StString linkTo 
)

Make link to existing option if exists. Link can be done to another link.

Returns:
False if linkTo doesn't exists.
See also:
addOption()

bool StArgs::optionExists ( const StString name  )  [inline]

Returns:
True if option given in arguments line.
See also:
getValues()

void StArgs::setArgs ( int  argc,
char *  argv[] 
)

bool StArgs::validate (  ) 

Returns:
True if argument line is valid


Member Data Documentation

bool StArgs::allowFree [private]

StStringList StArgs::args [private]

StValueList<StValueList<int> > StArgs::disallow [private]

StStringList StArgs::nonOptionValues [private]

StValueList<Option> StArgs::options [private]

bool StArgs::validated [private]


The documentation for this class was generated from the following files:
Generated on Tue Nov 14 21:15:09 2006 for Smart Tools Library by  doxygen 1.4.7