Add rvalue reference typemaps
This commit is contained in:
parent
9bd2fb2cad
commit
341a5366dd
2 changed files with 25 additions and 2 deletions
|
|
@ -40,7 +40,7 @@
|
||||||
%typemap(consttab) long long, unsigned long long
|
%typemap(consttab) long long, unsigned long long
|
||||||
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
|
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
|
||||||
|
|
||||||
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
|
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE []
|
||||||
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
|
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
|
||||||
|
|
||||||
// member function pointers
|
// member function pointers
|
||||||
|
|
|
||||||
|
|
@ -68,8 +68,12 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
|
||||||
// and const refs
|
// and const refs
|
||||||
%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &($basetype temp)
|
%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &($basetype temp)
|
||||||
%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%}
|
%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%}
|
||||||
|
%typemap(in,checkfn="lua_isnumber") const enum SWIGTYPE &&($basetype temp)
|
||||||
|
%{ temp=($basetype)(int)lua_tonumber(L,$input); $1=&temp;%}
|
||||||
%typemap(out) const enum SWIGTYPE &
|
%typemap(out) const enum SWIGTYPE &
|
||||||
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
|
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
|
||||||
|
%typemap(out) const enum SWIGTYPE &&
|
||||||
|
%{ lua_pushnumber(L, (lua_Number) *$1); SWIG_arg++;%}
|
||||||
|
|
||||||
|
|
||||||
// boolean (which is a special type in lua)
|
// boolean (which is a special type in lua)
|
||||||
|
|
@ -147,9 +151,18 @@ SWIGINTERN int SWIG_lua_isnilstring(lua_State *L, int idx) {
|
||||||
}
|
}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE&&
|
||||||
|
%{
|
||||||
|
if (!SWIG_IsOK(SWIG_ConvertPtr(L,$input,(void**)&$1,$descriptor,$disown))){
|
||||||
|
SWIG_fail_ptr("$symname",$argnum,$descriptor);
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
// out is simple
|
// out is simple
|
||||||
%typemap(out) SWIGTYPE*,SWIGTYPE&
|
%typemap(out) SWIGTYPE*,SWIGTYPE&
|
||||||
%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %}
|
%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %}
|
||||||
|
%typemap(out) SWIGTYPE*,SWIGTYPE&&
|
||||||
|
%{SWIG_NewPointerObj(L,$1,$descriptor,$owner); SWIG_arg++; %}
|
||||||
|
|
||||||
// dynamic casts
|
// dynamic casts
|
||||||
// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is
|
// this uses the SWIG_TypeDynamicCast() which relies on RTTI to find out what the pointer really is
|
||||||
|
|
@ -284,7 +297,7 @@ parmeters match which function
|
||||||
const unsigned int &, const unsigned short &, const unsigned long &,
|
const unsigned int &, const unsigned short &, const unsigned long &,
|
||||||
const signed char&, const unsigned char&,
|
const signed char&, const unsigned char&,
|
||||||
const long long &, const unsigned long long &,
|
const long long &, const unsigned long long &,
|
||||||
enum SWIGTYPE, const enum SWIGTYPE&,
|
enum SWIGTYPE, const enum SWIGTYPE&, const enum SWIGTYPE &&,
|
||||||
float, double, const float &, const double&
|
float, double, const float &, const double&
|
||||||
{
|
{
|
||||||
$1 = lua_isnumber(L,$input);
|
$1 = lua_isnumber(L,$input);
|
||||||
|
|
@ -323,6 +336,15 @@ parmeters match which function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE && {
|
||||||
|
void *ptr;
|
||||||
|
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $1_descriptor, 0)) {
|
||||||
|
$1 = 0;
|
||||||
|
} else {
|
||||||
|
$1 = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE {
|
||||||
void *ptr;
|
void *ptr;
|
||||||
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) {
|
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $&1_descriptor, 0)) {
|
||||||
|
|
@ -360,6 +382,7 @@ parmeters match which function
|
||||||
|
|
||||||
// Array reference typemaps
|
// Array reference typemaps
|
||||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||||
|
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||||
|
|
||||||
/* const pointers */
|
/* const pointers */
|
||||||
%apply SWIGTYPE * { SWIGTYPE *const }
|
%apply SWIGTYPE * { SWIGTYPE *const }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue