Jpp
18.4.0
the software that should make you happy
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
examples
JLang
JObjectOutput.cc
Go to the documentation of this file.
1
2
#include <string>
3
#include <iostream>
4
#include <sstream>
5
#include <iomanip>
6
7
#include "
JLang/JTypeList.hh
"
8
#include "
JLang/JObjectOutput.hh
"
9
#include "
JLang/JStreamObjectOutput.hh
"
10
#include "
JLang/JObjectWriter.hh
"
11
#include "
JLang/JASCIIFileWriter.hh
"
12
13
#include "
Jeep/JParser.hh
"
14
#include "
Jeep/JMessage.hh
"
15
16
17
/**
18
* \file
19
*
20
* Example program to test JLANG::JObjectOutput class.
21
* \author mdejong
22
*/
23
int
main
(
int
argc,
char
**argv)
24
{
25
using namespace
std;
26
27
int
debug
;
28
29
try
{
30
31
JParser<>
zap(
"Example program to test object output."
);
32
33
zap[
'd'
] =
make_field
(
debug
) = 3;
34
35
zap(argc, argv);
36
}
37
catch
(
const
exception &error) {
38
FATAL
(error.what() << endl);
39
}
40
41
42
using namespace
JPP;
43
44
typedef
JTYPELIST<int, float, string>::typelist
JTypelist_t;
45
46
stringstream io;
47
48
JObjectOutput<JTypelist_t>* out =
new
JStreamObjectOutput<JTypelist_t>(io,
"\n"
);
49
50
const
int
ival = 1;
51
const
float
fval = 3.1415;
52
const
string
sval =
"aap"
;
53
54
out->put(ival);
55
out->put(fval);
56
out->put(sval);
57
58
int
__ival;
59
float
__fval;
60
string
__sval;
61
62
io >> __ival >> __fval >> __sval;
63
64
ASSERT
(ival == __ival);
65
ASSERT
(fval == __fval);
66
ASSERT
(sval == __sval);
67
68
delete
out;
69
70
return
0;
71
}
JPARSER::JParser
Utility class to parse command line options.
Definition:
JParser.hh:1514
main
int main(int argc, char *argv[])
Definition:
Main.cc:15
JASCIIFileWriter.hh
JObjectWriter.hh
JTypeList.hh
JLANG::JTypeList
Type list.
Definition:
JTypeList.hh:22
ASSERT
#define ASSERT(A,...)
Assert macro.
Definition:
JMessage.hh:90
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition:
JParser.hh:1989
JMessage.hh
General purpose messaging.
FATAL
#define FATAL(A)
Definition:
JMessage.hh:67
JParser.hh
Utility class to parse command line options.
JObjectOutput.hh
debug
int debug
debug level
Definition:
archive-put-wiki-detectors.sh:92
JStreamObjectOutput.hh
Generated by
1.8.5