#include <stargs.h>
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< Option > | options |
StValueList< StValueList< int > > | disallow |
bool | allowFree |
bool | validated |
Classes | |
struct | Option |
StArgs::StArgs | ( | ) | [inline] |
StArgs::StArgs | ( | int | argc, | |
char * | argv[] | |||
) | [inline] |
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.
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.
int StArgs::findOption | ( | const StString & | name | ) | [private] |
int StArgs::findOptionInArgs | ( | const StString & | name | ) | [private] |
StValueList< int > StArgs::getDisallowTogetherOptions | ( | const StString & | withOption | ) | [private] |
StStringList StArgs::getValues | ( | const StString & | optionName = "" |
) |
optionName | Option name that arguments will be returned. If empty function will return free arguments |
void StArgs::init | ( | ) | [inline, private] |
Make link to existing option if exists. Link can be done to another link.
bool StArgs::optionExists | ( | const StString & | name | ) | [inline] |
void StArgs::setArgs | ( | int | argc, | |
char * | argv[] | |||
) |
bool StArgs::validate | ( | ) |
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] |