use macros by default and cosmetic changes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7723 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
dfbac7b290
commit
c26393c11d
1 changed files with 17 additions and 11 deletions
|
|
@ -79,7 +79,13 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
//
|
||||||
|
// Define SWIG_ATTRIBUTE_TEMPLATE if you want to use templates.
|
||||||
|
//
|
||||||
|
//#define SWIG_ATTRIBUTE_TEMPLATE
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && defined(SWIG_ATTRIBUTE_TEMPLATE)
|
||||||
%define %_attribute(Class, Wrap, type, attr, getcode, setcode)
|
%define %_attribute(Class, Wrap, type, attr, getcode, setcode)
|
||||||
%extend Class {
|
%extend Class {
|
||||||
type attr;
|
type attr;
|
||||||
|
|
@ -115,16 +121,16 @@
|
||||||
// Internal versions, need Wrap name
|
// Internal versions, need Wrap name
|
||||||
//
|
//
|
||||||
|
|
||||||
%define %attribute_T(Class, Wrap, type, attr, get, _Type...)
|
%define %attribute_T(Class, Wrap, type, attr, get, set...)
|
||||||
%ignore Class::get;
|
%ignore Class::get;
|
||||||
#if #_Type != ""
|
#if #set != ""
|
||||||
%ignore Class::_Type;
|
%ignore Class::set;
|
||||||
%_attribute(%arg(Class), Wrap, %arg(type),
|
%_attribute(%arg(Class), Wrap, %arg(type),
|
||||||
attr, _t->get(), _t->_Type(_val))
|
attr, _t->get(), _t->set(_val))
|
||||||
#else
|
#else
|
||||||
%_attribute(%arg(Class), Wrap, %arg(type),
|
%_attribute(%arg(Class), Wrap, %arg(type),
|
||||||
attr, _t->get(),
|
attr, _t->get(),
|
||||||
fprintf(stderr,"'attr' is a read-only attribute"))
|
SWIG_exception(SWIG_AttributeError,"read-only 'attr' attribute");)
|
||||||
#endif
|
#endif
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
@ -135,11 +141,11 @@
|
||||||
attr, _t->refname(), _t->refname() = _val)
|
attr, _t->refname(), _t->refname() = _val)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
%define %attribute_ref_T(Class, Wrap, type, refname, _Type...)
|
%define %attribute_ref_T(Class, Wrap, type, refname, attr...)
|
||||||
#if #_Type == ""
|
#if #attr == ""
|
||||||
%_attribute_ref_T(%arg(Class), Wrap, %arg(type), refname, refname)
|
%_attribute_ref_T(%arg(Class), Wrap, %arg(type), refname, refname)
|
||||||
#else
|
#else
|
||||||
%_attribute_ref_T(%arg(Class), Wrap, %arg(type), refname, _Type)
|
%_attribute_ref_T(%arg(Class), Wrap, %arg(type), refname, attr)
|
||||||
#endif
|
#endif
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
@ -147,8 +153,8 @@
|
||||||
// User versions
|
// User versions
|
||||||
//
|
//
|
||||||
|
|
||||||
%define %attribute(Class, type, attr, get, _Type...)
|
%define %attribute(Class, type, attr, get, set...)
|
||||||
%attribute_T(%arg(Class), %mangle(Class), %arg(type), attr, get, _Type)
|
%attribute_T(%arg(Class), %mangle(Class), %arg(type), attr, get, set)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
%define %attribute_ref(Class, type, refname, _Type...)
|
%define %attribute_ref(Class, type, refname, _Type...)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue