Jpp
 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 
6 #include "Jeep/JPrint.hh"
7 
8 #include "Jeep/JParser.hh"
9 #include "Jeep/JMessage.hh"
10 
11 /**
12  * \file
13  * Example program to test print auxiliaries.
14  * \author mdejong
15  */
16 int main(int argc, char* argv[])
17 {
18  using namespace std;
19  using namespace JPP;
20 
21  int debug;
22 
23  try {
24 
25  JParser<> zap;
26 
27  zap['d'] = make_field(debug) = 1;
28 
29  zap(argc, argv);
30  }
31  catch(const exception &error) {
32  FATAL(error.what() << endl);
33  }
34 
35  for (int value = 1; value < 1000000000; value *= 10) {
36  cout << "CENTER <" << CENTER(12) << value << ">" << endl;
37  }
38 
39  for (int value = 1; value < 1000000000; value *= 10) {
40  cout << "FILL <" << FILL(12,'.') << value << ">" << FILL() << endl;
41  }
42 
43  for (int value = 1; value < 1000000000; value *= 10) {
44  cout << "RIGHT <" << RIGHT(12) << value << ">" << endl;
45  }
46 
47  for (int value = 1; value < 1000000000; value *= 10) {
48  cout << "LEFT <" << LEFT(12) << value << ">" << endl;
49  }
50 
51  for (double value = 0.123456; value < 100000; value *= 10) {
52  cout << "FIXED <" << FIXED(12,6) << value << ">" << endl;
53  }
54 
55  vector<int> buffer;
56 
57  for (int i = 0; i != 10; ++i) {
58  buffer.push_back(i);
59  }
60 
61  //cout << buffer << endl; // compiler error
62  cout << "JEEPZ " << JEEPZ() << buffer << endl;
63 }
Utility class to parse command line options.
Definition: JParser.hh:1493
Auxiliary data structure for floating point format specification.
Definition: JPrint.hh:481
Auxiliary data structure for alignment of data.
Definition: JPrint.hh:401
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
int debug
debug level
Definition: JSirene.cc:61
Auxiliary data structure for streaming of STL containers.
Definition: JPrint.hh:558
General purpose messaging.
Auxiliary data structure for sequence of same character.
Definition: JPrint.hh:361
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
int main(int argc, char *argv[])
Definition: Main.cpp:15