import source from 1.3.40
[external/swig.git] / Examples / test-suite / constructor_copy.i
1 %module constructor_copy
2
3 %copyctor;
4 %nocopyctor Foo8;
5 %nocopyctor Bar<double>;
6
7 %inline %{
8   
9 struct Foo1 {
10   int x;
11
12   Foo1(int _x = 2) : x(_x)
13   {
14   }  
15 };
16
17 struct Foo2 {
18   Foo2() { }
19 };
20
21 struct Foo3 {
22   Foo3() { }
23   Foo3(const Foo3& ) { }
24 };
25
26 struct Foo4 {
27   Foo4() { }
28   
29 protected:
30   Foo4(const Foo4& ) { }
31 };
32
33
34 struct Foo4a {
35   Foo4a() { }
36   
37 private:
38   Foo4a(const Foo4a& ) { }
39 };
40
41
42 struct Foo5 : Foo4 {
43 };
44
45 struct Foo6 : Foo4 {
46   Foo6(const Foo6& f) : Foo4(f) { }
47 };
48
49 struct Foo7 : Foo5 {
50 };
51
52 struct Foo8 {
53 };
54
55 template <class T>
56 class Bar 
57 {
58 public:
59   int x;
60
61   Bar(int _x = 0) : x(_x)
62   {
63   }
64 };
65 %}
66
67 %template(Bari) Bar<int>;
68 %template(Bard) Bar<double>;
69
70
71 #if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGUTL)
72
73
74 %include "std_vector.i"
75
76 #if defined(SWIGJAVA) || defined(SWIGCSHARP) || defined(SWIGPYTHON) || defined(SWIGR) || defined(SWIGOCTAVE) || defined(SWIGRUBY)
77 #define SWIG_GOOD_VECTOR
78 %ignore std::vector<Space::Flow>::vector(size_type);
79 %ignore std::vector<Space::Flow>::resize(size_type);
80 #endif
81
82 #if defined(SWIGTCL) || defined(SWIGPERL)
83 #define SWIG_GOOD_VECTOR
84 /* here, for languages with bad declaration */
85 %ignore std::vector<Space::Flow>::vector(unsigned int);
86 %ignore std::vector<Space::Flow>::resize(unsigned int);
87 #endif
88
89 %copyctor;
90
91 %ignore FlowFlow::FlowFlow;
92
93 %inline %{
94
95 namespace Space {
96 class Flow {
97 public:
98   Flow(int i) {}
99 };
100
101
102 class FlowFlow {
103 public:
104   FlowFlow(int i) {}
105 };
106
107 }
108
109 %}
110
111 %template (VectFlow) std::vector<Space::Flow>;
112
113 #endif
114
115
116 %rename(ABC_Libor_ModelUtils) ABC_Nam::ABC_Libor::ModelUtils;
117
118 %copyctor;
119 %inline %{
120   namespace ABC_Nam {
121     namespace ABC_Libor {
122       struct ModelUtils {};
123
124       template <class T>
125       struct ModelUtils_T {};
126
127     }    
128   }
129 %}
130
131 %template(ModelUtils_i) ABC_Nam::ABC_Libor::ModelUtils_T<int>;
132
133
134 %rename(Space1Space2_TotalReturnSwap) Space1::Space2::TotalReturnSwap;
135
136 %copyctor;
137
138 %inline %{
139 namespace Space1 {
140   namespace Space2 {
141
142     class TotalReturnSwap {
143     public:
144       TotalReturnSwap() {}
145     };    
146
147     template <class T>
148     class TotalReturnSwap_T {
149     public:
150       TotalReturnSwap_T() {}
151     };    
152
153   }
154 }
155 %}
156
157 %template(Total_i) Space1::Space2::TotalReturnSwap_T<int>;
158