summaryrefslogtreecommitdiff
path: root/Examples/test-suite/constant_directive.i
blob: 8204720d6e11304aa903e691581193127a5ef271 (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
%module constant_directive

// %constant and struct
%{
  struct Type1 {
    Type1(int val = 0) : val(val) {} 
    int val;
  };
  static Type1 TYPE1_CONSTANT1(1);
  static Type1 TYPE1_CONST2(2);
  static Type1 TYPE1_CONST3(3);
%}

struct Type1 {
  Type1(int val = 0) : val(val) {} 
  int val;
};

%inline %{
Type1 getType1Instance() { return Type1(111); }
%}

%constant Type1 TYPE1_CONSTANT1;
%constant Type1 TYPE1_CONSTANT2 = TYPE1_CONST2;
%constant Type1 *TYPE1_CONSTANT3 = &TYPE1_CONST3;

%constant int TYPE_INT = 0;