生成“用户”和“开发商”使用 Doxygen 来自同一代码库的文档
我是 Doxygen 的新手,我正在尝试记录我计划开源的 API。我真的很想构建两套文档,一套供 API 的最终用户使用,一套供打算修改它的用户使用。有没有一种方法可以标记 Doxygen 注释块,以便我可以生成“用户”和“开发”文档树?对于我的问题有更好的解决方案吗?谢谢!
I'm new to Doxygen and I'm trying to document an API I am planning to open source. I'd really like to build two sets of documentation, one for end users of the API and one for those who intend to modify it. Is there a way to tag Doxygen comment blocks in a way such that I can generate "user" and "dev" documentation trees? Is there a better solution to my problem? Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据代码的结构,您可能可以使用两个 Doxygen 配置文件,每个文件都包含单独的源文件。 “user”配置文件只会列出包含 API 公共接口的源文件,而“dev”配置文件将列出整个项目的所有源文件。
这确实意味着所有接口(例如抽象基类)都需要在记录时考虑到用户,但这通常不是问题,因为根据定义,抽象基类中不太可能有任何实现细节。
然后,所有“开发”文档都位于实现接口的实际类中,API 永远不会看到这些文档,并且可以被“用户”Doxygen 配置文件安全地省略。
当然,如果你的代码不是这样构造的,它就不会工作,所以我能想到的唯一解决方案是用一堆 条件语句。
Depending on how your code is structured, you might be able to get away with using two Doxygen config files each including separate source files. The "user" config file would only list the source files containing the public interface to the API, while the "dev" config file would list all source files for the whole project.
This does mean that all your interfaces (e.g. abstract base classes) will need to be documented with the user in mind, but that is usually not a problem as by definition there is unlikely to be any implementation details in an abstract base class.
All your "dev" documentation then sits in the actual classes implementing the interfaces, which are never seen by the API and can be safely omitted by the "user" Doxygen config file.
Of course if your code isn't structured this way it's not going to work, so the only solution I can think of is to fill your comments with a bunch of conditional statements.
除了 Malvineous 已经说过的之外,还有
\internal
doxygen 命令。\internal
允许您通过更改 Doxyfile 中的INTERNAL_DOCS
来隐藏或显示部分文档更多信息:http://www.doxygen.nl/manual/commands.html#cmdinternal
In addition to what Malvineous already said, there is the
\internal
doxygen command.\internal
lets you hide or show part of the documentation by changingINTERNAL_DOCS
in the DoxyfileMore information here: http://www.doxygen.nl/manual/commands.html#cmdinternal