如何使用Doxygen制作介绍页面

Ale*_*x F 96 doxygen

我使用Doxygen为我的SDK制作了文档.它包含文件,名称空间,类,类型等的列表 - 我在代码中作为Doxygen注释放置的所有内容.现在我想写一些关于SDK(介绍类型)的一般信息,它与任何代码元素都没有直接关系.我想将此介绍放在文档起始页面上.我怎样才能做到这一点?

Chr*_*ris 91

看看mainpage命令.

另外,看看另一个线程的答案:如何在Doxygen中包含自定义文件.它指出,有三个扩展,并Doxygen的类作为附加的文档文件:.dox,.txt.doc.具有这些扩展名的文件不会出现在文件索引中,但可以用于在最终文档中包含其他信息 - 对于必要的文档非常有用,但这些文档并不适合包含在您的源代码中(例如,常见问题解答)

因此,我建议mainpage.dox您在项目目录中使用(或类似命名的)文件来向您介绍SDK.请注意,在此文件中,您需要放置一个或多个C/C++样式注释块.

  • 至少markdown文件(`.md`和`.markdown`)也被视为附加文档文件.我更喜欢它们而不是`.dox`,因为它们不需要周围的代码注释,并且可以使用降价编辑器进行很好的编辑 - 没有缺点. (3认同)

dox*_*gen 54

请注意,使用Doxygen版本1.8.0,您还可以添加Markdown格式化页面.为此,您需要创建扩展名为.md或.markdown的页面,并将以下内容添加到配置文件中:

INPUT += your_page.md
FILE_PATTERNS += *.md *.markdown
Run Code Online (Sandbox Code Playgroud)

有关详细信息,请参见http://www.doxygen.org/markdown.html#md_page_header.

  • 实际上当前的1.8.0版本支持markdown BUT并不将它们视为文档.所以你最终会得到文件和目录部分中列出的降价类.解决方案是将`dox = md`添加为`EXTENSION_MAPPING`并将你的降价扩展名重命名为`.dox`.所以配置看起来像:`INPUT + = your_page.dox EXTENSION_MAPPING + = dox = md` (6认同)
  • 好点子.我会纠正这个,以便.md和.markdown被视为类似于.dox. (6认同)
  • 不幸的是,这最终会出现在相关页面下,而不是主页面 (4认同)

Pas*_*cal 51

从v1.8.8开始,也有选项USE_MDFILE_AS_MAINPAGE.因此,请确保将索引文件(例如README.md)添加到INPUT并将其设置为此选项的值:

INPUT += README.md
USE_MDFILE_AS_MAINPAGE = README.md
Run Code Online (Sandbox Code Playgroud)

  • 除此之外,如果您要使用README.md作为主页面,请确保它首先出现在INPUT列表中.当存在多个主页候选时,选择解析时遇到的第一个,或者看起来如此. (4认同)
  • 顺便说一下,在doxygen gui中你只需要在expert> input>输入下包含你的.md文件. (2认同)
  • @samvv我没有在markdown文档中添加任何额外内容.我刚刚使用了`INPUT = README.md`然后`INPUT + = src`(遵循@Lester的建议)和'USE_MDFILE_AS_MAINPAGE = README.md`它就像一个魅力.版本:`$ doxygen --version`给我回复`1.8.11`. (2认同)

Bir*_*apa 7

以下语法可能有助于为 doxygen 添加主页和相关子页面:

/*! \mainpage Drawing Shapes
 *
 * This project helps user to draw shapes.
 * Currently two types of shapes can be drawn:
 * - \subpage drawingRectanglePage "How to draw rectangle?"
 *
 * - \subpage drawingCirclePage "How to draw circle?"
 *
 */ 

/*! \page drawingRectanglePage How to draw rectangle?
 *
 * Lorem ipsum dolor sit amet
 *
 */

/*! \page drawingCirclePage How to draw circle?
 *
 * This page is about how to draw a circle.
 * Following sections describe circle:
 * - \ref groupCircleDefinition "Definition of Circle"
 * - \ref groupCircleClass "Circle Class"
 */
Run Code Online (Sandbox Code Playgroud)

创建如下组也有助于设计页面:

/** \defgroup groupCircleDefinition Circle Definition
 * A circle is a simple shape in Euclidean geometry.
 * It is the set of all points in a plane that are at a given distance from a given point, the centre;
 * equivalently it is the curve traced out by a point that moves so that its distance from a given point is constant.
 * The distance between any of the points and the centre is called the radius.
 */
Run Code Online (Sandbox Code Playgroud)

一个例子可以在这里找到


小智 5

在文档中添加包含您的内容的任何文件,例如toc.h:

@ mainpage Manual SDK
<hr/>
@ section pageTOC Content
  -# @ref Description
  -# @ref License
  -# @ref Item
...
Run Code Online (Sandbox Code Playgroud)

在你的Doxyfile:

INPUT = toc.h \
Run Code Online (Sandbox Code Playgroud)

示例(俄语):