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 "
OptionParser.h
"
9
11
13
OptionParser
createOptionParser
(){
14
std::cerr <<
"createOptionParser : create the option parser :"
<< std::endl;
15
OptionParser
parser
(
true
,
"1.0.0"
);
16
parser
.setExampleLongOption(
"phoenix_tex2html --input=fileInput.tex --output=\"output/Directory\""
);
17
parser
.setExampleShortOption(
"phoenix_tex2html -i fileInput.tex -o output/Directory"
);
18
19
parser
.addOption(
"input"
,
"i"
,
OptionType::FILENAME
,
true
,
"name of the input file"
);
20
21
std::string defaultOutputDir(
"."
);
22
parser
.addOption(
"output"
,
"o"
, defaultOutputDir,
"output directory where the files will be generated"
);
23
24
std::string bibliographyFile(
""
);
25
parser
.addOption(
"bibliography"
,
"b"
, bibliographyFile,
"input bibliography file"
);
26
std::string includeDir(
"."
);
27
parser
.addOption(
"includedirs"
,
"I"
, includeDir,
"list of include directories"
);
28
29
parser
.addOption(
"mathjax"
,
"j"
,
OptionType::NONE
,
false
,
"enable the MathJax backend instead of the Latex one"
);
30
return
parser
;
31
}
32
33
int
main
(
int
argc,
char
** argv){
34
OptionParser
parser
=
createOptionParser
();
35
std::cerr <<
"createOptionParser : parse the argument"
<< std::endl;
36
parser
.parseArgument(argc, argv);
37
38
const
OptionMode
& defaultMode =
parser
.getDefaultMode();
39
std::string inputFile;
40
defaultMode.
getValue
(inputFile,
"input"
);
41
std::cout <<
"inputFile = '"
<< inputFile <<
"'"
<< std::endl;
42
43
std::string outputDir(
"."
);
44
defaultMode.
getValue
(outputDir,
"output"
);
45
46
if
(outputDir ==
""
){
47
outputDir =
"."
;
48
}
49
std::cout <<
"outputDir = '"
<< outputDir <<
"'"
<< std::endl;
50
51
std::string inputBibliography(
""
);
52
defaultMode.
getValue
(inputBibliography,
"bibliography"
);
53
std::cout <<
"inputBibliography = '"
<< inputBibliography <<
"'"
<< std::endl;
54
55
std::list<std::string> listInclude;
56
defaultMode.
getValue
(listInclude,
"includedirs"
);
57
std::cout <<
"listInclude :"
<< std::endl;
58
for
(std::list<std::string>::iterator it(listInclude.begin()); it != listInclude.end(); ++it){
59
std::cout <<
"\t"
<< (*it) << std::endl;
60
}
61
62
bool
useMathJax = defaultMode.
isOptionExist
(
"mathjax"
);
63
std::cout <<
"useMathJax = "
<< useMathJax << std::endl;
64
65
return
0;
66
}
67
68
OptionMode::getValue
bool getValue(T &value, const std::string &optionName) const
Get the value of the option.
Definition:
OptionMode_impl.h:18
createReleaseCurl.parser
parser
Definition:
createReleaseCurl.py:123
OptionParser
Parse the options passed to a program.
Definition:
OptionParser.h:15
OptionType::NONE
@ NONE
Definition:
OptionType.h:24
OptionParser.h
OptionMode::isOptionExist
bool isOptionExist(const std::string &optionName) const
Say if the given option has been passed to the program.
Definition:
OptionMode.cpp:195
createOptionParser
OptionParser createOptionParser()
Create the OptionParser of this program.
Definition:
main.cpp:13
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
tmp_project
OptionParser
TESTS
TEST_ParserOptionMulti
main.cpp
Generated on Mon Dec 9 2024 15:33:41 for PhoenixMock by
1.8.17