![]() |
Leonetienne/Hazelnupp
Simple, easy to use, command line parameter interface
|
The main class to interface with. More...
#include <Hazelnupp.h>
Public Member Functions | |
Hazelnupp () | |
Hazelnupp (const int argc, const char *const *argv) | |
~Hazelnupp () | |
void | Parse (const int argc, const char *const *argv) |
Will parse command line arguments. More... | |
const std::string & | GetExecutableName () const |
Will return argv[0], the name of the executable. More... | |
const Value & | operator[] (const std::string &key) const |
Will return the value given a key. More... | |
bool | HasParam (const std::string &key) const |
Will check wether a parameter exists given a key, or not. More... | |
void | RegisterAbbreviation (const std::string &abbrev, const std::string &target) |
Will register an abbreviation (like -f for –force) More... | |
const std::string & | GetAbbreviation (const std::string &abbrev) const |
Will return the long form of an abbreviation (like –force for -f) More... | |
bool | HasAbbreviation (const std::string &abbrev) const |
Will check wether or not an abbreviation is registered. More... | |
void | ClearAbbreviations () |
Will delete all abbreviations. More... | |
void | RegisterConstraints (const std::vector< ParamConstraint > &constraints) |
Will register parameter constraints. More... | |
void | ClearConstraints () |
Will delete all constraints. More... | |
void | SetCrashOnFail (bool crashOnFail) |
Sets whether to crash the application, and print to stderr, when an exception is raised whilst parsing, or not. More... | |
bool | GetCrashOnFail () const |
Gets whether the application crashes on an exception whilst parsing, and prints to stderr. More... | |
void | SetCatchHelp (bool catchHelp) |
Sets whether the Hazelnupp should automatically catch the –help parameter, print the parameter documentation to stdout, and exit or not. More... | |
bool | GetCatchHelp () const |
Retruns whether the Hazelnupp should automatically catch the –help parameter, print the parameter documentation to stdout, and exit or not. More... | |
void | SetBriefDescription (const std::string &description) |
Sets a brief description of the application to be automatically added to the documentation. More... | |
const std::string & | GetBriefDescription () |
Returns the brief description of the application to be automatically added to the documentation. More... | |
void | RegisterDescription (const std::string ¶meter, const std::string &description) |
Willl register a short description for a parameter. More... | |
const std::string | GetDescription (const std::string ¶meter) const |
Will return a short description for a parameter, if it exists. More... | |
void | ClearDescription (const std::string ¶meter) |
Will delete the description of a parameter if it exists. More... | |
std::string | GenerateDocumentation () const |
Will generate a text-based documentation suited to show the user, for example on –help. More... | |
The main class to interface with.
Definition at line 11 of file Hazelnupp.h.
Hazelnupp::Hazelnupp | ( | ) |
Definition at line 14 of file Hazelnupp.cpp.
Hazelnupp::Hazelnupp | ( | const int | argc, |
const char *const * | argv | ||
) |
Definition at line 19 of file Hazelnupp.cpp.
Hazelnupp::~Hazelnupp | ( | ) |
Definition at line 25 of file Hazelnupp.cpp.
void Hazelnupp::ClearAbbreviations | ( | ) |
Will delete all abbreviations.
Definition at line 515 of file Hazelnupp.cpp.
void Hazelnupp::ClearConstraints | ( | ) |
Will delete all constraints.
Definition at line 542 of file Hazelnupp.cpp.
void Hazelnp::Hazelnupp::ClearDescription | ( | const std::string & | parameter | ) |
Will delete the description of a parameter if it exists.
Definition at line 335 of file Hazelnupp.cpp.
std::string Hazelnupp::GenerateDocumentation | ( | ) | const |
Will generate a text-based documentation suited to show the user, for example on –help.
Definition at line 342 of file Hazelnupp.cpp.
const std::string & Hazelnupp::GetAbbreviation | ( | const std::string & | abbrev | ) | const |
Will return the long form of an abbreviation (like –force for -f)
Definition at line 505 of file Hazelnupp.cpp.
const std::string & Hazelnupp::GetBriefDescription | ( | ) |
Returns the brief description of the application to be automatically added to the documentation.
Definition at line 312 of file Hazelnupp.cpp.
bool Hazelnupp::GetCatchHelp | ( | ) | const |
Retruns whether the Hazelnupp should automatically catch the –help parameter, print the parameter documentation to stdout, and exit or not.
Definition at line 301 of file Hazelnupp.cpp.
bool Hazelnupp::GetCrashOnFail | ( | ) | const |
Gets whether the application crashes on an exception whilst parsing, and prints to stderr.
Definition at line 290 of file Hazelnupp.cpp.
const std::string Hazelnp::Hazelnupp::GetDescription | ( | const std::string & | parameter | ) | const |
Will return a short description for a parameter, if it exists.
Empty string if it does not exist.
Definition at line 323 of file Hazelnupp.cpp.
const std::string & Hazelnupp::GetExecutableName | ( | ) | const |
Will return argv[0], the name of the executable.
Definition at line 485 of file Hazelnupp.cpp.
bool Hazelnupp::HasAbbreviation | ( | const std::string & | abbrev | ) | const |
Will check wether or not an abbreviation is registered.
Definition at line 510 of file Hazelnupp.cpp.
bool Hazelnupp::HasParam | ( | const std::string & | key | ) | const |
Will check wether a parameter exists given a key, or not.
Definition at line 164 of file Hazelnupp.cpp.
const Value & Hazelnupp::operator[] | ( | const std::string & | key | ) | const |
void Hazelnupp::Parse | ( | const int | argc, |
const char *const * | argv | ||
) |
Will parse command line arguments.
Definition at line 35 of file Hazelnupp.cpp.
void Hazelnupp::RegisterAbbreviation | ( | const std::string & | abbrev, |
const std::string & | target | ||
) |
Will register an abbreviation (like -f for –force)
Definition at line 499 of file Hazelnupp.cpp.
void Hazelnupp::RegisterConstraints | ( | const std::vector< ParamConstraint > & | constraints | ) |
void Hazelnp::Hazelnupp::RegisterDescription | ( | const std::string & | parameter, |
const std::string & | description | ||
) |
Willl register a short description for a parameter.
Will overwrite existing descriptions for that parameter.
Definition at line 317 of file Hazelnupp.cpp.
void Hazelnupp::SetBriefDescription | ( | const std::string & | description | ) |
Sets a brief description of the application to be automatically added to the documentation.
Definition at line 306 of file Hazelnupp.cpp.
void Hazelnupp::SetCatchHelp | ( | bool | catchHelp | ) |
Sets whether the Hazelnupp should automatically catch the –help parameter, print the parameter documentation to stdout, and exit or not.
Definition at line 295 of file Hazelnupp.cpp.
void Hazelnupp::SetCrashOnFail | ( | bool | crashOnFail | ) |
Sets whether to crash the application, and print to stderr, when an exception is raised whilst parsing, or not.
Definition at line 548 of file Hazelnupp.cpp.