Go to the documentation of this file.
61 bool initialize(
int argc,
char *argv[],
bool pretty =
true) noexcept
override;
63 void process()
override;
65 void shutDown()
override;
77 :
BasicFramework(applName,
"Example application for CommandOption"),
78 fileOpt(
'f',
"file",
"input file", true),
79 screamOpt(0,
"scream",
"print a message very loudly"),
80 restOpt(
"FILE [...]", true)
95 ifstream fs(fileOpt.getValue()[0].c_str());
99 std::perror(fileOpt.getValue()[0].c_str());
101 exitCode = BasicFramework::EXIST_ERROR;
106 cout <<
"HELLO WORLD" << endl;
107 const vector<string>& restVec = restOpt.getValue();
108 cout <<
"Remaining values:" << endl;
109 for (
unsigned i = 0; i < restVec.size(); i++)
111 cout <<
" #" << i <<
" = " << restVec[i] << endl;
120 cout <<
"Nothing to process" << endl;
127 cout <<
"Shutting down" << endl;
131 int main(
int argc,
char *argv[])
146 catch (std::exception& e)
148 cerr << e.
what() << endl;
152 cerr <<
"Caught unknown exception" << endl;
bool initialize(int argc, char *argv[], bool pretty=true) noexcept override
Process command-line arguments.
Class to show how to add a simple command-line argument to an application.
CommandOptionNoArg screamOpt
Another example.
CommandOption to take the rest of the command line.
CommandOptionRest restOpt
Everything else after the above command-line options.
std::string what() const
Dump to a string.
CommandOptionWithAnyArg fileOpt
Command-line option example.
CommandOption1Example(const string &applName)
Initialize command-line arguments.
static const int EXCEPTION_ERROR
int main(int argc, char *argv[])
int initialize(string &errors)
void shutDown() override
Clean up.
CommandOption & setMaxCount(const unsigned long l)
void process() override
Do the processing.
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:38