PageRenderTime 19ms CodeModel.GetById 16ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Swig | 76 lines | 63 code | 13 blank | 0 comment | 0 complexity | 3170b1506647e355f87fb02b28fcb294 MD5 | raw file
 1%module conversion_ns_template
 2%{ 
 3 namespace oss 
 4 { 
 5   struct Hi
 6   {
 7     Hi(){}     
 8     Hi(int){}     
 9   };
10
11   enum Test {One, Two}; 
12
13   template <Test> 
14   struct Foo { 
15     Foo(){}
16   }; 
17
18   template <Test T>   
19   struct Bar { 
20     Bar(){ }
21     Bar(int){ }
22     
23     operator int() { return 0; }
24     operator int&() { static int num = 0; return num; }
25     operator Foo<T>() { return Foo<T>(); }
26     operator Foo<T>&() { return *(new Foo<T>()); }
27   }; 
28  } 
29%} 
30
31 namespace oss 
32 { 
33   enum Test {One, Two}; 
34 
35   // these works 
36   %ignore Hi::Hi(); 
37   %rename(create) Hi::Hi(int); 
38
39   struct Hi 
40   {
41     Hi();
42     Hi(int);
43   };
44
45   template <Test> 
46   struct Foo { 
47     Foo();
48   }; 
49 
50   // these works 
51   %rename(hello1) Bar<One>::operator int&(); 
52   %ignore Bar<One>::operator int(); 
53   %rename(hello2) Bar<One>::operator Foo<oss::One>&(); 
54   %ignore Bar<One>::operator Foo<oss::One>();
55    
56   // these don't
57   %ignore Bar<One>::Bar(); 
58   %rename(Bar_create) Bar<One>::Bar(int); 
59 
60   template <Test T>   
61   struct Bar { 
62     Bar();
63     Bar(int);
64     operator int(); 
65     operator int&(); 
66     operator Foo<T>(); 
67     operator Foo<T>&(); 
68   }; 
69  } 
70
71  
72namespace oss 
73{ 
74  %template(Foo_One) Foo<One>; 
75  %template(Bar_One) Bar<One>; 
76}