Jpp  18.3.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
examples/Jeep/JPrint.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 #include <vector>
5 #include <map>
6 
7 #include "Jeep/JPrint.hh"
8 
9 #include "Jeep/JParser.hh"
10 #include "Jeep/JMessage.hh"
11 
12 /**
13  * \file
14  * Example program to test print auxiliaries.
15  * \author mdejong
16  */
17 int main(int argc, char* argv[])
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:1514
int main(int argc, char *argv[])
Definition: Main.cc:15
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
#define MAKE_STRING(A)
Make string.
Definition: JPrint.hh:127
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
Auxiliary data structure for streaming of STL containers.
Definition: JPrint.hh:65
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
int debug
debug level