add attribute.i for other languages that don't use the unified typemap library
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7730 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a503a53533
commit
db4f2f71a1
2 changed files with 23 additions and 7 deletions
15
Lib/attribute.i
Normal file
15
Lib/attribute.i
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
/* we use a simple exception warning here */
|
||||||
|
%{
|
||||||
|
#include <stdio.h>
|
||||||
|
%}
|
||||||
|
#define %attribute_exception(code,msg) printf("%s\n",msg)
|
||||||
|
|
||||||
|
#ifndef %arg
|
||||||
|
#define %arg(x) x
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef %mange
|
||||||
|
#define %mangle(Type...) #@Type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
%include <typemaps/attribute.swg>
|
||||||
|
|
@ -1,9 +1,3 @@
|
||||||
%{
|
|
||||||
#include <stdio.h>
|
|
||||||
%}
|
|
||||||
|
|
||||||
%include <typemaps/swigmacros.swg>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Attribute implementation using JOHN E LENZ ideas.
|
Attribute implementation using JOHN E LENZ ideas.
|
||||||
|
|
||||||
|
|
@ -79,6 +73,10 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifndef %attribute_exception
|
||||||
|
#define %attribute_exception(code,msg) SWIG_exception(code,msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Define SWIG_ATTRIBUTE_TEMPLATE if you want to use templates.
|
// Define SWIG_ATTRIBUTE_TEMPLATE if you want to use templates.
|
||||||
//
|
//
|
||||||
|
|
@ -130,10 +128,11 @@
|
||||||
#else
|
#else
|
||||||
%_attribute(%arg(Class), Wrap, %arg(type),
|
%_attribute(%arg(Class), Wrap, %arg(type),
|
||||||
attr, _t->get(),
|
attr, _t->get(),
|
||||||
SWIG_exception(SWIG_AttributeError,"read-only 'attr' attribute");)
|
%attribute_exception(SWIG_AttributeError,"read-only 'attr' attribute");)
|
||||||
#endif
|
#endif
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
%define %_attribute_ref_T(Class, Wrap, type, refname, attr)
|
%define %_attribute_ref_T(Class, Wrap, type, refname, attr)
|
||||||
%ignore Class::refname();
|
%ignore Class::refname();
|
||||||
%ignore Class::refname() const;
|
%ignore Class::refname() const;
|
||||||
|
|
@ -160,3 +159,5 @@
|
||||||
%define %attribute_ref(Class, type, refname, _Type...)
|
%define %attribute_ref(Class, type, refname, _Type...)
|
||||||
%attribute_ref_T(%arg(Class), %mangle(Class), %arg(type), refname, _Type)
|
%attribute_ref_T(%arg(Class), %mangle(Class), %arg(type), refname, _Type)
|
||||||
%enddef
|
%enddef
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue