mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Doc, update C++ domain.
This commit is contained in:
parent
14e6affa7d
commit
9230dd6a89
@ -520,21 +520,24 @@ The C++ Domain
|
|||||||
|
|
||||||
The C++ domain (name **cpp**) supports documenting C++ projects.
|
The C++ domain (name **cpp**) supports documenting C++ projects.
|
||||||
|
|
||||||
The following directives are available:
|
The following directives are available. All declarations can start with a visibility statement
|
||||||
|
(``public``, ``private`` or ``protected``).
|
||||||
|
|
||||||
.. rst:directive:: .. cpp:class:: signatures
|
.. rst:directive:: .. cpp:class:: class speicifer
|
||||||
.. cpp:function:: signatures
|
|
||||||
.. cpp:member:: signatures
|
|
||||||
.. cpp:type:: signatures
|
|
||||||
|
|
||||||
Describe a C++ object. Full signature specification is supported -- give the
|
Describe a class/struct, possibly with specification of inheritance, e.g.,::
|
||||||
signature as you would in the declaration. Here some examples::
|
|
||||||
|
.. cpp:class:: SomeName::SomeClass : public MyBase, MyOtherBase
|
||||||
|
|
||||||
|
.. rst:directive:: .. cpp:function:: (member-)function prototype
|
||||||
|
|
||||||
|
Describe a function or member function, e.g.,::
|
||||||
|
|
||||||
.. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2)
|
.. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2)
|
||||||
|
|
||||||
Describes a method with parameters and types.
|
Describes a method with parameters and types.
|
||||||
|
|
||||||
.. cpp:function:: bool namespaced::theclass::method(arg1, arg2)
|
.. cpp:function:: bool namespaced::theclass::method(T1, T2)
|
||||||
|
|
||||||
Describes a method with unnamed parameters.
|
Describes a method with unnamed parameters.
|
||||||
|
|
||||||
@ -550,45 +553,24 @@ The following directives are available:
|
|||||||
|
|
||||||
Describe a constexpr function here.
|
Describe a constexpr function here.
|
||||||
|
|
||||||
.. cpp:member:: std::string theclass::name
|
.. cpp:function:: MyClass::MyClass(const MyClass&) = default
|
||||||
|
|
||||||
.. cpp:member:: std::string theclass::name[N][M]
|
Describe a copy constructor with default implementation.
|
||||||
|
|
||||||
.. cpp::type:: std::vector<int> MyList
|
.. rst:directive:: .. cpp:member:: variable or member declaration
|
||||||
|
|
||||||
A typedef-like declaration of a type.
|
Describe a varible or member variable, e.g.,::
|
||||||
|
|
||||||
.. cpp:type:: theclass::const_iterator
|
|
||||||
|
|
||||||
Declaration of a type alias with unspecified type.
|
|
||||||
|
|
||||||
Will be rendered like this:
|
|
||||||
|
|
||||||
.. cpp:function:: bool namespaced::theclass::method(int arg1, std::string arg2)
|
|
||||||
|
|
||||||
Describes a method with parameters and types.
|
|
||||||
|
|
||||||
.. cpp:function:: bool namespaced::theclass::method(arg1, arg2)
|
|
||||||
|
|
||||||
Describes a method with unnamed parameters.
|
|
||||||
|
|
||||||
.. cpp:function:: const T &array<T>::operator[]() const
|
|
||||||
|
|
||||||
Describes the constant indexing operator of a templated array.
|
|
||||||
|
|
||||||
.. cpp:function:: operator bool() const
|
|
||||||
|
|
||||||
Describe a casting operator here.
|
|
||||||
|
|
||||||
.. cpp:function:: constexpr void foo(std::string &bar[2]) noexcept
|
|
||||||
|
|
||||||
Describe a constexpr function here.
|
|
||||||
|
|
||||||
.. cpp:member:: std::string theclass::name
|
.. cpp:member:: std::string theclass::name
|
||||||
|
|
||||||
.. cpp:member:: std::string theclass::name[N][M]
|
.. cpp:member:: std::string theclass::name[N][M]
|
||||||
|
|
||||||
.. cpp::type:: std::vector<int> MyList
|
.. rst:directive:: .. cpp:type:: typedef-like declaration
|
||||||
|
.. cpp:type:: name
|
||||||
|
|
||||||
|
Describe a type as in a typedef declaration, or the name of a type with unspecified type, e.g.,::
|
||||||
|
|
||||||
|
.. cpp:type:: std::vector<int> MyList
|
||||||
|
|
||||||
A typedef-like declaration of a type.
|
A typedef-like declaration of a type.
|
||||||
|
|
||||||
@ -599,8 +581,14 @@ The following directives are available:
|
|||||||
.. rst:directive:: .. cpp:namespace:: namespace
|
.. rst:directive:: .. cpp:namespace:: namespace
|
||||||
|
|
||||||
Select the current namespace for the following objects. Note that the namespace
|
Select the current namespace for the following objects. Note that the namespace
|
||||||
does not need to correspond to C++ namespaces, but can end in names of classes.
|
does not need to correspond to C++ namespaces, but can end in names of classes, e.g.,::
|
||||||
(e.g., ``Namespace1::Namespace2::SomeClass::AnInnerClass``)
|
|
||||||
|
.. cpp:namespace:: Namespace1::Namespace2::SomeClass::AnInnerClass
|
||||||
|
|
||||||
|
All following objects will be defined as if their name were declared with the namespace
|
||||||
|
prepended. The following cross-references will be search for by both their specified name
|
||||||
|
and with the namespace prepended.
|
||||||
|
|
||||||
|
|
||||||
.. _cpp-roles:
|
.. _cpp-roles:
|
||||||
|
|
||||||
@ -611,7 +599,7 @@ These roles link to the given object types:
|
|||||||
cpp:member
|
cpp:member
|
||||||
cpp:type
|
cpp:type
|
||||||
|
|
||||||
Reference a C++ object. You can give the full signature (and need to, for
|
Reference a C++ object. You can give the full specification (and need to, for
|
||||||
overloaded functions.)
|
overloaded functions.)
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
@ -632,6 +620,12 @@ These roles link to the given object types:
|
|||||||
specific overload. Currently Sphinx will link to the first overloaded
|
specific overload. Currently Sphinx will link to the first overloaded
|
||||||
version of the method / function.
|
version of the method / function.
|
||||||
|
|
||||||
|
.. admonition:: Note on Template Delcarations
|
||||||
|
|
||||||
|
The C++ domain currently does not support template classes/functions/aliases/variables
|
||||||
|
(e.g., ``template<typename T> MyClass``), only template instantiations
|
||||||
|
(e.g., ``MyClass<T>``).
|
||||||
|
|
||||||
|
|
||||||
The Standard Domain
|
The Standard Domain
|
||||||
-------------------
|
-------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user