Add rvalue reference typemaps for D
This commit is contained in:
parent
2ded25d138
commit
e1e4e4df28
1 changed files with 43 additions and 0 deletions
|
|
@ -20,6 +20,10 @@
|
|||
%typemap(imtype) SWIGTYPE & "void*"
|
||||
%typemap(dtype, nativepointer="$dtype") SWIGTYPE & "$dclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE && "void *"
|
||||
%typemap(imtype) SWIGTYPE && "void*"
|
||||
%typemap(dtype, nativepointer="$dtype") SWIGTYPE && "$dclassname"
|
||||
|
||||
%typemap(ctype) SWIGTYPE *const& "void *"
|
||||
%typemap(imtype) SWIGTYPE *const& "void*"
|
||||
%typemap(dtype) SWIGTYPE *const& "$*dclassname"
|
||||
|
|
@ -28,6 +32,7 @@
|
|||
SWIGTYPE,
|
||||
SWIGTYPE *,
|
||||
SWIGTYPE &,
|
||||
SWIGTYPE &&,
|
||||
SWIGTYPE [],
|
||||
SWIGTYPE *const&
|
||||
""
|
||||
|
|
@ -148,6 +153,43 @@
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Rvalue reference conversion typemaps.
|
||||
*/
|
||||
|
||||
%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input;
|
||||
if (!$1) {
|
||||
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "$1_type type is null");
|
||||
return $null;
|
||||
} %}
|
||||
%typemap(out) SWIGTYPE && "$result = (void *)$1;"
|
||||
|
||||
%typemap(directorin) SWIGTYPE &&
|
||||
"$input = ($1_ltype) &$1;"
|
||||
%typemap(directorout, warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG) SWIGTYPE &&
|
||||
%{ if (!$input) {
|
||||
SWIG_DSetPendingException(SWIG_DIllegalArgumentException, "Unexpected null return for type $1_type");
|
||||
return $null;
|
||||
}
|
||||
$result = ($1_ltype)$input; %}
|
||||
|
||||
%typemap(ddirectorin,
|
||||
nativepointer="cast($dtype)$winput"
|
||||
) SWIGTYPE && "new $dclassname($winput, false)"
|
||||
%typemap(ddirectorout,
|
||||
nativepointer="cast(void*)$dcall"
|
||||
) SWIGTYPE && "$dclassname.swigGetCPtr($dcall)"
|
||||
|
||||
%typemap(din,
|
||||
nativepointer="cast(void*)$dinput"
|
||||
) SWIGTYPE && "$dclassname.swigGetCPtr($dinput)"
|
||||
%typemap(dout, excode=SWIGEXCODE,
|
||||
nativepointer="{\n auto ret = cast($dtype)$imcall;$excode\n return ret;\n}") SWIGTYPE && {
|
||||
$dclassname ret = new $dclassname($imcall, $owner);$excode
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Array conversion typemaps.
|
||||
*/
|
||||
|
|
@ -164,6 +206,7 @@
|
|||
|
||||
// Treat references to arrays like references to a single element.
|
||||
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
|
||||
%apply SWIGTYPE && { SWIGTYPE ((&&)[ANY]) }
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue