Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JPrintHelper.cc
Go to the documentation of this file.
1#include <iostream>
2#include <iomanip>
3
4#include "Jeep/JParser.hh"
5#include "Jeep/JMessage.hh"
6
9
10
11namespace {
12
13 struct __A__ {
14 const char* __str__() const
15 {
16 return "__A__::__str__()";
17 }
18 };
19
20 struct __B__ {
21 friend std::ostream& operator<<(std::ostream& out, const __B__& object)
22 {
23 return out << "__B__::operator<<()";
24 }
25 };
26
27 struct __C__ {
28 const char* __str__() const
29 {
30 return "__C__::__str__()";
31 }
32
33 friend std::ostream& operator<<(std::ostream& out, const __C__& object)
34 {
35 return out << "__C__::operator<<()";
36 }
37 };
38
39 struct __D__ {};
40}
41
42
43/**
44 * \file
45 *
46 * Example program to test JLANG::JPrintHelper class.
47 * \author mdejong
48 */
49int main(int argc, char **argv)
50{
51 using namespace std;
52
53 int debug;
54
55 try {
56
57 JParser<> zap("Example program to test print helper.");
58
59 zap['d'] = make_field(debug) = 0;
60
61 zap(argc, argv);
62 }
63 catch(const exception &error) {
64 FATAL(error.what() << endl);
65 }
66
67
68 __A__ a;
69 __B__ b;
70 __C__ c;
71 //__D__ d;
72
73 cout << JStreamAvailable<__A__>::has_ostream << endl;
74 cout << JStreamAvailable<__B__>::has_ostream << endl;
75 cout << JStreamAvailable<__C__>::has_ostream << endl;
76 cout << JStreamAvailable<__D__>::has_ostream << endl;
77
78 cout << a << endl;
79 cout << b << endl;
80 cout << c << endl;
81 //cout << d << endl; // compiler error
82}
General purpose messaging.
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
int main(int argc, char **argv)
Utility class to parse command line options.
Definition JParser.hh:1698
std::ostream & operator<<(std::ostream &stream, const CLBCommonHeader &header)