Jpp  17.1.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JTypedef.cc
Go to the documentation of this file.
1 
2 #include <iostream>
3 #include <iomanip>
4 
5 #include "JLang/JVoid.hh"
6 
7 #include "Jeep/JParser.hh"
8 #include "Jeep/JMessage.hh"
9 
10 
11 namespace {
12 
13  using namespace JPP;
14 
15  struct __A__ {
16  typedef int data_type;
17  };
18 
19  struct __B__ {
20  };
21 
22  template<class T, class JType_t = void>
23  struct JTypedef
24  {
25  static const bool has_typedef = false;
26  };
27 
28  template<class T>
29  struct JTypedef<T, typename JVoid<typename T::data_type>::type>
30  {
31  static const bool has_typedef = true;
32  };
33 
34 
35 #define PRINT(OUT, T) OUT << #T << ": typedef = " << JTypedef<T>::has_typedef << endl;
36 }
37 
38 
39 /**
40  * \file
41  *
42  * Example program to test JLANG::JTypedef class.
43  * \author mdejong
44  */
45 int main(int argc, char **argv)
46 {
47  using namespace std;
48 
49  int debug;
50 
51  try {
52 
53  JParser<> zap("Example program to test type defs.");
54 
55  zap['d'] = make_field(debug) = 3;
56 
57  zap(argc, argv);
58  }
59  catch(const exception &error) {
60  FATAL(error.what() << endl);
61  }
62 
63 
64  PRINT(cout, __A__);
65  PRINT(cout, __B__);
66 }
Utility class to parse command line options.
Definition: JParser.hh:1517
int main(int argc, char *argv[])
Definition: Main.cc:15
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
do set_variable OUTPUT_DIRECTORY $WORKDIR T
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Utility class to parse command line options.
#define PRINT(OUT, T)
Definition: JTypedef.cc:35
Auxiliary class for void type definition.
Definition: JVoid.hh:20
int debug
debug level