Go to the documentation of this file.
66 bool initialize(
int argc,
char *argv[],
bool pretty =
true) noexcept
override;
68 void process()
override;
70 void shutDown()
override;
95 :
BasicFramework(applName,
"Example application for CommandOption"),
96 gpsEWSOpt(
'o',
"ews",
"%E %G %g",
97 "\"GPSEpoch 10bitGPSweek SecondOfWeek\""),
98 gpsWSOpt(
'f',
"ws",
"%F %g",
"\"FullGPSWeek SecondOfWeek\""),
99 gpsWZOpt(
'w',
"wz",
"%F %Z",
"\"FullGPSWeek Zcount\""),
100 gpsZ29Opt(0,
"z29",
"%E %c",
"\"29bitZcount\""),
101 gpsZ32Opt(
'Z',
"z32",
"%C",
"\"32bitZcount\""),
102 screamOpt(0,
"scream",
"print a message very loudly"),
103 hushOpt(0,
"hush",
"don't print a message very loudly"),
131 for (
unsigned i = 0; i < timeOpts.size(); i++)
141 for (
unsigned j = 0; j < timeOpts[i]->getCount(); j++)
150 unsigned order = timeOpts[i]->
getOrder(j);
151 cout <<
"Option #" << order <<
" " << opt->
getValue()[j]
159 cout <<
"HELLO WORLD x" << screamOpt.getCount() << endl;
163 cout <<
"ok i'll be quiet x" << hushOpt.getCount() << endl;
169 if (which !=
nullptr)
172 <<
" (and possibly others)" << endl;
181 cout <<
"Nothing to do" << endl;
188 cout <<
"Shutting down" << endl;
192 int main(
int argc,
char *argv[])
207 catch (std::exception& e)
209 cerr << e.
what() << endl;
213 cerr <<
"Caught unknown exception" << endl;
unsigned long getOrder(unsigned long idx=-1) const
void addOption(CommandOption *opt)
Add an option to the list of mutually exclusive options.
CommandOptionNOf allTimesOption
Make sure that two of the time options have been specified.
std::string what() const
Dump to a string.
Example of using CommandOptionNOf in an application.
static const int EXCEPTION_ERROR
CommandOptionWithCommonTimeArg gpsEWSOpt
Express time as GPS epoch-week-second.
CommandOptionWithCommonTimeArg gpsZ32Opt
Express time as GPS 32-bit full zcount.
void process() override
Do the processing.
int initialize(string &errors)
CommandOptionNoArg hushOpt
Option for demonstrating CommandOptionOneOf.
void shutDown() override
Clean up.
std::vector< CommandOption * > CommandOptionVec
CommandOptionOneOf hushScreamOpt
Make sure at least one of hushOpt or screamOpt are used.
int main(int argc, char *argv[])
void addOption(CommandOption *opt)
Add an option to the list of mutually exclusive options.
CommandOption3Example(const string &applName)
Initialize command-line arguments.
CommandOptionWithCommonTimeArg gpsWSOpt
Express time as GPS fullweek-second.
std::string printTime(const CommonTime &t, const std::string &fmt)
std::string getFullOptionString() const
const std::vector< CommonTime > & getTime() const
Return the times scanned in from the command line.
const std::vector< std::string > & getValue() const
CommandOptionNoArg screamOpt
Option for demonstrating CommandOptionOneOf.
CommandOptionWithCommonTimeArg gpsZ29Opt
Express time as GPS 29-bit full zcount.
CommandOptionWithCommonTimeArg gpsWZOpt
Express time as GPS fullweek-zcount.
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