Javadoc:只有一个注释用于多个全局变量声明

时间:2014-07-18 15:50:39

标签: c++ javadoc doxygen

我正在记录使用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标志生成文档。我不想在不同的文件中分隔它们,也不想为每个常量写一个doc注释。

这可能吗?如果是,怎么样?

1 个答案:

答案 0 :(得分:4)

您可以将它们封装在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*/
相关问题