compare_type

sphinx_doxysummary.utils.compare_type(arg1: str, arg2: str, arg2_declarator: str = '') bool

Check if type of 2 arguments are the same.

Parameters:
  • arg1 (str) – First argument.

  • arg2 (str) – Second argument.

  • arg2_declarator (str, optional) – Full declarator of the second argument. This is useful for declarations whose array bounds or argument name are outside Doxygen’s type XML node.

Returns:

True if 2 arguments have the same type.

Return type:

bool

Examples

>>> compare_type('const int a', 'int const')  # normal case
True
>>> compare_type('const int * a', 'int *')  # without specifier
False
>>> compare_type('const int &', 'int const &')  # change specifier position
True
>>> compare_type('std::vector<const double *> &', 'std::vector<double const> &')  # template
False
>>> compare_type('int(&)[3]', 'int(&) a', 'int(&a)[3]')
True
>>> compare_type('int(*)(double)', 'int(*)(double) callback')
True
>>> compare_type('void', '')
True