PageRenderTime 11ms CodeModel.GetById 9ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/trunk/Examples/test-suite/template_typedef_rec.i

#
Swig | 113 lines | 87 code | 26 blank | 0 comment | 0 complexity | 3e467d759a6c3e96f7e0e8ed02257bd6 MD5 | raw file
  1%module template_typedef_rec
  2
  3%inline %{
  4// --- includes required to compile the wrapper code ---
  5typedef size_t MY_sizeT;
  6typedef long MY_intT;
  7typedef double MY_floatT;
  8
  9class test_Array
 10{
 11public:
 12  typedef MY_intT    intT;
 13  typedef MY_sizeT   sizeT;
 14};
 15
 16
 17
 18template <typename T>
 19class ArrayIterator_
 20{
 21 public:
 22  typedef test_Array::intT    intT;
 23};
 24
 25
 26template <typename T>
 27class ArrayReverseIterator
 28{
 29 public:
 30  typedef test_Array::intT    intT;
 31};
 32
 33
 34template <typename T>
 35class ArrayPrimitiveT 
 36  : public test_Array
 37{
 38public:
 39  typedef T  ValueT;
 40  typedef T  valueT;
 41  typedef ArrayIterator_<T>       Iterator;
 42  typedef ArrayIterator_<const T> ConstIterator;  
 43  typedef ArrayReverseIterator<T>       ReverseIterator;
 44  typedef ArrayReverseIterator<const T> ConstReverseIterator;
 45};
 46
 47
 48template <class T>
 49class TreeNode
 50{
 51public:
 52  typedef T  ValueT;
 53  typedef T  valueT;
 54  typedef MY_intT    intT;
 55  typedef MY_sizeT   sizeT;
 56};
 57
 58template <class T>
 59struct ArrayPointerT
 60{
 61};
 62
 63template <class T>
 64class TreeIterator
 65{
 66public:  
 67  typedef MY_intT    intT;
 68  typedef MY_sizeT   sizeT;
 69  typedef ArrayPointerT< T* > NodeArrayT;
 70  
 71};
 72
 73
 74template <class T>
 75class Tree
 76{
 77public:
 78  typedef T  ValueT;
 79  typedef T  valueT;
 80  typedef MY_intT    intT;
 81  typedef MY_sizeT   sizeT;
 82  typedef TreeNode<T> NodeT;
 83  typedef ArrayPointerT< NodeT* > NodeArrayT;
 84  typedef TreeIterator<NodeT> Iterator;
 85  typedef TreeIterator<NodeT> ConstIterator;
 86 
 87
 88};
 89
 90
 91class ModelNode
 92{
 93  typedef MY_intT    intT;
 94  typedef MY_floatT  floatT;
 95  typedef MY_sizeT   sizeT;
 96  
 97  
 98};
 99
100class Model
101{
102  typedef MY_intT    intT;
103  typedef MY_sizeT   sizeT;
104  typedef Tree<ModelNode> TreeT;
105  typedef TreeT::NodeT  TreeNodeT;
106  typedef TreeT::Iterator TreeIteratorT;
107  
108};
109%}
110
111
112// --- define ANSI C/C++ declarations to be interfaced ---
113%template(ModelTree)  Tree<ModelNode>;