如何在 Doxygen 代码示例中插入多行注释
我试图在 Doxygen 文档中包含一个包含多行注释的代码示例。问题是 C++ 预处理器将 */
解释为我的 Doxygen 注释的结尾,因此文件的语法被破坏。
例如:
/*! \brief My Doxygen comment.
*
* \code
* myFunction() /* Some multi-line comment */
* \endcode
*/
我已经尝试过适用于 JavaDoc 注释的建议:使用 HTML 实体对斜杠进行编码,如下所示:
* \code
* myFunction() /* Some multi-line comment */
* \endcode
但这不起作用(我猜是因为 Doxygen 不会替换代码部分中的 HTML 实体)。
所以问题是:是否可以在代码示例中包含多行注释以及如何做到?
I am trying to include a code example which contains a multi-line comment in Doxygen documentation. The problem is that the C++ preprocessor interprets the */
as the end of my Doxygen comment and therefore the syntax of the file is broken.
For example:
/*! \brief My Doxygen comment.
*
* \code
* myFunction() /* Some multi-line comment */
* \endcode
*/
I already tried the suggestion which works for JavaDoc comments: encode the slash using HTML entities like this:
* \code
* myFunction() /* Some multi-line comment */
* \endcode
but this doesn't work (I guess because Doxygen does not replace HTML entities within code sections).
So the question is: is it possible to include multi-line comments in code example and how can it be done?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用不同的评论风格。
而不是您拥有的内容,请使用:
///
与/*!
相同,并标记 doxygen 部分。预处理器会将每一行视为单行注释。Use different comment styles.
Instead of what you have, use:
The
///
is the same as/*!
and marks a doxygen portion. The pre-processor will treat each line as a single line comment.