summaryrefslogtreecommitdiff
path: root/Lib/csharp
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-08-20 15:40:53 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-08-31 19:40:14 +0100
commite139a3651157a42e0086b15ce9df5dcba48cf4b2 (patch)
tree22d0c28382122bb3cd6b291d3dfa5a86e4e1d9b5 /Lib/csharp
parent0634883089550070c55e53a9f788a6794f3efaf2 (diff)
downloadswig-e139a3651157a42e0086b15ce9df5dcba48cf4b2.tar.gz
SWIGTYPE && input typemaps now assume object has been moved
Replicated Java implementation. Fully implemented for: - C# - D - Guile - Javascript (UTL) - Lua - MzScheme - Octave (UTL) - Perl (UTL) - PHP - Python (UTL) - Ruby (UTL) - Tcl (UTL) PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
Diffstat (limited to 'Lib/csharp')
-rw-r--r--Lib/csharp/csharp.swg12
1 files changed, 7 insertions, 5 deletions
diff --git a/Lib/csharp/csharp.swg b/Lib/csharp/csharp.swg
index 60ab388f3..1f80d12a1 100644
--- a/Lib/csharp/csharp.swg
+++ b/Lib/csharp/csharp.swg
@@ -420,14 +420,15 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
%}
%typemap(in, canthrow=1) SWIGTYPE & %{ $1 = ($1_ltype)$input;
if (!$1) {
- SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
return $null;
} %}
-%typemap(in, canthrow=1) SWIGTYPE && %{ $1 = ($1_ltype)$input;
+%typemap(in, canthrow=1, fragment="<memory>") SWIGTYPE && (std::unique_ptr<$*1_ltype> rvrdeleter) %{ $1 = ($1_ltype)$input;
if (!$1) {
- SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type type is null", 0);
+ SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "$1_type is null", 0);
return $null;
- } %}
+ }
+ rvrdeleter.reset($1); %}
%typemap(out) SWIGTYPE * %{ $result = (void *)$1; %}
%typemap(out, fragment="SWIG_PackData") SWIGTYPE (CLASS::*) %{
char buf[128];
@@ -613,7 +614,8 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
"$csinput"
%typemap(csin) char *, char *&, char[ANY], char[] "$csinput"
%typemap(csin) SWIGTYPE "$&csclassname.getCPtr($csinput)"
-%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE &&, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
+%typemap(csin) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] "$csclassname.getCPtr($csinput)"
+%typemap(csin) SWIGTYPE && "$csclassname.swigRelease($csinput)"
%typemap(csin) SWIGTYPE (CLASS::*) "$csclassname.getCMemberPtr($csinput)"
/* The csout typemap is used for converting function return types from the return type