add argument protection for templates

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5778 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-20 00:23:40 +00:00
commit c827bad43b

View file

@ -79,7 +79,7 @@
return get; return get;
} }
template <class C> template <class C>
inline type Class ##_## attr ## _set(C *t, const type& val) { inline void Class ##_## attr ## _set(C *t, const type& val) {
set; set;
} }
%} %}
@ -87,9 +87,11 @@
%define %attribute(Class, type, attr, get, ...) %define %attribute(Class, type, attr, get, ...)
#if #__VA_ARGS__ != "" #if #__VA_ARGS__ != ""
%_attribute(Class, type, attr, t->get(), t->__VA_ARGS__(val)) %_attribute(SWIG_arg(Class), SWIG_arg(type),
attr, t->get(), t->__VA_ARGS__(val))
#else #else
%_attribute(Class, type, attr, t->get(), %_attribute(SWIG_arg(Class), SWIG_arg(type),
attr, t->get(),
std::cerr << "'attr' is a read-only attribute" << std::endl); std::cerr << "'attr' is a read-only attribute" << std::endl);
#endif #endif
%enddef %enddef
@ -106,7 +108,7 @@
return t->ref_name(); return t->ref_name();
} }
template <class C> template <class C>
inline type Class ##_## attr ## _set(C *t, const type& val) { inline void Class ##_## attr ## _set(C *t, const type& val) {
t->ref_name() = val; t->ref_name() = val;
} }
%} %}
@ -114,8 +116,8 @@
%define %attribute_ref(Class, type, attr, ...) %define %attribute_ref(Class, type, attr, ...)
#if #__VA_ARGS__ == "" #if #__VA_ARGS__ == ""
%_attribute_ref(Class, type, attr, attr) %_attribute_ref(SWIG_arg(Class), SWIG_arg(type), attr, attr)
#else #else
%_attribute_ref(Class, type, attr, __VA_ARGS__) %_attribute_ref(SWIG_arg(Class), SWIG_arg(type), attr, __VA_ARGS__)
#endif #endif
%enddef %enddef