Go to the documentation of this file.
69 bool initialize(
int argc,
char *argv[],
bool pretty =
true) noexcept
override;
71 void process()
override;
73 void shutDown()
override;
96 :
BasicFramework(applName,
"Example application for CommandOption"),
97 xOpt(
'x',
"",
"you say you want an x"),
98 yOpt(
'y',
"",
"you say you want an y"),
99 zOpt(
'z',
"",
"you say you want an z"),
100 screamOpt(0,
"scream",
"print a message very loudly"),
101 hushOpt(0,
"hush",
"don't print a message very loudly"),
102 hushAndXYZOpt(&xyzOpts, &hushOpt)
121 cout <<
"HELLO WORLD x" << screamOpt.getCount() << endl;
125 cout <<
"ok i'll be quiet x" << hushOpt.getCount() << endl;
129 if (which !=
nullptr)
133 cout <<
"You specified x,y, and/or z a total of " << xyzOpts.getCount()
142 cout <<
"Nothing to do" << endl;
149 cout <<
"Shutting down" << endl;
153 int main(
int argc,
char *argv[])
168 catch (std::exception& e)
170 cerr << e.
what() << endl;
174 cerr <<
"Caught unknown exception" << endl;
CommandOptionNoArg xOpt
generic option x
void addOption(CommandOption *opt)
Add an option to the list of mutually exclusive options.
int main(int argc, char *argv[])
std::string what() const
Dump to a string.
CommandOption5Example(const string &applName)
Initialize command-line arguments.
void shutDown() override
Clean up.
static const int EXCEPTION_ERROR
CommandOptionGroupOr xyzOpts
Virtual option that is "set" if x y or z are in use.
int initialize(string &errors)
CommandOptionNoArg zOpt
generic option z
void process() override
Do the processing.
CommandOptionNoArg yOpt
generic option y
CommandOptionNoArg hushOpt
Option for demonstrating CommandOptionOneOf.
CommandOptionDependent hushAndXYZOpt
Make sure that if xyz options are used, hush is specified.
Example of using CommandOptionNOf in an application.
std::string getFullOptionString() const
CommandOptionNoArg screamOpt
Option for demonstrating CommandOptionOneOf.
CommandOptionMutex hushOrScreamOpt
Make sure only one of hushOpt or screamOpt are used.
bool initialize(int argc, char *argv[], bool pretty=true) noexcept override
Process command-line arguments.
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38