Fix incorrect typemaps being used for a symbol within a templated type
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12747 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4cf0f14cb9
commit
d38e6bdf43
5 changed files with 41 additions and 4 deletions
|
|
@ -166,6 +166,7 @@ extern "C" {
|
|||
extern String *SwigType_templateprefix(const SwigType *t);
|
||||
extern String *SwigType_templatesuffix(const SwigType *t);
|
||||
extern String *SwigType_istemplate_templateprefix(const SwigType *t);
|
||||
extern String *SwigType_istemplate_only_templateprefix(const SwigType *t);
|
||||
extern String *SwigType_templateargs(const SwigType *t);
|
||||
extern String *SwigType_prefix(const SwigType *t);
|
||||
extern int SwigType_array_ndim(const SwigType *t);
|
||||
|
|
|
|||
|
|
@ -728,8 +728,8 @@ static Hash *typemap_search(const_String_or_char_ptr tmap_method, SwigType *type
|
|||
goto ret_result;
|
||||
|
||||
{
|
||||
/* Look for the type reduced to just the template prefix */
|
||||
SwigType *template_prefix = SwigType_istemplate_templateprefix(ctype);
|
||||
/* Look for the type reduced to just the template prefix - for templated types without the template parameter list being specified */
|
||||
SwigType *template_prefix = SwigType_istemplate_only_templateprefix(ctype);
|
||||
if (template_prefix) {
|
||||
tm = get_typemap(ts, template_prefix);
|
||||
result = typemap_search_helper(debug_display, tm, tm_method, template_prefix, cqualifiedname, cname, &backup);
|
||||
|
|
|
|||
|
|
@ -927,6 +927,32 @@ String *SwigType_istemplate_templateprefix(const SwigType *t) {
|
|||
return c ? NewStringWithSize(s, c - s) : 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_istemplate_only_templateprefix()
|
||||
*
|
||||
* Similar to SwigType_istemplate_templateprefix() but only returns the template
|
||||
* prefix if the type is just the template and not a subtype/symbol within the template.
|
||||
* Returns NULL if not a template or is a template with a symbol within the template.
|
||||
* For example:
|
||||
*
|
||||
* Foo<(p.int)> => Foo
|
||||
* Foo<(p.int)>::bar => NULL
|
||||
* r.q(const).Foo<(p.int)> => r.q(const).Foo
|
||||
* r.q(const).Foo<(p.int)>::bar => NULL
|
||||
* Foo => NULL
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *SwigType_istemplate_only_templateprefix(const SwigType *t) {
|
||||
int len = Len(t);
|
||||
const char *s = Char(t);
|
||||
if (len >= 4 && strcmp(s + len - 2, ")>") == 0) {
|
||||
const char *c = strstr(s, "<(");
|
||||
return c ? NewStringWithSize(s, c - s) : 0;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_templateargs()
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue