我终于放弃了微软的 XML 文档格式强加给我的尖括号税(还有什么意义,因为 MSVC 环境仍然没有对 C++ 项目做任何花哨的事情)并将我当前的项目切换到使用 Doxygen Javadoc 风格的语法。
太棒了。内联文档更易于阅读和输入,生成的输出也更加有用和通用。特别是,我MULTILINE_CPP_IS_BRIEF
打开了该选项,它允许我根据需要编写尽可能长的“简要”描述,然后使用空行将我的“详细信息”文档分成段落。换句话说:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
void ScrollRegion(int dx, int dy);
这为我提供了我想要的输出,同时减少了我必须使用的嘈杂元命令的@brief
数量\details
。
当我尝试在“备注”部分中包含第二段时,问题就出现了,就像我(隐含地)为“详细信息”部分所做的那样。例如:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
///
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
生成的输出不会将该部分中的第二段解释@remarks
为备注的一部分。我可以判断,因为它在 HTML 输出中没有缩进到同一级别,并且它不在<simplesect kind="remark">
XML 输出中的标记下。
我尝试在第二段的开头添加一个@par
命令,但这也没有达到我想要的效果。新段落仍然不是“备注”部分的子项。在 XML 输出中,它被放置在一个新<simplesect kind="para">
标签内,该标签是原始<simplesect kind="remark">
标签的兄弟。
在研究这个时,我看到其他人复制了这个@remarks
命令:
/// Changes the active viewing area of the currently selected region.
///
/// The modification is merely enqueued. This function has no effect until the
/// FlushRegion() function is called.
///
/// Newly-exposed regions will not be repainted automatically. The user must also
/// call the UpdateRegion() function on these regions to cause their contents to
/// be redrawn.
///
/// @param dx The amount, in pixels, to shift the visible region horizontally.
/// @param dy The amount, in pixels, to shift the visible region vertically.
///
/// @remarks
/// Note that this function is reentrant, but not thread-safe!
/// @remarks
/// If thread safety is required, the user must handle locking and unlocking
/// the region manually.
void ScrollRegion(int dx, int dy);
这确实产生了我想要的输出。这两个段落都嵌套在XML 输出中的<para>
标记下的<simplesect kind="remark">
标记中,并且在 HTML 输出中视觉关系是正确的。但这很丑陋,对我来说似乎是个错误。
有没有我想念的标准方法来做到这一点?当然,我不是第一个想要在我的文档的“备注”部分中包含多个段落的人……而且这不仅限于@remarks
; 例如,同样的事情也会发生@internal
。
我安装了最新版本的 Doxygen(1.8.2),但我非常怀疑这是特定于版本的。