Home | History | Annotate | Download | only in lua
      1 /*
      2 	A modification of factory.swg from the generic UTL library.
      3 */
      4 
      5 %include <typemaps/swigmacros.swg>
      6 
      7 %define %_factory_dispatch(Type)
      8 if (!dcast) {
      9   Type *dobj = dynamic_cast<Type *>($1);
     10   if (dobj) {
     11     dcast = 1;
     12     SWIG_NewPointerObj(L, dobj, $descriptor(Type *), $owner); SWIG_arg++;
     13   }
     14 }%enddef
     15 
     16 %define %factory(Method,Types...)
     17 %typemap(out) Method {
     18   int dcast = 0;
     19   %formacro(%_factory_dispatch, Types)
     20   if (!dcast) {
     21     SWIG_NewPointerObj(L, $1, $descriptor, $owner); SWIG_arg++;
     22   }
     23 }%enddef
     24