|
template<class T > |
std::string | toString (const T &value) |
|
|
InfoLog | infoLog |
|
WarningLog | warningLog |
|
ErrorLog | errorLog |
|
std::map< std::string, std::string > | options |
| Holds the options lookup map.
|
|
std::map< std::string, std::string > | results |
| Stores the results for each option in the options lookup map.
|
|
std::map< std::string, bool > | parsed |
| Stores the results that have been parsed.
|
|
Definition at line 41 of file CommandLineParser.h.
CommandLineParser::CommandLineParser |
( |
| ) |
|
|
inline |
virtual CommandLineParser::~CommandLineParser |
( |
| ) |
|
|
inlinevirtual |
bool CommandLineParser::addOption |
( |
const std::string & |
option, |
|
|
const std::string & |
id |
|
) |
| |
|
inline |
Adds an option with a specific retrival id. For example, addOption("-f","filename") would add the option "-f" which can be retrived using the "filename" id.
- Parameters
-
const | std::string &option: the command line option you want to store when the command line is parsed |
const | std::string &id: the id that will be used to retrieve the data associated with the option |
- Returns
- returns true if the option was added succesfully, false otherwise
Definition at line 60 of file CommandLineParser.h.
template<class T >
bool CommandLineParser::addOption |
( |
const std::string & |
option, |
|
|
const std::string & |
id, |
|
|
const T & |
defaultValue |
|
) |
| |
|
inline |
Adds an option with a specific retrival id. For example, addOption("-f","filename") would add the option "-f" which can be retrived using the "filename" id.
- Parameters
-
const | std::string &option: the command line option you want to store when the command line is parsed |
const | std::string &id: the id that will be used to retrieve the data associated with the option |
- Returns
- returns true if the option was added succesfully, false otherwise
Definition at line 81 of file CommandLineParser.h.
template<class T >
bool CommandLineParser::get |
( |
const std::string & |
id, |
|
|
T & |
value |
|
) |
| |
|
inline |
Retrives the value associated with the relevant id and stores it in value. If the id is invalid or the type can not be parsed, then the function will return false.
- Parameters
-
const | std::string &id: the search id |
T | &value: stores the return value |
T | defaultValue = T(): sets the default return value if the id is not found |
- Returns
- returns true if the value associated with the id was found succesfully, false otherwise
Definition at line 140 of file CommandLineParser.h.
unsigned int CommandLineParser::getNumOptions |
( |
| ) |
const |
|
inline |
bool CommandLineParser::getOptionParsed |
( |
const std::string & |
id | ) |
|
|
inline |
Checks if the id was succesfully parsed from the command line. If the id is invalid or was not parsed, then the function will return false.
- Parameters
-
const | std::string &id: the search id |
- Returns
- returns true if the value associated with the id was parsed from the command line succesfully, false otherwise
Definition at line 193 of file CommandLineParser.h.
bool CommandLineParser::getValidId |
( |
const std::string & |
id | ) |
|
|
inline |
Validates if id is validate (i.e., it exists in the lookup table). Any value in the lookup table will be validate, regardless of its parsed state. If the id is invalid, then the function will return false.
- Parameters
-
const | std::string &id: the search id |
- Returns
- returns true if the value associated with the id is valid, false otherwise
Definition at line 171 of file CommandLineParser.h.
bool CommandLineParser::parse |
( |
const int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
|
inline |
Parses the command line arguments, storing any relevant results in the results buffer. The can then be accessed using the get(...) function.
- Parameters
-
const | int argc: the number of command line arguments |
char | * argv[]: an array of arguments |
- Returns
- returns true if the command line was parsed succesfully, false otherwise
Definition at line 103 of file CommandLineParser.h.
bool CommandLineParser::setErrorLoggingEnabled |
( |
const bool |
loggingEnabled | ) |
|
|
inline |
Sets if error logging is enabled/disabled for this specific instance. If you want to enable/disable error logging globally, then you should use the ErrorLog::enableLogging( bool ) function.
- Returns
- returns true if the parameter was updated, false otherwise
Definition at line 239 of file CommandLineParser.h.
bool CommandLineParser::setInfoLoggingEnabled |
( |
const bool |
loggingEnabled | ) |
|
|
inline |
Sets if info logging is enabled/disabled for this specific instance. If you want to enable/disable info logging globally, then you should use the InfoLog::enableLogging( bool ) function.
- Returns
- returns true if the parameter was updated, false otherwise
Definition at line 219 of file CommandLineParser.h.
bool CommandLineParser::setWarningLoggingEnabled |
( |
const bool |
loggingEnabled | ) |
|
|
inline |
Sets if warning logging is enabled/disabled for this specific instance. If you want to enable/disable warning logging globally, then you should use the WarningLog::enableLogging( bool ) function.
- Returns
- returns true if the parameter was updated, false otherwise
Definition at line 229 of file CommandLineParser.h.
The documentation for this class was generated from the following file: