How to link to class methods in doxygen html
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, 开发者_Go百科basically, the questions is:
- Does anyone know how to tune doxygen to generate readable anchors
- if not, how do I calculate the hash?
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.
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:
memAnchor=const int SomeNamespace::GetStateGetState(SomeNamespace::State *state) sigStr=f2c41a8a6a152602c92fefb80bd0862a
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:
.. _GetState: `project0class_SomeNamespace_1f2c41a8a6a152602c92fefb80bd0862a`_
Not sure on the first question about readable anchors.
精彩评论