Jpp  17.2.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
examples/Jeep/JPrint.cc File Reference

Example program to test print auxiliaries. More...

#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include "Jeep/JPrint.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 print auxiliaries.

Author
mdejong

Definition in file examples/Jeep/JPrint.cc.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 17 of file examples/Jeep/JPrint.cc.

18 {
19  using namespace std;
20  using namespace JPP;
21 
22  int debug;
23 
24  try {
25 
26  JParser<> zap;
27 
28  zap['d'] = make_field(debug) = 1;
29 
30  zap(argc, argv);
31  }
32  catch(const exception &error) {
33  FATAL(error.what() << endl);
34  }
35 
36  {
37  vector<int> buffer;
38 
39  for (int i = 0; i != 10; ++i) {
40  buffer.push_back(i);
41  }
42 
43  //cout << buffer << endl; // compiler error
44  cout << "JEEPZ " << JEEPZ() << buffer << endl;
45  }
46 
47  {
48  map<int, int> buffer;
49 
50  for (int i = 0; i != 10; ++i) {
51  buffer[i] = i*i;
52  }
53 
54  //cout << buffer << endl; // compiler error
55  cout << "JEEPZ " << JEEPZ() << buffer << endl;
56  }
57 
58  {
59  string buffer = MAKE_STRING("hello world " << 1 << ' ' << 123.456);
60 
61  cout << buffer << endl;
62  }
63 
64  {
65  const char* const buffer = MAKE_CSTRING("hello world " << 1 << ' ' << 123.456);
66 
67  cout << buffer << endl;
68  }
69 }
Utility class to parse command line options.
Definition: JParser.hh:1517
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
Auxiliary data structure for streaming of STL containers.
Definition: JPrint.hh:65
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level