【问题标题】:Javadoc: Just one comment for multiple global variable declarationsJavadoc:多个全局变量声明只需一条注释
【发布时间】:2014-09-09 20:04:07
【问题描述】:

我正在记录我使用 Doxygen 用 C++ 编写的源代码。我有一个只包含常量定义的文件,例如:

// Flags for A
const int A = 0;
const int A1 = 1;
const int A2 = 2;
// Flags for B
const int B = 0;
const int B1 = 1;
const int B2 = 2;

我想要的是javadoc 语法来分别为A 标志和B 标志生成文档。我不想将它们分隔在不同的文件中,也不想为每个常量写一个文档注释。

这可能吗?如果是,如何?

【问题讨论】:

    标签: c++ javadoc doxygen


    【解决方案1】:

    您可以将它们包含在 Doxygen 组中:

    /*!
     * \addtogroup A_Flags
     * @{
     */
     const int A = 0; //!< Bit zero;
     const int A1 = 1; //!< Bit position 1;
     const int A2 = 2; //!< Bit position 2;
    /*! @} End of group A_Flags */
    
    
    /*!
     * \addtogroup B_Flags
     * @{
     */
     const int B = 0; //!< Bit zero;
     const int B1 = 1; //!< Bit position 1;
     const int B2 = 2; //!< Bit position 2;
    /*! @} End of group B_Flags */
    

    我对我们的 FPGA 寄存器做了类似的事情,详细说明了位值。

    /*!
     *  @addtogroup FPGA_CLEAR_WATCHDOG_FAULT_MAP
     *  @{
     *  \image html FPGA_Clear_Watchdog_Fault_Register.JPG "Clear Watchdog Fault Register"
     */
    
    /*! Clear Watchdog Fault flag.\n
     *  <code>
     *  binary: 0000 0000 0000 0001\n
     *  hex:      0    0    0    1\n
     *  </code>
     */
    #define FPGA_CLEAR_WATCHDOG_FAULT           (0x0001U)
    
    /*! Inform FPGA of shutdown
     *  <code>
     *  binary: 0000 0000 0000 0010\n
     *  hex:      0    0    0    2\n
     *  </code>
     */
    #define FPGA_INFORM_SHUTDOWN                (0x0002U)
    
    /*! @} End of Doxygen group FPGA_CLEAR_WATCHDOG_FAULT_MAP*/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-22
      • 1970-01-01
      • 1970-01-01
      • 2019-02-13
      • 2015-12-14
      • 1970-01-01
      相关资源
      最近更新 更多