C++ domain customization

cpp_strip_namespaces_from_signatures : list[str] = []

list[str] specifying namespaces to strip from signatures. This does not apply to the name of the symbol being defined by the signature, only to parameter types, return types, default value expressions, etc.

For example, with the following in conf.py:

cpp_strip_namespaces_from_signatures = [
    "my_ns1",
    "my_ns2",
    "my_ns2::my_nested_ns",
]
C++ function definition with stripped namespaces
.. cpp:type:: my_ns1::A

.. cpp:type:: my_ns2::my_nested_ns::B

.. cpp:type:: my_ns3::C

.. cpp:function:: void my_ns1::MyFunction(my_ns1::A x, my_ns2::my_nested_ns::B y, my_ns3::C);
type my_ns1::A
type my_ns2::my_nested_ns::B
type my_ns3::C
void my_ns1::MyFunction(A x, B y, my_ns3::C);

Warning

If a nested symbol name like "my_ns1::abc" is specified in cpp_strip_namespaces_from_signatures, then a reference like my_ns1::abc::X will be converted to my_ns1::X. To also strip the my_ns1:: portion, "my_ns1" must also be specified in cpp_strip_namespaces_from_signatures.

cpp_qualify_parameter_ids : bool = True

Specifies whether function, template, and macro parameters should be assigned fully-qualified ids (for cross-linking purposes) of the form <parent-id>-p-<param-name> based on the id of the parent declaration.

If set to False, instead the shorter unqualified id p-<param-name> is used. This option should only be set to False if each C++ declaration is on a separate page.

#include directives in signatures

This theme extend the C and C++ domains to allow signatures to specify required #include directives.

Specifying #include directives in signatures
.. cpp:function:: #include "my_header.h"
                  #include "another_header.h"
                  void foo(int param);

   Some function.
#include "my_header.h"
#include "another_header.h"
void foo(int param);

Some function.


Last update: Jul 26, 2022