PhoenixPresentation  2.0.0
Set of cmake function to automate presentation generation
main.cpp
Go to the documentation of this file.
1 
2 /***************************************
3  Auteur : Pierre Aubert
4  Mail : pierre.aubert@lapp.in2p3.fr
5  Licence : CeCILL-C
6 ****************************************/
7 
8 #include "phoenix_assert.h"
9 #include "phoenix_check.h"
10 #include "OptionParser.h"
11 
13 
16  OptionParser parser(true, "1.0.0");
17  parser.addOption("plugin", "p", OptionType::FILENAME, true, "Required option");
18 
19  std::string defaultConfigHost("");
20  parser.addOption("config", "c", defaultConfigHost, "Optional value");
21 
22  parser.addOption("loadonly", "l", OptionType::NONE, false, "Optional Trigger option");
23  return parser;
24 }
25 
26 int main(int argc, char** argv){
28  parser.parseArgument(argc, argv);
29 
30  const OptionMode & defaultMode = parser.getDefaultMode();
31  std::string pluginOption("");
32  defaultMode.getValue(pluginOption, "plugin");
33 // std::cout << "pluginOption = '" << pluginOption << "'" << std::endl;
34 
35  phoenix_assert(phoenix_check("Check ", pluginOption, "RequiredOptionValue"));
36  return 0;
37 }
38 
39 
int main(int argc, char **argv)
Definition: main.cpp:228
OptionParser createOptionParser()
Create the OptionParser of this program.
Definition: main.cpp:17
Describe a mode in the program arguments.
Definition: OptionMode.h:13
bool getValue(T &value, const PString &optionName) const
Get the value of the option.
Parse the options passed to a program.
Definition: OptionParser.h:15
void parseArgument(int argc, char **argv)
Parse the arguments passed to the program.
void addOption(const PString &longOption, const PString &shortOption, OptionType::OptionType optionType, bool isRequired, const PString &docString)
Add an option in the OptionParser.
const OptionMode & getDefaultMode() const
Get default mode.
#define phoenix_assert(isOk)
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.