summaryrefslogtreecommitdiff
path: root/Examples/test-suite/rename3.i
blob: 5b613d7694c46203e85f748af447a14086abc15b (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
// Test %rename directive within %extend
%module rename3

namespace Space {
  // Note no namespace nor class qualification
  %extend XYZ {
    %rename(opIntPtrA) operator NotXYZ<int>*() const;
    %rename(opIntPtrB) operator XYZ<int>*() const;
  }

  %extend XYZ {
    // Note use of type T
    %rename(opAnother1) operator Another() const;
    %rename(tMethod1) templateT(T i);
    %rename(tMethodNotXYZ1) templateNotXYZ(NotXYZ<T>);
    %rename(tMethodXYZ1) templateXYZ(XYZ<T>);
    %rename(opT1) operator T();
    %rename(opNotXYZ1) operator NotXYZ<T>() const;
    %rename(opXYZ1) operator XYZ<T>() const;
  }

  %extend XYZ<int> {
    %rename(opAnother2) operator Another() const;
    %rename(tMethod2) templateT(int i);
    %rename(tMethodNotXYZ2) templateNotXYZ(NotXYZ<int>);
    %rename(tMethodXYZ2) templateXYZ(XYZ<int>);
    %rename(opT2) operator int();
    %rename(opNotXYZ2) operator NotXYZ<int>() const;
    %rename(opXYZ2) operator XYZ<int>() const;
  }

  %extend XYZ<Space::Klass> {
    %rename(opAnother3) operator Another() const;
    %rename(tMethod3) templateT(Space::Klass i);
    %rename(tMethodNotXYZ3) templateNotXYZ(NotXYZ<Space::Klass>);
    %rename(tMethodXYZ3) templateXYZ(XYZ<Space::Klass>);
    %rename(opT3) operator Space::Klass();
    %rename(opNotXYZ3) operator NotXYZ<Space::Klass>() const;
    %rename(opXYZ3) operator XYZ<Space::Klass>() const;
  }

  %extend XYZ<Space::Enu> {
    %rename(opAnother4 )operator Another() const;
    %rename(tMethod4) templateT(Space::Enu i);
    %rename(tMethodNotXYZ4) templateNotXYZ(NotXYZ<Space::Enu>);
    %rename(tMethodXYZ4) templateXYZ(XYZ<Space::Enu>);
    %rename(opT4) operator Space::Enu();
    %rename(opNotXYZ4) operator NotXYZ<Space::Enu>() const;
    %rename(opXYZ4) operator XYZ<Space::Enu>() const;
  }


  %extend ABC {
    %rename(methodABC) method(ABC a) const;
    %rename(opABC) operator ABC*() const;
    %rename(methodKlass) method(Klass k) const;
    %rename(opKlass) operator Klass() const;
  }
}

%{
#include "rename.h"
%}
%include "rename.h"

%template(XYZInt) Space::XYZ<int>;
%template(XYZDouble) Space::XYZ<double>;
%template(XYZKlass) Space::XYZ<Space::Klass>;
%template(XYZEnu) Space::XYZ<Space::Enu>;

%template(NotXYZInt) Space::NotXYZ<int>;
%template(NotXYZDouble) Space::NotXYZ<double>;
%template(NotXYZKlass) Space::NotXYZ<Space::Klass>;
%template(NotXYZEnu) Space::NotXYZ<Space::Enu>;