PhoenixInkscape  2.0.0
Generate multiple png files with svg inkscape files
main.cpp File Reference
#include "phoenix_assert.h"
#include "phoenix_check.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, const PString &expectedLongOption, const PString &expectedShortOption, size_t expectedNbValue, bool expectedIsRequired, bool expectedAllowEmpty, const PString &expectedDocString)
 Print value of Option. More...
 
void printValueOfOptConst (const Option &opt, const PString &expectedLongOption, const PString &expectedShortOption, size_t expectedNbValue, bool expectedIsRequired, bool expectedAllowEmpty, const PString &expectedDocString)
 Print value of Option. More...
 
void testOption ()
 Test the option type. More...
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 73 of file main.cpp.

73  {
74  testOption();
75  return 0;
76 }
void testOption()
Test the option type.
Definition: main.cpp:54

References testOption().

+ Here is the call graph for this function:

◆ printValueOfOpt()

void printValueOfOpt ( Option opt,
const PString expectedLongOption,
const PString expectedShortOption,
size_t  expectedNbValue,
bool  expectedIsRequired,
bool  expectedAllowEmpty,
const PString expectedDocString 
)

Print value of Option.

Parameters
opt: Option to be printed
expectedLongOption: expected long option
expectedShortOption: expected short option
expectedNbValue: expected number of values
expectedIsRequired: expected value of is required
expectedAllowEmpty: expected value of is empty
expectedDocString: expected docstring

Definition at line 42 of file main.cpp.

44 {
45  phoenix_assert(phoenix_check("printValueOfOpt : docstring", opt.getDocString(), expectedDocString));
46  phoenix_assert(phoenix_check("printValueOfOpt : long name", opt.getLongName(), expectedLongOption));
47  phoenix_assert(phoenix_check("printValueOfOpt : short name", opt.getShortName(), expectedShortOption));
48  phoenix_assert(phoenix_check("printValueOfOpt : value", opt.getValue().getValue().size(), expectedNbValue));
49  phoenix_assert(phoenix_check("printValueOfOpt : isRequired", opt.isRequired(), expectedIsRequired));
50  phoenix_assert(phoenix_check("printValueOfOpt : isAllowEmpty", opt.isAllowEmpty(), expectedAllowEmpty));
51 }
const PVecString & getValue() const
Get the vector of values.
const PString & getLongName() const
Get the long name of the Option.
Definition: Option.cpp:189
const OptionValue & getValue() const
Get the value of the Option.
Definition: Option.cpp:209
const PString & getDocString() const
Get the documentation string of the Option.
Definition: Option.cpp:239
const PString & getShortName() const
Get the short name of the Option.
Definition: Option.cpp:199
bool isAllowEmpty() const
Get if the option value can be empty.
Definition: Option.cpp:229
bool isRequired() const
Get if the option is required.
Definition: Option.cpp:219
#define phoenix_assert(isOk)
bool phoenix_check(const std::string &testName, const std::string &val, const std::string &reference)
Check two string.

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

Referenced by testOption().

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

◆ printValueOfOptConst()

void printValueOfOptConst ( const Option opt,
const PString expectedLongOption,
const PString expectedShortOption,
size_t  expectedNbValue,
bool  expectedIsRequired,
bool  expectedAllowEmpty,
const PString expectedDocString 
)

Print value of Option.

Parameters
opt: Option to be printed
expectedLongOption: expected long option
expectedShortOption: expected short option
expectedNbValue: expected number of values
expectedIsRequired: expected value of is required
expectedAllowEmpty: expected value of is empty
expectedDocString: expected docstring

Definition at line 22 of file main.cpp.

24 {
25  phoenix_assert(phoenix_check("printValueOfOptConst : docstring", opt.getDocString(), expectedDocString));
26  phoenix_assert(phoenix_check("printValueOfOptConst : long name", opt.getLongName(), expectedLongOption));
27  phoenix_assert(phoenix_check("printValueOfOptConst : short name", opt.getShortName(), expectedShortOption));
28  phoenix_assert(phoenix_check("printValueOfOptConst : value", opt.getValue().getValue().size(), expectedNbValue));
29  phoenix_assert(phoenix_check("printValueOfOptConst : isRequired", opt.isRequired(), expectedIsRequired));
30  phoenix_assert(phoenix_check("printValueOfOptConst : isAllowEmpty", opt.isAllowEmpty(), expectedAllowEmpty));
31 }

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

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 54 of file main.cpp.

54  {
55  Option opt("long", "short", false, "some doc");
56  printValueOfOpt(opt, "long", "short", 0lu, false, false, "some doc");
57  printValueOfOptConst(opt, "long", "short", 0lu, false, false, "some doc");
58 
59  Option optReq("long", "short", true, "some doc");
60  printValueOfOptConst(optReq, "long", "short", 0lu, true, false, "some doc");
61 
62  Option optSet;
63  optSet.setDocString("Some doc");
64  optSet.setLongName("long");
65  optSet.setShortName("short");
66  optSet.setValue(OptionValue("Value", OptionType::STRING));
67  optSet.setIsRequired(true);
68  optSet.setIsAllowEmpty(true);
69  optSet.setIsParsed(false);
70  printValueOfOptConst(optSet, "long", "short", 1lu, true, true, "Some doc");
71 }
Describe the value of an option passed to a program.
Definition: OptionValue.h:16
Describes an option passed to a program.
Definition: Option.h:14
void setIsParsed(bool isParsed)
Say if the Option has been parsed or not.
Definition: Option.cpp:179
void setIsAllowEmpty(bool isAllowEmpty)
Say if the option can be empty or not.
Definition: Option.cpp:184
void setLongName(const PString &longName)
Set the long name of the option.
Definition: Option.cpp:154
void setShortName(const PString &shortName)
Set the short name of the option.
Definition: Option.cpp:159
void setIsRequired(bool isRequired)
Set if the option is required.
Definition: Option.cpp:169
void setValue(const OptionValue &value)
Set the value of the option.
Definition: Option.cpp:164
void setDocString(const PString &docString)
Set the documentation string of the Option.
Definition: Option.cpp:174
void printValueOfOpt(Option &opt, const PString &expectedLongOption, const PString &expectedShortOption, size_t expectedNbValue, bool expectedIsRequired, bool expectedAllowEmpty, const PString &expectedDocString)
Print value of Option.
Definition: main.cpp:42
void printValueOfOptConst(const Option &opt, const PString &expectedLongOption, const PString &expectedShortOption, size_t expectedNbValue, bool expectedIsRequired, bool expectedAllowEmpty, const PString &expectedDocString)
Print value of Option.
Definition: main.cpp:22

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: