我正在使用 doxygen 来记录 C++ 代码。假设我有两个类:Base 类和派生自 Base 的类 Derived。我在 Base 和 Derived 中有一个名为 Foo 的成员组。是否可以让 doxygen 在类 Derived 的文档中显示一个名为 Foo 的单个组,而不是像我现在观察到的那样有两个同名的组?
问问题
548 次
1 回答
2
我修补了 doxygen 的结帐来做到这一点。补丁如下。我没有注意到生成的文档中有任何不良影响。该实现的缺点是它是一个 O(n^2) 算法,其中 n 是成员组的数量。在我的情况下,成员组的数量足够少,复杂性不会打扰我。
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(
该代码通过扫描成员组字典中已有的组来查找具有相同名称(即标题)的组。如果找到这样的组,则将该组用作要插入的成员的成员组。
于 2013-05-15T15:31:03.493 回答