Doxygen 中 return 值的默认描述
Default description of return value in Doxygen
我正在使用我的 C++ 库并使用 Doxygen 编写一个不错的文档。假设我声明了类型:
typedef enum {
NO_ERROR, ///< Everything fine.
SOME_REALLY_BAD_ERROR, ///< Something went wrong.
VERY_INFREQUENT_ERROR ///< Used only in some cases.
} ReturnType;
并将其用作 return 值来标记函数中可能存在的错误。现在我定义一个函数:
/** Very important description
*
* @return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise.
*/
ReturnType ImportantFunction();
因此,对于每个函数定义,我都必须粘贴默认 return 值的相同描述(但有时我会 return VERY_INFREQUENT_ERROR
并编写不同的描述)。所以我的问题是:
在 Doxygen 中有没有办法创建 return 值的默认描述,或者我应该只为不常见的情况创建描述?
据我所知,您无法创建默认描述。你可以做的是使用 \copydoc 至少只写一次你的文字:
/**
* \class common_ReturnType
*
* NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise.
*/
/** Very important description
*
* @return \copydoc common_ReturnType
*/
ReturnType ImportantFunction();
/** Very important description with very infrequent result
*
* @return \copydoc common_ReturnType In very infrequent cases, VERY_INFREQUENT_ERROR.
*/
ReturnType ImportantFunctionWithInfrequentResult();
这将在您的文档中为 common_ReturnType
生成一个虚拟条目。您可以在配置文件中使用 EXCLUDE_SYMBOLS = common_*
从输出中排除它。
您可以使用 return 文档中的确切定义别名命令:
ALIASES += "return_noerr=@return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise."
然后你就可以使用那个快捷方式了:
/**
* @return_noerr
*/
我正在使用我的 C++ 库并使用 Doxygen 编写一个不错的文档。假设我声明了类型:
typedef enum {
NO_ERROR, ///< Everything fine.
SOME_REALLY_BAD_ERROR, ///< Something went wrong.
VERY_INFREQUENT_ERROR ///< Used only in some cases.
} ReturnType;
并将其用作 return 值来标记函数中可能存在的错误。现在我定义一个函数:
/** Very important description
*
* @return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise.
*/
ReturnType ImportantFunction();
因此,对于每个函数定义,我都必须粘贴默认 return 值的相同描述(但有时我会 return VERY_INFREQUENT_ERROR
并编写不同的描述)。所以我的问题是:
在 Doxygen 中有没有办法创建 return 值的默认描述,或者我应该只为不常见的情况创建描述?
据我所知,您无法创建默认描述。你可以做的是使用 \copydoc 至少只写一次你的文字:
/**
* \class common_ReturnType
*
* NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise.
*/
/** Very important description
*
* @return \copydoc common_ReturnType
*/
ReturnType ImportantFunction();
/** Very important description with very infrequent result
*
* @return \copydoc common_ReturnType In very infrequent cases, VERY_INFREQUENT_ERROR.
*/
ReturnType ImportantFunctionWithInfrequentResult();
这将在您的文档中为 common_ReturnType
生成一个虚拟条目。您可以在配置文件中使用 EXCLUDE_SYMBOLS = common_*
从输出中排除它。
您可以使用 return 文档中的确切定义别名命令:
ALIASES += "return_noerr=@return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise."
然后你就可以使用那个快捷方式了:
/**
* @return_noerr
*/