added support for unnamed C++ enum members

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5805 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-31 01:35:44 +00:00
commit e00522f427
3 changed files with 30 additions and 1 deletions

View file

@ -403,3 +403,19 @@ static int NAME(TYPE x) {
%enddef
/* Auxiliar methods for assigning unnamed type C++ variables, where
swig doesn't know the casting type, but C++ can derived it:
struct Foo { enum {Hi, Hello } hola; };
*/
%insert("runtime") %{
#ifdef __cplusplus
template <class T, class V>
void swig_assign_unnamed(T& eval, const V& val)
{
eval = static_cast<T>(val);
}
#else
#define swig_assign_unnamed(eval, val) eval = val
#endif
%}