Doxygen

维基百科,自由的百科全书
跳转到导航 跳转到搜索
Doxygen
File:Doxygen.png
开发者Dimitri van Heesch
当前版本
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    源代码库
    • {{URL|example.com|可选的显示文本}}
    Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
    编程语言C++
    引擎
      Module:EditAtWikidata第29行Lua错误:attempt to index field 'wikibase' (a nil value)
      操作系统跨平台
      类型文档生成器
      许可协议GNU通用公共许可证
      网站www.doxygen.nl

      Doxygen是一个适用于C++CJavaObjective-CPythonIDLCORBA和Microsoft flavors)、FortranVHDLPHPC#D语言的文档生成器。它可以在大多数类Unix操作系统macOS以及Microsoft Windows上执行。初始版本的Doxygen使用了一些旧版本DOC++的源代码,在那之后,Dimitri van Heesch重写了Doxygen的源代码。

      Doxygen是一个编写软件参考文档的工具。该文档是直接写在源代码中的,因此比较容易保持更新。Doxygen可以交叉引用和源代码,使文件的读者可以很容易地引用实际的源代码。

      KDE将Doxygen作为它的一部分且KDevelop具有内置的支持。Doxygen的发布遵守GNU通用公共许可证,是自由软件

      用法[编辑]

      如同Javadoc,Doxygen从源文件提取注解。除了Javadoc的语法,Doxygen支持Qt使用的文档标记,并可以输出成HTML、以及CHMRTFPDFLaTeXPostScript手册页

      示例代码[编辑]

      File:Doxygen ouput.png
      内容输出为HTML的截图

      注释文档一般用两个星号标志:

      /**
       * <A short one line description>
       *
       * <Longer description>
       * <May span multiple lines or paragraphs as needed>
       *
       * @param  Description of method's or function's input parameter
       * @param  ...
       * @return Description of the return value
       */
      

      但也能像HeaderDoc一样使用*!的标志。例如:

      /*!
       * <A short one line description>
       *
       * <Longer description>
       * <May span multiple lines or paragraphs as needed>
       *
       * @param  Description of method's or function's input parameter
       * @param  ...
       * @return Description of the return value
       */
      

      以下说明如何从C++源代码产生文档。请确保参数EXTRACT_ALL在Doxyfile设置为YES。

      /**
       * @file
       * @author  John Doe <jdoe@example.com>
       * @version 1.0
       *
       * @section LICENSE
       *
       * This program is free software; you can redistribute it and/or
       * modify it under the terms of the GNU General Public License as
       * published by the Free Software Foundation; either version 2 of
       * the License, or (at your option)any later version.
       *
       * This program is distributed in the hope that it will be useful, but
       * WITHOUT ANY WARRANTY; without even the implied warranty of
       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
       * General Public License for more details at
       * http://www.gnu.org/copyleft/gpl.html
       *
       * @section DESCRIPTION
       *
       * The time class represents a moment of time.
       */
      
      class Time {
      
          public:
      
             /**
              * Constructor that sets the time to a given value.
              *
              * @param timemillis Number of milliseconds
              *        passed since Jan 1, 1970.
              */
             Time (int timemillis){
                 // the code
             }
      
             /**
              * Get the current time.
              *
              * @return A time object set to the current time.
              */
             static Time now () {
                 // the code
             }
      };
      

      另一种方法是首选的一些参数的记录如下。这将产生同样的文件。

             /**
              * Constructor that sets the time to a given value.
              *
              */
             Timeint timemillis ///< Number of milliseconds passed since Jan 1, 1970.
                  
      {
                 // the code
             }
      

      外部链接[编辑]