PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/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. %module rename_default
  3. // Rename a class member
  4. %rename(bar2) Foo::bar;
  5. %inline %{
  6. // Define a class
  7. class Foo {
  8. public:
  9. static int bar;
  10. static int spam;
  11. // Use a renamed member as a default argument. SWIG has to resolve
  12. // bar to Foo::bar and not Foo::spam. SWIG-1.3.11 got this wrong.
  13. void method1(int x = bar) {}
  14. // Use unrenamed member as default
  15. void method2(int x = spam) {}
  16. };
  17. int Foo::bar = 1;
  18. int Foo::spam = 2;
  19. %}