技术2022-05-11  16

    Step 2:运行doxygen


    doxygen <config-file>

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


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



    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 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


    ·         执行文档中的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.