1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
4 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
6 <meta name="generator" content="Doxygen 1.8.12"/>
7 <meta name="viewport" content="width=device-width, initial-scale=1"/>
8 <title>Doxygen: Custom Commands</title>
9 <link href="tabs.css" rel="stylesheet" type="text/css"/>
10 <script type="text/javascript" src="jquery.js"></script>
11 <script type="text/javascript" src="dynsections.js"></script>
12 <link href="navtree.css" rel="stylesheet" type="text/css"/>
13 <script type="text/javascript" src="resize.js"></script>
14 <script type="text/javascript" src="navtreedata.js"></script>
15 <script type="text/javascript" src="navtree.js"></script>
16 <script type="text/javascript">
17 $(document).ready(initResizable);
19 <link href="doxygen_manual.css" rel="stylesheet" type="text/css" />
22 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
24 <table cellspacing="0" cellpadding="0">
26 <tr style="height: 56px;">
27 <td id="projectalign" style="padding-left: 0.5em;">
28 <div id="projectname">Doxygen
35 <!-- end header part -->
36 <!-- Generated by Doxygen 1.8.12 -->
38 <div id="side-nav" class="ui-resizable side-nav-resizable">
40 <div id="nav-tree-contents">
41 <div id="nav-sync" class="sync"></div>
44 <div id="splitbar" style="-moz-user-select:none;"
45 class="ui-resizable-handle">
48 <script type="text/javascript">
49 $(document).ready(function(){initNavTree('custcmd.html','');});
51 <div id="doc-content">
53 <div class="headertitle">
54 <div class="title">Custom Commands </div> </div>
56 <div class="contents">
57 <div class="toc"><h3>Table of Contents</h3>
58 <ul><li class="level1"><a href="#custcmd_simple">Simple aliases</a></li>
59 <li class="level1"><a href="#custcmd_complex">Aliases with arguments</a></li>
60 <li class="level1"><a href="#custcmd_nesting">Nesting custom command</a></li>
63 <div class="textblock"><p>Doxygen provides a large number of <a class="el" href="commands.html">special commands</a>, <a class="el" href="xmlcmds.html">XML commands</a>, and <a class="el" href="htmlcmds.html">HTML commands</a>. that can be used to enhance or structure the documentation inside a comment block. If you for some reason have a need to define new commands you can do so by means of an <em>alias</em> definition.</p>
64 <p>The definition of an alias should be specified in the configuration file using the <a class="el" href="config.html#cfg_aliases">ALIASES</a> configuration tag.</p>
65 <h1><a class="anchor" id="custcmd_simple"></a>
67 <p>The simplest form of an alias is a simple substitution of the form </p><pre class="fragment"> name=value
68 </pre><p> For example defining the following alias: </p><pre class="fragment"> ALIASES += sideeffect="\par Side Effects:\n"
69 </pre><p> will allow you to put the command <code>\sideeffect</code> (or <code>@sideeffect</code>) in the documentation, which will result in a user-defined paragraph with heading <b>Side Effects:</b>.</p>
70 <p>Note that you can put <code>\n</code>'s in the value part of an alias to insert newlines.</p>
71 <p>Also note that you can redefine existing special commands if you wish.</p>
72 <p>Some commands, such as <a class="el" href="commands.html#cmdxrefitem">\xrefitem</a> are designed to be used in combination with aliases.</p>
73 <h1><a class="anchor" id="custcmd_complex"></a>
74 Aliases with arguments</h1>
75 <p>Aliases can also have one or more arguments. In the alias definition you then need to specify the number of arguments between curly braces. In the value part of the definition you can place <code>\x</code> markers, where '<code>x</code>' represents the argument number starting with 1.</p>
76 <p>Here is an example of an alias definition with a single argument: </p><pre class="fragment">ALIASES += l{1}="\ref \1"
77 </pre><p>Inside a comment block you can use it as follows </p><pre class="fragment">/** See \l{SomeClass} for more information. */
78 </pre><p> which would be the same as writing </p><pre class="fragment">/** See \ref SomeClass for more information. */
79 </pre><p>Note that you can overload an alias by a version with multiple arguments, for instance: </p><pre class="fragment">ALIASES += l{1}="\ref \1"
80 ALIASES += l{2}="\ref \1 \"\2\""
81 </pre><p> Note that the quotes inside the alias definition have to be escaped with a backslash.</p>
82 <p>With these alias definitions, we can write </p><pre class="fragment">/** See \l{SomeClass,Some Text} for more information. */
83 </pre><p> inside the comment block and it will expand to </p><pre class="fragment">/** See \ref SomeClass "Some Text" for more information. */
84 </pre><p> where the command with a single argument would still work as shown before.</p>
85 <p>Aliases can also be expressed in terms of other aliases, e.g. a new command <code>\reminder</code> can be expressed as a <a class="el" href="commands.html#cmdxrefitem">\xrefitem</a> via an intermediate <code>\xreflist</code> command as follows: </p><pre class="fragment">ALIASES += xreflist{3}="\xrefitem \1 \"\2\" \"\3\" "
86 ALIASES += reminder="\xreflist{reminders,Reminder,Reminders}"
87 </pre><p>Note that if for aliases with more than one argument a comma is used as a separator, if you want to put a comma inside the command, you will need to escape it with a backslash, i.e. </p><pre class="fragment">\l{SomeClass,Some text\, with an escaped comma}
88 </pre><p> given the alias definition of <code>\l</code> in the example above.</p>
89 <h1><a class="anchor" id="custcmd_nesting"></a>
90 Nesting custom command</h1>
91 <p>You can use commands as arguments of aliases, including commands defined using aliases.</p>
92 <p>As an example consider the following alias definitions</p>
93 <pre class="fragment">ALIASES += Bold{1}="<b>\1</b>"
94 ALIASES += Emph{1}="<em>\1</em>"
95 </pre><p>Inside a comment block you can now use: </p><pre class="fragment">/** This is a \Bold{bold \Emph{and} Emphasized} text fragment. */
96 </pre><p> which will expand to </p><pre class="fragment">/** This is a <b>bold <em>and</em> Emphasized</b> text fragment. */
99 Go to the <a href="external.html">next</a> section or return to the
100 <a href="index.html">index</a>.
102 </div></div><!-- contents -->
103 </div><!-- doc-content -->
104 <!-- start footer part -->
105 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
107 <li class="footer">Generated by
108 <a href="http://www.doxygen.org/index.html">
109 <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>