Change typemap matching rules for the default type (SWIGTYPE) to follow template partial specialization type deduction. Fixes some containers of const pointers. SWIGTYPE*& typemps removed and replaced with SWIGTYPE *const&.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11958 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-04-01 18:26:37 +00:00
commit bdb136d611
41 changed files with 477 additions and 122 deletions

View file

@ -44,10 +44,10 @@
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >($1 SWIG_NO_NULL_DELETER_$owner); %}
// plain pointer by reference
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0)
%{ temp = (((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0)
%{ temp = (TYPE *)(((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input) ? ((SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *)$input)->get() : 0);
$1 = &temp; %}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *&
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST&
%{ $result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -138,7 +138,7 @@
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;
}
%typemap(csout, excode=SWIGEXCODE) CONST TYPE *& {
%typemap(csout, excode=SWIGEXCODE) TYPE *CONST& {
IntPtr cPtr = $imcall;
PROXYCLASS ret = (cPtr == IntPtr.Zero) ? null : new PROXYCLASS(cPtr, true);$excode
return ret;

View file

@ -522,6 +522,7 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -782,24 +783,21 @@ SWIGINTERN const char * SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
} %}
/* Pointer reference typemaps */
%typemap(ctype) SWIGTYPE *& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *& "HandleRef"
%typemap(cstype) SWIGTYPE *& "$*csclassname"
%typemap(csin) SWIGTYPE *& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *& {
%typemap(ctype) SWIGTYPE *const& "void *"
%typemap(imtype, out="IntPtr") SWIGTYPE *const& "HandleRef"
%typemap(cstype) SWIGTYPE *const& "$*csclassname"
%typemap(csin) SWIGTYPE *const& "$*csclassname.getCPtr($csinput)"
%typemap(csout, excode=SWIGEXCODE) SWIGTYPE *const& {
IntPtr cPtr = $imcall;
$*csclassname ret = (cPtr == IntPtr.Zero) ? null : new $*csclassname(cPtr, $owner);$excode
return ret;
}
%typemap(in) SWIGTYPE *& ($*1_ltype temp = 0)
%typemap(in) SWIGTYPE *const& ($*1_ltype temp = 0)
%{ temp = ($*1_ltype)$input;
$1 = &temp; %}
%typemap(out) SWIGTYPE *&
$1 = ($1_ltype)&temp; %}
%typemap(out) SWIGTYPE *const&
%{ $result = (void *)*$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Marshal C/C++ pointer to IntPtr */
%typemap(ctype) void *VOID_INT_PTR "void *"
%typemap(imtype) void *VOID_INT_PTR "IntPtr"
@ -953,6 +951,12 @@ using System.Runtime.InteropServices;
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* csharp keywords */
%include <csharpkw.swg>