1 // Test %rename directive with the 'using' keyword and within the class definition
15 namespace AnotherSpace {
20 %rename(opAnother1) XYZ::operator Another() const;
21 %rename(opAnother2) XYZ<int>::operator Another() const;
22 %rename(opAnother3) XYZ<Space::Klass>::operator Another() const;
23 %rename(opAnother4) XYZ<Space::Enu>::operator Another() const;
26 // Test %rename - no namespace, but specific templated type in the parameter, is used over the generic type T
27 %rename(tMethod2) templateT(int i);
28 %rename(tMethodNotXYZ2) templateNotXYZ(NotXYZ<int>);
29 %rename(tMethodXYZ2) templateXYZ(XYZ<int>);
30 %rename(opT2) operator int();
31 %rename(opNotXYZ2) operator NotXYZ<int>() const;
32 %rename(opXYZ2) operator XYZ<int>() const;
34 %rename(tMethod3) templateT(Space::Klass i);
35 %rename(tMethodNotXYZ3) templateNotXYZ(NotXYZ<Space::Klass>);
36 %rename(tMethodXYZ3) templateXYZ(XYZ<Space::Klass>);
37 %rename(opT3) operator Space::Klass();
38 %rename(opNotXYZ3) operator NotXYZ<Space::Klass>() const;
39 %rename(opXYZ3) operator XYZ<Space::Klass>() const;
41 %rename(tMethod4) templateT(Space::Enu i);
42 %rename(tMethodNotXYZ4) templateNotXYZ(NotXYZ<Space::Enu>);
43 %rename(tMethodXYZ4) templateXYZ(XYZ<Space::Enu>);
44 %rename(opT4) operator Space::Enu();
45 %rename(opNotXYZ4) operator NotXYZ<Space::Enu>() const;
46 %rename(opXYZ4) operator XYZ<Space::Enu>() const;
49 using namespace AnotherSpace;
50 enum Enu { En1, En2, En3 };
51 template<typename T> struct NotXYZ {};
52 template<typename T> class XYZ {
54 // Test %rename within the class
55 %rename(opIntPtrA) operator NotXYZ<int>*() const;
56 %rename(opIntPtrB) operator XYZ<int>*() const;
58 %rename(tMethod1) templateT(T i);
59 %rename(tMethodNotXYZ1) templateNotXYZ(NotXYZ<T>);
60 %rename(tMethodXYZ1) templateXYZ(XYZ<T>);
61 %rename(opT1) operator T();
62 %rename(opNotXYZ1) operator NotXYZ<T>() const;
63 %rename(opXYZ1) operator XYZ<T>() const;
69 operator NotXYZ<int>*() const { return m_int; }
70 operator XYZ<int>*() const { return 0; }
71 operator Another() const { Another an; return an; }
72 void templateT(T i) {}
73 void templateNotXYZ(NotXYZ<T> i) {}
74 void templateXYZ(XYZ<T> i) {}
75 operator T() { return m_t; }
76 operator NotXYZ<T>() const { return m_notxyz; }
77 operator XYZ<T>() const { XYZ<T> xyz; return xyz; }
82 // non-templated class using itself in method and operator
86 %rename(methodABC) method(ABC a) const;
87 %rename(opABC) operator ABC() const;
88 %rename(methodKlass) method(Klass k) const;
89 %rename(opKlass) operator Klass() const;
91 void method(ABC a) const {}
92 void method(Klass k) const {}
93 operator ABC() const { ABC a; return a; }
94 operator Klass() const { Klass k; return k; }
99 %template(XYZInt) Space::XYZ<int>;
100 %template(XYZDouble) Space::XYZ<double>;
101 %template(XYZKlass) Space::XYZ<Space::Klass>;
102 %template(XYZEnu) Space::XYZ<Space::Enu>;
104 %template(NotXYZInt) Space::NotXYZ<int>;
105 %template(NotXYZDouble) Space::NotXYZ<double>;
106 %template(NotXYZKlass) Space::NotXYZ<Space::Klass>;
107 %template(NotXYZEnu) Space::NotXYZ<Space::Enu>;