我有一个功能的以下Doxygen文档:
/**
@brief Does interesting things
@param[in] pfirst The first parameter: a barrel full of monkeys
@pre
"pfirst" must have been previously passed through BarrelFiller()
*/
Run Code Online (Sandbox Code Playgroud)
请注意,这pfirst是一个参数,并在前提条件中引用它.
我在这里用引号包围它,因为我想从文本的其余部分中脱颖而出.但是这样做会很好,Doxygen会强调命令,最好将它链接到参数定义.有没有办法做到这一点?
如果只使用默认配置(或其微小的改动)就会发生这种情况会特别好.
DRH*_*DRH 63
Doxygen提供\p指示下一个字是函数参数的命令.你会像这样使用它:
... the \p x and \p y coordinates are used to ...
Run Code Online (Sandbox Code Playgroud)
我相信默认情况下会使用打字机字体来表示.我不认为这目前提供任何自动链接功能,但可能在未来.
有一个相关的命令,\a用于标记成员参数.默认情况下,它在文本中强调显示(<em>arg</em>)
您可以找到有关各种Doxygen 特殊命令参考的更多信息.
我知道你问的是@parameters,但谷歌搜索也在这里搜索@return类型,所以这里是答案:
#在返回值前使用Doxygen来创建指向其定义的超链接:使用#符号。
完整示例(请参阅@return下面的类型#,每个类型前面都有一个):
#include <stdarg.h> // for va_list, va_start, va_end
#include <stdio.h> // for vsnprintf
// Function prototype:
int debug_printf(const char *format, ...) __attribute__((format(printf, 1, 2)));
// Function definition:
/// @brief Function to print out data through serial UART for debugging.
/// @details Feel free to add more details here,
/// perhaps
/// even
/// a
/// whole
/// paragraph.
/// @note Optionally add a note too.
/// @param[in] format `printf`-like format string
/// @param[in] ... `printf`-like variadic list of arguments corresponding to the format string
/// @return Number of characters printed if OK, or < 0 if error:
/// - #DEBUG_ERR_ENCODING
/// - #DEBUG_ERR_OVERFLOW
/// - #DEBUG_ERR_UART
int debug_printf(const char *format, ...)
{
int num_chars_printed;
va_list args;
va_start(args, format);
// Use `vsnprintf()` now here to format everything into a single string buffer, then send
// out over the UART
// - num_chars_printed could be set to one of the error codes listed above here
va_end(args);
return num_chars_printed;
}
Run Code Online (Sandbox Code Playgroud)
Doxygen 输出现在将错误返回类型显示为行下的子项目符号列表Number of characters printed if OK, or < 0 if error:,并且由于#前面的字符,每个错误类型都转换为各自定义的 URL。
\brief或@brief,\note或者@note,\details或者@details,\example等)。param值是param[in],param[in,out]和param[out]。有关更多详细信息和官方文档,请参阅这些参考资料:
param特殊命令的官方 Doxygen 文档:http : //www.doxygen.nl/manual/commands.html#cmdparamprintf包装器实现:https : //github.com/adafruit/ArduinoCore-samd/blob/master/cores/arduino/Print.cpp#L189(复制自我的 eRCaGuy_dotfiles 项目在这里)
完整的 Doxygen 函数头示例:
/// \brief A brief one or two line description of the function.
/// \note An important note the user should be aware of--perhaps many lines.
/// \details Extra details.
/// Perhaps
/// even
/// a long
/// paragraph.
/// \param[in] var1 Description of variable one, an input
/// \param[in] var2 Description of variable two, an input
/// \param[out] var3 Description of variable three, an output (usu. via a pointer
/// to a variable)
/// \param[in,out] var4 Description of variable four, an input/output (usu. via a
/// pointer) since its initial value is read and used, but then
/// it is also updated by the function at some point
/// \return Description of return types. It may be an enum, with these
/// possible values:
/// - #ENUM_VALUE_1
/// - #ENUM_VALUE_2
/// - #ENUM_VALUE_3
my_enum_t myFunc(int var1, int var2, int* var3, int* var4)
{
// function implementation here
my_enum_t error = ENUM_VALUE_1;
// Check for NULL pointers
if (!var3 || !var4)
{
// var3 or var4 are NULL pointers, which means they can't be dereferenced
error = ENUM_VALUE_2;
goto done;
}
if (something_else)
{
error = ENUM_VALUE_3;
goto done;
}
done:
return error;
}
Run Code Online (Sandbox Code Playgroud)
您也可以使用@代替\:
/// @brief A brief one or two line description of the function.
/// @param[in] var1 Description of variable one, an input
/// @param[in] var2 Description of variable two, an input
/// @param[out] var3 Description of variable three, an output (usu. via a pointer
/// to a variable)
/// @param[in,out] var4 Description of variable four, an input/output (usu. via a
/// pointer) since its initial value is read and used, but then
/// it is also updated by the function at some point
/// @return None
void myFunc(int var1, int var2, int* var3, int* var4)
{
// function implementation here
}
Run Code Online (Sandbox Code Playgroud)
现在\又是这个较短的版本,而不是@:
/// \brief A brief one or two line description of the function.
/// \param[in] var1 Description of variable one, an input
/// \param[in] var2 Description of variable two, an input
/// \param[out] var3 Description of variable three, an output (usu. via a pointer
/// to a variable)
/// \param[in,out] var4 Description of variable four, an input/output (usu. via a
/// pointer) since its initial value is read and used, but then
/// it is also updated by the function at some point
/// \return None
void myFunc(int var1, int var2, int* var3, int* var4)
{
// function implementation here
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
24431 次 |
| 最近记录: |