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
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 
7 #include "JLang/JPrintHelper.hh"
9 
10 
11 namespace {
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  */
49 int 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 }
Utility class to parse command line options.
Definition: JParser.hh:1500
int main(int argc, char *argv[])
Definition: Main.cc:15
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:66
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
then JCalibrateToT a
Definition: JTuneHV.sh:116
Utility class to parse command line options.
std::ostream & operator<<(std::ostream &stream, const CLBCommonHeader &header)
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'