PhoenixMock
1.8.7
Tools to split/merge/print mock used in Phoenix
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
15
OptionParser
createOptionParser
(){
16
OptionParser
parser
(
true
,
"1.0.0"
);
17
parser
.addMode(
"class"
);
18
parser
.addOption(
"name"
,
"n"
,
OptionType::STRING
,
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
.addOption(
"config"
,
"c"
,
OptionType::FILENAME
,
false
,
"base name of the file to be created"
);
22
parser
.closeMode();
23
24
parser
.addMode(
"source"
);
25
parser
.addOption(
"name"
,
"n"
,
OptionType::STRING
,
true
,
"base name of the file to be created"
);
26
parser
.closeMode();
27
return
parser
;
28
}
29
30
int
main
(
int
argc,
char
** argv){
31
OptionParser
parser
=
createOptionParser
();
32
// parser.print();
33
parser
.parseArgument(argc, argv);
34
35
const
OptionMode
& classMode =
parser
.getMode(
"class"
);
36
const
OptionMode
& sourceMode =
parser
.getMode(
"source"
);
37
if
(classMode.
isParsed
()){
//We are using the class mode
38
// std::cout << "Class mode activated" << std::endl;
39
std::string className(
""
), templateDef(
""
);
40
classMode.
getValue
(className,
"name"
);
41
classMode.
getValue
(templateDef,
"template"
);
42
// std::cout << "name of the class to be generated : '" << className << "', templateDef = '"<<templateDef<<"'" << std::endl;
43
44
phoenix_assert
(
phoenix_check
(
"Check class name"
, className,
"classname"
));
45
phoenix_assert
(
phoenix_check
(
"Check type name"
, templateDef,
"typename T"
));
46
}
47
48
if
(sourceMode.
isParsed
()){
//We are using the source mode
49
// std::cout << "Source mode activated" << std::endl;
50
std::string fileName(
""
);
51
sourceMode.
getValue
(fileName,
"name"
);
52
// std::cout << "name of the header/source files to be generated : " << fileName << "'" << std::endl;
53
54
phoenix_assert
(
phoenix_check
(
"Check source name"
, fileName,
"sourcename"
));
55
}
56
return
0;
57
}
58
59
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
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
OptionParser.h
createOptionParser
OptionParser createOptionParser()
Create the OptionParser of this program.
Definition:
main.cpp:13
phoenix_assert.h
main
int main(int argc, char **argv)
Definition:
main.cpp:85
OptionMode
Describe a mode in the program arguments.
Definition:
OptionMode.h:13
OptionType::FILENAME
@ FILENAME
Definition:
OptionType.h:26
phoenix_check.h
tmp_project
OptionParser
TESTS
TEST_ParserModeMulti
main.cpp
Generated on Mon Dec 9 2024 15:33:41 for PhoenixMock by
1.8.17