Adding 'reference tables' to Doxygen

604 Views Asked by At

In my C++ application I have about 10 different classes that define certain 'behaviors' (let's call them A, B, C, ...). Other places (methods) in the code might use these behaviors in any combination. E.g. method M1 uses behaviors A and B, method M2 uses behaviors A, C and D, ...

In practice the code is similar like this:

BehaviorCollection coll;
BehaviorA ba;
coll.push_back(&ba);
BehaviorB bb;
coll.push_back(&bb);
someComplexFunctionality (coll);

I want to generate a clear overview of which method uses a behavior, preferably in the documentation of the specific behavior, so that the class documentation of every behavior contains a list like:

BehaviorA is used by the following methods:
- method1
- method3
- method7

I could hard-code this list but after a while it will become outdated because new methods are added, methods starts to use additional behaviors, or methods stop using behaviors. So, to make this maintainable, I prefer to have something in the method using the behaviors, telling Doxygen "this code is using these behaviors, so add something in the documentation of that behavior".

Tools like "Visual AssistX" or "Understand for C/C++" allow me to perform the lookup but they still require some manual actions every time you want to do the lookup. Therefore I want to automate this in my documentation generation system.

I am considering using defgroup and ingroup, but I'm not sure this will work for code fragments. What is the best approach to use?

1

There are 1 best solutions below

0
On BEST ANSWER

I found a solution by using the xrefitem tag.

In every method using a behavior I added a line like this:

//! \xrefitem group_behaviorA_users "Behavior A users" "Behavior A Users"

And then the behavior itself contains a documentation line like this:

See \ref group_behaviorA_users for an overview of all users of this behavior.

Problem solved.