ProgOptio Code
Status: Beta
Brought to you by:
balhok
| File | Date | Author | Commit |
|---|---|---|---|
| src | 2012-05-26 | balhok | [r4] Version finale ? |
| CMakeLists.txt | 2012-05-26 | balhok | [r5] correction installation lib |
| README | 2012-05-26 | balhok | [r4] Version finale ? |
| main.cpp | 2012-05-26 | balhok | [r4] Version finale ? |
Simplistic program option handler
the main.cpp only contain example code, only src/programoption.h and .cpp are useful.
It only use the STL.
Create a ProgramOption object.
Add your named arguments and options.
Add their descriptions if you need.
link the ProgramOption object with your argc, argv.
take back your typed arguments/options with their names.
Enjoy :)
It's still in beta, feedback would be nice.
###########Example################
int main(int argc, char **argv) {
ProgramOption po;
po.addBoolArgument("bool1");
po.addStringArgument("string1");
po.addFloatArgument("float1");
po.addBoolOption("optBool");
po.link(argc, argv);
cout << po.getBoolArgument("bool1") << endl;
cout << po.getStringArgument("string1") << endl;
cout << po.getFloatArgument("float1") << endl;
cout << po.getBoolOption("optBool") << endl;
return 0;
}
##########Command Line############
./progoptio false "balbalba" 7.15555 -optBool=true
##########OUTPUT##################
0
balbalba
7.15555
1
##################################
also :
##########Command Line############
./progoptio -h
##########OUTPUT##################
Arguments:
bool1 [ true| false]
string1
float1
Options:
optBool
0
0
0
#################################