简体   繁体   English

C++ 函数的自定义 Doxygen 永久链接

[英]Custom Doxygen permalinks to c++ functions

We use Doxygen for documenting our C++ code and we include the Doxygen results in our Sphinx HTML documentation using the Breathe plugin.我们使用 Doxygen 来记录我们的 C++ 代码,并使用 Breathe 插件将 Doxygen 结果包含在我们的 Sphinx HTML 文档中。 We want to jump directly to functions within the HTML documentation using named anchors in a HTML link like this:我们想使用 HTML 链接中的命名锚直接跳转到 HTML 文档中的函数,如下所示:

http://path/MyClassDocumentation.html#myFunction(params)

The idea is to automatically jump to functions using their signature which we can retrieve dynamically at run time.这个想法是使用它们的签名自动跳转到我们可以在运行时动态检索的函数。 How can we create these named anchors in our C++ Doxygen comments?我们如何在 C++ Doxygen 注释中创建这些命名锚点? Breathe creates HTML elements which address the functions using their signature and a md5 sum. Breathe 创建 HTML 元素,这些元素使用它们的签名和 md5 总和来处理函数。 Example:示例:

<span id="my_class_my_function_1a21be2544e55395e0218006fca87a2a82"></span>

This is not helpful, because we cannot jump to these ids at run time using the signature of the function.这没有帮助,因为我们无法在运行时使用函数签名跳转到这些 id。 Therefore we want to add our own named anchors which should look like this:因此,我们要添加我们自己的命名锚点,它应该如下所示:

MyClass::MyFunc(paramList)

I tried using "\\anchor" in our comments, but it seems they are ignored.我尝试在我们的评论中使用 "\\anchor",但似乎它们被忽略了。 Is there a way to get named anchors which we can define within our C++ code comments?有没有办法获得我们可以在 C++ 代码注释中定义的命名锚点? Or is there another way for achieving this?还是有另一种方法可以实现这一目标?

EDIT: I think what we need is something to define custom html permalinks addressing the functions in our C++ code from within the Doxygen comments.编辑:我认为我们需要的是定义自定义 html 永久链接,以从 Doxygen 注释中解决我们的 C++ 代码中的函数。

I have a similar problem, wanting to link to doxygen documentation for C from a docbook document.我有一个类似的问题,想从 docbook 文档链接到 C 的 doxygen 文档。

The solution is to generate a tagfile from doxygen using the GENERATE_TAGFILE configuration parameter.解决方案是使用 GENERATE_TAGFILE 配置参数从 doxygen 生成标记文件。

I then parse the tagfile using some custom scripts to extract the anchor value for each function.然后我使用一些自定义脚本解析标记文件以提取每个函数的锚值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM