biu::COptionParser Class Reference
#include <OptionParser.hh>
Detailed Description
Class for type assured parameter parsing and help output generation.
Definition at line 91 of file OptionParser.hh.
Public Member Functions | |
| bool | argExist (std::string option) |
| COptionParser (OptionMap _options, int argc, char **argv, std::string infoText) | |
| void | coutUsage () const |
| bool | getBoolVal (std::string arg) |
| char | getCharVal (std::string arg) |
| double | getDoubleVal (std::string arg) |
| float | getFloatVal (std::string arg) |
| int | getIntVal (std::string arg) |
| std::string | getStrVal (std::string arg) |
| bool | noErrors () |
Static Public Attributes | |
| static int | OUTPUT_LINE_LENGTH |
Private Types | |
| enum | ERRORS { ERR_NO_OPT, ERR_WR_USE, ERR_WR_VAL, ERR_NO_ARG } |
Private Member Functions | |
| void | coutError (int error, std::string optionName, std::string errormsg) |
| void | coutLineBreaking (std::string text, std::ostream &os, const int emptyHeadSize, const int lineLength) const |
| bool | isCastable (std::string val, int type) const |
| void | parseOpt (int argc, char **argv) |
Private Attributes | |
| bool | errorOccured |
| std::string | infoText |
| unsigned int | maxOName |
| std::map< std::string, int > | mopt |
| OptionMap | opt |
| std::string | programName |
Member Enumeration Documentation
enum biu::COptionParser::ERRORS [private] |
Constructor & Destructor Documentation
| biu::COptionParser::COptionParser | ( | OptionMap | _options, | |
| int | argc, | |||
| char ** | argv, | |||
| std::string | infoText | |||
| ) |
Member Function Documentation
| bool biu::COptionParser::argExist | ( | std::string | option | ) |
== true if the corresponding parameter was given or has a default value
Definition at line 134 of file OptionParser.cc.
| void biu::COptionParser::coutError | ( | int | error, | |
| std::string | optionName, | |||
| std::string | errormsg | |||
| ) | [private] |
prints a formatted error output
- Parameters:
-
error the error code for the main return value optionName the name of the option not found errormsg the error message to display
Definition at line 200 of file OptionParser.cc.
| void biu::COptionParser::coutLineBreaking | ( | std::string | text, | |
| std::ostream & | os, | |||
| const int | emptyHeadSize, | |||
| const int | lineLength | |||
| ) | const [private] |
| void biu::COptionParser::coutUsage | ( | ) | const |
| bool biu::COptionParser::getBoolVal | ( | std::string | arg | ) |
Definition at line 190 of file OptionParser.cc.
| char biu::COptionParser::getCharVal | ( | std::string | arg | ) |
Definition at line 150 of file OptionParser.cc.
| double biu::COptionParser::getDoubleVal | ( | std::string | arg | ) |
Definition at line 179 of file OptionParser.cc.
| float biu::COptionParser::getFloatVal | ( | std::string | arg | ) |
Definition at line 168 of file OptionParser.cc.
| int biu::COptionParser::getIntVal | ( | std::string | arg | ) |
Definition at line 157 of file OptionParser.cc.
| std::string biu::COptionParser::getStrVal | ( | std::string | arg | ) |
Definition at line 143 of file OptionParser.cc.
| bool biu::COptionParser::isCastable | ( | std::string | val, | |
| int | type | |||
| ) | const [private] |
tests whether or not the parameters are parseable
- Parameters:
-
val the string to cast type the variable to cast to
- Returns:
- true if a cast is possible, false otherwise
Definition at line 214 of file OptionParser.cc.
| bool biu::COptionParser::noErrors | ( | ) |
| void biu::COptionParser::parseOpt | ( | int | argc, | |
| char ** | argv | |||
| ) | [private] |
Field Documentation
bool biu::COptionParser::errorOccured [private] |
std::string biu::COptionParser::infoText [private] |
unsigned int biu::COptionParser::maxOName [private] |
Definition at line 100 of file OptionParser.hh.
std::map<std::string,int> biu::COptionParser::mopt [private] |
Definition at line 101 of file OptionParser.hh.
OptionMap biu::COptionParser::opt [private] |
int biu::COptionParser::OUTPUT_LINE_LENGTH [static] |
std::string biu::COptionParser::programName [private] |
The documentation for this class was generated from the following files:
- src/biu/OptionParser.hh
- src/biu/OptionParser.cc
