aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp_static.i
blob: 1f8ca1282a7f2d061e4ca15772702513d1784d28 (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
/*
Testcase to test c++ static member variables and static functions.
Tests Sourceforge bug #444748.
*/

%module cpp_static

%inline %{

class StaticMemberTest {
public:
  static int static_int;
};

class StaticFunctionTest {
public:
  static void static_func() {};
  static void static_func_2(int param_1) {};
  static void static_func_3(int param_1, int param_2) {};
};

%}

%{
int StaticMemberTest::static_int = 99;
%}

%inline %{
struct StaticBase {
  static int statty;
  virtual ~StaticBase() {}
};
struct StaticDerived : StaticBase {
  static int statty;
};
%}

%{
int StaticBase::statty = 11;
int StaticDerived::statty = 111;
%}

%inline %{
#ifdef SWIGPYTHON_BUILTIN
bool is_python_builtin() { return true; }
#else
bool is_python_builtin() { return false; }
#endif
%}