Add rvalue reference typemaps
This commit is contained in:
parent
d3769a1fd4
commit
ac74c90fb0
6 changed files with 127 additions and 6 deletions
|
|
@ -84,6 +84,9 @@
|
|||
%typemap(varout,type="$1_descriptor") SWIGTYPE &
|
||||
"sv_setiv(SvRV($result),PTR2IV(&$1));";
|
||||
|
||||
%typemap(varout,type="$1_descriptor") SWIGTYPE &&
|
||||
"sv_setiv(SvRV($result),PTR2IV(&$1));";
|
||||
|
||||
%typemap(varout,type="$&1_descriptor") SWIGTYPE
|
||||
"sv_setiv(SvRV($result), PTR2IV(&$1));";
|
||||
|
||||
|
|
|
|||
|
|
@ -5,11 +5,13 @@
|
|||
%typemap(doc) SWIGTYPE "@param $1_name $1_type value";
|
||||
%typemap(doc) SWIGTYPE * "@param $1_name $1_type value";
|
||||
%typemap(doc) const SWIGTYPE & "@param $1_name $1_type value";
|
||||
%typemap(doc) const SWIGTYPE && "@param $1_name $1_type value";
|
||||
%typemap(doc) enum SWIGTYPE "@param $1_name enum $1_type value";
|
||||
#else
|
||||
%typemap(doc) SWIGTYPE "$1_name: $1_type value";
|
||||
%typemap(doc) SWIGTYPE * "$1_name: $1_type value";
|
||||
%typemap(doc) const SWIGTYPE & "$1_name: $1_type value";
|
||||
%typemap(doc) const SWIGTYPE && "$1_name: $1_type value";
|
||||
%typemap(doc) enum SWIGTYPE "$1_name: enum $1_type value";
|
||||
|
||||
%typemap(doc) SWIGTYPE *INOUT "$1_name: $1_type input/ouput value";
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@
|
|||
%typemap("rtype") enum SWIGTYPE * "character";
|
||||
%typemap("rtype") enum SWIGTYPE *const "character";
|
||||
%typemap("rtype") enum SWIGTYPE & "character";
|
||||
%typemap("rtype") enum SWIGTYPE && "character";
|
||||
%typemap("rtype") SWIGTYPE * "$R_class";
|
||||
%typemap("rtype") SWIGTYPE *const "$R_class";
|
||||
%typemap("rtype") SWIGTYPE & "$R_class";
|
||||
%typemap("rtype") SWIGTYPE && "$R_class";
|
||||
%typemap("rtype") SWIGTYPE "$&R_class";
|
||||
|
||||
|
||||
|
|
@ -65,13 +67,15 @@
|
|||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE &
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE &&
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE *
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
%typemap(scoercein) enum SWIGTYPE *const
|
||||
%{ $input = enumToInteger($input, "$R_class"); %}
|
||||
|
||||
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
|
||||
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE &&
|
||||
%{ %}
|
||||
|
||||
/*
|
||||
|
|
@ -81,6 +85,9 @@
|
|||
%typemap(scoercein) SWIGTYPE &
|
||||
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE &&
|
||||
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
|
||||
|
||||
%typemap(scoercein) SWIGTYPE
|
||||
%{ $input = coerceIfNotSubclass($input, "$&R_class") %}
|
||||
*/
|
||||
|
|
@ -116,6 +123,9 @@ string &, std::string &
|
|||
%typemap(scoerceout) enum SWIGTYPE &
|
||||
%{ $result = enumFromInteger($result, "$R_class"); %}
|
||||
|
||||
%typemap(scoerceout) enum SWIGTYPE &&
|
||||
%{ $result = enumFromInteger($result, "$R_class"); %}
|
||||
|
||||
%typemap(scoerceout) enum SWIGTYPE *
|
||||
%{ $result = enumToInteger($result, "$R_class"); %}
|
||||
|
||||
|
|
@ -129,6 +139,9 @@ string &, std::string &
|
|||
%typemap(scoerceout) SWIGTYPE &
|
||||
%{ class($result) <- "$R_class"; %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE &&
|
||||
%{ class($result) <- "$R_class"; %}
|
||||
|
||||
%typemap(scoerceout) SWIGTYPE *
|
||||
%{ class($result) <- "$R_class"; %}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
#if 1
|
||||
// Old 1.3.25 typemaps needed to avoid premature object deletion
|
||||
%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] {
|
||||
%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE &&INSTANCE, SWIGTYPE INSTANCE[] {
|
||||
Tcl_SetObjResult(interp, SWIG_NewInstanceObj( %as_voidptr($1), $1_descriptor,0));
|
||||
}
|
||||
|
||||
|
|
@ -86,5 +86,6 @@
|
|||
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
|
||||
%typemap(out) SWIGTYPE *const = SWIGTYPE *;
|
||||
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
|
||||
%typemap(out) SWIGTYPE && = SWIGTYPE &&INSTANCE;
|
||||
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
|
||||
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,20 @@
|
|||
* ------------------------------------------------------------ */
|
||||
|
||||
%apply int { enum SWIGTYPE };
|
||||
%apply const int& { const enum SWIGTYPE& };
|
||||
%apply const int& { const enum SWIGTYPE & };
|
||||
%apply const int& { const enum SWIGTYPE && };
|
||||
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE& (int val, int ecode, $basetype temp) {
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE & (int val, int ecode, $basetype temp) {
|
||||
ecode = SWIG_AsVal(int)($input, &val);
|
||||
if (!SWIG_IsOK(ecode)) {
|
||||
%argument_fail(ecode, "$type", $symname, $argnum);
|
||||
} else {
|
||||
temp = %static_cast(val,$basetype);
|
||||
$1 = &temp;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in,fragment=SWIG_AsVal_frag(int),noblock=1) const enum SWIGTYPE && (int val, int ecode, $basetype temp) {
|
||||
ecode = SWIG_AsVal(int)($input, &val);
|
||||
if (!SWIG_IsOK(ecode)) {
|
||||
%argument_fail(ecode, "$type", $symname, $argnum);
|
||||
|
|
|
|||
|
|
@ -67,6 +67,41 @@
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Rvalue reference */
|
||||
%typemap(in, noblock=1) SWIGTYPE && (void *argp = 0, int res = 0) {
|
||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
%typemap(freearg) SWIGTYPE && "";
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(in,noblock=1,implicitconv=1) const SWIGTYPE && (void *argp = 0, int res = 0) {
|
||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags | %implicitconv_flag);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
%typemap(freearg,noblock=1,match="in",implicitconv=1) const SWIGTYPE &&
|
||||
{
|
||||
if (SWIG_IsNewObj(res$argnum)) %delete($1);
|
||||
}
|
||||
#else
|
||||
%typemap(in,noblock=1) const SWIGTYPE && (void *argp, int res = 0) {
|
||||
res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%argument_fail(res, "$type", $symname, $argnum);
|
||||
}
|
||||
if (!argp) { %argument_nullref("$type", $symname, $argnum); }
|
||||
$1 = %reinterpret_cast(argp, $ltype);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* By value */
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(in,implicitconv=1) SWIGTYPE (void *argp, int res = 0) {
|
||||
|
|
@ -102,7 +137,7 @@
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
/* Pointers, references */
|
||||
%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE[] {
|
||||
%typemap(out,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE[] {
|
||||
%set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags));
|
||||
}
|
||||
|
||||
|
|
@ -235,6 +270,18 @@
|
|||
$1 = *(%reinterpret_cast(argp, $ltype));
|
||||
}
|
||||
|
||||
%typemap(varin,warning=SWIGWARN_TYPEMAP_SWIGTYPELEAK_MSG) SWIGTYPE && {
|
||||
void *argp = 0;
|
||||
int res = SWIG_ConvertPtr($input, &argp, $descriptor, %convertptr_flags);
|
||||
if (!SWIG_IsOK(res)) {
|
||||
%variable_fail(res, "$type", "$name");
|
||||
}
|
||||
if (!argp) {
|
||||
%variable_nullref("$type", "$name");
|
||||
}
|
||||
$1 = *(%reinterpret_cast(argp, $ltype));
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(varin,implicitconv=1) SWIGTYPE {
|
||||
void *argp = 0;
|
||||
|
|
@ -284,6 +331,10 @@
|
|||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags));
|
||||
}
|
||||
|
||||
%typemap(varout, noblock=1) SWIGTYPE && {
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $descriptor, %newpointer_flags));
|
||||
}
|
||||
|
||||
/* Value */
|
||||
%typemap(varout, noblock=1) SWIGTYPE {
|
||||
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(&$1), $&descriptor, %newpointer_flags));
|
||||
|
|
@ -311,12 +362,23 @@
|
|||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE && {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE & {
|
||||
int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) const SWIGTYPE && {
|
||||
int res = SWIG_ConvertPtr($input, 0, $descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1,implicitconv=1) SWIGTYPE {
|
||||
int res = SWIG_ConvertPtr($input, 0, $&descriptor, %implicitconv_flag);
|
||||
$1 = SWIG_CheckState(res);
|
||||
|
|
@ -327,6 +389,11 @@
|
|||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) const SWIGTYPE && {
|
||||
void *vptr = 0;
|
||||
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
|
||||
$1 = SWIG_CheckState(res);
|
||||
}
|
||||
|
||||
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE {
|
||||
void *vptr = 0;
|
||||
|
|
@ -355,6 +422,10 @@
|
|||
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
|
||||
}
|
||||
|
||||
%typemap(directorin,noblock=1) SWIGTYPE && {
|
||||
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
|
||||
}
|
||||
|
||||
/* directorout */
|
||||
#if defined(__cplusplus) && defined(%implicitconv_flag)
|
||||
%typemap(directorout,noblock=1,implicitconv=1) SWIGTYPE (void * swig_argp, int swig_res = 0) {
|
||||
|
|
@ -406,6 +477,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
%typemap(directorout,noblock=1,warning=SWIGWARN_TYPEMAP_DIRECTOROUT_PTR_MSG)
|
||||
SWIGTYPE &&(void *swig_argp, int swig_res, swig_owntype own) {
|
||||
swig_res = SWIG_ConvertPtrAndOwn($input, &swig_argp, $descriptor, %convertptr_flags | SWIG_POINTER_DISOWN, &own);
|
||||
if (!SWIG_IsOK(swig_res)) {
|
||||
%dirout_fail(swig_res,"$type");
|
||||
}
|
||||
if (!swig_argp) { %dirout_nullref("$type"); }
|
||||
$result = %reinterpret_cast(swig_argp, $ltype);
|
||||
swig_acquire_ownership_obj(%as_voidptr($result), own /* & TODO: SWIG_POINTER_OWN */);
|
||||
}
|
||||
%typemap(directorfree,noblock=1,match="directorout") SWIGTYPE && {
|
||||
if (director) {
|
||||
SWIG_AcquirePtr($result, director->swig_release_ownership(%as_voidptr($input)));
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SWIG_DIRECTOR_TYPEMAPS */
|
||||
|
||||
|
||||
|
|
@ -413,7 +500,7 @@
|
|||
* --- Constants ---
|
||||
* ------------------------------------------------------------ */
|
||||
|
||||
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
|
||||
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] {
|
||||
%set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags));
|
||||
}
|
||||
|
||||
|
|
@ -441,6 +528,10 @@
|
|||
%raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor);
|
||||
}
|
||||
|
||||
%typemap(throws,noblock=1) SWIGTYPE && {
|
||||
%raise(SWIG_NewPointerObj(%as_voidptr(&$1),$descriptor,0), "$type", $descriptor);
|
||||
}
|
||||
|
||||
%typemap(throws,noblock=1) (...) {
|
||||
SWIG_exception_fail(SWIG_RuntimeError,"unknown exception");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue