Chapter 4: Grouping
Doxygen has two mechanisms for grouping. The first is the global level, create a new Page for each group. These groups are called "modules" in the comments. Another mechanism is used in some Compound Entity, called "MEMBER GROUP".
Modules module
Modules is a way to group Things on separate Page. The members of the group can be FILE, NAMESPACE, CLASS, FUNCTIONS, VARIABLES, ENUMS, TYPEDEFS, and DEFINES, but can also be other groups.
To define a group, you should place / defggroup on a special annotation block. The first parameter of the command should be a unique flag of the group of the group. To place an Entity as a member of a group, place the / INGROUP command before entity. The second parameter is the title of Group.
To avoid placing the / INGROUP command before each Member in the comment, you can encapsulate the Member with @ {and @}. @ {@} Tag can be set in a group's annotation, or you can be in a separate annotation block.
Mark Groups using these groups can also nested.
If you use a Group tag multiple times, it will be wrong. If you don't want Doxygen to force the unique label, you can use / addtogroup instead of / defgroup. The operation mode and / defgroup are very similar, but if the group has defined, it adds a new item to the existing comment by default. Group's title is optional, or you can use it.
/ ** / addtogroup
/ * / @ {* /
/ * / @} * /
This can add MEMBERS to a Group in other places.
Note Compound Entities (such as Classes, Files, and Namespaces) can be placed in multiple groups, but MEMBERS (such as variables, functions, typedefs, and enmus) can only be attributed to a group (this limit is to avoid link target ambiguous).
Doxygen puts Members in Gourp with the highest priority: f.i. / INGROUP is higher than any of the automatic grouch using @ {@}. And the same priority group definition conflict will trigger a warning unless one definition was for a member without any expedition documentation. The following example puts Varina in Group A and puts IntegerVariable in Group Intvariables to resolve and IntegerVariable conflicts, because IntegerVariable's second instance is not comment:
/ **
* / INGROUP A
* /
EXTERN INT VARINA;
/ **
* / Defgroup intvariables global integer variables
* /
/ * @ {* /
/ ** an integer variable * /
Extern int integerhannel;
/ * @} * /
....
/ **
* / Defgroup Variables Global Variables
* /
/ * @ {* /
/ ** a variable in group a * /
Int varina;
INTEGERVARIABLE; / * @} * /
Group defines the priority of the command (from high to low): / INGROUP, / DEFGROUP, / AddTogroup, / weakgroup. / WeakGroup is like a low priority / addtogroup. It is designed to implement a "Lazy" Group definition method: can define the structure in .h file, use / weakGroup in .cpp file, the hierarchy in the .h file is not repeated. (Translation: Whether it is said that you can also make a Group action in the .cpp file? For example, several nonmember functions have been defined in .cpp file, you can use Nonmember Function and previous despite .h has been put together with the meper functions.)
EXAMPLE:
/ ** @Defgroup group1 The first group
* This is the first group
* @ {
* /
/ ** @Brief class c1 in group 1 * /
Class C1 {};
/ ** @brief class c2 in group 1 * /
Class C2 {};
/ ** Function in group 1 * /
Void func () {}
/ ** @} * / // end of group1
/ **
* @Defgroup group2 the second group
* This is the second group
* /
/ ** @Defgroup group3 the third group
* This is the third group
* /
/ ** @Defgroup group4 the fourth group
* @InGroup Group3
* Group 4 Is A Subgroup of Group 3
* /
/ **
* @InGroup Group2
* @Brief Class C3 in Group 2
* /
Class C3 {};
/ ** @Improup group2
* @Brief class c4 in group 2
* /
Class C4 {};
/ ** @Improup group3
* @Brief class c5 in @Link Group3 The Third Group @ endlink.
* /
Class C5 {};
/ ** @Improup group1 group2 group3 group4
* Namespace n1 is in four groups
* @SA @Link Group1 the first group @ endlink, group2, group3, group
*
* Also See @ref mypage2
* /
Namespace n1 {};
/ ** @file
* @InGroup Group3
* @Brief this file in group 3
* /
/ ** @Defgroup group5 the fiffh group
* This is the fiffh group
* @ {
* /
/ ** @Page mypage1 this is a section in group 5
* Text of the first section
* /
/ ** @Page mypage2 this is another section in group 5 * text of the second section
* /
/ ** @} * / // end of group5
/ ** @addtogroup group1
*
* More Documentation for the first group.
* @ {
* /
/ ** Another Function in Group 1 * /
Void func2 () {}
/ ** YET Another Function in Group 1 * /
Void func3 () {}
/ ** @} * / // end of group1
Click Hered The Corresponding Html Documentation That IS generated by doxygen.
MEMBER GROUPS
If a Compound, such as a Class or File, there are multiple membs, usually we want to group them. Doxygen can automatically set these Things to groups together, but maybe you will think that it is not enough or this default approach is wrong. For example, you think that there is a different type of syntax, you need to be classified into the same group.
This definitions a member group:
@ {
...
@}
Block or use
/ * @ {* /
...
/ * @} * /
Block If you prefer C Style Comments. It should be noted that all of Members must be written.
You can also add an comment block before @ {, which should contain @name (or / name) to indicate the HEAPER of Group. Optionally, this comment block can contain more detailed information for Group.
MEMBER Group is not allowed to use nested.
If you have the same Type and Protection Level in a class of MEMBER Group in a class, this whole will be explicitly explicitly explicit as the Subgroup of the Type / Protection Level Group (for example, this group. As the "Sbash" SubSection of Static Public Members "Section. If two or more members have different types, then this group will be in the same level and the automatically generated groups. If you want all Member-Groups in a class, you can use the / nosubgrouping command in the class's comment block.
EXAMPLE:
/ ** a class. Details * /
Class test
{
PUBLIC:
@ {
/ ** Same Documentation for Both MEMBERS. DETAILS * /
Void func1InGroup1 ();
Void func2ingroup1 ();
@}
/ ** Function without group. Details. * /
Void ungroupectedfunction ();
Void func1InGroup2 ();
protected:
Void func2ingroup2 ();
}
Void test :: func1ingroup1 () {}
Void test :: func2ingroup1 () {}
/ ** @name group2
* Description of group 2.
* /
@ {
/ ** Function 2 in group 2. Details. * / Void test :: func2ingroup2 () {}
/ ** Function 1 in group 2. Details. * /
Void test :: func1ingroup2 () {}
@}
/ *! / file
* DOCS for this file
* /
@ {
//! One Description for All MEMBERS OF this group
//! (Because Distribute_Group_Doc is Yes in the config file)
#define a 1
#define b 2
Void glob_func ();
@}
Click Hered The Corresponding Html Documentation That IS generated by doxygen.
Here Group1 Is Displayed As A Subsection of The "Public Members". And Group2 Is A Separate Section Because IT Contains Members with Different Protection Levels (i.e. public and protected).