Go to the documentation of this file.
49 #include "tce_version_string.h"
74 std::string description,
75 std::string version) :
78 description_(description),
112 for (
int i = 1; i < argc; i++) {
133 for (
int i = 1; i < argc; i++) {
152 for (
unsigned int i = 1; i < argv.size(); i++) {
168 bool finished =
false;
172 bool checkArguments =
true;
181 string arguments =
"";
184 bool hasArgument =
true;
187 optString, name, arguments, prefix, hasArgument)) {
189 if (optString ==
"--") {
190 checkArguments =
false;
201 if (name ==
"help" || name ==
"h") {
203 string msg =
"The client should not proceed";
204 string method =
"CmdLineParser::parseAll()";
206 }
else if (name ==
"version") {
208 string msg =
"The client should not proceed";
209 string method =
"CmdLineParser::parseAll()";
215 if (arguments ==
"" &&
227 bool doneWithParsing = opt->
parseValue(arguments, prefix);
229 if (!doneWithParsing) {
238 for (
unsigned int i = 0; i < arguments.length(); i++) {
247 if (checkArguments && optString[0] ==
'-') {
248 string msg =
"Illegal command line argument: " + optString;
249 string method =
"CmdLineOptions::parse()";
264 cout <<
"Options:" << endl;
278 int charsPrintedInRow = 0;
280 std::string nextToken =
"";
282 if (nextToken.size() + charsPrintedInRow > 60) {
285 charsPrintedInRow = 0;
287 cout << nextToken <<
" ";
288 charsPrintedInRow += nextToken.size();
std::string description_
The description of usage of program.
static const std::string VERBOSE_SPAM_SWITCH
Switch for verbose output listing spam from scheduler internals.
static const int LONG_FLAG
Number of characters reserved for printing long version of commandline flag.
std::vector< std::string > commandLine_
Command line is stored here.
std::map< std::string, CmdLineOptionParser * > optionLongNames_
Database for holding options with their long names as a key.
bool optionGiven(std::string key) const
std::string progName_
The name of the program.
std::string shortName() const
virtual bool parseValue(std::string arguments, std::string prefix)=0
Pure virtual function that parses the value of option.
bool parseOption(std::string option, std::string &name, std::string &arguments, std::string &prefix, bool &hasArgument) const
void addOption(CmdLineOptionParser *opt)
virtual ~CmdLineOptions()
CmdLineOptions(std::string description, std::string version="")
std::vector< std::string > arguments_
Command line arguments are stored here.
virtual bool isVerboseSwitchDefined() const
std::string longName() const
virtual void printHelp() const
void parse(char *argv[], int argc)
static const int SHORT_FLAG
Number of characters reserved for printing short version of commandline flag.
std::string description() const
virtual void printVersion() const =0
std::map< std::string, CmdLineOptionParser * >::const_iterator constMapIter
For traversing const maps.
static const std::string VERBOSE_SWITCH
Switch for verbose output listing scheduler modules.
CmdLineOptionParser * findOption(std::string name) const
virtual bool isVerboseSpamSwitchDefined() const