/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
- // Here's a nice little test for renaming, symbol table management, and default arguments
- %module rename_default
- // Rename a class member
- %rename(bar2) Foo::bar;
- %inline %{
- // Define a class
- class Foo {
- public:
- static int bar;
- static int spam;
- // Use a renamed member as a default argument. SWIG has to resolve
- // bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
- void method1(int x = bar) {}
-
- // Use unrenamed member as default
- void method2(int x = spam) {}
- };
- int Foo::bar = 1;
- int Foo::spam = 2;
- %}