mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
C++, add retval info field to cpp:function
This commit is contained in:
parent
50dd03d640
commit
91d0289009
1
CHANGES
1
CHANGES
@ -21,6 +21,7 @@ Features added
|
|||||||
base class
|
base class
|
||||||
* 9691: C, added new info-field ``retval``
|
* 9691: C, added new info-field ``retval``
|
||||||
for :rst:dir:`c:function` and :rst:dir:`c:macro`.
|
for :rst:dir:`c:function` and :rst:dir:`c:macro`.
|
||||||
|
* C++, added new info-field ``retval`` for :rst:dir:`cpp:function`.
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -1496,14 +1496,23 @@ The ``cpp:namespace-pop`` directive undoes the most recent
|
|||||||
Info field lists
|
Info field lists
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
The C++ directives support the following info fields (see also
|
All the C++ directives for declaring entities support the following
|
||||||
:ref:`info-field-lists`):
|
info fields (see also :ref:`info-field-lists`):
|
||||||
|
|
||||||
* `param`, `parameter`, `arg`, `argument`: Description of a parameter.
|
* ``tparam``: Description of a template parameter.
|
||||||
* `tparam`: Description of a template parameter.
|
|
||||||
* `returns`, `return`: Description of a return value.
|
The :rst:dir:`cpp:function` directive additionally supports the
|
||||||
|
following fields:
|
||||||
|
|
||||||
|
* ``param``, ``parameter``, ``arg``, ``argument``: Description of a parameter.
|
||||||
|
* ``returns``, ``return``: Description of a return value.
|
||||||
|
* ``retval``, ``retvals``: An alternative to ``returns`` for describing
|
||||||
|
the result of the function.
|
||||||
* `throws`, `throw`, `exception`: Description of a possibly thrown exception.
|
* `throws`, `throw`, `exception`: Description of a possibly thrown exception.
|
||||||
|
|
||||||
|
.. versionadded:: 4.3
|
||||||
|
The ``retval`` field type.
|
||||||
|
|
||||||
.. _cpp-roles:
|
.. _cpp-roles:
|
||||||
|
|
||||||
Cross-referencing
|
Cross-referencing
|
||||||
|
@ -6934,18 +6934,10 @@ def _make_phony_error_name() -> ASTNestedName:
|
|||||||
class CPPObject(ObjectDescription[ASTDeclaration]):
|
class CPPObject(ObjectDescription[ASTDeclaration]):
|
||||||
"""Description of a C++ language object."""
|
"""Description of a C++ language object."""
|
||||||
|
|
||||||
doc_field_types = [
|
doc_field_types: List[Field] = [
|
||||||
GroupedField('parameter', label=_('Parameters'),
|
|
||||||
names=('param', 'parameter', 'arg', 'argument'),
|
|
||||||
can_collapse=True),
|
|
||||||
GroupedField('template parameter', label=_('Template Parameters'),
|
GroupedField('template parameter', label=_('Template Parameters'),
|
||||||
names=('tparam', 'template parameter'),
|
names=('tparam', 'template parameter'),
|
||||||
can_collapse=True),
|
can_collapse=True),
|
||||||
GroupedField('exceptions', label=_('Throws'), rolename='expr',
|
|
||||||
names=('throws', 'throw', 'exception'),
|
|
||||||
can_collapse=True),
|
|
||||||
Field('returnvalue', label=_('Returns'), has_arg=False,
|
|
||||||
names=('returns', 'return')),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
option_spec: OptionSpec = {
|
option_spec: OptionSpec = {
|
||||||
@ -7181,6 +7173,20 @@ class CPPMemberObject(CPPObject):
|
|||||||
class CPPFunctionObject(CPPObject):
|
class CPPFunctionObject(CPPObject):
|
||||||
object_type = 'function'
|
object_type = 'function'
|
||||||
|
|
||||||
|
doc_field_types = CPPObject.doc_field_types + [
|
||||||
|
GroupedField('parameter', label=_('Parameters'),
|
||||||
|
names=('param', 'parameter', 'arg', 'argument'),
|
||||||
|
can_collapse=True),
|
||||||
|
GroupedField('exceptions', label=_('Throws'), rolename='expr',
|
||||||
|
names=('throws', 'throw', 'exception'),
|
||||||
|
can_collapse=True),
|
||||||
|
GroupedField('retval', label=_('Return values'),
|
||||||
|
names=('retvals', 'retval'),
|
||||||
|
can_collapse=True),
|
||||||
|
Field('returnvalue', label=_('Returns'), has_arg=False,
|
||||||
|
names=('returns', 'return')),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class CPPClassObject(CPPObject):
|
class CPPClassObject(CPPObject):
|
||||||
object_type = 'class'
|
object_type = 'class'
|
||||||
|
Loading…
Reference in New Issue
Block a user