Fix typos in attribute2ref() in Lib/typemaps/attribute.swg
AccessorName was being used instead of AttributeName. Closes #1872.
This commit is contained in:
parent
c12ab1f012
commit
bcfa927298
3 changed files with 7 additions and 1 deletions
|
|
@ -95,6 +95,7 @@ struct MyFoo; // %attribute2 does not work with templates
|
||||||
|
|
||||||
// class/struct attribute with get/set methods using return/pass by reference
|
// class/struct attribute with get/set methods using return/pass by reference
|
||||||
%attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo);
|
%attribute2(MyClass, MyFoo, Foo, GetFoo, SetFoo);
|
||||||
|
%attribute2ref(MyClass, MyFoo, Foo2);
|
||||||
%inline %{
|
%inline %{
|
||||||
struct MyFoo {
|
struct MyFoo {
|
||||||
MyFoo() : x(-1) {}
|
MyFoo() : x(-1) {}
|
||||||
|
|
@ -102,9 +103,11 @@ struct MyFoo; // %attribute2 does not work with templates
|
||||||
};
|
};
|
||||||
class MyClass {
|
class MyClass {
|
||||||
MyFoo foo;
|
MyFoo foo;
|
||||||
|
MyFoo foo2;
|
||||||
public:
|
public:
|
||||||
MyFoo& GetFoo() { return foo; }
|
MyFoo& GetFoo() { return foo; }
|
||||||
void SetFoo(const MyFoo& other) { foo = other; }
|
void SetFoo(const MyFoo& other) { foo = other; }
|
||||||
|
MyFoo& Foo2() { return foo2; }
|
||||||
};
|
};
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,9 @@ myClass = li_attribute.MyClass()
|
||||||
myClass.Foo = myFoo
|
myClass.Foo = myFoo
|
||||||
if myClass.Foo.x != 8:
|
if myClass.Foo.x != 8:
|
||||||
raise RuntimeError
|
raise RuntimeError
|
||||||
|
myClass.Foo2 = myFoo
|
||||||
|
if myClass.Foo2.x != 8:
|
||||||
|
raise RuntimeError
|
||||||
|
|
||||||
# class/struct attribute with get/set methods using return/pass by value
|
# class/struct attribute with get/set methods using return/pass by value
|
||||||
myClassVal = li_attribute.MyClassVal()
|
myClassVal = li_attribute.MyClassVal()
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@
|
||||||
#if #AccessorMethod != ""
|
#if #AccessorMethod != ""
|
||||||
%attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, &self_->AccessorMethod(), self_->AccessorMethod() = *val_)
|
%attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AccessorMethod, AccessorMethod, &self_->AccessorMethod(), self_->AccessorMethod() = *val_)
|
||||||
#else
|
#else
|
||||||
%attribute_custom(%arg(Class), %arg(AttributeType), AccessorName, AccessorName, AccessorName, &self_->AccessorName(), self_->AccessorName() = *val_)
|
%attribute_custom(%arg(Class), %arg(AttributeType), AttributeName, AttributeName, AttributeName, &self_->AttributeName(), self_->AttributeName() = *val_)
|
||||||
#endif
|
#endif
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue