23 const string& description):
25 _description(description) {
46 unsigned int paramCount) {
47 if (from <= paramCount && paramCount <= to)
52 errorMsg <<
"Option -" <<
getName() <<
" takes ";
55 errorMsg <<
"one parameter, ";
57 errorMsg << from <<
" parameters, ";
59 errorMsg <<
"from " << from <<
" to " << to <<
" parameters, ";
62 errorMsg <<
"but no parameters were provided.\n";
65 errorMsg <<
"but one parameter was provided.";
67 errorMsg <<
"but " << paramCount <<
" parameters were provided.";
70 errorMsg <<
"The provided parameters were: ";
71 const char* prefix =
"";
72 for (
unsigned int i = 0; i < paramCount; ++i) {
73 errorMsg << prefix << params[i];
80 "(Did you forget to put a - in front of one of the options?)\n";
83 errorMsg <<
"The option -"
85 <<
" has the following description:\n "
A replacement for stringstream.
virtual void doProcessArguments(const char **args, size_t argCount)=0
void processArguments(const char **args, size_t argCount)
const string & getName() const
virtual pair< size_t, size_t > doGetArgumentCountRange() const =0
const string & getDescription() const
void appendToDescription(const char *str)
Parameter(const string &name, const string &description)
void checkCorrectParameterCount(unsigned int from, unsigned int to, const char **params, unsigned int paramCount)
void reportError(const string &errorMsg)