summaryrefslogtreecommitdiff
path: root/Examples/test-suite/conversion_ns_template.i
blob: bddda5e7b627524fa18e8ddd70c4a713234360b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
%module conversion_ns_template
%{ 
 namespace oss 
 { 
   struct Hi
   {
     Hi(){}     
     Hi(int){}     
   };

   enum Test {One, Two}; 

   template <Test> 
   struct Foo { 
     Foo(){}
   }; 

   template <Test T>   
   struct Bar { 
     Bar(){ }
     Bar(int){ }
     
#if !defined(__SUNPRO_CC)
     operator int() { return 0; }
#endif
     operator int&() { static int num = 0; return num; }
#if !defined(__SUNPRO_CC)
     operator Foo<T>() { return Foo<T>(); }
#endif
     operator Foo<T>&() { return *(new Foo<T>()); }
   }; 
  } 
%} 

 namespace oss 
 { 
   enum Test {One, Two}; 
 
   // these works 
   %ignore Hi::Hi(); 
   %rename(create) Hi::Hi(int); 

   struct Hi 
   {
     Hi();
     Hi(int);
   };

   template <Test> 
   struct Foo { 
     Foo();
   }; 
 
   // these works 
   %rename(hello1) Bar<One>::operator int&(); 
   %ignore Bar<One>::operator int(); 
   %rename(hello2) Bar<One>::operator Foo<oss::One>&(); 
   %ignore Bar<One>::operator Foo<oss::One>();
    
   // these don't
   %ignore Bar<One>::Bar(); 
   %rename(Bar_create) Bar<One>::Bar(int); 
 
   template <Test T>   
   struct Bar { 
     Bar();
     Bar(int);
     operator int(); 
     operator int&(); 
     operator Foo<T>(); 
     operator Foo<T>&(); 
   }; 
  } 

  
namespace oss 
{ 
  %template(Foo_One) Foo<One>; 
  %template(Bar_One) Bar<One>; 
}