Doxygen grouping

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-07 03:40:45

问题


I have a question about pages and groups in doxygen. I have a project, where I grouped classes etc. with the @defgroup and @ingroup cmds. So far this works fine.

Now I'd like to add special documentation to the project with markdown pages. These pages should appear in the dedicated module (group). I tried to create pages with the @page and @subpage cmds. That works fine, but the pages appear plain in the menu.

So I tried to add them to the groups with @ingroup. But that doesn't work as I guessed. Is it possible to add pages to modules (groups)?

The result should look like this:

Project
|-- Modules
| |-- "Module1"
| | |-- documentation page1 (from *.md file)
| | |-- class documentation
| |-- "Module2"
| | |-- documentation page2
| | |-- class documentation

I hope you can help me!


回答1:


In described case we have two types of documentation for groups:

  1. documentation from source files
  2. documentation from markdown files

And we need create tree structure for this goups.

For example, we create 2 groups :

  1. Main Application with documentation in source code
  2. Library with documentation in file library.md

Main Application group source code (for C++) may look like this:

/** @defgroup app Main Application */

/** @addtogroup app
  * @brief Main application description.
  *
  * @{
  */

int main() { return 0; } //do nothing

/** @} */

MarkDown file library.md contain simple text:

Library File {#library}
============

Library Page Content from library.md.

Now to define structure we create mainpage.md file with content:

Pages {#mainpage}
============

Content:

- @subpage library

@defgroup Library
@addtogroup Library
@copydoc library
@{
@}

@subpage tag in mainpage.md used to hide all pages from tree to one root item (Pages). @defgroup tag create new group for markdown documentation. @copydoc tag copy content from library page to Library group.

On screenshot you can see result structure:

Doxygen groups and pages

Note, that Module Group name and Page name may be different in that case. You can also paste content from MarkDown files into source code documentation using @copydoc tag.

Reference: http://www.doxygen.nl/manual/grouping.html




回答2:


I have done it using @{ and @} commands and it works like this -

/**  
 * @defgroup module_name Sample Module   
 * @{   
 *     @page page_name [Optional Page Heading]   
 *     here will be the texts for the page ...    
 * @}   
 */   

If you have the module already defined some where, probably you need to use @addtogroup instead of @defgroup.

Hope this helps.



来源:https://stackoverflow.com/questions/15202909/doxygen-grouping

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!