Remove unnecessary duplicate typemap lookup

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11833 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-01-29 06:55:38 +00:00
commit a4d28ba148
3 changed files with 24 additions and 2 deletions

View file

@ -852,10 +852,12 @@ SwigType *SwigType_add_template(SwigType *t, ParmList *parms) {
* SwigType_templateprefix()
*
* Returns the prefix before the first template definition.
* Returns the type unmodified if not a template.
* For example:
*
* Foo<(p.int)>::bar => Foo
* r.q(const).Foo<(p.int)>::bar => r.q(const).Foo
* Foo => Foo
* ----------------------------------------------------------------------------- */
String *SwigType_templateprefix(const SwigType *t) {
@ -896,6 +898,25 @@ String *SwigType_templatesuffix(const SwigType *t) {
return NewStringEmpty();
}
/* -----------------------------------------------------------------------------
* SwigType_istemplate_templateprefix()
*
* Combines SwigType_istemplate and SwigType_templateprefix efficiently into one function.
* Returns the prefix before the first template definition.
* Returns NULL if not a template.
* For example:
*
* Foo<(p.int)>::bar => Foo
* r.q(const).Foo<(p.int)>::bar => r.q(const).Foo
* Foo => NULL
* ----------------------------------------------------------------------------- */
String *SwigType_istemplate_templateprefix(const SwigType *t) {
const char *s = Char(t);
const char *c = strstr(s, "<(");
return c ? NewStringWithSize(s, c - s) : 0;
}
/* -----------------------------------------------------------------------------
* SwigType_templateargs()
*