is it possible to make doxygen to merge member groups

爱⌒轻易说出口 提交于 2019-12-22 18:22:10

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!