如何链接到 doxygen html 中的类方法
我有一个设置,我使用 doxygen 来描述一组单元测试(我使用 QtTest 来运行测试)。测试的输出由一个小的 Python 代码片段进行解析,生成一个漂亮而整洁的报告。现在,我希望将报告链接到 doxygen 材料中的每个测试用例,即私有槽成员方法。然而,doxygen 定义的锚点看起来像这样:
<a class="anchor" id="a2a0e066d4dad8e0dff6c9231bf65fd65"></a>
<!-- doxytag: member="PRadioTunerTst::scanFM" ref="a2a0e066d4dad8e0dff6c9231bf65fd65" args="()" -->
当然,我可以解析 doxygen html 并将所有方法与引用键相匹配,但我更愿意有可读的链接。我不会重载任何单元测试用例方法,因此枚举它们不会成为问题 - 我只需能够选择第一个也是唯一的。我什至很乐意自己计算 id 哈希值。我只需要知道怎么做。
所以,基本上,问题是:
- 有谁知道如何调整 doxygen 要生成可读的锚点
- ,如果没有,我如何计算哈希值?
I've got a setup where I use doxygen to describe a set on unit tests (I use QtTest to run the tests). The output from the tests are parsed by a little Python snippet that produces a nice and tidy report. Now, I'd love to link from the report to each test case, i.e. private slot member method, in the doxygen material. However, the anchors defined by doxygen looks like this:
<a class="anchor" id="a2a0e066d4dad8e0dff6c9231bf65fd65"></a>
<!-- doxytag: member="PRadioTunerTst::scanFM" ref="a2a0e066d4dad8e0dff6c9231bf65fd65" args="()" -->
Sure, I could parse the doxygen html and match all method to the reference key, but I'd much rather have readable links. I do not overload any unit test case methods, so having them enumerated would not be an issue - I'd simply be able to pick the first and only. I'd even be happy to calculate the id hash myself. I just need to know how to.
So, basically, the questions is:
- Does anyone know how to tune doxygen
to generate readable anchors - if not, how do I calculate the hash?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不要尝试重建哈希值(这是 doxygen 解析的方法定义的 md5 校验和,请参阅代码中的 MemberDef::setAnchor() )。我建议让 doxygen 生成一个标记文件(GENERATE_TAGFILE),然后解析它。标记文件是一个简单的 XML 文件,其中包含每个成员的名称和锚点。
Instead of trying to reconstruct the hash (which is a md5 checksum over the method's definition as parsed by doxygen, see MemberDef::setAnchor() in the code). I would suggest to let doxygen generate a tag file (GENERATE_TAGFILE) and then parse that. The tag file is a simple XML file which has both the name and the anchor for each member.
我还需要链接目标,在我的例子中,第一个文档指向 Breath/doxygen 创建的 html。这就是我所做的:
为了更好地理解 doxygen 如何创建锚点,我重新编译了 doxygen,并将其放在 setAnchor() 的末尾:
printf("memAnchor=%s sigStr=%s\n", memAnchor.data() , sigStr.data());
,它创建的输出如下:
我已经有了我的函数签名,所以我创建了类似于上面的 memAnchor 的字符串和通过 md5sum 进行管道传输以获取哈希值,然后将其附加到所有锚点通用的字符串中。在我的第一个文档中,我给出了这样的定义:
不确定关于可读锚点的第一个问题。
I also needed link targets, in my case for rst docs to point at breathe/doxygen-created html. Here's what I did:
To better understand how doxygen creates anchors, I recompiled doxygen, with this at the end of setAnchor():
printf("memAnchor=%s sigStr=%s\n", memAnchor.data(), sigStr.data());
, which creates output like:
I already had my function signatures, so I created strings similar to memAnchor above and piped it through md5sum to get the hash, then appended it to the string which is common to all anchors. In my rst doc, I then put definitions like:
Not sure on the first question about readable anchors.