Adding all header content to a Doxygen group

Since this seems like such a common task, it's hard for me to believe that if I want to add all the doxygen comments to the group header file, what do I need to do

foo.h /** *\addtogroup fooGroup * @{ */ ... ... ... /**@}*/ 

Is there any way to make this work without @ {comment?

+5
source share
1 answer

The short answer is no. An alternative is the @ingroup command. If you place this command directly under the @file command, the link to the file is added to the group, for example:

 foo.h: /** * @file foo.h * @ingroup fooGroup */ ... 

It also requires that you define a group with that name (it may also be in another file):

 /** * @defgroup fooGroup Foo * @brief A brief description of the Foo component. * @details A more detailed description of the Foo component. */ 

BUT the big drawback is that you have to put the @ingroup command for every object that you want to display in the group documentation. This means that you need to add a command to each declaration or definition, such as enumerations, structures, variables and functions.

Using the @addtogroup and @{ ... @} commands has the great advantage that you do not need to add each @ingroup to the group using the @ingroup .

The meaning of groups is to collect documentation from different files under one specific name. You can also split one file into different groups, so the comments @ {and @} determine the beginning and end of the region that should be added to the group name. Another reason is that groups can create hierarchies, for example. one file with the following code:

 /** * @addtogroup group_name * @{ */ <Code Example 1> /** * @} */ /** * @addtogroup group_name_2 * @{ */ <Code Example 2> /** * @addtogroup sub_group_name * @{ */ <Code Example 3> /** * @addtogroup sub_sub_group_name * @{ */ <Code Example 4> /** * @} */ /** * @} */ /** * @} */ 

This will result in the following group hierarchy:

  • group_name
  • group_name_2
    • sub_group_name
      • sub_sub_group_name

The only thing you can try is to add an alias for the \ addtogroup and {commands, for example:

 ALIAS += "begingroup{1} = \addtogroup \1 \{" 

But in this case, you still have to add the @} command at the end of the file.

+2
source

All Articles