swig/Examples/test-suite/python/attributetest.i
Marcelo Matus 95fa3be654 add 'attribute' macros for python
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5777 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2004-03-20 00:08:36 +00:00

50 lines
644 B
OpenEdge ABL

%module attributetest
%include attribute.i
%attribute(A, int, a, get_a, set_a);
%attribute_ref(A, int, b);
%attribute(A, int, c, get_c); /* read-only */
%attribute_ref(A, int, d, b); /* different attribute name 'd' */
%inline
{
struct A
{
A(int a, int b, int c) : _a(a), _b(b), _c(c)
{
}
int get_a() const
{
return _a;
}
void set_a(int aa)
{
_a = aa;
}
const int& b() const
{
return _b;
}
int& b()
{
return _b;
}
int get_c() const
{
return _c;
}
private:
int _a;
int _b;
int _c;
};
}