Fix wrapping of virtual comparison operators with directors
Closes #1642.
This commit is contained in:
parent
430a44e075
commit
4e57c5536d
4 changed files with 28 additions and 4 deletions
|
|
@ -184,6 +184,7 @@ CPP_TEST_CASES += \
|
||||||
director_classes \
|
director_classes \
|
||||||
director_classic \
|
director_classic \
|
||||||
director_constructor \
|
director_constructor \
|
||||||
|
director_comparison_operators \
|
||||||
director_conversion_operators \
|
director_conversion_operators \
|
||||||
director_default \
|
director_default \
|
||||||
director_detect \
|
director_detect \
|
||||||
|
|
|
||||||
16
Examples/test-suite/director_comparison_operators.i
Normal file
16
Examples/test-suite/director_comparison_operators.i
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
%module(directors="1") director_comparison_operators
|
||||||
|
|
||||||
|
%include "std_string.i"
|
||||||
|
%feature("director");
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class Foo {
|
||||||
|
public:
|
||||||
|
virtual ~Foo() { }
|
||||||
|
virtual bool operator==(const Foo&) const = 0;
|
||||||
|
virtual bool operator>=(const Foo&) const = 0;
|
||||||
|
virtual bool operator<=(const Foo&) const = 0;
|
||||||
|
virtual bool operator!=(const Foo&) const = 0;
|
||||||
|
virtual std::string test(const char *foo="a=1,b=2") { return foo; }
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
import director_comparison_operators
|
||||||
|
|
||||||
|
|
||||||
|
class PyFoo(director_comparison_operators.Foo):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
a = PyFoo()
|
||||||
|
|
||||||
|
if a.test() != "a=1,b=2":
|
||||||
|
raise RuntimeError, a.test()
|
||||||
|
|
@ -175,10 +175,6 @@ String *Swig_method_decl(SwigType *return_base_type, SwigType *decl, const_Strin
|
||||||
if (qualifiers)
|
if (qualifiers)
|
||||||
Printv(result, " ", qualifiers, NIL);
|
Printv(result, " ", qualifiers, NIL);
|
||||||
|
|
||||||
// Reformat result to how it has been historically
|
|
||||||
Replaceall(result, ",", ", ");
|
|
||||||
Replaceall(result, "=", " = ");
|
|
||||||
|
|
||||||
Delete(args_string);
|
Delete(args_string);
|
||||||
Delete(popped_decl);
|
Delete(popped_decl);
|
||||||
Delete(qualifiers);
|
Delete(qualifiers);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue