Jpp
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JLang
JToken.cc
Go to the documentation of this file.
1
2
#include <iostream>
3
#include <iomanip>
4
#include <vector>
5
6
#include "
JLang/JToken.hh
"
7
8
#include "
Jeep/JParser.hh
"
9
#include "
Jeep/JMessage.hh
"
10
11
12
/**
13
* \file
14
*
15
* Example program to test JLANG::JToken class.
16
* \author mdejong
17
*/
18
int
main
(
int
argc,
char
**argv)
19
{
20
using namespace
std;
21
22
typedef
JLANG::JToken<';'>
JToken_t;
23
24
vector<JToken_t>
buffer;
25
int
debug
;
26
27
try
{
28
29
JParser<>
zap(
"Example program to test token parsing."
);
30
31
zap[
'b'
] =
make_field
(buffer) =
JPARSER::initialised
();
32
zap[
'd'
] =
make_field
(
debug
) = 0;
33
34
zap(argc, argv);
35
}
36
catch
(
const
exception &error) {
37
FATAL
(error.what() << endl);
38
}
39
40
41
DEBUG
(argv[0] <<
" parse input with separator '"
<< JToken_t::getSeparator() <<
"'"
<< endl);
42
43
for
(
size_t
i = 0; i != buffer.size(); ++i) {
44
cout <<
"["
<< setw(2) << i <<
"] "
<< buffer[i] << endl;
45
}
46
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1493
JPARSER::initialised
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition:
JParser.hh:63
std::vector
Definition:
JSTDTypes.hh:12
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1954
debug
int debug
debug level
Definition:
JSirene.cc:61
JToken.hh
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JLANG::JToken
Wrapper class around string.
Definition:
JToken.hh:23
DEBUG
#define DEBUG(A)
Message macros.
Definition:
JMessage.hh:62
main
int main(int argc, char *argv[])
Definition:
Main.cpp:15
Generated by
1.8.5