Sophie

Sophie

distrib > Fedora > 14 > x86_64 > by-pkgid > bbf8b69a7c5792df8049c96b78d19811 > files > 742

doxygen-1.7.4-2.fc14.x86_64.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Doxygen manual: Custom Commands</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.7.4 -->
<div id="top">
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Doxygen manual</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Custom Commands </div>  </div>
</div>
<div class="contents">
<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>
<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>
<h2><a class="anchor" id="custcmd_simple"></a>
Simple aliases</h2>
<p>The simplest form of an alias is a simple substitution of the form </p>
<div class="fragment"><pre class="fragment">
 name=value
</pre></div><p> For example defining the following alias: </p>
<div class="fragment"><pre class="fragment">
 ALIASES += sideeffect="\par Side Effects:\n" 
</pre></div><p> will allow you to put the command \sideeffect (or @sideeffect) in the documentation, which will result in a user-defined paragraph with heading <b>Side Effects:</b>.</p>
<p>Note that you can put \n's in the value part of an alias to insert newlines.</p>
<p>Also note that you can redefine existing special commands if you wish.</p>
<p>Some commands, such as <a class="el" href="commands.html#cmdxrefitem">\xrefitem</a> are designed to be used in combination with aliases.</p>
<h2><a class="anchor" id="custcmd_complex"></a>
Aliases with arguments</h2>
<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 \x markers, where 'x' represents the argument number starting with 1.</p>
<p>Here is an example of an alias definition with a single argument: </p>
<div class="fragment"><pre class="fragment">
ALIASES += l{1}="\ref \1"
</pre></div><p>Inside a comment block you can use it as follows </p>
<div class="fragment"><pre class="fragment">
/** See \l{SomeClass} for more information. */
</pre></div><p> which would be the same as writing </p>
<div class="fragment"><pre class="fragment">
/** See \ref SomeClass for more information. */
</pre></div><p>Note that you can overload an alias by a version with multiple arguments, for instance: </p>
<div class="fragment"><pre class="fragment">
ALIASES += l{1}="\ref \1"
ALIASES += l{2}="\ref \1 \"\2\""
</pre></div><p> Note that the quotes inside the alias definition have to be escaped with a backslash.</p>
<p>With these alias definitions, we can write </p>
<div class="fragment"><pre class="fragment">
/** See \l{SomeClass,Some Text} for more information. */
</pre></div><p> inside the comment block and it will expand to </p>
<div class="fragment"><pre class="fragment">
/** See \ref SomeClass "Some Text" for more information. */
</pre></div><p> where the command with a single argument would still work as shown before.</p>
<p>Aliases can also be expressed in terms of other aliases, e.g. a new command \reminder can be expressed as a \xrefitem via an intermediate \xreflist command as follows: </p>
<div class="fragment"><pre class="fragment">
ALIASES += xreflist{3}="\xrefitem \1 \"\2\" \"\3\" " \
ALIASES += reminder="\xreflist{reminders,Reminder,Reminders}" \
</pre></div><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>
<div class="fragment"><pre class="fragment">
\l{SomeClass,Some text\, with an escaped comma} 
</pre></div><p> given the alias definition of \l in the example above.</p>
<h2><a class="anchor" id="custcmd_nesting"></a>
Nesting custom command</h2>
<p>You can use commands as arguments of aliases, including commands defined using aliases.</p>
<p>As an example consider the following alias definitions</p>
<div class="fragment"><pre class="fragment">
ALIASES += Bold{1}="&lt;b&gt;\1&lt;/b&gt;"
ALIASES += Emph{1}="&lt;em&gt;\1&lt;/em&gt;"
</pre></div><p>Inside a comment block you can now use: </p>
<div class="fragment"><pre class="fragment">
/** This is a \Bold{bold \Emph{and} Emphasized} text fragment. */
</pre></div><p> which will expand to </p>
<div class="fragment"><pre class="fragment">
/** This is a &lt;b&gt;bold &lt;em&gt;and&lt;/em&gt; Emphasized&lt;/b&gt; text fragment. */
</pre></div> </div></div>
<hr class="footer"/><address class="footer"><small>Generated on Mon Jun 27 2011 for Doxygen manual by&#160;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.4 </small></address>
</body>
</html>