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:
parent
e0670df706
commit
e00522f427
3 changed files with 30 additions and 1 deletions
16
Lib/swig.swg
16
Lib/swig.swg
|
|
@ -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
|
||||
%}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue