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
             }
      

      外部連結[編輯]