C++, alias directive

See sphinx-doc/sphinx#4981
This commit is contained in:
Jakob Lykke Andersen
2019-01-06 17:12:06 +01:00
parent 6b74541ec4
commit d6b7aad138
3 changed files with 207 additions and 16 deletions

View File

@@ -541,8 +541,8 @@ The C++ Domain
The C++ domain (name **cpp**) supports documenting C++ projects.
Directives
~~~~~~~~~~
Directives for Declaring Entities
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following directives are available. All declarations can start with a
visibility statement (``public``, ``private`` or ``protected``).
@@ -794,6 +794,41 @@ This will be rendered as:
Explicit ref: :cpp:var:`Data::@data::a`. Short-hand ref: :cpp:var:`Data::a`.
Aliasing Declarations
~~~~~~~~~~~~~~~~~~~~~
Sometimes it may be helpful list declarations elsewhere than their main documentation,
e.g., when creating a synopsis of a class interface.
The following directive can be used for this purpose.
.. rst:directive:: .. cpp:alias:: name or function signature
Insert one or more alias declarations. Each entity can be specified
as they can in the :rst:role:`cpp:any` role.
If the name of a function is given (as opposed to the complete signature),
then all overloads of the function will be listed.
For example::
.. cpp:alias:: Data::a
overload_example::C::f
becomes
.. cpp:alias:: Data::a
overload_example::C::f
whereas::
.. cpp:alias:: void overload_example::C::f(double d) const
void overload_example::C::f(double d)
becomes
.. cpp:alias:: void overload_example::C::f(double d) const
void overload_example::C::f(double d)
Constrained Templates
~~~~~~~~~~~~~~~~~~~~~