aboutsummaryrefslogtreecommitdiff
path: root/Examples/test-suite/cpp_static.i
blob: 9ffe55837e540a4cdf444d4f5977ba0316c1a1d5 (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
/*
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;
  static int grab_int() { return 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;
  static int grab_statty_base() { return statty; }
  virtual ~StaticBase() {}
};
struct StaticDerived : StaticBase {
  static int statty;
  static int grab_statty_derived() { return 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
%}