Use Python-ish, not C++, parameter types in Python documentation.

Using C++ types in documentation for Python users is more harmful than
useless, so use Python types whenever possible and allow defining "doctype"
typemap to customize this for the user-defined types.
This commit is contained in:
Vadim Zeitlin 2014-07-13 00:46:31 +02:00
commit dd4c680a02
6 changed files with 74 additions and 5 deletions

View file

@ -246,8 +246,16 @@ std::string PyDocConverter::getParamType(std::string param)
if (Char (Getattr(p, "name")) != param)
continue;
String *s = SwigType_str(Getattr(p, "type"), "");
String *s = Swig_typemap_lookup("doctype", p, Getattr(p, "name"), 0);
if (!s)
s = SwigType_str(Getattr(p, "type"), "");
// In Python C++ namespaces are flattened, so remove all but last component
// of the name.
String * const last = Swig_scopename_last(s);
type = Char (s);
Delete(last);
Delete(s);
break;
}