Blame doc/grouping.doc

Packit Service 50c9f2
/******************************************************************************
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * 
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Copyright (C) 1997-2015 by Dimitri van Heesch.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Permission to use, copy, modify, and distribute this software and its
Packit Service 50c9f2
 * documentation under the terms of the GNU General Public License is hereby 
Packit Service 50c9f2
 * granted. No representations are made about the suitability of this software 
Packit Service 50c9f2
 * for any purpose. It is provided "as is" without express or implied warranty.
Packit Service 50c9f2
 * See the GNU General Public License for more details.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 * Documents produced by Doxygen are derivative works derived from the
Packit Service 50c9f2
 * input used in their production; they are not affected by this license.
Packit Service 50c9f2
 *
Packit Service 50c9f2
 */
Packit Service 50c9f2
/*! \page grouping Grouping
Packit Service 50c9f2
Packit Service 50c9f2
Doxygen has three mechanisms to group things together. 
Packit Service 50c9f2
One mechanism works at a global level, creating a new page
Packit Service 50c9f2
for each group. These groups are called \ref modules "'modules'" in the documentation.
Packit Service 50c9f2
The second mechanism works within a member list of some compound entity,
Packit Service 50c9f2
and is referred to as a \ref memgroup "'member groups'". 
Packit Service 50c9f2
For \ref cmdpage "pages" there is a third grouping mechanism referred to 
Packit Service 50c9f2
as \ref subpaging "subpaging".
Packit Service 50c9f2
Packit Service 50c9f2
\section modules Modules
Packit Service 50c9f2
Packit Service 50c9f2
Modules are a way to group things together on a separate page. You
Packit Service 50c9f2
can document a group as a whole, as well as all individual members.
Packit Service 50c9f2
Members of a group can be files, namespaces, classes, functions,
Packit Service 50c9f2
variables, enums, typedefs, and defines, but also other groups.
Packit Service 50c9f2
Packit Service 50c9f2
To define a group, you should put the \ref cmddefgroup "\\defgroup"
Packit Service 50c9f2
command in a special comment block. The first argument of the command 
Packit Service 50c9f2
is a label that should uniquely identify the group.  
Packit Service 50c9f2
The second argument is the name or title of the group as it should appear 
Packit Service 50c9f2
in the documentation.
Packit Service 50c9f2
Packit Service 50c9f2
You can make an entity a member of a specific group by putting 
Packit Service 50c9f2
a \ref cmdingroup "\\ingroup" command inside its documentation block.
Packit Service 50c9f2
Packit Service 50c9f2
To avoid putting \ref cmdingroup "\\ingroup" commands in the documentation
Packit Service 50c9f2
for each member you can also group members together by the 
Packit Service 50c9f2
open marker \@{ before the group and the 
Packit Service 50c9f2
closing marker \@} after the group. The markers can 
Packit Service 50c9f2
be put in the documentation of the group definition or in a separate 
Packit Service 50c9f2
documentation block. 
Packit Service 50c9f2
Packit Service 50c9f2
Groups themselves can also be nested using these grouping markers.
Packit Service 50c9f2
Packit Service 50c9f2
You will get an error message when you use the same group label more than once.
Packit Service 50c9f2
If you don't want doxygen to enforce unique labels, then you can 
Packit Service 50c9f2
use \ref cmdaddtogroup "\\addtogroup" instead of
Packit Service 50c9f2
\ref cmddefgroup "\\defgroup". 
Packit Service 50c9f2
It can be used exactly like \ref cmddefgroup "\\defgroup",
Packit Service 50c9f2
but when the group has been defined already, then it silently merges the 
Packit Service 50c9f2
existing documentation with the new one.
Packit Service 50c9f2
The title of the group is optional for this command, so you can use
Packit Service 50c9f2
\verbatim
Packit Service 50c9f2
/** \addtogroup <label> 
Packit Service 50c9f2
 *  @{
Packit Service 50c9f2
 */
Packit Service 50c9f2
...
Packit Service 50c9f2
Packit Service 50c9f2
/** @}*/
Packit Service 50c9f2
\endverbatim
Packit Service 50c9f2
to add additional members to a group that is defined in more detail elsewhere.
Packit Service 50c9f2
Packit Service 50c9f2
Note that compound entities (like classes, files and namespaces) can
Packit Service 50c9f2
be put into multiple groups, but members (like variable, functions, typedefs
Packit Service 50c9f2
and enums) can only be a member of one group 
Packit Service 50c9f2
(this restriction is in place to avoid ambiguous linking targets in case 
Packit Service 50c9f2
a member is not documented in the context of its class, namespace
Packit Service 50c9f2
or file, but only visible as part of a group).
Packit Service 50c9f2
Packit Service 50c9f2
Doxygen will put members into the group whose definition has
Packit Service 50c9f2
the highest "priority": e.g. An explicit \ref cmdingroup "\\ingroup" overrides 
Packit Service 50c9f2
an implicit grouping definition via \@{ \@}. 
Packit Service 50c9f2
Conflicting grouping definitions with the same priority trigger a warning, 
Packit Service 50c9f2
unless one definition was for a member without any explicit documentation. 
Packit Service 50c9f2
Packit Service 50c9f2
The following example puts VarInA into group A and silently resolves 
Packit Service 50c9f2
the conflict for IntegerVariable by putting it into group IntVariables, 
Packit Service 50c9f2
because the second instance of IntegerVariable
Packit Service 50c9f2
is undocumented:
Packit Service 50c9f2
Packit Service 50c9f2
\verbatim
Packit Service 50c9f2
Packit Service 50c9f2
/**
Packit Service 50c9f2
 * \ingroup A
Packit Service 50c9f2
 */
Packit Service 50c9f2
extern int VarInA;
Packit Service 50c9f2
Packit Service 50c9f2
/**
Packit Service 50c9f2
 * \defgroup IntVariables Global integer variables
Packit Service 50c9f2
 * @{
Packit Service 50c9f2
 */
Packit Service 50c9f2
Packit Service 50c9f2
/** an integer variable */
Packit Service 50c9f2
extern int IntegerVariable;
Packit Service 50c9f2
Packit Service 50c9f2
/**@}*/
Packit Service 50c9f2
Packit Service 50c9f2
....
Packit Service 50c9f2
Packit Service 50c9f2
/**
Packit Service 50c9f2
 * \defgroup Variables Global variables
Packit Service 50c9f2
 */
Packit Service 50c9f2
/**@{*/
Packit Service 50c9f2
Packit Service 50c9f2
/** a variable in group A */
Packit Service 50c9f2
int VarInA;
Packit Service 50c9f2
Packit Service 50c9f2
int IntegerVariable;
Packit Service 50c9f2
Packit Service 50c9f2
/**@}*/
Packit Service 50c9f2
\endverbatim
Packit Service 50c9f2
Packit Service 50c9f2
The \ref cmdref "\\ref" command can be used to refer to a group.
Packit Service 50c9f2
The first argument of the \\ref command should be group's label.
Packit Service 50c9f2
To use a custom link name, you can put the name of the links in 
Packit Service 50c9f2
double quotes after the label, as shown by the following example
Packit Service 50c9f2
\verbatim
Packit Service 50c9f2
This is the \ref group_label "link" to this group.
Packit Service 50c9f2
\endverbatim
Packit Service 50c9f2
Packit Service 50c9f2
The priorities of grouping definitions are (from highest to lowest):
Packit Service 50c9f2
\ref cmdingroup "\\ingroup", \ref cmddefgroup "\\defgroup",
Packit Service 50c9f2
\ref cmdaddtogroup "\\addtogroup", \ref cmdweakgroup "\\weakgroup".
Packit Service 50c9f2
The \ref cmdweakgroup "\\weakgroup" command is exactly like \ref cmdaddtogroup "\\addtogroup"
Packit Service 50c9f2
with a lower priority. It was added to allow "lazy" grouping
Packit Service 50c9f2
definitions: you can use commands with a higher priority in your .h
Packit Service 50c9f2
files to define the hierarchy and \ref cmdweakgroup "\\weakgroup"
Packit Service 50c9f2
in .c files without having to duplicate the hierarchy exactly.
Packit Service 50c9f2
Packit Service 50c9f2
\par Example:
Packit Service 50c9f2
\include group.cpp
Packit Service 50c9f2
Packit Service 50c9f2
\htmlonly
Packit Service 50c9f2

Packit Service 50c9f2
Click here 
Packit Service 50c9f2
for the corresponding HTML documentation that is generated by doxygen.
Packit Service 50c9f2
\endhtmlonly
Packit Service 50c9f2
\latexonly
Packit Service 50c9f2
See \hyperlink{modules_example}{Modules example}
Packit Service 50c9f2
for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen.
Packit Service 50c9f2
\endlatexonly
Packit Service 50c9f2
Packit Service 50c9f2
\section memgroup Member Groups
Packit Service 50c9f2
Packit Service 50c9f2
If a compound (e.g. a class or file) has many members, it is often 
Packit Service 50c9f2
desired to group them together. Doxygen already automatically groups 
Packit Service 50c9f2
things together on type and protection level, but maybe you feel that 
Packit Service 50c9f2
this is not enough or that that default grouping is wrong. 
Packit Service 50c9f2
For instance, because you feel that members of different (syntactic) 
Packit Service 50c9f2
types belong to the same (semantic) group.
Packit Service 50c9f2
Packit Service 50c9f2
A member group is defined by 
Packit Service 50c9f2
a 
Packit Service 50c9f2
\verbatim
Packit Service 50c9f2
///@{ 
Packit Service 50c9f2
  ...
Packit Service 50c9f2
///@}
Packit Service 50c9f2
\endverbatim 
Packit Service 50c9f2
block or a 
Packit Service 50c9f2
\verbatim
Packit Service 50c9f2
/**@{*/ 
Packit Service 50c9f2
  ... 
Packit Service 50c9f2
/**@}*/ 
Packit Service 50c9f2
\endverbatim 
Packit Service 50c9f2
block if you prefer C style 
Packit Service 50c9f2
comments. Note that the members of the group should be 
Packit Service 50c9f2
physically inside the member group's body.
Packit Service 50c9f2
Packit Service 50c9f2
Before the opening marker of a block a separate comment block may be 
Packit Service 50c9f2
placed. This block should contain the \ref cmdname "@@name" 
Packit Service 50c9f2
(or \ref cmdname "\\name") command and is used to specify the header 
Packit Service 50c9f2
of the group. Optionally, the comment block may also contain more
Packit Service 50c9f2
detailed information about the group.
Packit Service 50c9f2
Packit Service 50c9f2
Nesting of member groups is not allowed. 
Packit Service 50c9f2
Packit Service 50c9f2
If all members of a member group inside a class have the same type 
Packit Service 50c9f2
and protection level (for instance all are static public members), 
Packit Service 50c9f2
then the whole member group is displayed as a subgroup of 
Packit Service 50c9f2
the type/protection level group (the group is displayed as a 
Packit Service 50c9f2
subsection of the "Static Public Members" section for instance). 
Packit Service 50c9f2
If two or more members have different types, then the group is put 
Packit Service 50c9f2
at the same level as the automatically generated groups.
Packit Service 50c9f2
If you want to force all member-groups of a class to be at the top level, 
Packit Service 50c9f2
you should put a \ref cmdnosubgrouping "\\nosubgrouping" command inside the
Packit Service 50c9f2
documentation of the class. 
Packit Service 50c9f2
Packit Service 50c9f2
\par Example:
Packit Service 50c9f2
\include memgrp.cpp
Packit Service 50c9f2
Packit Service 50c9f2
\htmlonly
Packit Service 50c9f2

Packit Service 50c9f2
Click here 
Packit Service 50c9f2
for the corresponding HTML documentation that is generated by doxygen.
Packit Service 50c9f2
\endhtmlonly
Packit Service 50c9f2
\latexonly
Packit Service 50c9f2
See \hyperlink{memgrp_example}{Member Groups example}
Packit Service 50c9f2
for the corresponding \mbox{\LaTeX} documentation that is generated by doxygen.
Packit Service 50c9f2
\endlatexonly
Packit Service 50c9f2
Packit Service 50c9f2
Here Group1 is displayed as a subsection of the "Public Members". And
Packit Service 50c9f2
Group2 is a separate section because it contains members with
Packit Service 50c9f2
different protection levels (i.e. public and protected).
Packit Service 50c9f2
Packit Service 50c9f2
\section subpaging Subpaging
Packit Service 50c9f2
Packit Service 50c9f2
Information can be grouped into pages using the \ref cmdpage "\\page" and
Packit Service 50c9f2
\ref cmdsubpage "\\mainpage" commands. Normally, this results in a
Packit Service 50c9f2
flat list of pages, where the "main" page is the first in the list. 
Packit Service 50c9f2
Packit Service 50c9f2
Instead of adding structure using the approach described in section
Packit Service 50c9f2
\ref modules "modules" it is often more natural and convenient to add 
Packit Service 50c9f2
additional structure to the pages using the \ref cmdsubpage "\\subpage" 
Packit Service 50c9f2
command. 
Packit Service 50c9f2
Packit Service 50c9f2
For a page A the \\subpage command adds a link to another page B and at 
Packit Service 50c9f2
the same time makes page B a subpage of A. This has the effect of making
Packit Service 50c9f2
two groups GA and GB, where GB is part of GA, page A is put in group GA, 
Packit Service 50c9f2
and page B is put in group GB.
Packit Service 50c9f2
Packit Service 50c9f2
\htmlonly
Packit Service 50c9f2

Packit Service 50c9f2
Go to the next section or return to the
Packit Service 50c9f2
 index.
Packit Service 50c9f2

Packit Service 50c9f2
\endhtmlonly
Packit Service 50c9f2
Packit Service 50c9f2
*/