PhoenixMock  1.8.7
Tools to split/merge/print mock used in Phoenix
main.cpp File Reference
#include "phoenix_assert.h"
#include "phoenix_check.h"
#include "OptionParser.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

OptionParser createOptionParser ()
 Create the OptionParser of this program. More...
 
int main (int argc, char **argv)
 
void printConstParser (const OptionParser &parser)
 Do the same thing but with a const parser. More...
 

Function Documentation

◆ createOptionParser()

OptionParser createOptionParser ( )

Create the OptionParser of this program.

Returns
OptionParser of this program

Definition at line 15 of file main.cpp.

15  {
16  OptionParser parser(true, "1.0.0");
17  parser.addMode("class");
18  parser.addOption("name", "n", OptionType::FILENAME, true, "base name of the file to be created");
19  std::string templateDef("");
20  parser.addOption("template", "t", templateDef, "template definition of the class (ex: 'typename T' or 'typename T, typename U', etc");
21  parser.closeMode();
22 
23  parser.addMode("source");
24  parser.addOption("name", "n", OptionType::STRING, true, "base name of the file to be created");
25  parser.closeMode();
26  return parser;
27 }

References OptionType::FILENAME, createReleaseCurl::parser, and OptionType::STRING.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 39 of file main.cpp.

39  {
41  parser.print();
42  parser.parseArgument(argc, argv);
44  const OptionMode & classMode = parser.getMode("class");
45  const OptionMode & sourceMode = parser.getMode("source");
46 
47  if(classMode.isParsed()){ //We are using the class mode
48  std::cout << "Class mode activated" << std::endl;
49  std::string className("");
50  classMode.getValue(className, "name");
51  std::cout << "name of the class to be generated : '" << className << "'" << std::endl;
52 
53  phoenix_assert(phoenix_check("Check class name", className, "classname"));
54  }
55 
56  if(sourceMode.isParsed()){ //We are using the source mode
57  std::cout << "Source mode activated" << std::endl;
58  std::string fileName("");
59  sourceMode.getValue(fileName, "name");
60  std::cout << "name of the header/source files to be generated : " << fileName << "'" << std::endl;
61 
62  phoenix_assert(phoenix_check("Check file name", fileName, "sourcename"));
63  }
64  return 0;
65 }

References createOptionParser(), OptionMode::getValue(), OptionMode::isParsed(), createReleaseCurl::parser, phoenix_assert, phoenix_check(), and printConstParser().

+ Here is the call graph for this function:

◆ printConstParser()

void printConstParser ( const OptionParser parser)

Do the same thing but with a const parser.

Parameters
parser: OptionParser to be used

Definition at line 32 of file main.cpp.

32  {
33  const OptionMode & noneMode = parser.getMode("class");
34  noneMode.print();
35  const OptionMode & defaultMode = parser.getDefaultMode();
36  defaultMode.print();
37 }

References createReleaseCurl::parser, and OptionMode::print().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
OptionType::STRING
@ STRING
Definition: OptionType.h:25
OptionMode::getValue
bool getValue(T &value, const std::string &optionName) const
Get the value of the option.
Definition: OptionMode_impl.h:18
OptionMode::print
void print() const
Print the option of the mode.
Definition: OptionMode.cpp:104
phoenix_check
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.
Definition: phoenix_check.cpp:17
createReleaseCurl.parser
parser
Definition: createReleaseCurl.py:123
OptionParser
Parse the options passed to a program.
Definition: OptionParser.h:15
OptionMode::isParsed
bool isParsed() const
Say if the OptionMode contains option which are parsed.
Definition: OptionMode.cpp:187
phoenix_assert
#define phoenix_assert(isOk)
Definition: phoenix_assert.h:19
createOptionParser
OptionParser createOptionParser()
Create the OptionParser of this program.
Definition: main.cpp:13
printConstParser
void printConstParser(const OptionParser &parser)
Do the same thing but with a const parser.
Definition: main.cpp:32
OptionMode
Describe a mode in the program arguments.
Definition: OptionMode.h:13
OptionType::FILENAME
@ FILENAME
Definition: OptionType.h:26