问题
I am using doxygen to document C++ code. Let's say I have two classes: class Base and class Derived derived from Base. I have a member group with named Foo in both Base and Derived. Is it possible to make doxygen to show a single group named Foo in documentation for class Derived instead of having two identically named groups as I observe now?
回答1:
I patched a checkout of doxygen to do this. The patch is below. I haven't noticed any ill effects in the generated documentation. The downside of the implementation is that it is an O(n^2) algorithm where n is the number of member groups. In my case the number of member groups is small enough that the complexity doesn't bother me.
Index: src/util.cpp
===================================================================
--- src/util.cpp (revision 848)
+++ src/util.cpp (working copy)
@@ -5759,6 +5759,24 @@
(*ppMemberGroupSDict)->setAutoDelete(TRUE);
}
MemberGroup *mg = (*ppMemberGroupSDict)->find(groupId);
+
+ uint ngrps = (*ppMemberGroupSDict)->count();
+ const char * ghs = info->header;
+ int gid = groupId;
+ for (uint i=0; i != ngrps; ++i)
+ {
+ MemberGroup *tg = (*ppMemberGroupSDict)->at(i);
+ MemberListIterator oli(*(tg->members()));
+ MemberDef *omd = oli.current();
+ const char * ohs = Doxygen::memGrpInfoDict[omd->getMemberGroupId()]->header;
+ int oid = tg->groupId();
+ if ( ghs && ohs && strcmp(ghs, ohs) == 0)
+ {
+ mg = tg;
+ break;
+ }
+ }
+
if (mg==0)
{
mg = new MemberGroup(
The code works by scanning the groups already in the member group dictionary for a group that has the same name (i.e., header). If such a group is found then that group is used as the member group for the member being inserted.
来源:https://stackoverflow.com/questions/11526679/is-it-possible-to-make-doxygen-to-merge-member-groups