Commit 1f22d19e authored by Dimitri van Heesch's avatar Dimitri van Heesch

Bug 704412 - doxygen don't hide private Inherited Members

parent 1f5147ee
......@@ -1521,7 +1521,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible())
{
ol.writeSummaryLink(0,ml->listTypeAsString(),lmd->title(lang),first);
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE;
}
}
......@@ -3901,6 +3901,20 @@ void ClassDef::sortMemberLists()
}
}
/** Computes for a given list type \a inListType, which are the
* the corresponding list type(s) in the base class that are to be
* added to this list.
*
* So for public inheritance, the mapping is 1-1, so outListType1=inListType
* Private members are to be hidden completely.
*
* For protected inheritance, both protected and public members of the
* base class should be joined in the protected member section.
*
* For private inheritance, both protected and public members of the
* base class should be joined in the private member section.
*/
static void convertProtectionLevel(
MemberListType inListType,
Protection inProt,
......@@ -3908,7 +3922,8 @@ static void convertProtectionLevel(
int *outListType2
)
{
// default representing Public inheritance
static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
// default representing 1-1 mapping
*outListType1=inListType;
*outListType2=-1;
if (inProt==Public)
......@@ -3953,28 +3968,22 @@ static void convertProtectionLevel(
break;
case MemberListType_proMethods:
*outListType1=MemberListType_pubMethods;
*outListType2=MemberListType_proMethods;
*outListType2=MemberListType_pubMethods;
break;
case MemberListType_proStaticMethods:
*outListType1=MemberListType_pubStaticMethods;
*outListType2=MemberListType_proStaticMethods;
*outListType2=MemberListType_pubStaticMethods;
break;
case MemberListType_proSlots:
*outListType1=MemberListType_pubSlots;
*outListType1=MemberListType_proSlots;
*outListType2=MemberListType_pubSlots;
break;
case MemberListType_proAttribs:
*outListType1=MemberListType_pubAttribs;
*outListType2=MemberListType_proAttribs;
*outListType2=MemberListType_pubAttribs;
break;
case MemberListType_proStaticAttribs:
*outListType1=MemberListType_pubStaticAttribs;
*outListType2=MemberListType_proStaticAttribs;
*outListType2=MemberListType_pubStaticAttribs;
break;
case MemberListType_proTypes:
*outListType1=MemberListType_pubTypes;
*outListType2=MemberListType_proTypes;
*outListType2=MemberListType_pubTypes;
break;
default:
break;
......@@ -4003,28 +4012,76 @@ static void convertProtectionLevel(
break;
case MemberListType_priMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubMethods;
*outListType2=MemberListType_proMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticMethods;
*outListType2=MemberListType_proStaticMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priSlots:
if (extractPrivate)
{
*outListType1=MemberListType_pubSlots;
*outListType1=MemberListType_proSlots;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubAttribs;
*outListType2=MemberListType_proAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticAttribs;
*outListType2=MemberListType_proStaticAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priTypes:
if (extractPrivate)
{
*outListType1=MemberListType_pubTypes;
*outListType2=MemberListType_proTypes;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
default:
break;
......@@ -4034,11 +4091,48 @@ static void convertProtectionLevel(
// inListType,inProt,*outListType1,*outListType2);
}
int ClassDef::countInheritedDecMembersRec(MemberListType lt,
ClassDef *inheritedFrom)
int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom,
int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses)
{
//printf("> %s::countedInheritedDecMembersRec(%d)\n",name().data(),lt);
//printf("%s: countMemberDeclarations for %d and %d\n",name().data(),lt,lt2);
int count=0;
MemberList * ml = getMemberList(lt);
MemberList * ml2 = getMemberList((MemberListType)lt2);
if (getLanguage()!=SrcLangExt_VHDL) // use specific declarations function
{
if (ml)
{
count+=ml->numDecMembers();
//printf("-> ml=%d\n",ml->numDecMembers());
}
if (ml2)
{
count+=ml2->numDecMembers();
//printf("-> ml2=%d\n",ml2->numDecMembers());
}
static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB");
if (!inlineInheritedMembers) // show inherited members as separate lists
{
QPtrDict<void> visited(17);
count+=countInheritedDecMembers(lt,inheritedFrom,invert,showAlways,visitedClasses);
}
}
//printf("-> %d\n",count);
return count;
}
int ClassDef::countInheritedDecMembers(MemberListType lt,
ClassDef *inheritedFrom,bool invert,bool showAlways,
QPtrDict<void> *visitedClasses)
{
int inhCount = 0;
int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE)>0;
bool process = count>0;
//printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n",
// name().data(),lt,process,count,invert);
if ((process^invert) || showAlways)
{
if (m_impl->inherits)
{
BaseClassListIterator it(*m_impl->inherits);
......@@ -4047,54 +4141,45 @@ int ClassDef::countInheritedDecMembersRec(MemberListType lt,
{
ClassDef *icd=ibcd->classDef;
int lt1,lt2;
// an inherited member with protection level lt
// could have come from a section with protection levels lt1 or lt2
// in the bass class (e.g. for protected inheritance, the protected
// member comes from protected and public methods in the base class)
convertProtectionLevel(lt,ibcd->prot,&lt1,&lt2);
MemberList *ml1 = icd->getMemberList((MemberListType)lt1);
MemberList *ml2 = icd->getMemberList((MemberListType)lt2);
if (ml1)
{
count+=icd->countMembersIncludingGrouped((MemberListType)lt1,inheritedFrom,TRUE);
}
if (ml2)
//printf("%s: convert %d->(%d,%d) prot=%d\n",
// icd->name().data(),lt,lt1,lt2,ibcd->prot);
if (visitedClasses->find(icd)==0)
{
count+=icd->countMembersIncludingGrouped((MemberListType)lt2,inheritedFrom,TRUE);
}
visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance
if (lt1!=-1)
{
count+=icd->countInheritedDecMembersRec((MemberListType)lt1,inheritedFrom);
inhCount+=icd->countMemberDeclarations((MemberListType)lt1,inheritedFrom,lt2,FALSE,TRUE,visitedClasses);
}
if (lt2!=-1)
{
count+=icd->countInheritedDecMembersRec((MemberListType)lt2,inheritedFrom);
}
}
}
//printf("< %s::countedInheritedDecMembersRec(%d) count=%d\n",name().data(),lt,count);
return count;
}
return inhCount;
}
int ClassDef::countInheritedDecMembers(MemberListType lt)
void ClassDef::getTitleForMemberListType(MemberListType type,
QCString &title,QCString &subtitle)
{
int count=0;
MemberList *ml = getMemberList(lt);
if (ml)
SrcLangExt lang = getLanguage();
QListIterator<LayoutDocEntry> eli(
LayoutDocManager::instance().docEntries(LayoutDocManager::Class));
LayoutDocEntry *lde;
for (eli.toFirst();(lde=eli.current());++eli)
{
count = ml->countInheritableMembers(this);
}
if (count==0) // for this class the (non-private) member list is empty
// see if we need to create a section for it under
// Additional Inherited Members
if (lde->kind()==LayoutDocEntry::MemberDecl)
{
count = countInheritedDecMembersRec(lt,this);
}
else // member list is not empty, so we will add the inherited members there
LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
if (lmd->type==type)
{
count = 0;
title = lmd->title(lang);
subtitle = lmd->subtitle(lang);
return;
}
return count;
}
}
title="";
subtitle="";
}
int ClassDef::countAdditionalInheritedMembers()
......@@ -4110,7 +4195,12 @@ int ClassDef::countAdditionalInheritedMembers()
LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
if (lmd->type!=MemberListType_friends) // friendship is not inherited
{
totalCount+=countInheritedDecMembers(lmd->type);
//MemberList *ml = getMemberList(lmd->type);
//if (ml==0 || ml->numDecMembers()==0)
//{
QPtrDict<void> visited(17);
totalCount+=countInheritedDecMembers(lmd->type,this,TRUE,FALSE,&visited);
//}
}
}
}
......@@ -4129,11 +4219,10 @@ void ClassDef::writeAdditionalInheritedMembers(OutputList &ol)
if (lde->kind()==LayoutDocEntry::MemberDecl)
{
LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde;
MemberList *ml = getMemberList(lmd->type);
if (ml==0 || ml->numDecMembers()==0)
if (lmd->type!=MemberListType_friends)
{
QPtrDict<void> visited(17);
writeInheritedMemberDeclarations(ol,lmd->type,lmd->title(getLanguage()),this,TRUE,&visited);
writeInheritedMemberDeclarations(ol,lmd->type,-1,lmd->title(getLanguage()),this,TRUE,FALSE,&visited);
}
}
}
......@@ -4164,21 +4253,22 @@ int ClassDef::countMembersIncludingGrouped(MemberListType lt,
}
}
//printf("%s:countMembersIncludingGrouped(lt=%d,%s)=%d\n",
// name().data(),lt,ml?ml->listTypeAsString().data():"<none>",count);
// name().data(),lt,ml?ml->listTypeAsString(ml->listType()).data():"<none>",count);
return count;
}
void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
MemberListType lt,const QCString &title,
ClassDef *inheritedFrom,bool invert,
MemberListType lt,int lt2,const QCString &title,
ClassDef *inheritedFrom,bool invert,bool showAlways,
QPtrDict<void> *visitedClasses)
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
bool process = countMembersIncludingGrouped(lt,inheritedFrom,FALSE)>0;
//printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d\n",
// name().data(),lt,process,invert);
if (process^invert)
int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE)>0;
bool process = count>0;
//printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n",
// name().data(),lt,process,invert,showAlways);
if ((process^invert) || showAlways)
{
if (m_impl->inherits)
{
......@@ -4187,18 +4277,26 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
for (it.toFirst();(ibcd=it.current());++it)
{
ClassDef *icd=ibcd->classDef;
int lt1,lt2;
convertProtectionLevel(lt,ibcd->prot,&lt1,&lt2);
//printf("%s:convert %d->(%d,%d)\n",icd->name().data(),lt,lt1,lt2);
int lt1,lt3;
convertProtectionLevel(lt,ibcd->prot,&lt1,&lt3);
if (lt2==-1 && lt3!=-1)
{
lt2=lt3;
}
//printf("%s:convert %d->(%d,%d) prot=%d\n",icd->name().data(),lt,lt1,lt2,ibcd->prot);
if (visitedClasses->find(icd)==0)
{
visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance
if (lt1!=-1)
{
icd->writeMemberDeclarations(ol,(MemberListType)lt1,
title,QCString(),FALSE,inheritedFrom,lt2,invert,visitedClasses);
title,QCString(),FALSE,inheritedFrom,lt2,FALSE /*invert*/,TRUE,visitedClasses);
}
}
else
{
//printf("%s: class already visited!\n",icd->name().data());
}
}
}
}
......@@ -4206,10 +4304,12 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
}
void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title,
const char *subTitle,bool showInline,ClassDef *inheritedFrom,int lt2,bool invert,QPtrDict<void> *visitedClasses)
const char *subTitle,bool showInline,ClassDef *inheritedFrom,int lt2,
bool invert,bool showAlways,QPtrDict<void> *visitedClasses)
{
//printf("%s: ClassDef::writeMemberDeclarations for %s\n",name().data(),ml->listTypeAsString().data());
//printf("%s: ClassDef::writeMemberDeclarations lt=%d lt2=%d\n",name().data(),lt,lt2);
MemberList * ml = getMemberList(lt);
MemberList * ml2 = getMemberList((MemberListType)lt2);
if (getLanguage()==SrcLangExt_VHDL) // use specific declarations function
{
if (ml)
......@@ -4219,27 +4319,31 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC
}
else
{
//printf("%s::writeMemberDeclarations(%s)\n",name().data(),title.data());
//static bool optimizeVhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL");
//printf("%s::writeMemberDeclarations(%s) ml=%p ml2=%p\n",name().data(),title.data(),ml,ml2);
QCString tt = title, st = subTitle;
if (ml)
{
ml->writeDeclarations(ol,this,0,0,0,title,subTitle,definitionType(),FALSE,showInline,inheritedFrom);
if (lt2!=-1)
{
MemberList * ml2 = getMemberList((MemberListType)lt2);
//printf(" writeDeclaration type=%d count=%d\n",lt,ml->numDecMembers());
ml->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt);
tt.resize(0);
st.resize(0);
}
if (ml2)
{
ml2->writeDeclarations(ol,this,0,0,0,0,0,definitionType(),FALSE,showInline,inheritedFrom);
}
}
//printf(" writeDeclaration type=%d count=%d\n",lt2,ml2->numDecMembers());
ml2->writeDeclarations(ol,this,0,0,0,tt,st,definitionType(),FALSE,showInline,inheritedFrom,lt);
}
static bool inlineInheritedMembers = Config_getBool("INLINE_INHERITED_MEMB");
if (!inlineInheritedMembers) // show inherited members as separate lists
{
if (lt!=-1)
{
QPtrDict<void> visited(17);
writeInheritedMemberDeclarations(ol,lt,title,
writeInheritedMemberDeclarations(ol,lt,lt2,title,
inheritedFrom ? inheritedFrom : this,
invert,visitedClasses==0 ? &visited: visitedClasses);
invert,showAlways,
visitedClasses==0 ? &visited: visitedClasses);
}
}
}
}
......
......@@ -383,9 +383,9 @@ class ClassDef : public Definition
QCString getMemberListFileName() const;
void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief);
MemberList *createMemberList(MemberListType lt);
void writeInheritedMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title,ClassDef *inheritedFrom,bool invert,QPtrDict<void> *visitedClasses);
void writeInheritedMemberDeclarations(OutputList &ol,MemberListType lt,int lt2,const QCString &title,ClassDef *inheritedFrom,bool invert,bool showAlways,QPtrDict<void> *visitedClasses);
void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title,
const char *subTitle=0,bool showInline=FALSE,ClassDef *inheritedFrom=0,int lt2=-1,bool invert=FALSE,QPtrDict<void> *visitedClasses=0);
const char *subTitle=0,bool showInline=FALSE,ClassDef *inheritedFrom=0,int lt2=-1,bool invert=FALSE,bool showAlways=FALSE,QPtrDict<void> *visitedClasses=0);
void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline=FALSE);
void writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt);
void writePlainMemberDeclaration(OutputList &ol,MemberListType lt,bool inGroup,ClassDef *inheritedFrom,const char *inheritId);
......@@ -407,11 +407,16 @@ class ClassDef : public Definition
void writeMoreLink(OutputList &ol,const QCString &anchor);
void writeDetailedDocumentationBody(OutputList &ol);
int countInheritedDecMembersRec(MemberListType lt,ClassDef *inheritedFrom);
int countInheritedDecMembers(MemberListType lt);
int countAdditionalInheritedMembers();
void writeAdditionalInheritedMembers(OutputList &ol);
void addClassAttributes(OutputList &ol);
int countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom,
int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses);
int countInheritedDecMembers(MemberListType lt,
ClassDef *inheritedFrom,bool invert,bool showAlways,
QPtrDict<void> *visitedClasses);
void getTitleForMemberListType(MemberListType type,
QCString &title,QCString &subtitle);
ClassDefImpl *m_impl;
......
......@@ -514,7 +514,7 @@ void FileDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible())
{
ol.writeSummaryLink(0,ml->listTypeAsString(),lmd->title(lang),first);
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE;
}
}
......
......@@ -913,7 +913,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible())
{
ol.writeSummaryLink(0,ml->listTypeAsString(),lmd->title(lang),first);
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE;
}
}
......
......@@ -329,6 +329,7 @@ void MemberList::writePlainDeclarations(OutputList &ol,
if ((inheritedFrom==0 || !md->isReimplementedBy(inheritedFrom)) &&
md->isBriefSectionVisible())
{
//printf(">>> rendering\n");
switch(md->memberType())
{
case MemberType_Define: // fall through
......@@ -493,7 +494,7 @@ void MemberList::writeDeclarations(OutputList &ol,
ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
const char *title,const char *subtitle,
const DefinitionIntf::DefType compoundType,bool showEnumValues,
bool showInline,ClassDef *inheritedFrom)
bool showInline,ClassDef *inheritedFrom,MemberListType lt)
{
(void)showEnumValues; // unused
......@@ -507,8 +508,8 @@ void MemberList::writeDeclarations(OutputList &ol,
if (ctx==0 && gd) ctx = gd;
if (ctx==0 && fd) ctx = fd;
//printf("%p: MemberList::writeDeclaration(title=`%s',subtitle=`%s')=%d\n",
// this,title,subtitle,numDecMembers());
//printf("%p: MemberList::writeDeclaration(title=`%s',subtitle=`%s')=%d inheritedFrom=%p\n",
// this,title,subtitle,numDecMembers(),inheritedFrom);
int num = numDecMembers();
if (inheritedFrom)
......@@ -519,7 +520,7 @@ void MemberList::writeDeclarations(OutputList &ol,
{
ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html);
inheritId = substitute(listTypeAsString(),"-","_")+"_"+
inheritId = substitute(listTypeAsString(lt),"-","_")+"_"+
stripPath(cd->getOutputFileBase());
if (title)
{
......@@ -540,7 +541,7 @@ void MemberList::writeDeclarations(OutputList &ol,
}
else
{
ol.startMemberHeader(listTypeAsString());
ol.startMemberHeader(listTypeAsString(m_listType));
}
ol.parseText(title);
if (showInline)
......@@ -872,9 +873,14 @@ void MemberList::unmarshal(StorageIntf *s)
}
}
QCString MemberList::listTypeAsString() const
void MemberList::setNeedsSorting(bool b)
{
m_needsSorting = b;
}
QCString MemberList::listTypeAsString(MemberListType type) const
{
switch(m_listType)
switch(type)
{
case MemberListType_pubMethods: return "pub-methods";
case MemberListType_proMethods: return "pro-methods";
......@@ -928,10 +934,6 @@ QCString MemberList::listTypeAsString() const
return "";
}
void MemberList::setNeedsSorting(bool b)
{
m_needsSorting = b;
}
//--------------------------------------------------------------------------
......
......@@ -36,7 +36,7 @@ class MemberList : public QList<MemberDef>
MemberList(MemberListType lt);
~MemberList();
MemberListType listType() const { return m_listType; }
QCString listTypeAsString() const;
QCString listTypeAsString(MemberListType type) const;
bool insert(uint index,const MemberDef *md);
void inSort(const MemberDef *md);
void append(const MemberDef *md);
......@@ -63,7 +63,7 @@ class MemberList : public QList<MemberDef>
ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd,
const char *title,const char *subtitle,const DefinitionIntf::DefType compoundType,
bool showEnumValues=FALSE,bool showInline=FALSE,
ClassDef *inheritedFrom=0);
ClassDef *inheritedFrom=0,MemberListType lt=MemberListType_pubMethods);
void writeDocumentation(OutputList &ol,const char *scopeName,
Definition *container,const char *title,bool showEnumValues=FALSE,bool showInline=FALSE);
void writeSimpleDocumentation(OutputList &ol,Definition *container);
......
......@@ -429,7 +429,7 @@ void NamespaceDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible())
{
ol.writeSummaryLink(0,ml->listTypeAsString(),lmd->title(lang),first);
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment