PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 606 lines | 533 code | 73 blank | 0 comment | 0 complexity | 6420ee14f440cafef9250c7943e3c938 MD5 | raw file
  1%module "enum_thorough"
  2
  3// Suppress warning messages from the Ruby module for all of the
  4// following...
  5
  6#pragma SWIG nowarn=SWIGWARN_PARSE_KEYWORD
  7
  8%warnfilter(SWIGWARN_RUBY_WRONG_NAME);
  9%warnfilter(SWIGWARN_RUBY_WRONG_NAME) red;
 10%warnfilter(SWIGWARN_RUBY_WRONG_NAME) blue;
 11%warnfilter(SWIGWARN_RUBY_WRONG_NAME) green;
 12%warnfilter(SWIGWARN_RUBY_WRONG_NAME) SpeedClass::slow;
 13%warnfilter(SWIGWARN_RUBY_WRONG_NAME) SpeedClass::medium;
 14%warnfilter(SWIGWARN_RUBY_WRONG_NAME) SpeedClass::fast;
 15%warnfilter(SWIGWARN_RUBY_WRONG_NAME) SpeedClass::lightning;
 16%warnfilter(SWIGWARN_RUBY_WRONG_NAME) TemplateClass::einstein;
 17%warnfilter(SWIGWARN_RUBY_WRONG_NAME) TemplateClass::galileo;
 18%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Name::TClass::faraday;
 19%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Name::TClass::bell;
 20%warnfilter(SWIGWARN_RUBY_WRONG_NAME) argh;
 21%warnfilter(SWIGWARN_RUBY_WRONG_NAME) eek;
 22%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::whizz;
 23%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::kerboom;
 24%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::pop;
 25%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::simple1;
 26%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::singlename1;
 27%warnfilter(SWIGWARN_RUBY_WRONG_NAME) OldNameStruct::doublename1;
 28%warnfilter(SWIGWARN_RUBY_WRONG_NAME) TreesClass::oak;
 29%warnfilter(SWIGWARN_RUBY_WRONG_NAME) TreesClass::fir;
 30%warnfilter(SWIGWARN_RUBY_WRONG_NAME) TreesClass::pine;
 31%warnfilter(SWIGWARN_RUBY_WRONG_NAME) curly::greasy::HairStruct::blonde;
 32%warnfilter(SWIGWARN_RUBY_WRONG_NAME) curly::greasy::HairStruct::ginger;
 33%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::one;
 34%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::onetrail;
 35%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::two;
 36%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::twoagain;
 37%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::twotrail;
 38%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Obscure::twotrailagain;
 39%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance1;
 40%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance2;
 41%warnfilter(SWIGWARN_RUBY_WRONG_NAME) globalinstance3;
 42%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Instances::memberinstance1;
 43%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Instances::memberinstance2;
 44%warnfilter(SWIGWARN_RUBY_WRONG_NAME) Instances::memberinstance3;
 45
 46%warnfilter(SWIGWARN_GO_NAME_CONFLICT);                       /* Ignoring 'one' due to Go name ('ObscureOne') conflict with 'Obscure::One' */
 47
 48%inline %{
 49
 50enum { AnonEnum1, AnonEnum2 = 100 };
 51enum { ReallyAnInteger = 200 };
 52//enum { AnonEnum3, AnonEnum4 } instance;
 53namespace AnonSpace {
 54  enum { AnonSpaceEnum1, AnonSpaceEnum2 = 300 };
 55  struct AnonStruct {
 56    enum { AnonStructEnum1, AnonStructEnum2 = 400 };
 57  };
 58}
 59
 60
 61enum colour { red=-1, blue, green = 10 };
 62colour colourTest1(colour e) { return e; }
 63enum colour colourTest2(enum colour e) { return e; }
 64const colour colourTest3(const colour e) { return e; }
 65const enum colour colourTest4(const enum colour e) { return e; }
 66
 67colour myColour;
 68
 69struct SpeedClass {
 70  enum speed { slow=10, medium=20, fast=30, lightning };
 71  typedef enum speed speedtd1;
 72
 73  int                           speedTest0(int s) { return s; }
 74  speed                         speedTest1(speed s) { return s; }
 75  enum speed                    speedTest2(enum speed s) { return s; }
 76  const speed                   speedTest3(const speed s) { return s; }
 77  const enum speed              speedTest4(const enum speed s) { return s; }
 78  speedtd1                      speedTest5(speedtd1 s) { return s; }
 79  const speedtd1                speedTest6(const speedtd1 s) { return s; }
 80  const speed &                 speedTest7(const speed &s) { return s; }
 81  const enum speed &            speedTest8(const enum speed &s) { return s; }
 82
 83  const colour myColour2;
 84  speedtd1 mySpeedtd1;
 85  SpeedClass() : myColour2(red), mySpeedtd1(slow) { }
 86private:
 87  SpeedClass& operator=(const SpeedClass&);
 88};
 89
 90int                            speedTest0(int s) { return s; }
 91SpeedClass::speed              speedTest1(SpeedClass::speed s) { return s; }
 92enum SpeedClass::speed         speedTest2(enum SpeedClass::speed s) { return s; }
 93const SpeedClass::speed        speedTest3(const SpeedClass::speed s) { return s; }
 94const enum SpeedClass::speed   speedTest4(const enum SpeedClass::speed s) { return s; }
 95const SpeedClass::speed &      speedTest5(const SpeedClass::speed &s) { return s; }
 96
 97
 98typedef enum { NamedAnon1, NamedAnon2 } namedanon;
 99
100namedanon                       namedanonTest1(namedanon e) { return e; } 
101
102typedef enum twonamestag { TwoNames1, TwoNames2, TwoNames3 = 33 } twonames;
103
104twonames                        twonamesTest1(twonames e) { return e; } 
105twonamestag                     twonamesTest2(twonamestag e) { return e; } 
106enum twonamestag                twonamesTest3(enum twonamestag e) { return e; } 
107
108struct TwoNamesStruct {
109  typedef enum twonamestag { TwoNamesStruct1, TwoNamesStruct2 } twonames;
110  twonames                      twonamesTest1(twonames e) { return e; } 
111  twonamestag                   twonamesTest2(twonamestag e) { return e; } 
112  enum twonamestag              twonamesTest3(enum twonamestag e) { return e; } 
113};
114
115namespace AnonSpace{
116  typedef enum { NamedAnonSpace1, NamedAnonSpace2 } namedanonspace;
117  namedanonspace                namedanonspaceTest1(namedanonspace e) { return e; } 
118  AnonSpace::namedanonspace     namedanonspaceTest2(AnonSpace::namedanonspace e) { return e; } 
119}
120AnonSpace::namedanonspace       namedanonspaceTest3(AnonSpace::namedanonspace e) { return e; } 
121using namespace AnonSpace;
122namedanonspace                  namedanonspaceTest4(namedanonspace e) { return e; } 
123
124
125template<typename T> struct TemplateClass {
126  enum scientists { einstein, galileo = 10 }; 
127  typedef enum scientists scientiststd1;
128  typedef scientists scientiststd2;
129  typedef scientiststd1 scientiststd3;
130  scientists                                scientistsTest1(scientists e) { return e; }
131  enum scientists                           scientistsTest2(enum scientists e) { return e; }
132  const scientists                          scientistsTest3(const scientists e) { return e; }
133  const enum scientists                     scientistsTest4(const enum scientists e) { return e; }
134  typename TemplateClass<T>::scientists     scientistsTest5(typename TemplateClass<T>::scientists e) { return e; }
135  const typename TemplateClass<T>::scientists        scientistsTest6(const typename TemplateClass<T>::scientists e) { return e; }
136  enum TemplateClass<T>::scientists         scientistsTest7(enum TemplateClass<T>::scientists e) { return e; }
137  const enum TemplateClass<T>::scientists   scientistsTest8(const enum TemplateClass<T>::scientists e) { return e; }
138  typename TemplateClass::scientists        scientistsTest9(typename TemplateClass::scientists e) { return e; }
139//  enum TemplateClass::scientists            scientistsTestA(enum TemplateClass::scientists e) { return e; }
140  const typename TemplateClass::scientists  scientistsTestB(const typename TemplateClass::scientists e) { return e; }
141//  const enum TemplateClass::scientists      scientistsTestC(const enum TemplateClass::scientists e) { return e; }
142  scientiststd1                             scientistsTestD(scientiststd1 e) { return e; }
143  scientiststd2                             scientistsTestE(scientiststd2 e) { return e; }
144  scientiststd3                             scientistsTestF(scientiststd3 e) { return e; }
145  typename TemplateClass<T>::scientiststd1  scientistsTestG(typename TemplateClass<T>::scientiststd1 e) { return e; }
146  typename TemplateClass<T>::scientiststd2  scientistsTestH(typename TemplateClass<T>::scientiststd2 e) { return e; }
147  typename TemplateClass<T>::scientiststd3  scientistsTestI(typename TemplateClass<T>::scientiststd3 e) { return e; }
148  const scientists &                        scientistsTestJ(const scientists &e) { return e; }
149};
150
151TemplateClass<int>::scientists              scientistsTest1(TemplateClass<int>::scientists e) { return e; }
152const TemplateClass<int>::scientists        scientistsTest2(const TemplateClass<int>::scientists e) { return e; }
153enum TemplateClass<int>::scientists         scientistsTest3(enum TemplateClass<int>::scientists e) { return e; }
154const enum TemplateClass<int>::scientists   scientistsTest4(const enum TemplateClass<int>::scientists e) { return e; }
155TemplateClass<int>::scientiststd1           scientistsTest5(TemplateClass<int>::scientiststd1 e) { return e; }
156TemplateClass<int>::scientiststd2           scientistsTest6(TemplateClass<int>::scientiststd2 e) { return e; }
157TemplateClass<int>::scientiststd3           scientistsTest7(TemplateClass<int>::scientiststd3 e) { return e; }
158const TemplateClass<int>::scientiststd3 &   scientistsTest8(const TemplateClass<int>::scientiststd3 &e) { return e; }
159
160
161namespace Name {
162template<typename T> struct TClass {
163  enum scientists { faraday, bell = 20 }; 
164  typedef enum scientists scientiststd1;
165  typedef scientists scientiststd2;
166  typedef scientiststd1 scientiststd3;
167  scientists                                scientistsNameTest1(scientists e) { return e; }
168  enum scientists                           scientistsNameTest2(enum scientists e) { return e; }
169  const scientists                          scientistsNameTest3(const scientists e) { return e; }
170  const enum scientists                     scientistsNameTest4(const enum scientists e) { return e; }
171  typename TClass<T>::scientists            scientistsNameTest5(typename TClass<T>::scientists e) { return e; }
172  const typename TClass<T>::scientists      scientistsNameTest6(const typename TClass<T>::scientists e) { return e; }
173  enum TClass<T>::scientists                scientistsNameTest7(enum TClass<T>::scientists e) { return e; }
174  const enum TClass<T>::scientists          scientistsNameTest8(const enum TClass<T>::scientists e) { return e; }
175  typename TClass::scientists               scientistsNameTest9(typename TClass::scientists e) { return e; }
176//  enum TClass::scientists                   scientistsNameTestA(enum TClass::scientists e) { return e; }
177  const typename TClass::scientists         scientistsNameTestB(const typename TClass::scientists e) { return e; }
178//  const enum TClass::scientists             scientistsNameTestC(const enum TClass::scientists e) { return e; }
179  scientiststd1                             scientistsNameTestD(scientiststd1 e) { return e; }
180  scientiststd2                             scientistsNameTestE(scientiststd2 e) { return e; }
181  scientiststd3                             scientistsNameTestF(scientiststd3 e) { return e; }
182  typename TClass<T>::scientiststd1         scientistsNameTestG(typename TClass<T>::scientiststd1 e) { return e; }
183  typename TClass<T>::scientiststd2         scientistsNameTestH(typename TClass<T>::scientiststd2 e) { return e; }
184  typename TClass<T>::scientiststd3         scientistsNameTestI(typename TClass<T>::scientiststd3 e) { return e; }
185
186  typename Name::TClass<T>::scientists      scientistsNameSpaceTest1(typename Name::TClass<T>::scientists e) { return e; }
187  const typename Name::TClass<T>::scientists         scientistsNameSpaceTest2(const typename Name::TClass<T>::scientists e) { return e; }
188  enum Name::TClass<T>::scientists          scientistsNameSpaceTest3(enum Name::TClass<T>::scientists e) { return e; }
189  const enum Name::TClass<T>::scientists    scientistsNameSpaceTest4(const enum Name::TClass<T>::scientists e) { return e; }
190  typename Name::TClass<T>::scientiststd1   scientistsNameSpaceTest5(typename Name::TClass<T>::scientiststd1 e) { return e; }
191  typename Name::TClass<T>::scientiststd2   scientistsNameSpaceTest6(typename Name::TClass<T>::scientiststd2 e) { return e; }
192  typename Name::TClass<T>::scientiststd3   scientistsNameSpaceTest7(typename Name::TClass<T>::scientiststd3 e) { return e; }
193
194  // Test TemplateClass::scientists rather then TClass::scientists
195  ::TemplateClass<int>::scientists              scientistsOtherTest1(::TemplateClass<int>::scientists e) { return e; }
196  const ::TemplateClass<int>::scientists        scientistsOtherTest2(const ::TemplateClass<int>::scientists e) { return e; }
197  enum ::TemplateClass<int>::scientists         scientistsOtherTest3(enum ::TemplateClass<int>::scientists e) { return e; }
198  const enum ::TemplateClass<int>::scientists   scientistsOtherTest4(const enum ::TemplateClass<int>::scientists e) { return e; }
199  ::TemplateClass<int>::scientiststd1           scientistsOtherTest5(::TemplateClass<int>::scientiststd1 e) { return e; }
200  ::TemplateClass<int>::scientiststd2           scientistsOtherTest6(::TemplateClass<int>::scientiststd2 e) { return e; }
201  ::TemplateClass<int>::scientiststd3           scientistsOtherTest7(::TemplateClass<int>::scientiststd3 e) { return e; }
202};
203
204TClass<int>::scientists                     scientistsNameTest1(TClass<int>::scientists e) { return e; }
205const TClass<int>::scientists               scientistsNameTest2(const TClass<int>::scientists e) { return e; }
206enum TClass<int>::scientists                scientistsNameTest3(enum TClass<int>::scientists e) { return e; }
207const enum TClass<int>::scientists          scientistsNameTest4(const enum TClass<int>::scientists e) { return e; }
208TClass<int>::scientiststd1                  scientistsNameTest5(TClass<int>::scientiststd1 e) { return e; }
209TClass<int>::scientiststd2                  scientistsNameTest6(TClass<int>::scientiststd2 e) { return e; }
210TClass<int>::scientiststd3                  scientistsNameTest7(TClass<int>::scientiststd3 e) { return e; }
211
212Name::TClass<int>::scientists               scientistsNameSpaceTest1(Name::TClass<int>::scientists e) { return e; }
213const Name::TClass<int>::scientists         scientistsNameSpaceTest2(const Name::TClass<int>::scientists e) { return e; }
214enum Name::TClass<int>::scientists          scientistsNameSpaceTest3(enum Name::TClass<int>::scientists e) { return e; }
215const enum Name::TClass<int>::scientists    scientistsNameSpaceTest4(const enum Name::TClass<int>::scientists e) { return e; }
216Name::TClass<int>::scientiststd1            scientistsNameSpaceTest5(Name::TClass<int>::scientiststd1 e) { return e; }
217Name::TClass<int>::scientiststd2            scientistsNameSpaceTest6(Name::TClass<int>::scientiststd2 e) { return e; }
218Name::TClass<int>::scientiststd3            scientistsNameSpaceTest7(Name::TClass<int>::scientiststd3 e) { return e; }
219}
220
221Name::TClass<int>::scientists               scientistsNameSpaceTest8(Name::TClass<int>::scientists e) { return e; }
222const Name::TClass<int>::scientists         scientistsNameSpaceTest9(const Name::TClass<int>::scientists e) { return e; }
223enum Name::TClass<int>::scientists          scientistsNameSpaceTestA(enum Name::TClass<int>::scientists e) { return e; }
224const enum Name::TClass<int>::scientists    scientistsNameSpaceTestB(const enum Name::TClass<int>::scientists e) { return e; }
225Name::TClass<int>::scientiststd1            scientistsNameSpaceTestC(Name::TClass<int>::scientiststd1 e) { return e; }
226Name::TClass<int>::scientiststd2            scientistsNameSpaceTestD(Name::TClass<int>::scientiststd2 e) { return e; }
227Name::TClass<int>::scientiststd3            scientistsNameSpaceTestE(Name::TClass<int>::scientiststd3 e) { return e; }
228
229using namespace Name;
230TClass<int>::scientists                     scientistsNameSpaceTestF(TClass<int>::scientists e) { return e; }
231const TClass<int>::scientists               scientistsNameSpaceTestG(const TClass<int>::scientists e) { return e; }
232enum TClass<int>::scientists                scientistsNameSpaceTestH(enum TClass<int>::scientists e) { return e; }
233const enum TClass<int>::scientists          scientistsNameSpaceTestI(const enum TClass<int>::scientists e) { return e; }
234TClass<int>::scientiststd1                  scientistsNameSpaceTestJ(TClass<int>::scientiststd1 e) { return e; }
235TClass<int>::scientiststd2                  scientistsNameSpaceTestK(TClass<int>::scientiststd2 e) { return e; }
236TClass<int>::scientiststd3                  scientistsNameSpaceTestL(TClass<int>::scientiststd3 e) { return e; }
237
238%}
239
240%template(TemplateClassInt) TemplateClass<int>;
241%template(TClassInt) Name::TClass<int>;
242
243
244// %rename tests
245%rename(NewNameStruct) OldNameStruct;
246%rename(newname) old_name;
247%rename(doublenamerenamed) doublename;
248%rename(simplerenamed) simple;
249%rename(singlenamerenamed) singlename;
250%rename(bang) OldNameStruct::kerboom;
251
252%inline %{
253enum old_name { argh, eek = -1 };
254typedef old_name old_nametd;
255old_name                            renameTest1(old_name e) { return e; }
256old_nametd                          renameTest2(old_nametd e) { return e; }
257
258struct OldNameStruct {
259  enum enumeration {whizz, kerboom, pop};
260  enumeration                       renameTest1(enumeration e) { return e; }
261  OldNameStruct::enumeration        renameTest2(OldNameStruct::enumeration e) { return e; }
262
263  enum simple {simple1};
264  typedef enum doublenametag {doublename1} doublename;
265  typedef enum {singlename1} singlename;
266
267  simple                            renameTest3(simple e) { return e; }
268  doublename                        renameTest4(doublename e) { return e; }
269  doublenametag                     renameTest5(doublenametag e) { return e; }
270  singlename                        renameTest6(singlename e) { return e; }
271};
272
273OldNameStruct::enumeration          renameTest3(OldNameStruct::enumeration e) { return e; }
274OldNameStruct::simple               renameTest4(OldNameStruct::simple e) { return e; }
275OldNameStruct::doublename           renameTest5(OldNameStruct::doublename e) { return e; }
276OldNameStruct::doublenametag        renameTest6(OldNameStruct::doublenametag e) { return e; }
277OldNameStruct::singlename           renameTest7(OldNameStruct::singlename e) { return e; }
278%}
279
280%inline %{
281struct TreesClass {
282  enum trees {oak, fir, pine };
283  typedef enum trees treestd1;
284  typedef trees treestd2;
285  typedef treestd1 treestd3;
286  typedef TreesClass::trees treestd4;
287  typedef treestd1 treestd5;
288
289  trees                             treesTest1(trees e) { return e; }
290  treestd1                          treesTest2(treestd1 e) { return e; }
291  treestd2                          treesTest3(treestd2 e) { return e; }
292  treestd3                          treesTest4(treestd3 e) { return e; }
293  treestd4                          treesTest5(treestd4 e) { return e; }
294  treestd5                          treesTest6(treestd5 e) { return e; }
295  const trees                       treesTest7(const trees e) { return e; }
296  const treestd1                    treesTest8(const treestd1 e) { return e; }
297  const treestd2                    treesTest9(const treestd2 e) { return e; }
298  const treestd3                    treesTestA(const treestd3 e) { return e; }
299  const treestd4                    treesTestB(const treestd4 e) { return e; }
300  const treestd5                    treesTestC(const treestd5 e) { return e; }
301  TreesClass::trees                 treesTestD(TreesClass::trees e) { return e; }
302  TreesClass::treestd1              treesTestE(TreesClass::treestd1 e) { return e; }
303  TreesClass::treestd2              treesTestF(TreesClass::treestd2 e) { return e; }
304  TreesClass::treestd3              treesTestG(TreesClass::treestd3 e) { return e; }
305  TreesClass::treestd4              treesTestH(TreesClass::treestd4 e) { return e; }
306  TreesClass::treestd5              treesTestI(TreesClass::treestd5 e) { return e; }
307  const TreesClass::trees           treesTestJ(const TreesClass::trees e) { return e; }
308  const TreesClass::treestd1        treesTestK(const TreesClass::treestd1 e) { return e; }
309  const TreesClass::treestd2        treesTestL(const TreesClass::treestd2 e) { return e; }
310  const TreesClass::treestd3        treesTestM(const TreesClass::treestd3 e) { return e; }
311  const TreesClass::treestd4        treesTestN(const TreesClass::treestd4 e) { return e; }
312  const TreesClass::treestd5        treesTestO(const TreesClass::treestd5 e) { return e; }
313};
314
315TreesClass::trees                   treesTest1(TreesClass::trees e) { return e; }
316TreesClass::treestd1                treesTest2(TreesClass::treestd1 e) { return e; }
317TreesClass::treestd2                treesTest3(TreesClass::treestd2 e) { return e; }
318TreesClass::treestd3                treesTest4(TreesClass::treestd3 e) { return e; }
319TreesClass::treestd4                treesTest5(TreesClass::treestd4 e) { return e; }
320TreesClass::treestd5                treesTest6(TreesClass::treestd5 e) { return e; }
321const TreesClass::trees             treesTest7(const TreesClass::trees e) { return e; }
322const TreesClass::treestd1          treesTest8(const TreesClass::treestd1 e) { return e; }
323const TreesClass::treestd2          treesTest9(const TreesClass::treestd2 e) { return e; }
324const TreesClass::treestd3          treesTestA(const TreesClass::treestd3 e) { return e; }
325const TreesClass::treestd4          treesTestB(const TreesClass::treestd4 e) { return e; }
326const TreesClass::treestd5          treesTestC(const TreesClass::treestd5 e) { return e; }
327
328typedef enum TreesClass::trees treesglobaltd1;
329typedef TreesClass::trees treesglobaltd2;
330typedef TreesClass::treestd1 treesglobaltd3;
331typedef TreesClass::treestd2 treesglobaltd4;
332typedef treesglobaltd4 treesglobaltd5;
333
334treesglobaltd1                      treesTestD(treesglobaltd1 e) { return e; }
335treesglobaltd2                      treesTestE(treesglobaltd2 e) { return e; }
336treesglobaltd3                      treesTestF(treesglobaltd3 e) { return e; }
337treesglobaltd4                      treesTestG(treesglobaltd4 e) { return e; }
338treesglobaltd5                      treesTestH(treesglobaltd5 e) { return e; }
339const treesglobaltd1                treesTestI(const treesglobaltd1 e) { return e; }
340const treesglobaltd2                treesTestJ(const treesglobaltd2 e) { return e; }
341const treesglobaltd3                treesTestK(const treesglobaltd3 e) { return e; }
342const treesglobaltd4                treesTestL(const treesglobaltd4 e) { return e; }
343const treesglobaltd5                treesTestM(const treesglobaltd5 e) { return e; }
344
345typedef const enum TreesClass::trees treesglobaltd6;
346typedef const TreesClass::trees treesglobaltd7;
347typedef const TreesClass::treestd1 treesglobaltd8;
348typedef const TreesClass::treestd2 treesglobaltd9;
349typedef const treesglobaltd4 treesglobaltdA;
350
351//treesglobaltd6                      treesTestN(treesglobaltd6 e) { return e; } // casting using an int instead of treesglobaltd6
352treesglobaltd7                      treesTestO(treesglobaltd7 e) { return e; }
353treesglobaltd8                      treesTestP(treesglobaltd8 e) { return e; }
354treesglobaltd9                      treesTestQ(treesglobaltd9 e) { return e; }
355treesglobaltdA                      treesTestR(treesglobaltdA e) { return e; }
356
357namespace curly {
358  namespace greasy {
359    struct HairStruct {
360      enum hair { blonde=0xFF0, ginger };
361      typedef hair hairtd1;
362      typedef HairStruct::hair hairtd2;
363      typedef greasy::HairStruct::hair hairtd3;
364      typedef curly::greasy::HairStruct::hair hairtd4;
365      typedef ::curly::greasy::HairStruct::hair hairtd5;
366      typedef hairtd1 hairtd6;
367      typedef HairStruct::hairtd1 hairtd7;
368      typedef greasy::HairStruct::hairtd1 hairtd8;
369      typedef curly::greasy::HairStruct::hairtd1 hairtd9;
370      typedef ::curly::greasy::HairStruct::hairtd1 hairtdA;
371      hair                          hairTest1(hair e) { return e; }
372      hairtd1                       hairTest2(hairtd1 e) { return e; }
373      hairtd2                       hairTest3(hairtd2 e) { return e; }
374      hairtd3                       hairTest4(hairtd3 e) { return e; }
375      hairtd4                       hairTest5(hairtd4 e) { return e; }
376      hairtd5                       hairTest6(hairtd5 e) { return e; }
377      hairtd6                       hairTest7(hairtd6 e) { return e; }
378      hairtd7                       hairTest8(hairtd7 e) { return e; }
379      hairtd8                       hairTest9(hairtd8 e) { return e; }
380      hairtd9                       hairTestA(hairtd9 e) { return e; }
381      hairtdA                       hairTestB(hairtdA e) { return e; }
382
383      ::colour                      colourTest1(::colour e) { return e; }
384      enum colour                   colourTest2(enum colour e) { return e; }
385      namedanon                     namedanonTest1(namedanon e) { return e; }
386      AnonSpace::namedanonspace      namedanonspaceTest1(AnonSpace::namedanonspace e) { return e; }
387
388      treesglobaltd1                treesGlobalTest1(treesglobaltd1 e) { return e; }
389      treesglobaltd2                treesGlobalTest2(treesglobaltd2 e) { return e; }
390      treesglobaltd3                treesGlobalTest3(treesglobaltd3 e) { return e; }
391      treesglobaltd4                treesGlobalTest4(treesglobaltd4 e) { return e; }
392      treesglobaltd5                treesGlobalTest5(treesglobaltd5 e) { return e; }
393
394    };
395    HairStruct::hair                hairTest1(HairStruct::hair e) { return e; }
396    HairStruct::hairtd1             hairTest2(HairStruct::hairtd1 e) { return e; }
397    HairStruct::hairtd2             hairTest3(HairStruct::hairtd2 e) { return e; }
398    HairStruct::hairtd3             hairTest4(HairStruct::hairtd3 e) { return e; }
399    HairStruct::hairtd4             hairTest5(HairStruct::hairtd4 e) { return e; }
400    HairStruct::hairtd5             hairTest6(HairStruct::hairtd5 e) { return e; }
401    HairStruct::hairtd6             hairTest7(HairStruct::hairtd6 e) { return e; }
402    HairStruct::hairtd7             hairTest8(HairStruct::hairtd7 e) { return e; }
403    HairStruct::hairtd8             hairTest9(HairStruct::hairtd8 e) { return e; }
404    HairStruct::hairtd9             hairTestA(HairStruct::hairtd9 e) { return e; }
405    HairStruct::hairtdA             hairTestB(HairStruct::hairtdA e) { return e; }
406    const HairStruct::hair &        hairTestC(const HairStruct::hair &e) { return e; }
407  }
408  greasy::HairStruct::hair          hairTestA1(greasy::HairStruct::hair e) { return e; }
409  greasy::HairStruct::hairtd1       hairTestA2(greasy::HairStruct::hairtd1 e) { return e; }
410  greasy::HairStruct::hairtd2       hairTestA3(greasy::HairStruct::hairtd2 e) { return e; }
411  greasy::HairStruct::hairtd3       hairTestA4(greasy::HairStruct::hairtd3 e) { return e; }
412  greasy::HairStruct::hairtd4       hairTestA5(greasy::HairStruct::hairtd4 e) { return e; }
413  greasy::HairStruct::hairtd5       hairTestA6(greasy::HairStruct::hairtd5 e) { return e; }
414  greasy::HairStruct::hairtd6       hairTestA7(greasy::HairStruct::hairtd6 e) { return e; }
415  greasy::HairStruct::hairtd7       hairTestA8(greasy::HairStruct::hairtd7 e) { return e; }
416  greasy::HairStruct::hairtd8       hairTestA9(greasy::HairStruct::hairtd8 e) { return e; }
417  greasy::HairStruct::hairtd9       hairTestAA(greasy::HairStruct::hairtd9 e) { return e; }
418  greasy::HairStruct::hairtdA       hairTestAB(greasy::HairStruct::hairtdA e) { return e; }
419  const greasy::HairStruct::hairtdA &     hairTestAC(const greasy::HairStruct::hairtdA &e) { return e; }
420}
421curly::greasy::HairStruct::hair     hairTestB1(curly::greasy::HairStruct::hair e) { return e; }
422curly::greasy::HairStruct::hairtd1  hairTestB2(curly::greasy::HairStruct::hairtd1 e) { return e; }
423curly::greasy::HairStruct::hairtd2  hairTestB3(curly::greasy::HairStruct::hairtd2 e) { return e; }
424curly::greasy::HairStruct::hairtd3  hairTestB4(curly::greasy::HairStruct::hairtd3 e) { return e; }
425curly::greasy::HairStruct::hairtd4  hairTestB5(curly::greasy::HairStruct::hairtd4 e) { return e; }
426curly::greasy::HairStruct::hairtd5  hairTestB6(curly::greasy::HairStruct::hairtd5 e) { return e; }
427curly::greasy::HairStruct::hairtd6  hairTestB7(curly::greasy::HairStruct::hairtd6 e) { return e; }
428curly::greasy::HairStruct::hairtd7  hairTestB8(curly::greasy::HairStruct::hairtd7 e) { return e; }
429curly::greasy::HairStruct::hairtd8  hairTestB9(curly::greasy::HairStruct::hairtd8 e) { return e; }
430curly::greasy::HairStruct::hairtd9  hairTestBA(curly::greasy::HairStruct::hairtd9 e) { return e; }
431curly::greasy::HairStruct::hairtdA  hairTestBB(curly::greasy::HairStruct::hairtdA e) { return e; }
432const curly::greasy::HairStruct::hairtdA & hairTestBC(const curly::greasy::HairStruct::hairtdA &e) { return e; }
433
434using curly::greasy::HairStruct;
435HairStruct::hair                    hairTestC1(HairStruct::hair e) { return e; }
436HairStruct::hairtd1                 hairTestC2(HairStruct::hairtd1 e) { return e; }
437HairStruct::hairtd2                 hairTestC3(HairStruct::hairtd2 e) { return e; }
438HairStruct::hairtd3                 hairTestC4(HairStruct::hairtd3 e) { return e; }
439HairStruct::hairtd4                 hairTestC5(HairStruct::hairtd4 e) { return e; }
440HairStruct::hairtd5                 hairTestC6(HairStruct::hairtd5 e) { return e; }
441HairStruct::hairtd6                 hairTestC7(HairStruct::hairtd6 e) { return e; }
442HairStruct::hairtd7                 hairTestC8(HairStruct::hairtd7 e) { return e; }
443HairStruct::hairtd8                 hairTestC9(HairStruct::hairtd8 e) { return e; }
444HairStruct::hairtd9                 hairTestCA(HairStruct::hairtd9 e) { return e; }
445HairStruct::hairtdA                 hairTestCB(HairStruct::hairtdA e) { return e; }
446const HairStruct::hairtdA &         hairTestCC(const HairStruct::hairtdA &e) { return e; }
447
448namespace curly {
449  namespace greasy {
450    struct FirStruct : HairStruct {
451      hair                          hairTestFir1(hair e) { return e; }
452      hairtd1                       hairTestFir2(hairtd1 e) { return e; }
453      hairtd2                       hairTestFir3(hairtd2 e) { return e; }
454      hairtd3                       hairTestFir4(hairtd3 e) { return e; }
455      hairtd4                       hairTestFir5(hairtd4 e) { return e; }
456      hairtd5                       hairTestFir6(hairtd5 e) { return e; }
457      hairtd6                       hairTestFir7(hairtd6 e) { return e; }
458      hairtd7                       hairTestFir8(hairtd7 e) { return e; }
459      hairtd8                       hairTestFir9(hairtd8 e) { return e; }
460      hairtd9                       hairTestFirA(hairtd9 e) { return e; }
461      hairtdA                       hairTestFirB(hairtdA e) { return e; }
462    };
463  }
464}
465
466struct Obscure {
467  enum Zero {};
468  enum One {one};
469  enum Two {two, twoagain};
470#if defined(SWIG)
471  // g++-4.3 warns about this
472  typedef enum Empty {};
473#endif
474  typedef enum {} AlsoEmpty;
475};
476
477// Unnamed enum instance
478extern "C" {
479enum { globalinstance1, globalinstance2, globalinstance3 = 30 } GlobalInstance;
480}
481
482struct Instances {
483  enum { memberinstance1, memberinstance2, memberinstance3 = 300 } MemberInstance;
484  Instances() : MemberInstance(memberinstance3) {}
485};
486
487%}
488
489// Repeated values
490#if defined(SWIGJAVA)
491%javaconst(1);
492// needed for typesafe and proper enums only
493%javaconst(0) ignoreA_three;
494%javaconst(0) ignoreA_thirteen;
495#elif defined(SWIGCSHARP)
496// needed for typesafe enums only
497#ifdef SWIG_TEST_NOCSCONST
498  %csconst(0) ignoreA_three;
499  %csconst(0) ignoreA_thirteen;
500#endif
501%csconst(1);
502#endif
503
504%ignore ignoreA_one;
505%ignore ignoreA_two;
506%ignore ignoreA_twelve;
507%ignore ignoreA_thirty_one;
508
509%ignore ignoreB_ten;
510%ignore ignoreB_twenty;
511%ignore ignoreB_thirty;
512%ignore ignoreB_forty;
513
514%ignore ignoreC_eleven;
515%ignore ignoreC_thirty_one;
516%ignore ignoreC_forty_one;
517
518%ignore ignoreD_ten;
519%ignore ignoreD_twenty;
520
521%ignore ignoreE_twenty;
522
523%inline %{
524struct IgnoreTest {
525  enum IgnoreA { ignoreA_zero, ignoreA_one, ignoreA_two, ignoreA_three, ignoreA_ten=10, ignoreA_eleven, ignoreA_twelve, ignoreA_thirteen, ignoreA_fourteen, ignoreA_twenty=20, ignoreA_thirty=30, ignoreA_thirty_one, ignoreA_thirty_two, ignoreA_thirty_three };
526  enum IgnoreB { ignoreB_ten=10, ignoreB_eleven, ignoreB_twelve, ignoreB_twenty=20, ignoreB_thirty=30, ignoreB_thirty_one, ignoreB_thirty_two, ignoreB_forty=40, ignoreB_forty_one, ignoreB_forty_two };
527  enum IgnoreC { ignoreC_ten=10, ignoreC_eleven, ignoreC_twelve, ignoreC_twenty=20, ignoreC_thirty=30, ignoreC_thirty_one, ignoreC_thirty_two, ignoreC_forty=40, ignoreC_forty_one, ignoreC_forty_two };
528  enum IgnoreD { ignoreD_ten=10, ignoreD_twenty=20, ignoreD_twenty_one, ignoreD_twenty_two };
529  enum IgnoreE { ignoreE_zero, ignoreE_twenty=20, ignoreE_twenty_one, ignoreE_twenty_two };
530};
531
532IgnoreTest::IgnoreA ignoreATest(IgnoreTest::IgnoreA n) { return n; }
533IgnoreTest::IgnoreB ignoreBTest(IgnoreTest::IgnoreB n) { return n; }
534IgnoreTest::IgnoreC ignoreCTest(IgnoreTest::IgnoreC n) { return n; }
535IgnoreTest::IgnoreD ignoreDTest(IgnoreTest::IgnoreD n) { return n; }
536IgnoreTest::IgnoreE ignoreETest(IgnoreTest::IgnoreE n) { return n; }
537%}
538
539%inline %{
540namespace RepeatSpace {
541typedef enum
542{
543   one = 1,
544   initial = one,
545   two,
546   three,
547   llast = three,
548   end = llast
549} repeat;
550repeat repeatTest(repeat e) { return e; }
551}
552%}
553
554%inline %{
555namespace DifferentSpace {
556enum DifferentTypes {
557  typeint = 10,
558  typeboolfalse = false,
559  typebooltrue = true,
560  typebooltwo,
561  typechar = 'C',
562  typedefaultint
563};
564DifferentTypes differentTypesTest(DifferentTypes n) { return n; }
565
566enum {
567  global_typeint = 10,
568  global_typeboolfalse = false,
569  global_typebooltrue = true,
570  global_typebooltwo,
571  global_typechar = 'C',
572  global_typedefaultint
573};
574int globalDifferentTypesTest(int n) { return n; }
575}
576
577%}
578
579#if defined(SWIGJAVA)
580%javaconst(0);
581#elif defined(SWIGCSHARP)
582%csconst(0);
583#endif
584
585%inline %{
586namespace DifferentSpace {
587enum DifferentTypesNoConst {
588  typeint_noconst = 10,
589  typeboolfalse_noconst = false,
590  typebooltrue_noconst = true,
591  typebooltwo_noconst,
592  typechar_noconst = 'C',
593  typedefaultint_noconst
594};
595
596enum {
597  global_typeint_noconst = 10,
598  global_typeboolfalse_noconst = false,
599  global_typebooltrue_noconst = true,
600  global_typebooltwo_noconst,
601  global_typechar_noconst = 'C',
602  global_typedefaultint_noconst
603};
604}
605
606%}