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

@ -219,6 +219,12 @@ $body)"
%typemap(lispclass) wchar_t* "cl:string";
//////////////////////////////////////////////////////////////
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* name conversion for overloaded operators. */
#ifdef __cplusplus
%rename(__add__) *::operator+;

View file

@ -130,6 +130,11 @@
%typemap(lispclass) double "cl:number";
%typemap(lispclass) char * "cl:string";
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
%{

View file

@ -679,6 +679,16 @@ $result = C_SCHEME_UNDEFINED;
%apply unsigned long { size_t };
/* ------------------------------------------------------------
* Various
* ------------------------------------------------------------ */
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* Overloaded operator support
* ------------------------------------------------------------ */

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>

View file

@ -224,7 +224,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& __getitem__(const K& key) throw (std::out_of_range) {
const T& __getitem__(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -208,7 +208,7 @@ namespace std {
self->pop_back();
return x;
}
T& ref(int i) throw (std::out_of_range) {
const T& ref(int i) throw (std::out_of_range) {
int size = int(self->size());
if (i>=0 && i<size)
return (*self)[i];

View file

@ -448,4 +448,10 @@ typedef unsigned long SCM;
$1 = SWIG_CheckState(res);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* typemaps.i ends here */

View file

@ -69,12 +69,12 @@
#endif
%}
%typemap(in) CONST TYPE *& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
%typemap(in) TYPE *CONST& ($*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
// plain pointer by reference
temp = ((*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input) ? (*(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$input)->get() : 0);
temp = ($*1_ltype)((*(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_intrusive_deleter,SWIG_null_deleter") CONST TYPE *& %{
%typemap(out, fragment="SWIG_intrusive_deleter,SWIG_null_deleter") TYPE *CONST& %{
// plain pointer by reference(out)
#if ($owner)
if (*$1) {
@ -246,7 +246,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
@ -353,10 +353,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$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 = ($*1_ltype)((*(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&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
%typemap(in) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > swigSharedPtrUpcast ($&1_type smartarg) %{
@ -396,7 +396,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -44,10 +44,10 @@
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$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&
%{ *(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > **)&$result = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner); %}
// shared_ptr by value
@ -132,7 +132,7 @@
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}
%typemap(javaout) CONST TYPE *& {
%typemap(javaout) TYPE *CONST& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new PROXYCLASS(cPtr, true);
}

View file

@ -897,6 +897,7 @@
SWIGTYPE,
SWIGTYPE *,
SWIGTYPE &,
SWIGTYPE *const&,
SWIGTYPE [],
SWIGTYPE (CLASS::*)
""
@ -1025,23 +1026,20 @@
}
/* Pointer reference typemaps */
%typemap(jni) SWIGTYPE *& "jlong"
%typemap(jtype) SWIGTYPE *& "long"
%typemap(jstype) SWIGTYPE *& "$*javaclassname"
%typemap(javain) SWIGTYPE *& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *& {
%typemap(jni) SWIGTYPE *const& "jlong"
%typemap(jtype) SWIGTYPE *const& "long"
%typemap(jstype) SWIGTYPE *const& "$*javaclassname"
%typemap(javain) SWIGTYPE *const& "$*javaclassname.getCPtr($javainput)"
%typemap(javaout) SWIGTYPE *const& {
long cPtr = $jnicall;
return (cPtr == 0) ? null : new $*javaclassname(cPtr, $owner);
}
%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&
%{ *($1_ltype)&$result = *$1; %}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* Typemaps used for the generation of proxy and type wrapper class code */
%typemap(javabase) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) ""
%typemap(javaclassmodifiers) SWIGTYPE, SWIGTYPE *, SWIGTYPE &, SWIGTYPE [], SWIGTYPE (CLASS::*) "public class"
@ -1203,6 +1201,12 @@ SWIG_PROXY_CONSTRUCTOR(true, true, SWIGTYPE)
%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 }
/* java keywords */
%include <javakw.swg>

View file

@ -40,7 +40,7 @@
%typemap(consttab) long long, unsigned long long
{ SWIG_LUA_STRING, (char *) "$symname", 0, 0, (void *)"$value", 0}
%typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []
%typemap(consttab) SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &, SWIGTYPE []
{ SWIG_LUA_POINTER, (char *)"$symname", 0, 0, (void *)$value, &$1_descriptor}
// member function pointers

View file

@ -167,11 +167,11 @@ temp=($basetype)lua_tonumber(L,$input); $1=&temp;%}
// Also needed for object ptrs by const ref
// eg A* const& ref_pointer(A* const& a);
// found in mixed_types.i
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *&($*ltype temp)
%typemap(in,checkfn="lua_isuserdata") SWIGTYPE *const&($*ltype temp)
%{temp=($*ltype)SWIG_MustGetPtr(L,$input,$*descriptor,0,$argnum,"$symname");
$1=&temp;%}
$1=($1_ltype)&temp;%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{SWIG_NewPointerObj(L,*$1,$*descriptor,$owner); SWIG_arg++; %}
@ -335,7 +335,7 @@ parmeters match which function
// Also needed for object ptrs by const ref
// eg const A* ref_pointer(A* const& a);
// found in mixed_types.i
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE* const &
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *const&
{
void *ptr;
if (lua_isuserdata(L,$input)==0 || SWIG_ConvertPtr(L,$input, (void **) &ptr, $*descriptor, 0)) {
@ -352,6 +352,9 @@ parmeters match which function
// Array reference typemaps
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
// size_t (which is just a unsigned long)
%apply unsigned long { size_t };
%apply const unsigned long & { const size_t & };

View file

@ -745,3 +745,10 @@ FROM BlaBla IMPORT Bla;
/* Some ANSI C typemaps */
%apply unsigned long { size_t };
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -349,3 +349,10 @@ REF_MAP(double, SCHEME_REALP, scheme_real_to_double,
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -29,7 +29,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -314,3 +314,11 @@ SIMPLE_MAP(unsigned long long,caml_val_ulong,caml_long_val);
%swig_enum_out(out)
%swig_enum_out(varout)
%swig_enum_out(directorin)
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }

View file

@ -143,7 +143,7 @@
// plain pointer by reference
// Note: $disown not implemented as it will lead to a memory leak of the shared_ptr instance
%typemap(in) CONST TYPE *& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), %convertptr_flags, &newmem);
if (!SWIG_IsOK(res)) {
@ -158,15 +158,15 @@
}
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *& {
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
%typemap(varin) CONST TYPE *& %{
%typemap(varin) TYPE *CONST& %{
#error "varin typemap not implemented"
%}
%typemap(varout) CONST TYPE *& %{
%typemap(varout) TYPE *CONST& %{
#error "varout typemap not implemented"
%}
@ -283,10 +283,10 @@
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
CONST TYPE,
CONST TYPE &,
CONST TYPE *,
CONST TYPE *&,
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,

View file

@ -75,7 +75,7 @@
%include <typemaps/swigtypemaps.swg>
/* ------------------------------------------------------------
* Perl extra typemaps
* Perl extra typemaps / typemap overrides
* ------------------------------------------------------------ */
%typemap(varout,type="$1_descriptor") SWIGTYPE *, SWIGTYPE []
@ -90,3 +90,6 @@
%typemap(varout,type="$1_descriptor") SWIGTYPE (CLASS::*) {
SWIG_MakePackedObj($result, (void *) &$1, sizeof($1_type), $1_descriptor);
}
%typemap(varout) SWIGTYPE *const = SWIGTYPE *;

View file

@ -30,7 +30,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -115,12 +115,12 @@
}
}
%typemap(in) SWIGTYPE *& ($*ltype temp)
%typemap(in) SWIGTYPE *const& ($*ltype temp)
{
if(SWIG_ConvertPtr(*$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
$1 = &temp;
$1 = ($1_ltype)&temp;
}
%typemap(in) SWIGTYPE *DISOWN
@ -339,7 +339,7 @@
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
%}
%typemap(out) SWIGTYPE *&
%typemap(out) SWIGTYPE *const&
%{
SWIG_SetPointerZval(return_value, (void *)*$1, $*1_descriptor, $owner);
%}
@ -394,10 +394,6 @@
SWIG_SetPointerZval($input, SWIG_as_voidptr(&$1_name), $&1_descriptor, 2);
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
%typemap(out) void "";
%typemap(out) char [ANY]
@ -441,10 +437,11 @@
_v = (SWIG_ConvertPtr(*$input, (void **)&tmp, $&1_descriptor, 0) >= 0);
}
%typecheck(SWIG_TYPECHECK_POINTER) SWIGTYPE *,
%typecheck(SWIG_TYPECHECK_POINTER)
SWIGTYPE *,
SWIGTYPE [],
SWIGTYPE &,
SWIGTYPE *&
SWIGTYPE *const&
{
void *tmp;
_v = (SWIG_ConvertPtr(*$input, (void**)&tmp, $1_descriptor, 0) >= 0);
@ -478,6 +475,12 @@
SWIG_PHP_Error(E_ERROR, (char *)$1);
%}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* php keywords */
%include <phpkw.swg>

View file

@ -29,7 +29,7 @@ namespace std {
unsigned int size() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -264,6 +264,12 @@ extern "C" {
}
}
/* Array reference typemaps */
%apply SWIGTYPE & { SWIGTYPE ((&)[ANY]) }
/* const pointers */
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* Overloaded operator support
* ------------------------------------------------------------ */

View file

@ -151,7 +151,7 @@
// plain pointer by reference
// Note: $disown not implemented by default as it will lead to a memory leak of the shared_ptr instance
%typemap(in) CONST TYPE *& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
%typemap(in) TYPE *CONST& (void *argp = 0, int res = 0, $*1_ltype temp = 0, SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > tempshared) {
int newmem = 0;
res = SWIG_ConvertPtrAndOwn($input, &argp, $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SHARED_PTR_DISOWN | %convertptr_flags, &newmem);
if (!SWIG_IsOK(res)) {
@ -166,15 +166,15 @@
}
$1 = &temp;
}
%typemap(out, fragment="SWIG_null_deleter") CONST TYPE *& {
%typemap(out, fragment="SWIG_null_deleter") TYPE *CONST& {
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(*$1 SWIG_NO_NULL_DELETER_$owner);
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
%typemap(varin) CONST TYPE *& %{
%typemap(varin) TYPE *CONST& %{
#error "varin typemap not implemented"
%}
%typemap(varout) CONST TYPE *& %{
%typemap(varout) TYPE *CONST& %{
#error "varout typemap not implemented"
%}
@ -291,10 +291,10 @@
// Note: SWIG_ConvertPtr with void ** parameter set to 0 instead of using SWIG_ConvertPtrAndOwn, so that the casting
// function is not called thereby avoiding a possible smart pointer copy constructor call when casting up the inheritance chain.
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1)
CONST TYPE,
CONST TYPE &,
CONST TYPE *,
CONST TYPE *&,
TYPE CONST,
TYPE CONST &,
TYPE CONST *,
TYPE *CONST&,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > &,
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *,

View file

@ -61,7 +61,7 @@
/* ------------------------------------------------------------
* Python extra typemaps
* Python extra typemaps / typemap overrides
* ------------------------------------------------------------ */
/* Get the address of the 'python self' object */

View file

@ -29,8 +29,10 @@
%typemap("rtype") bool, bool * "logical";
%typemap("rtype") enum SWIGTYPE "character";
%typemap("rtype") enum SWIGTYPE * "character";
%typemap("rtype") enum SWIGTYPE *const "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";
@ -65,13 +67,15 @@
%{ $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 &
%typemap(scoercein) SWIGTYPE, SWIGTYPE *, SWIGTYPE *const, SWIGTYPE &
%{ %}
/*
%typemap(scoercein) SWIGTYPE *
%typemap(scoercein) SWIGTYPE *, SWIGTYPE *const
%{ $input = coerceIfNotSubclass($input, "$R_class") %}
%typemap(scoercein) SWIGTYPE &
@ -115,6 +119,9 @@ string &, std::string &
%typemap(scoerceout) enum SWIGTYPE *
%{ $result = enumToInteger($result, "$R_class"); %}
%typemap(scoerceout) enum SWIGTYPE *const
%{ $result = enumToInteger($result, "$R_class"); %}
%typemap(scoerceout) SWIGTYPE
%{ class($result) <- "$&R_class"; %}
@ -125,6 +132,9 @@ string &, std::string &
%typemap(scoerceout) SWIGTYPE *
%{ class($result) <- "$R_class"; %}
%typemap(scoerceout) SWIGTYPE *const
%{ class($result) <- "$R_class"; %}
/* Override the SWIGTYPE * above. */
%typemap(scoerceout) char,
char *,

View file

@ -31,7 +31,7 @@ namespace std {
bool empty() const;
void clear();
%extend {
T& get(const K& key) throw (std::out_of_range) {
const T& get(const K& key) throw (std::out_of_range) {
std::map<K,T >::iterator i = self->find(key);
if (i != self->end())
return i->second;

View file

@ -61,7 +61,7 @@
/* ------------------------------------------------------------
* Tcl extra typemaps
* Tcl extra typemaps / typemap overrides
* ------------------------------------------------------------ */
#if 1
@ -84,6 +84,7 @@
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE *const = SWIGTYPE *;
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;

View file

@ -21,15 +21,15 @@
%typemap(freearg) SWIGTYPE [] "";
%typemap(in, noblock=1) SWIGTYPE* const& (void *argp = 0, int res = 0, $*ltype temp) {
%typemap(in, noblock=1) SWIGTYPE *const& (void *argp = 0, int res = 0, $*1_ltype temp) {
res = SWIG_ConvertPtr($input, &argp, $*descriptor, $disown | %convertptr_flags);
if (!SWIG_IsOK(res)) {
%argument_fail(res, "$*ltype", $symname, $argnum);
}
temp = %reinterpret_cast(argp, $*ltype);
$1 = &temp;
$1 = %reinterpret_cast(&temp, $1_ltype);
}
%typemap(freearg) SWIGTYPE* const& "";
%typemap(freearg) SWIGTYPE *const& "";
/* Reference */
@ -106,7 +106,7 @@
%set_output(SWIG_NewPointerObj(%as_voidptr($1), $descriptor, $owner | %newpointer_flags));
}
%typemap(out, noblock=1) SWIGTYPE* const& {
%typemap(out, noblock=1) SWIGTYPE *const& {
%set_output(SWIG_NewPointerObj(%as_voidptr(*$1), $*descriptor, $owner | %newpointer_flags));
}
@ -299,6 +299,12 @@
$1 = SWIG_CheckState(res);
}
%typemap(typecheck,precedence=SWIG_TYPECHECK_POINTER,noblock=1) SWIGTYPE *const& {
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;
int res = SWIG_ConvertPtr($input, &vptr, $descriptor, 0);
@ -337,7 +343,7 @@
/* directorin */
%typemap(directorin,noblock=1) SWIGTYPE*, SWIGTYPE* const& {
%typemap(directorin,noblock=1) SWIGTYPE *, SWIGTYPE *const& {
$input = SWIG_NewPointerObj(%as_voidptr($1_name), $descriptor, %newpointer_flags);
}
@ -345,7 +351,7 @@
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $&descriptor, %newpointer_flags);
}
%typemap(directorin,noblock=1) SWIGTYPE& {
%typemap(directorin,noblock=1) SWIGTYPE & {
$input = SWIG_NewPointerObj(%as_voidptr(&$1_name), $descriptor, %newpointer_flags);
}
@ -407,7 +413,7 @@
* --- Constants ---
* ------------------------------------------------------------ */
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE []{
%typemap(constcode,noblock=1) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
%set_constant("$symname", SWIG_NewPointerObj(%as_voidptr($value),$descriptor,%newpointer_flags));
}
@ -547,6 +553,7 @@
}
#endif
%apply SWIGTYPE * { SWIGTYPE *const }
/* ------------------------------------------------------------
* --- Special typemaps ---
@ -602,3 +609,4 @@
%typemap(varout,noblock=1) SWIGTYPE INSTANCE {
%set_varoutput(SWIG_NewInstanceObj(%as_voidptr(&$1), $&1_descriptor, %newinstance_flags));
}