Jpp  17.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JObjectOutput.cc File Reference

Example program to test JLANG::JObjectOutput class. More...

#include <string>
#include <iostream>
#include <sstream>
#include <iomanip>
#include "JLang/JTypeList.hh"
#include "JLang/JObjectOutput.hh"
#include "JLang/JStreamObjectOutput.hh"
#include "JLang/JObjectWriter.hh"
#include "JLang/JASCIIFileWriter.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Example program to test JLANG::JObjectOutput class.

Author
mdejong

Definition in file JObjectOutput.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 23 of file JObjectOutput.cc.

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 int 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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
Type list.
Definition: JTypeList.hh:22
#define ASSERT(A,...)
Assert macro.
Definition: JMessage.hh:90
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:66
#define FATAL(A)
Definition: JMessage.hh:67