DoxyGen文档三

本文介绍使用Doxygen生成代码文档的方法,输入特定命令可生成多种格式文档,可修改输出目录。生成的文档需编译器处理,还能转换为PostScript或PDF。同时说明了为源码添加注释的方式,有两种基本选项,特殊注释块文本会经过解析处理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

Step 2:运行doxygen

输入下面的命令,生成一个文档:

doxygen <config-file>

Doxygen将在输入目录下生成一个htmlrtflatexman目录,分别对应于HTMLRTF Unix-Man文件格式。

 

       缺省的输出目录是doxygen的目录。使用OUTPUT_DIRECTORYHTML_OUTPUT, RTF_OUTPUTLATEX_OUTPUTMAN_OUTPUT可以进行修改。如果输出目录不存在,doxygen会创建出来。

生成的html文档需要一个支持CSS的浏览器。

 

The generated documentation must first be compiled by a compiler (I use teTeX distribution version 0.9 that contains version 3.14159). To simplify the process of compiling the generated documentation, doxygen writes a Makefile into the latex directory. By typing make in the latex directory the dvi file refman.dvi will be generated (provided that you have a make tool called make of course). This file can then be viewed using xdvi or converted into a PostScript file refman.ps by typing make ps (this requires dvips). To put 2 pages on one physical page use make ps_2on1 instead. The resulting PostScript file can be send to a PostScript printer. If you do not have a PostScript printer, you can try to use ghostscript to convert PostScript into something your printer understands. Conversion to PDF is also possible if you have installed the ghostscript interpreter; just type make pdf (or make pdf_2on1). To get the best results for PDF output you should set the PDF_HYPERLINKS tag to YES.

       文档必须首先经过 编译器(我手头上的是teTeX version 0.9其中包括 version 3.14159)。

 

Step 3: Documenting the sources为源码添加注释

Although documenting the source is presented as step 3, in a new project this should of course be step 1. Here I assume you already have some code and you want doxygen to generate a nice document describing the API and maybe the internals as well.

 

如果配置文件中EXTRACT_ALL设置为NO(缺省值),doxygen就只为documented membersfilesclassesnamespaces生成文档。那么应该如何为这些元素添加注释呢?对于membersclassesnamespaces有两个基本选项:

1.        memberclassnamespace之前添加special注释。对于fileclassnamespace members也直接可以在该member后添加注释。参考Special documentation blocks一章。

2.        在其他地方(另一个文件或位置)放置一个特殊的文档块并在此文档块中放置一个structural command。一个structural command in链接到、一个文档块到一个特定的可以documented(例如一个memberclassnamespacefile)。具体参考Documentation at other places一章。

文件只能只能使用第二种选项,因为没有办法将一个注释块放在文件前。当然,file memberfunctionsvariabletypedefsdefines)不需要一个显式的structural command;只要在其前后放置一个特殊的注释就OK了。

 

特殊注释块中的文本被写入到HTML 之前,会作个parse

parse的过程中有以下几步:

·         执行文档中的Special Commands

·         If a line starts with some whitespace followed by one or more asterisks (*) and then optionally more whitespace, then all whitespace and asterisks are removed.

·         空白行被认为是段的分隔符。无需再使用一个new-paragraph命令。

·         出现在文本中的单词,如果和documented类相匹配,就生成一个到documented类的链接。

·         Links to members are created when certain patterns are found in the text.参见Automatic link generation以获取有关自动创建链接。

·         HTML tags that are in the documentation are interpreted and converted to equivalents for the output. See section HTML Commands for an overview of all supported HTML tags.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值