| // Exercises the -keyword command line option combined with per-symbol | |
| // %nokwargs opt-outs. Covers constructors, instance methods, static methods, | |
| // and global functions. KwargsClass inherits the -keyword default and accepts | |
| // keyword arguments; NoKwargsClass marks its constructor and methods with | |
| // %nokwargs and must reject them. Built with -keyword via Makefile.in. | |
| %module python_nokwargs_keyword | |
| %inline %{ | |
| #ifdef SWIGPYTHON_BUILTIN | |
| bool is_python_builtin() { return true; } | |
| #else | |
| bool is_python_builtin() { return false; } | |
| #endif | |
| %} | |
| %nokwargs NoKwargsClass::NoKwargsClass; | |
| %nokwargs NoKwargsClass::instance_method; | |
| %nokwargs NoKwargsClass::static_method; | |
| %nokwargs no_kw_global; | |
| %inline %{ | |
| struct KwargsClass { | |
| int value; | |
| KwargsClass(int a = 10, int b = 20) : value(1000 * a + b) {} | |
| int instance_method(int a = 1, int b = 2) { return 10 * a + b; } | |
| static int static_method(int a = 1, int b = 2) { return 100 * a + b; } | |
| }; | |
| struct NoKwargsClass { | |
| int value; | |
| NoKwargsClass(int a = 10, int b = 20) : value(1000 * a + b) {} | |
| int instance_method(int a = 1, int b = 2) { return 10 * a + b; } | |
| static int static_method(int a = 1, int b = 2) { return 100 * a + b; } | |
| }; | |
| int kw_global(int a = 1, int b = 2) { return 10000 * a + b; } | |
| int no_kw_global(int a = 1, int b = 2) { return 10000 * a + b; } | |
| %} |