diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2010-04-01 18:26:37 +0000 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2010-04-01 18:26:37 +0000 |
commit | bdb136d611286df89ba94b04170259d75c51e9f8 (patch) | |
tree | 72b5af71d3bcca6555e641df2e55311b2ecc90e2 /Lib/php | |
parent | b1c594078628ca7b5e57aa63ea117e1cd281ec80 (diff) | |
download | swig-bdb136d611286df89ba94b04170259d75c51e9f8.tar.gz |
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
Diffstat (limited to 'Lib/php')
-rw-r--r-- | Lib/php/php.swg | 21 | ||||
-rw-r--r-- | Lib/php/std_map.i | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/Lib/php/php.swg b/Lib/php/php.swg index feeb9c5df..ff4001d7e 100644 --- a/Lib/php/php.swg +++ b/Lib/php/php.swg @@ -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> diff --git a/Lib/php/std_map.i b/Lib/php/std_map.i index cfb82f44c..b6b417da7 100644 --- a/Lib/php/std_map.i +++ b/Lib/php/std_map.i @@ -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; |