Jpp
examples
Jeep
JParser.cc
Go to the documentation of this file.
1
#include <iostream>
2
#include <iomanip>
3
#include <string>
4
#include <map>
5
6
#include "
Jeep/JParser.hh
"
7
#include "
Jeep/JMessage.hh
"
8
9
10
/**
11
* \file
12
*
13
* Example program to test JPARSER::JParser.
14
* \author mdejong
15
*/
16
int
main
(
int
argc,
char
**argv)
17
{
18
using namespace
std
;
19
20
string
text
;
21
bool
a, b, c;
22
map<int, int>
buffer;
23
int
debug
;
24
25
try
{
26
27
JParser<>
zap(
"Example program to test command line parser."
);
28
29
zap[
'T'
] =
make_field
(
text
,
"this is some text"
);
30
zap[
'a'
] =
make_field
(a);
// default set to false; not mandatory to set
31
zap[
'b'
] =
make_field
(b);
// default set to false; not mandatory to set
32
zap[
'c'
] =
make_field
(c);
// default set to false; not mandatory to set
33
zap[
'!'
] =
make_field
(buffer) =
JPARSER::initialised
();
// not mandatory to set
34
zap[
'd'
] =
make_field
(
debug
) = 3, 0, 1, 2;
// default value, and possible values
35
36
zap(argc, argv);
37
}
38
catch
(
const
exception &error) {
39
FATAL
(error.what() << endl);
40
}
41
}
text
char text[TEXT_SIZE]
Definition:
elog.cc:72
JMessage.hh
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e.
Definition:
JParser.hh:63
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
debug
int debug
debug level
Definition:
JSirene.cc:59
std::map
Definition:
JSTDTypes.hh:16
JParser.hh
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
std
Definition:
jaanetDictionary.h:36
main
int main(int argc, char **argv)
Definition:
JParser.cc:16
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
Generated by
1.8.16