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.setExampleLongOption("test_plib_optionparser_int --value=42");
18  parser.setExampleShortOption("test_plib_optionparser_int -n 42");
19  parser.addOption("value", "n", OptionType::INT, true, "Required option");
20  return parser;
21 }

References OptionType::INT, and createReleaseCurl::parser.

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 33 of file main.cpp.

33  {
35  parser.parseArgument(argc, argv);
36  parser.print();
38  const OptionMode & noneMode = parser.getMode("NotExistingMode");
39  noneMode.print();
40 
41  OptionParser parser2(parser), parser3;
42  parser2.print();
43  parser3 = parser;
44  parser3.print();
45 
46  const OptionMode & defaultMode = parser.getDefaultMode();
47  int value(0);
48  defaultMode.getValue(value, "value");
49 // std::cout << "value = '" << value << "'" << std::endl;
50 
51  phoenix_assert(phoenix_check("Value", value, 42));
52  return 0;
53 }

References createOptionParser(), OptionMode::getValue(), createReleaseCurl::parser, phoenix_assert, phoenix_check(), OptionMode::print(), OptionParser::print(), 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 26 of file main.cpp.

26  {
27  const OptionMode & noneMode = parser.getMode("NotExistingMode");
28  noneMode.print();
29  const OptionMode & defaultMode = parser.getDefaultMode();
30  defaultMode.print();
31 }

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

+ Here is the call graph for this function:
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
OptionParser::print
void print() const
Print all the options.
Definition: OptionParser.cpp:105
createReleaseCurl.parser
parser
Definition: createReleaseCurl.py:123
OptionType::INT
@ INT
Definition: OptionType.h:32
OptionParser
Parse the options passed to a program.
Definition: OptionParser.h:15
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