簡體   English   中英

Doxygen中返回值的默認描述

[英]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;

並將其用作返回值以標記函數中的可能錯誤。 現在我定義一個函數:

/** Very important description
 *
 * @return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise.
 */
ReturnType ImportantFunction();

因此,對於每個函數定義,我必須粘貼相同的默認返回值的描述(但有時我將返回VERY_INFREQUENT_ERROR並寫入不同的描述)。 所以我的問題是:

在Doxygen中是否有一種方法可以創建返回值的默認描述,或者我是否應該為不常見的情況創建描述?

AFAIK您無法創建默認描述。 你可以做的是使用\\ 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_*將其從輸出中排除。

您可以使用確切的返回文檔定義別名命令:

ALIASES += "return_noerr=@return NO_ERROR on proper exit, SOME_REALLY_BAD_ERROR otherwise."

然后你可以使用那個快捷方式:

/**
 * @return_noerr
 */

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM