DoxyPress
1.7.0
|
DoxyPress provides a large number commands which can be used to enhance or structure the documentation inside a comment block. New commands can be implemented by using the alias
command. The definition of an alias is specified in the project file using the aliases tag.
The simplest form of an alias is a simple substitution of the form
name=value
For example defining the following alias:
ALIASES += sideeffect="\par Side Effects:\n"
will allow you to put the command \sideeffect
(or @sideeffect
) in the documentation, which will result in a user-defined paragraph with heading Side Effects:.
You can put \n
's in the value part of an alias to insert newlines. You can also redefine existing special commands.
Some commands, such as cmdxrefitem are designed to be used in combination with aliases.
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.
Here is an example of an alias definition with a single argument:
ALIASES += l{1}="\ref \1"
Inside a comment block you can use it as follows
/** See \l{SomeClass} for more information. */
which would be the same as writing
/** See \ref SomeClass for more information. */
Note that you can overload an alias by a version with multiple arguments, for instance:
ALIASES += l{1}="\ref \1" ALIASES += l{2}="\ref \1 \"\2\""
Note that the quotes inside the alias definition have to be escaped with a backslash.
With these alias definitions, we can write
/** See \l{SomeClass,Some Text} for more information. */
inside the comment block and it will expand to
/** See \ref SomeClass "Some Text" for more information. */
where the command with a single argument would still work as shown before.
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:
ALIASES += xreflist{3}="\xrefitem \1 \"\2\" \"\3\" " ALIASES += reminder="\xreflist{reminders,Reminder,Reminders}"
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
\l{SomeClass,Some text\, with an escaped comma}
given the alias definition of \l
in the example above.
You can use commands as arguments of aliases, including commands defined using aliases.
As an example consider the following alias definitions
ALIASES += Bold{1}="<b>\1</b>" ALIASES += Emph{1}="<em>\1</em>"
Inside a comment block you can now use:
/** This is a \Bold{bold \Emph{and} Emphasized} text fragment. */
which will expand to
/** This is a <b>bold <em>and</em> Emphasized</b> text fragment. */