Add 'cpp:struct' directive and 'cpp:struct' role.

They are cosmetic variants of the class directive/role.
This commit is contained in:
Frank Erens
2019-01-09 19:27:54 +01:00
committed by Jakob Lykke Andersen
parent 4e6dacd81b
commit 9e6fe21c6a
4 changed files with 55 additions and 41 deletions

View File

@@ -548,11 +548,16 @@ The following directives are available. All declarations can start with a
visibility statement (``public``, ``private`` or ``protected``).
.. rst:directive:: .. cpp:class:: class specifier
.. cpp:struct:: class specifier
Describe a class/struct, possibly with specification of inheritance, e.g.,::
.. cpp:class:: MyClass : public MyBase, MyOtherBase
The difference between :rst:dir:`cpp:class` and :rst:dir:`cpp:struct` is
only cosmetic: the prefix rendered in the output, and the specifier shown
in the index.
The class can be directly declared inside a nested scope, e.g.,::
.. cpp:class:: OuterScope::MyClass : public MyBase, MyOtherBase
@@ -574,6 +579,9 @@ visibility statement (``public``, ``private`` or ``protected``).
.. cpp:class:: template<typename T> \
std::array<T, 42>
.. versionadded:: 2.0
The :rst:dir:`cpp:struct` directive.
.. rst:directive:: .. cpp:function:: (member) function prototype
Describe a function or member function, e.g.,::
@@ -1037,6 +1045,7 @@ These roles link to the given declaration types:
.. rst:role:: cpp:any
cpp:class
cpp:struct
cpp:func
cpp:member
cpp:var
@@ -1048,6 +1057,9 @@ These roles link to the given declaration types:
Reference a C++ declaration by name (see below for details). The name must
be properly qualified relative to the position of the link.
.. versionadded:: 2.0
The :rst:role:`cpp:struct` role as alias for the :rst:role:`cpp:class` role.
.. admonition:: Note on References with Templates Parameters/Arguments
These roles follow the Sphinx :ref:`xref-syntax` rules. This means care must be