Template:dcl list/doc

来自cppreference.com

This is one of the family of templates used for creation of declaration list. These templates should be used to design function, variable or type lists.

目录

List template families

  • dcl list **** : For creation of member variable/function lists.
  • ddcl list **** : For creation of detailed declaration lists (those including actual declaration code)
  • sdcl list **** : For creation of lists representing various syntaxes of a language feature. Used in subpages of cpp/language
  • param list **** : For creation of lists explaining function parameters.
  • sb list **** : For creation of feature lists in navbars.

{{dcl list begin}}

starts the declaration list

{{dcl list end}}

ends the declaration list

{{dcl list h1| heading}}

adds heading to the declaration list (h3 level)

{{dcl list h2| heading}}

adds sub-heading to the declaration list (h5 level)

{{dcl list header}}

adds explanation which header the features come from

{{dcl list namespace}}

adds explanation which namespace the features are in

{{dcl list sep}}

adds a separator

{{dcl list item| name| explanation}}

adds a generic item to the declaration list. If explanation is omitted, the item spans through both columns.

{{dcl list hitem| name| explanation}}

adds a highlighted item to the declaration list. If explanation is omitted, the item spans through both columns.

{{dcl list template| location| param1 (可选)| param2 (可选) ...}}

Sets dcl-list-template-name variable to location, includes the template from location and unsets the variable. Use this template whenever copying dcl list items from a template; this will add an edit link to them. The unnamed parameters param1, param2, ... are passed to the template.

{{dcl list break}}

breaks the columns. The width of the columns above does not depend on the content below and vice-versa.

{{dcl list todo| reason}}

adds a todo item (similar to {{todo}})

[编辑] Specialized templates

There are templates already specialized for most of the usage cases.

Classes

{{dcl list class| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a class.

{{dcl list tclass| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a class template.

{{dcl list ptclass| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a class template specialization.

{{dcl list mem class| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a member class.
Functions

{{dcl list fun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a function

{{dcl list tfun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a function template.

{{dcl list mem fun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a public member function.

{{dcl list prot mem fun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a protected member function template.

{{dcl list mem ctor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a public constructor.

{{dcl list prot mem ctor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a protected constructor.

{{dcl list mem dtor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a public destructor.

{{dcl list prot mem dtor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a protected destructor.

{{dcl list mem vdtor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a virtual public destructor.

{{dcl list prot mem vdtor| link| notes=link notes(可选)| explanation}}

adds an item linking to a description of a virtual protected destructor.

{{dcl list mem sfun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a static member function.

{{dcl list mem vfun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a virtual public member function template.

{{dcl list prot mem vfun| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a virtual protected member function template.

{{dcl list macro fun| link| title=link title(可选)| notes=link notes(可选)| explanation}} - adds an item linking to a description of a function macro.

Constants

{{dcl list macro const| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a macro constant.

{{dcl list const| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a global constant variable.

{{dcl list mem const| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a constant member variable.

{{dcl list mem sconst| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a static constant member variable.
Objects

{{dcl list mem obj| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a member object.

{{dcl list prot mem obj| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a protected member object.

{{dcl list priv mem obj| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a private member object.
Miscellaneous

{{dcl list typedef| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a typedef.

{{dcl list enum| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a enum or enum class.

{{dcl list concept| link| title=link title(可选)| notes=link notes(可选)| explanation}}

adds an item linking to a description of a concept.
Parameters

link

this parameter controls the link target.

title=link title

this parameter overrides the link title

notes=link notes

this parameter adds text besides the link that is not the part of the link

explanation

the explanation of the feature.

All templates accept nolink=true parameter. In that case no link is made, the formatting is the same.

The templates for member objects accept inlinemem=true parameter. This should be used if the functionality is described inline in the page of the class.

[编辑] See also templates

Used in see also lists.

{{dcl list see cpp| location| nomono=true_if_serif (可选)| title1(可选)| title2(可选) ...}}

adds a link to C++ documentation of a feature.

{{dcl list see c| location| nomono=true_if_serif (可选)| title1(可选)| title2(可选) ...}}

adds a link to C documentation of a feature.
Parameters

location

this parameter controls the link target.

nomono

true if serif font should be used for the title

title1, title2, ...

this parameter overrides the title (default the title is guessed from location). Commas are placed between titles if several of them are provided.

[编辑] Example

 
  {{dsc begin}}
  {{dsc h1 | Magic creatures}}
  {{dsc h2 | Dragon}}
  {{dsc header | dragon.h}}
  {{dsc fun | cpp/dragon/call_dragon | calls the dragon}}
  {{dsc fun | cpp/dragon/receive_fire | receives the fire}}
  {{dsc end}}
  

The above results in the following:

Magic creatures

Dragon
在头文件 <dragon.h> 中定义
calls the dragon
(函数)
receives the fire
(函数)

[编辑] Templates used in the implementation

[编辑] {{dcl member}}

{{dcl member| page| title (可选)| nolink=true_if_nolink (可选)| nobold=true_if_nobold (可选)| notes=notes (可选)}}

Default title of the link is page. Custom title can be supplied via the second unnamed parameter or title parameter. If nolink is true, no link is produced.
Default font of the link is bold monospace. If nobold is true, the font is normal serif.
Additional notes to be placed in the right of the link can be passed through notes parameter.
Both title and notes can accept <br> tags without breaking the layout.

[编辑] {{dcl mark mem}}

{{dcl mark mem| link| mark_class| nomem=true_if_nomem (可选)| inlinemem=true_if_inlinemem (可选)}}

Outputs {{mark mark_class}} potentially appending additional description of the class the function/class is member of.
Specifically, the template checks if the parent of the page linked to by link is a parent of the page the template is used in (i.e. they are siblings). For example, consider link = a/b/c and page the page the template is used in. Then the template would append the additional description if page equals to z/z/z, or a/z, or a/b/z/z, but not if page is a/b/z or a/b.
If nomem is true then additional description is never appended.
The template fetches information about the name of the parent class from a/b/title page.
If inlinemem is true then the name of the parent class is fetched from a/b/c/title template. This is used when a class includes descriptions of its members inline.