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:
parent
d677321323
commit
dd4c680a02
6 changed files with 74 additions and 5 deletions
|
|
@ -314,6 +314,9 @@
|
|||
#error "typemaps for $1_type not available"
|
||||
%}
|
||||
|
||||
%typemap(doctype) SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >,
|
||||
SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >& %{TYPE%}
|
||||
|
||||
|
||||
%template() SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >;
|
||||
|
||||
|
|
|
|||
|
|
@ -22,3 +22,24 @@
|
|||
%typemap(doc) SWIGTYPE *INPUT, SWIGTYPE &INPUT "$1_name: $1_type (input)";
|
||||
%typemap(doc) SWIGTYPE *OUTPUT, SWIGTYPE &OUTPUT "$1_name: $1_type (output)";
|
||||
#endif
|
||||
|
||||
|
||||
// Types to use in Python documentation for the parameters of the given C++ type.
|
||||
%typemap(doctype) bool "boolean";
|
||||
|
||||
%define int_doctype_for_cppint_type(cppint_type)
|
||||
%typemap(doctype) cppint_type, unsigned cppint_type "int";
|
||||
%enddef
|
||||
%formacro(int_doctype_for_cppint_type, short, int, long, long long)
|
||||
|
||||
%typemap(doctype) size_t "int";
|
||||
|
||||
%typemap(doctype) enum SWIGTYPE "int";
|
||||
|
||||
%typemap(doctype) float, double, long double "float";
|
||||
|
||||
%typemap(doctype) char*, std::string "string";
|
||||
|
||||
%typemap(doctype) SWIGTYPE "$1_basetype"
|
||||
%typemap(doctype) SWIGTYPE * "$typemap(doctype, $*1_ltype)"
|
||||
%typemap(doctype) SWIGTYPE & "$typemap(doctype, $*1_ltype)"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue