PageRenderTime 12ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
Swig | 212 lines | 170 code | 40 blank | 2 comment | 0 complexity | 88b9fc82a0e76c1070d829816afd5eca MD5 | raw file
  1%module nested_class
  2
  3#pragma SWIG nowarn=SWIGWARN_PARSE_UNNAMED_NESTED_CLASS
  4%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct1;
  5%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass1;
  6%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion1;
  7%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass2;
  8%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct2;
  9%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion2;
 10%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass4Typedef;
 11%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct4Typedef;
 12%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion4Typedef;
 13%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerClass5;
 14%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerStruct5;
 15%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerUnion5;
 16%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultiple;
 17%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleDerived;
 18%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleAnonTypedef1;
 19%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerMultipleNamedTypedef;
 20%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer::InnerSameName;
 21%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Outer2::IgnoreMe;
 22
 23%inline %{
 24struct Outer {
 25  typedef int Integer;
 26  ///////////////////////////////////////////
 27  struct InnerStruct1 {
 28    Integer x;
 29  };
 30
 31  class InnerClass1 {
 32  public:
 33    Integer x;
 34  };
 35
 36  union InnerUnion1 {
 37    Integer x;
 38    double y;
 39  };
 40
 41  ///////////////////////////////////////////
 42#ifdef SWIG
 43/* some compilers do not accept these */
 44  class {
 45  public:
 46    Integer a;
 47  };
 48
 49  struct {
 50    Integer b;
 51  };
 52#endif
 53
 54  union {
 55    Integer c;
 56    double d;
 57  };
 58
 59  ///////////////////////////////////////////
 60  class InnerClass2 {
 61  public:
 62    Integer x;
 63  } InnerClass2Instance;
 64
 65  struct InnerStruct2 {
 66    Integer x;
 67  } InnerStruct2Instance;
 68
 69  union InnerUnion2 {
 70    Integer x;
 71    double y;
 72  } InnerUnion2Instance;
 73
 74  ///////////////////////////////////////////
 75  class {
 76  public:
 77    Integer x;
 78  } InnerClass3Instance;
 79
 80  struct {
 81    Integer x;
 82  } InnerStruct3Instance;
 83
 84  union {
 85    Integer x;
 86    double y;
 87  } InnerUnion3Instance;
 88
 89  ///////////////////////////////////////////
 90  typedef class {
 91  public:
 92    Integer x;
 93  } InnerClass4Typedef;
 94
 95  typedef struct {
 96    Integer x;
 97  } InnerStruct4Typedef;
 98
 99  typedef union {
100    Integer x;
101    double y;
102  } InnerUnion4Typedef;
103
104  ///////////////////////////////////////////
105  typedef class InnerClass5 {
106  public:
107    Integer x;
108  } InnerClass5Typedef;
109
110  typedef struct InnerStruct5 {
111    Integer x;
112  } InnerStruct5Typedef;
113
114  typedef union InnerUnion5 {
115    Integer x;
116    double y;
117  } InnerUnion5Typedef;
118
119  // bug #909387 - inner declared types are treated as forward declarations
120  InnerStruct1* makeInnerStruct1() { return 0; }
121  InnerClass1* makeInnerClass1() { return 0; }
122  InnerUnion1* makeInnerUnion1() { return 0; }
123
124  InnerStruct2* makeInnerStruct2() { return 0; }
125  InnerClass2* makeInnerClass2() { return 0; }
126  InnerUnion2* makeInnerUnion2() { return 0; }
127
128  InnerStruct4Typedef* makeInnerStruct4Typedef() { return 0; }
129  InnerClass4Typedef* makeInnerClass4Typedef() { return 0; }
130  InnerUnion4Typedef* makeInnerUnion4Typedef() { return 0; }
131
132  InnerStruct5* makeInnerStruct5() { return 0; }
133  InnerClass5* makeInnerClass5() { return 0; }
134  InnerUnion5* makeInnerUnion5() { return 0; }
135
136  InnerStruct5Typedef* makeInnerStruct5Typedef() { return 0; }
137  InnerClass5Typedef* makeInnerClass5Typedef() { return 0; }
138  InnerUnion5Typedef* makeInnerUnion5Typedef() { return 0; }
139
140  ///////////////////////////////////////////
141  struct InnerMultiple {
142    Integer x;
143  } MultipleInstance1, MultipleInstance2, *MultipleInstance3, MultipleInstance4[2];
144
145  struct InnerMultipleDerived : public InnerMultiple {
146    Integer xx;
147  } MultipleDerivedInstance1, MultipleDerivedInstance2, *MultipleDerivedInstance3, MultipleDerivedInstance4[2];
148
149  struct {
150    Integer x;
151  } MultipleInstanceAnon1, MultipleInstanceAnon2, *MultipleInstanceAnon3, MultipleInstanceAnon4[2];
152
153  struct : public InnerMultiple {
154    Integer xx;
155  } MultipleInstanceAnonDerived1, MultipleInstanceAnonDerived2, *MultipleInstanceAnonDerived3, MultipleInstanceAnonDerived4[2];
156
157#ifdef SWIG
158/* some compilers do not accept these */
159  struct : public InnerMultiple {
160    Integer xx;
161  };
162
163  class : public InnerMultiple {
164  public:
165    Integer yy;
166  };
167#endif
168
169  ///////////////////////////////////////////
170  typedef struct {
171    Integer x;
172  } InnerMultipleAnonTypedef1, InnerMultipleAnonTypedef2, *InnerMultipleAnonTypedef3;
173
174  InnerMultipleAnonTypedef1* makeInnerMultipleAnonTypedef1() { return 0; }
175  InnerMultipleAnonTypedef2* makeInnerMultipleAnonTypedef2() { return 0; }
176  InnerMultipleAnonTypedef3* makeInnerMultipleAnonTypedef3() { return 0; }
177
178  typedef struct InnerMultipleNamedTypedef {
179    Integer x;
180  } InnerMultipleNamedTypedef1, InnerMultipleNamedTypedef2, *InnerMultipleNamedTypedef3;
181
182  InnerMultipleNamedTypedef* makeInnerMultipleNamedTypedef() { return 0; }
183  InnerMultipleNamedTypedef1* makeInnerMultipleNamedTypedef1() { return 0; }
184  InnerMultipleNamedTypedef2* makeInnerMultipleNamedTypedef2() { return 0; }
185  InnerMultipleNamedTypedef3* makeInnerMultipleNamedTypedef3() { return 0; }
186
187  ///////////////////////////////////////////
188  typedef struct InnerSameName {
189    Integer x;
190  } InnerSameName;
191
192  InnerSameName* makeInnerSameName() { return 0; }
193};
194%}
195
196// Ignore nested struct instance
197%ignore Outer2::IgnoreMeInstance;
198%{
199struct Outer2 {
200  struct IgnoreMe {
201    int xx;
202  };
203};
204%}
205
206struct Outer2 {
207  struct IgnoreMe {
208    int xx;
209  } IgnoreMeInstance;
210};
211
212