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 "print_string.h"
#include "Option.h"
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 
void printValueOfOpt (Option &opt)
 Print value of Option. More...
 
void printValueOfOptConst (const Option &opt)
 Print value of Option. More...
 
void testOption ()
 Test the option type. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file main.cpp.

58  {
59  testOption();
60  return 0;
61 }

References testOption().

+ Here is the call graph for this function:

◆ printValueOfOpt()

void printValueOfOpt ( Option opt)

Print value of Option.

Parameters
opt: Option to be printed

Definition at line 29 of file main.cpp.

29  {
30  phoenix_print(opt.getDocString(), "", "Docstring : ");
31  phoenix_print(opt.getLongName(), "", "LongName : ");
32  phoenix_print(opt.getShortName(), "", "ShortName : ");
33  phoenix_print(opt.getValue().getValue(), "", "Value : ");
34  phoenix_print(opt.isRequired(), "", "IsRequired : ");
35  phoenix_print(opt.isAllowEmpty(), "", "IsAllowEmpty : ");
36 }

References Option::getDocString(), Option::getLongName(), Option::getShortName(), OptionValue::getValue(), Option::getValue(), Option::isAllowEmpty(), Option::isRequired(), and phoenix_print().

Referenced by testOption(), and testOptionValue().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printValueOfOptConst()

void printValueOfOptConst ( const Option opt)

Print value of Option.

Parameters
opt: Option to be printed

Definition at line 17 of file main.cpp.

17  {
18  phoenix_print(opt.getDocString(), "", "Docstring : ");
19  phoenix_print(opt.getLongName(), "", "LongName : ");
20  phoenix_print(opt.getShortName(), "", "ShortName : ");
21  phoenix_print(opt.getValue().getValue(), "", "Value : ");
22  phoenix_print(opt.isRequired(), "", "IsRequired : ");
23  phoenix_print(opt.isAllowEmpty(), "", "IsAllowEmpty : ");
24 }

References Option::getDocString(), Option::getLongName(), Option::getShortName(), OptionValue::getValue(), Option::getValue(), Option::isAllowEmpty(), Option::isRequired(), and phoenix_print().

Referenced by testOption().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ testOption()

void testOption ( )

Test the option type.

Definition at line 39 of file main.cpp.

39  {
40  Option opt("long", "short", "value", "some doc");
41  printValueOfOpt(opt);
43 
44  Option optReq("long", "short", true, "some doc");
45  printValueOfOptConst(optReq);
46 
47  Option optSet;
48  optSet.setDocString("Some doc");
49  optSet.setLongName("long");
50  optSet.setShortName("short");
51  optSet.setValue(OptionValue("Value", OptionType::STRING));
52  optSet.setIsRequired(true);
53  optSet.setIsAllowEmpty(true);
54  optSet.setIsParsed(false);
55  printValueOfOptConst(optSet);
56 }

References printValueOfOpt(), printValueOfOptConst(), Option::setDocString(), Option::setIsAllowEmpty(), Option::setIsParsed(), Option::setIsRequired(), Option::setLongName(), Option::setShortName(), Option::setValue(), and OptionType::STRING.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:
Option::isRequired
bool isRequired() const
Get if the option is required.
Definition: Option.cpp:212
Option::setIsParsed
void setIsParsed(bool isParsed)
Say if the Option has been parsed or not.
Definition: Option.cpp:172
phoenix_print
void phoenix_print(const T &data, const std::string &suffix="", const std::string &prefix="")
Print data.
Definition: print_string_impl.h:18
printValueOfOpt
void printValueOfOpt(Option &opt)
Print value of Option.
Definition: main.cpp:29
OptionType::STRING
@ STRING
Definition: OptionType.h:25
Option::setDocString
void setDocString(const std::string &docString)
Set the documentation string of the Option.
Definition: Option.cpp:167
Option::getValue
const OptionValue & getValue() const
Get the value of the Option.
Definition: Option.cpp:202
printValueOfOptConst
void printValueOfOptConst(const Option &opt)
Print value of Option.
Definition: main.cpp:17
Option::isAllowEmpty
bool isAllowEmpty() const
Get if the option value can be empty.
Definition: Option.cpp:222
Option::setLongName
void setLongName(const std::string &longName)
Set the long name of the option.
Definition: Option.cpp:147
Option::setValue
void setValue(const OptionValue &value)
Set the value of the option.
Definition: Option.cpp:157
testOption
void testOption()
Test the option type.
Definition: main.cpp:39
Option::getShortName
const std::string & getShortName() const
Get the short name of the Option.
Definition: Option.cpp:192
Option::setShortName
void setShortName(const std::string &shortName)
Set the short name of the option.
Definition: Option.cpp:152
Option::getLongName
const std::string & getLongName() const
Get the long name of the Option.
Definition: Option.cpp:182
Option
Definition: Option.h:13
OptionValue::getValue
const VecValue & getValue() const
Get the vector of values.
Definition: OptionValue.cpp:131
Option::setIsAllowEmpty
void setIsAllowEmpty(bool isAllowEmpty)
Say if the option can be empty or not.
Definition: Option.cpp:177
OptionValue
Describe the value of an option passed to a program.
Definition: OptionValue.h:20
Option::setIsRequired
void setIsRequired(bool isRequired)
Set if the option is required.
Definition: Option.cpp:162
Option::getDocString
const std::string & getDocString() const
Get the documentation string of the Option.
Definition: Option.cpp:232