CPUnit 0.95 (beta)
The REAL C++ port of JUnit.
|
Class implementing command line parsing functionality. More...
#include <cpunit_CmdLineParser.hpp>
Public Member Functions | |
CmdLineParser () | |
CmdLineParser (const CmdLineParser &p) | |
virtual | ~CmdLineParser () |
CmdLineParser & | operator= (const CmdLineParser &p) |
void | add_legal (const std::string &s) |
void | parse (const int argc, const char **cmdline) |
bool | has (const std::string &arg) const |
bool | has_one_of (const std::string &arg) const |
template<class T > | |
T | value_of (const std::string &arg) const |
const std::vector< std::string > & | program_input () const |
std::string | to_string () const |
Private Member Functions | |
void | parse_long_token (const std::string &token) |
A long token is a string prepended by '--'. | |
void | parse_short_token (const std::string &token) |
A short token is a string prepended by '-'. | |
Private Attributes | |
std::set< std::string > | legal_args |
std::map< std::string, std::string > | args |
std::vector< std::string > | input |
Static Private Attributes | |
static const std::string | BLANKS |
Class implementing command line parsing functionality.
The parser is used in the following manner:
Definition at line 57 of file cpunit_CmdLineParser.hpp.
cpunit::CmdLineParser::CmdLineParser | ( | ) |
Definition at line 38 of file cpunit_CmdLineParser.cpp.
cpunit::CmdLineParser::CmdLineParser | ( | const CmdLineParser & | p | ) |
Definition at line 44 of file cpunit_CmdLineParser.cpp.
cpunit::CmdLineParser::~CmdLineParser | ( | ) | [virtual] |
Definition at line 50 of file cpunit_CmdLineParser.cpp.
void cpunit::CmdLineParser::add_legal | ( | const std::string & | s | ) |
Definition at line 64 of file cpunit_CmdLineParser.cpp.
bool cpunit::CmdLineParser::has | ( | const std::string & | arg | ) | const |
Definition at line 162 of file cpunit_CmdLineParser.cpp.
bool cpunit::CmdLineParser::has_one_of | ( | const std::string & | arg | ) | const |
Definition at line 173 of file cpunit_CmdLineParser.cpp.
cpunit::CmdLineParser & cpunit::CmdLineParser::operator= | ( | const CmdLineParser & | p | ) |
Definition at line 54 of file cpunit_CmdLineParser.cpp.
void cpunit::CmdLineParser::parse | ( | const int | argc, |
const char ** | cmdline | ||
) |
Definition at line 89 of file cpunit_CmdLineParser.cpp.
void cpunit::CmdLineParser::parse_long_token | ( | const std::string & | token | ) | [private] |
A long token is a string prepended by '--'.
Definition at line 141 of file cpunit_CmdLineParser.cpp.
void cpunit::CmdLineParser::parse_short_token | ( | const std::string & | token | ) | [private] |
A short token is a string prepended by '-'.
Definition at line 112 of file cpunit_CmdLineParser.cpp.
const std::vector< std::string > & cpunit::CmdLineParser::program_input | ( | ) | const |
Definition at line 198 of file cpunit_CmdLineParser.cpp.
std::string cpunit::CmdLineParser::to_string | ( | ) | const |
Definition at line 203 of file cpunit_CmdLineParser.cpp.
T cpunit::CmdLineParser::value_of | ( | const std::string & | arg | ) | const |
Definition at line 36 of file cpunit_CmdLineParser.tcc.
std::map<std::string, std::string> cpunit::CmdLineParser::args [private] |
Definition at line 61 of file cpunit_CmdLineParser.hpp.
const std::string cpunit::CmdLineParser::BLANKS [static, private] |
Definition at line 58 of file cpunit_CmdLineParser.hpp.
std::vector<std::string> cpunit::CmdLineParser::input [private] |
Definition at line 62 of file cpunit_CmdLineParser.hpp.
std::set<std::string> cpunit::CmdLineParser::legal_args [private] |
Definition at line 60 of file cpunit_CmdLineParser.hpp.