Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
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 */
16int 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}
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
int main(int argc, char **argv)
Definition JParser.cc:16
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
Utility class to parse command line options.
Definition JParser.hh:1698
char text[TEXT_SIZE]
Definition elog.cc:72
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition JParser.hh:68