mirror of https://github.com/swig/swig
parent
8cf62a3325
commit
8e4868af75
|
@ -15,6 +15,10 @@ public class runme
|
|||
if (a.getA() != "Hello set from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.setAByRef("Hello");
|
||||
if (a.getA() != "Hello setAByRef from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.Dispose();
|
||||
}
|
||||
|
||||
|
@ -28,6 +32,10 @@ public class runme
|
|||
if (a.getA() != "Hello set from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.setAByRef("Hello");
|
||||
if (a.getA() != "Hello setAByRef from MyFoo") {
|
||||
throw new Exception( "Test failed" );
|
||||
}
|
||||
a.Dispose();
|
||||
}
|
||||
}
|
||||
|
@ -44,6 +52,11 @@ public class MyFoo : Foo
|
|||
{
|
||||
base.setA(a + " set from MyFoo");
|
||||
}
|
||||
|
||||
public override void setAByRef(string a)
|
||||
{
|
||||
base.setA(a + " setAByRef from MyFoo");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
virtual std::string pong() { return "Foo::pong();" + ping(); }
|
||||
virtual std::string getA() { return this->a_; }
|
||||
virtual void setA(std::string a) { this->a_ = a; }
|
||||
virtual void setAByRef(const std::string &a) { this->a_ = a; }
|
||||
|
||||
static Foo* get_self(Foo *slf) {return slf;}
|
||||
|
||||
};
|
||||
|
||||
%}
|
||||
|
@ -37,9 +37,9 @@
|
|||
virtual std::string pong();
|
||||
virtual std::string getA();
|
||||
virtual void setA(std::string a);
|
||||
virtual void setAByRef(const std::string &a);
|
||||
|
||||
static Foo* get_self(Foo *slf);
|
||||
|
||||
};
|
||||
|
||||
%{
|
||||
|
|
|
@ -23,6 +23,10 @@ public class director_property_runme {
|
|||
if (!a.getA().equals("Hello set from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.setAByRef("Hello");
|
||||
if (!a.getA().equals("Hello setAByRef from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.delete();
|
||||
}
|
||||
|
||||
|
@ -36,6 +40,10 @@ public class director_property_runme {
|
|||
if (!a.getA().equals("Hello set from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.setAByRef("Hello");
|
||||
if (!a.getA().equals("Hello setAByRef from MyFoo")) {
|
||||
throw new RuntimeException( "Test failed" );
|
||||
}
|
||||
a.delete();
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +57,10 @@ class director_property_MyFoo extends Foo {
|
|||
public void setA(String a) {
|
||||
super.setA(a + " set from MyFoo");
|
||||
}
|
||||
@Override
|
||||
public void setAByRef(String a) {
|
||||
super.setA(a + " setAByRef from MyFoo");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,3 +23,34 @@ if foo.a != "BIBI":
|
|||
raise RuntimeError
|
||||
if foo.getA() != "BIBI":
|
||||
raise RuntimeError
|
||||
|
||||
|
||||
|
||||
class MyFoo(director_property.Foo):
|
||||
def setA(self, a):
|
||||
director_property.Foo.setA(self, a + " set from MyFoo")
|
||||
def setAByRef(self, a):
|
||||
director_property.Foo.setA(self, a + " setAByRef from MyFoo")
|
||||
|
||||
a = MyFoo()
|
||||
if (a.getA() != ""):
|
||||
raise RuntimeError("Test failed")
|
||||
a.setA("Hello")
|
||||
if (a.getA() != "Hello set from MyFoo"):
|
||||
raise RuntimeError("Test failed")
|
||||
a.setAByRef("Hello")
|
||||
if (a.getA() != "Hello setAByRef from MyFoo"):
|
||||
raise RuntimeError("Test failed")
|
||||
del a
|
||||
|
||||
a_original = MyFoo()
|
||||
a = director_property.Foo.get_self(a_original)
|
||||
if (a.getA() != ""):
|
||||
raise RuntimeError("Test failed")
|
||||
a.setA("Hello")
|
||||
if (a.getA() != "Hello set from MyFoo"):
|
||||
raise RuntimeError("Test failed")
|
||||
a.setAByRef("Hello")
|
||||
if (a.getA() != "Hello setAByRef from MyFoo"):
|
||||
raise RuntimeError("Test failed")
|
||||
del a
|
||||
|
|
|
@ -57,7 +57,7 @@ class string;
|
|||
return $null; %}
|
||||
|
||||
// const string &
|
||||
%typemap(ctype) const string & "char *"
|
||||
%typemap(ctype) const string & "const char *"
|
||||
%typemap(imtype) const string & "string"
|
||||
%typemap(cstype) const string & "string"
|
||||
|
||||
|
@ -89,7 +89,7 @@ class string;
|
|||
$1_str = $input;
|
||||
$result = &$1_str; %}
|
||||
|
||||
%typemap(directorin) const string & %{ $input = SWIG_csharp_string_callback($1.c_str()); %}
|
||||
%typemap(directorin) const string & %{ $input = $1.c_str(); %}
|
||||
|
||||
%typemap(csvarin, excode=SWIGEXCODE2) const string & %{
|
||||
set {
|
||||
|
|
Loading…
Reference in New Issue