ug4
|
As written in our Coding Style Guidelines, we are using Doxygen for documentation purposes in ug4.
This is a list and short description of the most frequently used and most important Doxygen commands and tricks. Using these should result in a concise and beatiful documentation.
The full list of available commands can be found in Doxygen's documentation: http://www.stack.nl/~dimitri/doxygen/commands.html
When ever a paragraph command is used (e.g. note
), which does not define a start and end command (as verbatim
/endverbatim
), the paragraph ends at the next paragraph command or empty line.
To ease the "correct" writing of this software we are documenting — ug4 — a custom command (alias) has been defined:
which renders to: ug4.
The usual formatting is available.
\b word
<strong>several words</strong>
\em word
<em>several words</em>
typewriter
\c word
<tt>several words</tt>
In case of function and class names, Doxygen is smart and will automatically create a link to the documentation of a function or class whenever it is mentioned inside Doxygen comments.
To force the reference to a class or method one can use the \see
command followed by a list of class and method names. Accessing a method of one specific class, the ::
and #
notation is supported. E.g. MyNamespace::AwesomeClass::print
Full URLs (with http://
) and email addresses are converted into links.
To create custom links, either the HTML tag (<a href="place-the-url-here">This is a link</a>
) or the reference command (\ref target "Title"
) can be used. In case "Title"
is not given with the \ref
command, the name of the section or page is used.
Targets accessible by the \ref
command are either defined pages (\page
), sections (e.g. \subsection
) or arbitrarily defined anchors (\anchor target
) somewhere in documents within the include path of Doxygen.
There are some special paragraphs available, which do not only look nice but come sometimes rather handy.
</li>
').\note It might be a good thing to bookmark this page.
\remarks Make sure your development toolchain is functional.
\todo Extend the documentation.
\warning Check your pointers!
The second type of paragraphs are defined by a starting and closing command. Especially for displaying source code the following are usefull:
\code
— \endcode
to display source code. It offers basic syntax highlighting and automated linking to functions and classes found somewhere else in the documentation. \verbatim
— \endverbatim
, same as above, but without the fancy syntax highlighting or linking. There are two options: One pure and one lazy with a little remark.
<ul>
- </ul>
) <ol>
) - </ol>
<li>
- </li>
. lazy — simple Markdown Same possibilities as with HTML, but with simple dashes ('-
') followed by a whitespace defining each element. For the ordered list, append a hash ('#
') to the dash.
renders to:
To define author and date of creation, the commands \author
and \date
are available. The first can be used several times.
\brief text
\param[in,out] name text
name
of the function with a short descriptive text and whether it is only an input (in
) or output (out
) or both (in,out
) paameter. \return text
text
. \exception type text
type
and a descriptive text
. Multiple \exception
commands are possible. Everything except of pages can be grouped into Modules showing up in a separate group in the documentation. An example of this usage can be found with the lib_algebra, lib_disc and lib_grid modules.
\defgroup identifier name
will create such a group, which can be referenced and used by its identifier
and show up in the rendered page as name
. Make sure this command is only called once per identifier — Doxygen will get confused otherwise and throw errors / warnings.
\addtogroup identifier
will add a component to a defined group. You can use @{
and @}
to add several components at once:
/** * \addtogroup myPrefiouslyDefinedGroup * @{ * / class MyClass { void myFunction() { std::cout << "Hello World!" << std::endl; } int add(int a, int b) { return a+b; } } /** @} * /
For more details about this powerful functionality of Doxygen, see http://www.stack.nl/~dimitri/doxygen/grouping.html
A hierarchy of pages can be achieved with the \subpage
command.
Special characters as the dash ('—') should be entered in the form of their HTML entity. (without the whitespaces)
& mdash ;
'& auml ;
', '& Auml ;
', '& szlig ;
'a
', 'A
' respectively.Horizontal lines are created with the default HTML tag: <hr>
.
For a complete build of the documentation (in particular for testing modifications / additions you've made to the documentation before committing) go into ug4/docs directory, then execute in a shell:
If you only want to build the documentation (without source code docu), you can do this in the subdir ug4/docs with
Opening of e.g. the main page of the ug4 documentation in a browser (under OSX, from the shell in the same directory):