/tags/rel-1-3-15/SWIG/Examples/test-suite/rename_default.i
Swig | 27 lines | 19 code | 8 blank | 0 comment | 0 complexity | 9a6b55ba3c90598231533a3ca53bb560 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1// Here's a nice little test for renaming, symbol table management, and default arguments
2
3%module rename_default
4
5// Rename a class member
6%rename(bar2) Foo::bar;
7
8%inline %{
9
10// Define a class
11class Foo {
12public:
13 static int bar;
14 static int spam;
15
16 // Use a renamed member as a default argument. SWIG has to resolve
17 // bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
18
19 void method1(int x = bar) {}
20
21 // Use unrenamed member as default
22 void method2(int x = spam) {}
23};
24int Foo::bar = 1;
25int Foo::spam = 2;
26%}
27