Template:dsc begin
This high-risk template has been protected from editing to prevent vandalism. Please discuss any changes on the talk page. |
This is one of the family of templates used for creation of description list. These templates should be used to design function, variable or type lists.
Contents |
List template families
- dsc **** : For creation of member variable/function lists.
- dcl **** : For creation of detailed declaration lists (those including actual declaration code).
- sdsc **** : For creation of lists representing various syntaxes of a language feature. Used in subpages of cpp/language.
- par **** : For creation of lists explaining function parameters.
- spar **** : For creation of lists explaining syntax parameters.
- nv **** : For creation of feature lists in navbars.
- elink **** : For creation of External links lists.
{{dsc begin}}
- starts the description list
{{dsc end}}
- ends the description list
{{dsc h1|heading }}
- adds heading to the description list (
h3
level)
{{dsc h2|heading }}
- adds sub-heading to the description list (
h5
level)
{{dsc header}}
- adds explanation which header the features come from
{{dsc namespace}}
- adds explanation which namespace the features are in
{{dsc sep}}
- adds a separator
{{dsc|name |explanation }}
- adds a generic item to the description list. If explanation is omitted, the item spans through both columns.
{{dsc hitem|name |explanation }}
- adds a highlighted item to the description list. If explanation is omitted, the item spans through both columns.
{{dsc inc|location |param1 (optional)|param2 (optional)|... }}
- Sets
dsc-list-template-name
variable to location, includes the template from location and unsets the variable. Use this template whenever copying dsc items from a template; this will add an edit link to them. The unnamed parameters param1, param2, ... are passed to the template.
{{dsc break}}
- breaks the columns. The width of the columns above does not depend on the content below and vice-versa.
{{dsc todo|reason }}
- adds a todo item (similar to {{todo}})
Specialized templates
There are templates already specialized for most of the usage cases.
- Classes
{{dsc class|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a class.
{{dsc tclass|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a class template.
{{dsc talias|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an alias template.
{{dsc ptclass|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a class template specialization.
{{dsc mem class|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a member class.
{{dsc mem tclass|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a member class template.
{{dsc expos mem class|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an exposition-only member class.
{{dsc expos mem tclass|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an exposition-only member class template.
{{dsc expos mem type|name |explanation |private=yes (optional)|protected=yes (optional)|maybe=yes|some-text (optional)|notes=rev (optional)|id=anchor-name (optional)}}
- describes an exposition-only member type.
- The private, protected, and maybe params, if provided, add the (private), (protected), and (optional) annotations respectively; notes is typically used for life marks such as
{{mark c++26}}
for (C++26). - The nolink and inlinemem params are not supported directly (behaves as if they are true).
- If id param is provided, generates an inplace anchor with given anchor-name. Note that leading/trailing underscores in anchor-name are unconditionally trimmed.
- Functions
{{dsc fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a function
{{dsc tfun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a function template.
{{dsc mem fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a public member function.
{{dsc prot mem fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a protected member function.
{{dsc priv mem fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a private member function.
{{dsc expos mem fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an exposition-only member function.
{{dsc mem ctor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a public constructor.
{{dsc prot mem ctor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a protected constructor.
{{dsc mem dtor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a public destructor.
{{dsc prot mem dtor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a protected destructor.
{{dsc mem vdtor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a virtual public destructor.
{{dsc prot mem vdtor|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a virtual protected destructor.
{{dsc mem sfun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a static member function.
{{dsc expos mem sfun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an exposition-only static member function.
{{dsc mem vfun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a virtual public member function template.
{{dsc prot mem vfun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a virtual protected member function template.
{{dsc macro fun|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a function macro.
- Constants
{{dsc macro const|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a macro constant.
{{dsc const|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a global constant variable.
{{dsc mem const|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a constant member variable.
{{dsc mem sconst|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a static constant member variable.
{{dsc expos mem sconst|name |explanation |spec=specifiers and/or declared type (optional)|private=yes (optional)|protected=yes (optional)|maybe=yes|some-text (optional)|notes=rev (optional)|id=anchor-name (optional)}}
- describes an exposition-only static constant member variable.
- The private, protected, and maybe params, if provided, add the (private), (protected), and (optional) annotations respectively;
- The notes is typically used for life marks such as
{{mark c++26}}
for (C++26). - The spec param, if provided, adds the specifiers and/or declared type before the name.
- The nolink and inlinemem params are not supported directly (behaves as if they are true).
- If id param is provided, generates an inplace anchor with given anchor-name. Note that leading/trailing underscores in anchor-name are unconditionally trimmed.
- Objects
{{dsc tvar|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a variable template.
{{dsc mem obj|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a member object.
{{dsc prot mem obj|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a protected member object.
{{dsc priv mem obj|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a private member object.
{{dsc expos mem obj|name |explanation |private=yes (optional)|protected=yes (optional)|maybe=yes|some-text (optional)|notes=rev (optional)|id=anchor-name (optional)}}
- describes an exposition-only member object.
- The private and protected params, if provided, add the (private), and (protected) annotations respectively.
- The maybe, if provided, adds (conditionally present) text, for yes argument; otherwise, it adds whichever text is provided, e.g. maybe=(present only if {{c|1=x == y}}) produces (present only if x == y).
- The notes is typically used for life marks such as
{{mark c++26}}
for (C++26). - The nolink and inlinemem params are not supported directly (behaves as if they are true).
- If id param is provided, generates an inplace anchor with given anchor-name. Note that leading/trailing underscores in anchor-name are unconditionally trimmed.
{{dsc expos mem var|name |explanation |private=yes (optional)|protected=yes (optional)|maybe=yes (optional)|notes=rev (optional)}}
- describes an exposition-only variant member object.
{{dsc custpt|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a customization point object.
{{dsc niebloid|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a niebloid.
- Miscellaneous
{{dsc typedef|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a
typedef
.
{{dsc enum|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an
enum
orenum class
.
{{dsc mem enum|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a member
enum
orenum class
.
{{dsc attr|title |notes=link notes (optional)|explanation }}
- adds an item linking to a description of C / C++ attribute specifier. title is usually equal to {{attr|attr-params}}
{{dsc concept|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a (concept).
{{dsc expos concept|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an (exposition-only concept*).
{{dsc tag|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of an (tag).
{{dsc named req|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a named requirement.
{{dsc macro opr|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a operator macro.
{{dsc macro keyword|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a keyword macro.
{{dsc preprocessing directive|link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a preprocessing directive.
- 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.
Other templates
{{dsc cpphdr|name for link |title=link title (optional)|notes=link notes (optional)|explanation }}
- adds an item linking to a description of a header from C++ standard library or TS.
{{dsc hash|class link |nested=true if nested (optional)|notes=link notes (optional)}}
- adds an item linking to a description of a std::hash specialization.
See also templates
Used in see also lists.
{{dsc see cpp|location |nomono=true if serif (optional)|title1 (optional)|title2 (optional)|... }}
- adds a link to C++ documentation of a feature.
{{dsc see c|location |nomono=true if serif (optional)|title1 (optional)|title2 (optional)|... }}
- 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 | |
Defined in header
<dragon.h> | |
calls the dragon (function) | |
receives the fire (function) |
Templates used in the implementation
{{dsc member|page |title (optional)|title=title (optional)|nolink=true if nolink (optional)|nobold=true if nobold (optional)|notes=notes (optional)}}
- Default title of the link is page. Custom title can be supplied via the second unnamed parameter or
title
parameter. Ifnolink
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
andnotes
can accept <br> tags without breaking the layout.
{{dsc mark mem|link |mark class |nomem=true if nomem (optional)|inlinemem=true if inlinemem (optional)}}
- 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, considerlink
= a/b/c and page the page the template is used in. Then the template would append the additional description ifpage
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.
{{dsc editlink}}
- Outputs an [edit] text box with a link pointing to a page for editing the template whose name is defined in
dsc-list-template-name
variable. At least one dummy parameter must be passed to this template, as MediaWiki software employs some optimizations that break the implementation.
The above documentation is transcluded from Template:dsc/doc. (edit | history) Subpages of this template. |