diff options
Diffstat (limited to 'src')
44 files changed, 3196 insertions, 2308 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 621b98c..5ea8cea 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -45,15 +45,235 @@ #include "filedef.h" #include "namespacedef.h" #include "membergroup.h" +#include "definitionimpl.h" //----------------------------------------------------------------------------- -/** Private data associated with a ClassDef object. */ -class ClassDefImpl + +/** Implementation of the ClassDef interface */ +class ClassDefImpl : public DefinitionImpl, public ClassDef { public: - ClassDefImpl(); + ClassDefImpl(const char *fileName,int startLine,int startColumn, + const char *name,CompoundType ct, + const char *ref=0,const char *fName=0, + bool isSymbol=TRUE,bool isJavaEnum=FALSE); + /** Destroys a compound definition. */ ~ClassDefImpl(); + + virtual DefType definitionType() const { return TypeClass; } + virtual QCString getOutputFileBase() const; + virtual QCString getInstanceOutputFileBase() const; + virtual QCString getSourceFileBase() const; + virtual QCString getReference() const; + virtual bool isReference() const; + virtual bool isLocal() const; + virtual ClassSDict *getClassSDict() const; + virtual bool hasDocumentation() const; + virtual bool hasDetailedDescription() const; + virtual QCString collaborationGraphFileName() const; + virtual QCString inheritanceGraphFileName() const; + virtual QCString displayName(bool includeScope=TRUE) const; + virtual CompoundType compoundType() const; + virtual QCString compoundTypeString() const; + virtual BaseClassList *baseClasses() const; + virtual BaseClassList *subClasses() const; + virtual MemberNameInfoSDict *memberNameInfoSDict() const; + virtual Protection protection() const; + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual bool isVisibleInHierarchy() const; + virtual bool visibleInParentsDeclList() const; + virtual ArgumentList *templateArguments() const; + virtual NamespaceDef *getNamespaceDef() const; + virtual FileDef *getFileDef() const; + virtual MemberDef *getMemberByName(const QCString &) const; + virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const; + virtual bool isSubClass(ClassDef *bcd,int level=0) const; + virtual bool isAccessibleMember(const MemberDef *md) const; + virtual QDict<ClassDef> *getTemplateInstances() const; + virtual ClassDef *templateMaster() const; + virtual bool isTemplate() const; + virtual IncludeInfo *includeInfo() const; + virtual UsesClassDict *usedImplementationClasses() const; + virtual UsesClassDict *usedByImplementationClasses() const; + virtual UsesClassDict *usedInterfaceClasses() const; + virtual ConstraintClassDict *templateTypeConstraints() const; + virtual bool isTemplateArgument() const; + virtual Definition *findInnerCompound(const char *name) const; + virtual void getTemplateParameterLists(QList<ArgumentList> &lists) const; + virtual QCString qualifiedNameWithTemplateParameters( + QList<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; + virtual bool isAbstract() const; + virtual bool isObjectiveC() const; + virtual bool isFortran() const; + virtual bool isCSharp() const; + virtual bool isFinal() const; + virtual bool isSealed() const; + virtual bool isPublished() const; + virtual bool isExtension() const; + virtual bool isForwardDeclared() const; + virtual bool isInterface() const; + virtual ClassDef *categoryOf() const; + virtual QCString className() const; + virtual MemberList *getMemberList(MemberListType lt) const; + virtual const QList<MemberList> &getMemberLists() const; + virtual MemberGroupSDict *getMemberGroupSDict() const; + virtual QDict<int> *getTemplateBaseClassNames() const; + virtual ClassDef *getVariableInstance(const char *templSpec); + virtual bool isUsedOnly() const; + virtual QCString anchor() const; + virtual bool isEmbeddedInOuterScope() const; + virtual bool isSimple() const; + virtual const ClassList *taggedInnerClasses() const; + virtual ClassDef *tagLessReference() const; + virtual MemberDef *isSmartPointer() const; + virtual bool isJavaEnum() const; + virtual bool isGeneric() const; + virtual bool isAnonymous() const; + virtual const ClassSDict *innerClasses() const; + virtual QCString title() const; + virtual QCString generatedFromFiles() const; + virtual const FileList &usedFiles() const; + virtual const ArgumentList *typeConstraints() const; + virtual const ExampleSDict *exampleList() const; + virtual bool hasExamples() const; + virtual QCString getMemberListFileName() const; + virtual bool subGrouping() const; + virtual bool isSliceLocal() const; + virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0); + virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0); + virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); + virtual void insertMember(MemberDef *); + virtual void insertUsedFile(FileDef *); + virtual bool addExample(const char *anchor,const char *name, const char *file); + virtual void mergeCategory(ClassDef *category); + virtual void setNamespace(NamespaceDef *nd); + virtual void setFileDef(FileDef *fd); + virtual void setSubGrouping(bool enabled); + virtual void setProtection(Protection p); + virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs); + virtual void addInnerCompound(Definition *d); + virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, + const QCString &templSpec,bool &freshInstance); + virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot); + virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot); + virtual void setIsStatic(bool b); + virtual void setCompoundType(CompoundType t); + virtual void setClassName(const char *name); + virtual void setClassSpecifier(uint64 spec); + virtual void setTemplateArguments(ArgumentList *al); + virtual void setTemplateBaseClassNames(QDict<int> *templateNames); + virtual void setTemplateMaster(ClassDef *tm); + virtual void setTypeConstraints(ArgumentList *al); + virtual void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec); + virtual void makeTemplateArgument(bool b=TRUE); + virtual void setCategoryOf(ClassDef *cd); + virtual void setUsedOnly(bool b); + virtual void addTaggedInnerClass(ClassDef *cd); + virtual void setTagLessReference(ClassDef *cd); + virtual void setName(const char *name); + virtual void setMetaData(const char *md); + virtual void findSectionsInDocumentation(); + virtual void addMembersToMemberGroup(); + virtual void addListReferences(); + virtual void addTypeConstraints(); + virtual void computeAnchors(); + virtual void mergeMembers(); + virtual void sortMemberLists(); + virtual void distributeMemberGroupDocumentation(); + virtual void writeDocumentation(OutputList &ol); + virtual void writeDocumentationForInnerClasses(OutputList &ol); + virtual void writeMemberPages(OutputList &ol); + virtual void writeMemberList(OutputList &ol); + virtual void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, + ClassDef *inheritedFrom,const char *inheritId); + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const; + virtual void writeSummaryLinks(OutputList &ol); + virtual void reclassifyMember(MemberDef *md,MemberType t); + virtual void writeInlineDocumentation(OutputList &ol); + virtual void writeDeclarationLink(OutputList &ol,bool &found, + const char *header,bool localNames); + virtual void removeMemberFromLists(MemberDef *md); + virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, + ClassDef *inheritedFrom,const QCString &inheritId); + virtual int countMembersIncludingGrouped(MemberListType lt,ClassDef *inheritedFrom,bool additional); + virtual int countInheritanceNodes(); + virtual void writeTagFile(FTextStream &); + + virtual void setVisited(bool visited) { m_visited = visited; } + virtual bool isVisited() const { return m_visited; } + virtual bool hasNonReferenceSuperClass() const; + virtual int countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, + int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses); + virtual 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,bool showAlways=FALSE, + QPtrDict<void> *visitedClasses=0); + + private: + bool m_visited; + void addUsedInterfaceClasses(MemberDef *md,const char *typeStr); + void showUsedFiles(OutputList &ol); + + void writeDocumentationContents(OutputList &ol,const QCString &pageTitle); + void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList); + void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief); + MemberList *createMemberList(MemberListType lt); + void writeInheritedMemberDeclarations(OutputList &ol,MemberListType lt,int lt2,const QCString &title,ClassDef *inheritedFrom,bool invert,bool showAlways,QPtrDict<void> *visitedClasses); + 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); + void writeBriefDescription(OutputList &ol,bool exampleFlag); + void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag, + const QCString &title,const QCString &anchor=QCString()); + void writeIncludeFiles(OutputList &ol); + void writeIncludeFilesForSlice(OutputList &ol); + //void writeAllMembersLink(OutputList &ol); + void writeInheritanceGraph(OutputList &ol); + void writeCollaborationGraph(OutputList &ol); + void writeMemberGroups(OutputList &ol,bool showInline=FALSE); + void writeNestedClasses(OutputList &ol,const QCString &title); + void writeInlineClasses(OutputList &ol); + void startMemberDeclarations(OutputList &ol); + void endMemberDeclarations(OutputList &ol); + void startMemberDocumentation(OutputList &ol); + void endMemberDocumentation(OutputList &ol); + void writeAuthorSection(OutputList &ol); + void writeMoreLink(OutputList &ol,const QCString &anchor); + void writeDetailedDocumentationBody(OutputList &ol); + + int countAdditionalInheritedMembers(); + void writeAdditionalInheritedMembers(OutputList &ol); + void addClassAttributes(OutputList &ol); + int countInheritedDecMembers(MemberListType lt, + ClassDef *inheritedFrom,bool invert,bool showAlways, + QPtrDict<void> *visitedClasses); + void getTitleForMemberListType(MemberListType type, + QCString &title,QCString &subtitle); + QCString includeStatement() const; + void addTypeConstraint(const QCString &typeConstraint,const QCString &type); + + // PIMPL idiom + class IMPL; + IMPL *m_impl; +}; + +ClassDef *createClassDef( + const char *fileName,int startLine,int startColumn, + const char *name,ClassDef::CompoundType ct, + const char *ref,const char *fName, + bool isSymbol,bool isJavaEnum) +{ + return new ClassDefImpl(fileName,startLine,startColumn,name,ct,ref,fName,isSymbol,isJavaEnum); +} + +/** Private data associated with a ClassDef object. */ +class ClassDefImpl::IMPL +{ + public: + IMPL(); + ~IMPL(); void init(const char *defFileName, const char *name, const QCString &ctStr, const char *fName); @@ -206,7 +426,7 @@ class ClassDefImpl QCString metaData; }; -void ClassDefImpl::init(const char *defFileName, const char *name, +void ClassDefImpl::IMPL::init(const char *defFileName, const char *name, const QCString &ctStr, const char *fName) { if (fName) @@ -268,12 +488,12 @@ void ClassDefImpl::init(const char *defFileName, const char *name, isAnonymous = QCString(name).find('@')!=-1; } -ClassDefImpl::ClassDefImpl() : vhdlSummaryTitles(17) +ClassDefImpl::IMPL::IMPL() : vhdlSummaryTitles(17) { vhdlSummaryTitles.setAutoDelete(TRUE); } -ClassDefImpl::~ClassDefImpl() +ClassDefImpl::IMPL::~IMPL() { delete inherits; delete inheritedBy; @@ -294,17 +514,19 @@ ClassDefImpl::~ClassDefImpl() delete taggedInnerClasses; } +//------------------------------------------------------------------------------------------- + // constructs a new class definition -ClassDef::ClassDef( +ClassDefImpl::ClassDefImpl( const char *defFileName,int defLine,int defColumn, const char *nm,CompoundType ct, const char *lref,const char *fName, bool isSymbol,bool isJavaEnum) - : Definition(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol) + : DefinitionImpl(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol) { - visited=FALSE; + m_visited=FALSE; setReference(lref); - m_impl = new ClassDefImpl; + m_impl = new ClassDefImpl::IMPL; m_impl->compType = ct; m_impl->isJavaEnum = isJavaEnum; m_impl->init(defFileName,name(),compoundTypeString(),fName); @@ -318,17 +540,17 @@ ClassDef::ClassDef( } // destroy the class definition -ClassDef::~ClassDef() +ClassDefImpl::~ClassDefImpl() { delete m_impl; } -QCString ClassDef::getMemberListFileName() const +QCString ClassDefImpl::getMemberListFileName() const { return m_impl->memberListFileName; } -QCString ClassDef::displayName(bool includeScope) const +QCString ClassDefImpl::displayName(bool includeScope) const { //static bool optimizeOutputForJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); SrcLangExt lang = getLanguage(); @@ -362,7 +584,7 @@ QCString ClassDef::displayName(bool includeScope) const //{ // n = n.left(n.length()-2); //} - //printf("ClassDef::displayName()=%s\n",n.data()); + //printf("ClassDefImpl::displayName()=%s\n",n.data()); if (n.find('@')!=-1) { return removeAnonymousScopes(n); @@ -374,7 +596,7 @@ QCString ClassDef::displayName(bool includeScope) const } // inserts a base/super class in the inheritance list -void ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p, +void ClassDefImpl::insertBaseClass(ClassDef *cd,const char *n,Protection p, Specifier s,const char *t) { //printf("*** insert base class %s into %s\n",cd->name().data(),name().data()); @@ -389,7 +611,7 @@ void ClassDef::insertBaseClass(ClassDef *cd,const char *n,Protection p, } // inserts a derived/sub class in the inherited-by list -void ClassDef::insertSubClass(ClassDef *cd,Protection p, +void ClassDefImpl::insertSubClass(ClassDef *cd,Protection p, Specifier s,const char *t) { //printf("*** insert sub class %s into %s\n",cd->name().data(),name().data()); @@ -404,7 +626,7 @@ void ClassDef::insertSubClass(ClassDef *cd,Protection p, m_impl->isSimple = FALSE; } -void ClassDef::addMembersToMemberGroup() +void ClassDefImpl::addMembersToMemberGroup() { QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; @@ -433,7 +655,7 @@ void ClassDef::addMembersToMemberGroup() } // adds new member definition to the class -void ClassDef::internalInsertMember(MemberDef *md, +void ClassDefImpl::internalInsertMember(MemberDef *md, Protection prot, bool addToAllList ) @@ -739,13 +961,13 @@ void ClassDef::internalInsertMember(MemberDef *md, } } -void ClassDef::insertMember(MemberDef *md) +void ClassDefImpl::insertMember(MemberDef *md) { internalInsertMember(md,md->protection(),TRUE); } // compute the anchors for all members -void ClassDef::computeAnchors() +void ClassDefImpl::computeAnchors() { //ClassDef *context = Config_getBool(INLINE_INHERITED_MEMB) ? this : 0; //const char *letters = "abcdefghijklmnopqrstuvwxyz0123456789"; @@ -771,7 +993,7 @@ void ClassDef::computeAnchors() } } -void ClassDef::distributeMemberGroupDocumentation() +void ClassDefImpl::distributeMemberGroupDocumentation() { if (m_impl->memberGroupSDict) { @@ -784,7 +1006,7 @@ void ClassDef::distributeMemberGroupDocumentation() } } -void ClassDef::findSectionsInDocumentation() +void ClassDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); if (m_impl->memberGroupSDict) @@ -809,7 +1031,7 @@ void ClassDef::findSectionsInDocumentation() // add a file name to the used files set -void ClassDef::insertUsedFile(FileDef *fd) +void ClassDefImpl::insertUsedFile(FileDef *fd) { if (fd==0) return; if (m_impl->files.find(fd)==-1) m_impl->files.append(fd); @@ -846,10 +1068,10 @@ static void writeInheritanceSpecifier(OutputList &ol,BaseClassDef *bcd) } } -void ClassDef::setIncludeFile(FileDef *fd, +void ClassDefImpl::setIncludeFile(FileDef *fd, const char *includeName,bool local, bool force) { - //printf("ClassDef::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force); + //printf("ClassDefImpl::setIncludeFile(%p,%s,%d,%d)\n",fd,includeName,local,force); if (!m_impl->incInfo) m_impl->incInfo=new IncludeInfo; if ((includeName && m_impl->incInfo->includeName.isEmpty()) || (fd!=0 && m_impl->incInfo->fileDef==0) @@ -868,7 +1090,7 @@ void ClassDef::setIncludeFile(FileDef *fd, } // TODO: fix this: a nested template class can have multiple outer templates -//ArgumentList *ClassDef::outerTemplateArguments() const +//ArgumentList *ClassDefImpl::outerTemplateArguments() const //{ // int ti; // ClassDef *pcd=0; @@ -896,7 +1118,7 @@ static void searchTemplateSpecs(/*in*/ Definition *d, { searchTemplateSpecs(d->getOuterScope(),result,name,lang); } - ClassDef *cd=(ClassDef *)d; + ClassDef *cd=dynamic_cast<ClassDef *>(d); if (!name.isEmpty()) name+="::"; QCString clName = d->localName(); if (/*clName.right(2)=="-g" ||*/ clName.right(2)=="-p") @@ -962,7 +1184,7 @@ static void writeTemplateSpec(OutputList &ol,Definition *d, } } -void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag) +void ClassDefImpl::writeBriefDescription(OutputList &ol,bool exampleFlag) { if (hasBriefDescription()) { @@ -989,7 +1211,7 @@ void ClassDef::writeBriefDescription(OutputList &ol,bool exampleFlag) ol.writeSynopsis(); } -void ClassDef::writeDetailedDocumentationBody(OutputList &ol) +void ClassDefImpl::writeDetailedDocumentationBody(OutputList &ol) { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); @@ -1037,7 +1259,7 @@ void ClassDef::writeDetailedDocumentationBody(OutputList &ol) ol.endTextBlock(); } -bool ClassDef::hasDetailedDescription() const +bool ClassDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); @@ -1047,7 +1269,7 @@ bool ClassDef::hasDetailedDescription() const } // write the detailed description for this class -void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag, +void ClassDefImpl::writeDetailedDescription(OutputList &ol, const QCString &/*pageType*/, bool exampleFlag, const QCString &title,const QCString &anchor) { if (hasDetailedDescription() || exampleFlag) @@ -1083,7 +1305,7 @@ void ClassDef::writeDetailedDescription(OutputList &ol, const QCString &/*pageTy } } -QCString ClassDef::generatedFromFiles() const +QCString ClassDefImpl::generatedFromFiles() const { QCString result; SrcLangExt lang = getLanguage(); @@ -1114,7 +1336,7 @@ QCString ClassDef::generatedFromFiles() const return result; } -void ClassDef::showUsedFiles(OutputList &ol) +void ClassDefImpl::showUsedFiles(OutputList &ol) { ol.pushGeneratorState(); ol.disable(OutputGenerator::Man); @@ -1194,7 +1416,7 @@ void ClassDef::showUsedFiles(OutputList &ol) ol.popGeneratorState(); } -int ClassDef::countInheritanceNodes() +int ClassDefImpl::countInheritanceNodes() { int count=0; BaseClassDef *ibcd; @@ -1219,7 +1441,7 @@ int ClassDef::countInheritanceNodes() return count; } -void ClassDef::writeInheritanceGraph(OutputList &ol) +void ClassDefImpl::writeInheritanceGraph(OutputList &ol) { // count direct inheritance relations const int count=countInheritanceNodes(); @@ -1344,7 +1566,7 @@ void ClassDef::writeInheritanceGraph(OutputList &ol) } } -void ClassDef::writeCollaborationGraph(OutputList &ol) +void ClassDefImpl::writeCollaborationGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(COLLABORATION_GRAPH)*/) { @@ -1361,7 +1583,7 @@ void ClassDef::writeCollaborationGraph(OutputList &ol) } } -QCString ClassDef::includeStatement() const +QCString ClassDefImpl::includeStatement() const { SrcLangExt lang = getLanguage(); bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java; @@ -1379,7 +1601,7 @@ QCString ClassDef::includeStatement() const } } -void ClassDef::writeIncludeFilesForSlice(OutputList &ol) +void ClassDefImpl::writeIncludeFilesForSlice(OutputList &ol) { if (m_impl->incInfo) { @@ -1489,15 +1711,15 @@ void ClassDef::writeIncludeFilesForSlice(OutputList &ol) else { // Must be a class. - bool implements = false; + bool implements = FALSE; BaseClassListIterator it(*m_impl->inherits); BaseClassDef *ibcd; for (;(ibcd=it.current());++it) { ClassDef *icd = ibcd->classDef; - if (icd->m_impl->spec & Entry::Interface) + if (icd->isInterface()) { - implements = true; + implements = TRUE; } else { @@ -1508,11 +1730,11 @@ void ClassDef::writeIncludeFilesForSlice(OutputList &ol) if (implements) { ol.docify(" implements "); - bool first = true; + bool first = TRUE; for (ibcd=it.toFirst();(ibcd=it.current());++it) { ClassDef *icd = ibcd->classDef; - if (icd->m_impl->spec & Entry::Interface) + if (icd->isInterface()) { if (!first) { @@ -1520,7 +1742,7 @@ void ClassDef::writeIncludeFilesForSlice(OutputList &ol) } else { - first = false; + first = FALSE; } ol.docify(icd->name()); } @@ -1533,7 +1755,7 @@ void ClassDef::writeIncludeFilesForSlice(OutputList &ol) ol.endParagraph(); } -void ClassDef::writeIncludeFiles(OutputList &ol) +void ClassDefImpl::writeIncludeFiles(OutputList &ol) { if (m_impl->incInfo /*&& Config_getBool(SHOW_INCLUDE_FILES)*/) { @@ -1580,7 +1802,7 @@ void ClassDef::writeIncludeFiles(OutputList &ol) } #if 0 -void ClassDef::writeAllMembersLink(OutputList &ol) +void ClassDefImpl::writeAllMembersLink(OutputList &ol) { // write link to list of all members (HTML only) if (m_impl->allMemberNameInfoSDict && @@ -1600,7 +1822,7 @@ void ClassDef::writeAllMembersLink(OutputList &ol) } #endif -void ClassDef::writeMemberGroups(OutputList &ol,bool showInline) +void ClassDefImpl::writeMemberGroups(OutputList &ol,bool showInline) { // write user defined member groups if (m_impl->memberGroupSDict) @@ -1623,7 +1845,7 @@ void ClassDef::writeMemberGroups(OutputList &ol,bool showInline) } } -void ClassDef::writeNestedClasses(OutputList &ol,const QCString &title) +void ClassDefImpl::writeNestedClasses(OutputList &ol,const QCString &title) { // nested classes if (m_impl->innerClasses) @@ -1632,7 +1854,7 @@ void ClassDef::writeNestedClasses(OutputList &ol,const QCString &title) } } -void ClassDef::writeInlineClasses(OutputList &ol) +void ClassDefImpl::writeInlineClasses(OutputList &ol) { if (m_impl->innerClasses) { @@ -1640,9 +1862,9 @@ void ClassDef::writeInlineClasses(OutputList &ol) } } -void ClassDef::startMemberDocumentation(OutputList &ol) +void ClassDefImpl::startMemberDocumentation(OutputList &ol) { - //printf("%s: ClassDef::startMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::startMemberDocumentation()\n",name().data()); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.disable(OutputGenerator::Html); @@ -1650,9 +1872,9 @@ void ClassDef::startMemberDocumentation(OutputList &ol) } } -void ClassDef::endMemberDocumentation(OutputList &ol) +void ClassDefImpl::endMemberDocumentation(OutputList &ol) { - //printf("%s: ClassDef::endMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::endMemberDocumentation()\n",name().data()); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.enable(OutputGenerator::Html); @@ -1660,15 +1882,15 @@ void ClassDef::endMemberDocumentation(OutputList &ol) } } -void ClassDef::startMemberDeclarations(OutputList &ol) +void ClassDefImpl::startMemberDeclarations(OutputList &ol) { - //printf("%s: ClassDef::startMemberDeclarations()\n",name().data()); + //printf("%s: ClassDefImpl::startMemberDeclarations()\n",name().data()); ol.startMemberSections(); } -void ClassDef::endMemberDeclarations(OutputList &ol) +void ClassDefImpl::endMemberDeclarations(OutputList &ol) { - //printf("%s: ClassDef::endMemberDeclarations()\n",name().data()); + //printf("%s: ClassDefImpl::endMemberDeclarations()\n",name().data()); static bool inlineInheritedMembers = Config_getBool(INLINE_INHERITED_MEMB); if (!inlineInheritedMembers && countAdditionalInheritedMembers()>0) { @@ -1680,7 +1902,7 @@ void ClassDef::endMemberDeclarations(OutputList &ol) ol.endMemberSections(); } -void ClassDef::writeAuthorSection(OutputList &ol) +void ClassDefImpl::writeAuthorSection(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Man); @@ -1693,7 +1915,7 @@ void ClassDef::writeAuthorSection(OutputList &ol) } -void ClassDef::writeSummaryLinks(OutputList &ol) +void ClassDefImpl::writeSummaryLinks(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1752,7 +1974,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol) ol.popGeneratorState(); } -void ClassDef::writeTagFile(FTextStream &tagFile) +void ClassDefImpl::writeTagFile(FTextStream &tagFile) { if (!isLinkableInProject()) return; tagFile << " <compound kind=\""; @@ -1871,12 +2093,12 @@ void ClassDef::writeTagFile(FTextStream &tagFile) } /** Write class documentation inside another container (i.e. a group) */ -void ClassDef::writeInlineDocumentation(OutputList &ol) +void ClassDefImpl::writeInlineDocumentation(OutputList &ol) { bool isSimple = m_impl->isSimple; ol.addIndexItem(name(),0); - //printf("ClassDef::writeInlineDocumentation(%s)\n",name().data()); + //printf("ClassDefImpl::writeInlineDocumentation(%s)\n",name().data()); QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Class)); LayoutDocEntry *lde; @@ -1988,7 +2210,7 @@ void ClassDef::writeInlineDocumentation(OutputList &ol) ol.popGeneratorState(); } -void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor) +void ClassDefImpl::writeMoreLink(OutputList &ol,const QCString &anchor) { // TODO: clean up this mess by moving it to // the output generators... @@ -2032,7 +2254,7 @@ void ClassDef::writeMoreLink(OutputList &ol,const QCString &anchor) } } -bool ClassDef::visibleInParentsDeclList() const +bool ClassDefImpl::visibleInParentsDeclList() const { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES); @@ -2044,7 +2266,7 @@ bool ClassDef::visibleInParentsDeclList() const ); } -void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames) +void ClassDefImpl::writeDeclarationLink(OutputList &ol,bool &found,const char *header,bool localNames) { //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); @@ -2153,7 +2375,7 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade } } -void ClassDef::addClassAttributes(OutputList &ol) +void ClassDefImpl::addClassAttributes(OutputList &ol) { QStrList sl; if (isFinal()) sl.append("final"); @@ -2178,7 +2400,7 @@ void ClassDef::addClassAttributes(OutputList &ol) ol.popGeneratorState(); } -void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*pageTitle*/) +void ClassDefImpl::writeDocumentationContents(OutputList &ol,const QCString & /*pageTitle*/) { ol.startContents(); @@ -2313,7 +2535,7 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page ol.endContents(); } -QCString ClassDef::title() const +QCString ClassDefImpl::title() const { QCString pageTitle; SrcLangExt lang = getLanguage(); @@ -2363,7 +2585,7 @@ QCString ClassDef::title() const } // write all documentation for this class -void ClassDef::writeDocumentation(OutputList &ol) +void ClassDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); @@ -2421,7 +2643,7 @@ void ClassDef::writeDocumentation(OutputList &ol) } } -void ClassDef::writeMemberPages(OutputList &ol) +void ClassDefImpl::writeMemberPages(OutputList &ol) { /////////////////////////////////////////////////////////////////////////// //// Member definitions on separate pages @@ -2444,7 +2666,7 @@ void ClassDef::writeMemberPages(OutputList &ol) ol.popGeneratorState(); } -void ClassDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const +void ClassDefImpl::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const { static bool createSubDirs=Config_getBool(CREATE_SUBDIRS); @@ -2494,7 +2716,7 @@ void ClassDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const -void ClassDef::writeDocumentationForInnerClasses(OutputList &ol) +void ClassDefImpl::writeDocumentationForInnerClasses(OutputList &ol) { // write inner classes after the parent, so the tag files contain // the definition in proper order! @@ -2519,7 +2741,7 @@ void ClassDef::writeDocumentationForInnerClasses(OutputList &ol) } // write the list of all (inherited) members for this class -void ClassDef::writeMemberList(OutputList &ol) +void ClassDefImpl::writeMemberList(OutputList &ol) { static bool cOpt = Config_getBool(OPTIMIZE_OUTPUT_FOR_C); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); @@ -2804,7 +3026,7 @@ void ClassDef::writeMemberList(OutputList &ol) // add a reference to an example -bool ClassDef::addExample(const char *anchor,const char *nameStr, +bool ClassDefImpl::addExample(const char *anchor,const char *nameStr, const char *file) { if (m_impl->exampleSDict==0) @@ -2825,7 +3047,7 @@ bool ClassDef::addExample(const char *anchor,const char *nameStr, } // returns TRUE if this class is used in an example -bool ClassDef::hasExamples() const +bool ClassDefImpl::hasExamples() const { bool result=FALSE; if (m_impl->exampleSDict) @@ -2833,7 +3055,7 @@ bool ClassDef::hasExamples() const return result; } -void ClassDef::addTypeConstraint(const QCString &typeConstraint,const QCString &type) +void ClassDefImpl::addTypeConstraint(const QCString &typeConstraint,const QCString &type) { //printf("addTypeContraint(%s,%s)\n",type.data(),typeConstraint.data()); static bool hideUndocRelation = Config_getBool(HIDE_UNDOC_RELATIONS); @@ -2841,7 +3063,7 @@ void ClassDef::addTypeConstraint(const QCString &typeConstraint,const QCString & ClassDef *cd = getResolvedClass(this,getFileDef(),typeConstraint); if (cd==0 && !hideUndocRelation) { - cd = new ClassDef(getDefFileName(),getDefLine(),getDefColumn(),typeConstraint,ClassDef::Class); + cd = new ClassDefImpl(getDefFileName(),getDefLine(),getDefColumn(),typeConstraint,ClassDef::Class); cd->setUsedOnly(TRUE); cd->setLanguage(getLanguage()); Doxygen::hiddenClasses->append(typeConstraint,cd); @@ -2868,7 +3090,7 @@ void ClassDef::addTypeConstraint(const QCString &typeConstraint,const QCString & } // Java Type Constrains: A<T extends C & I> -void ClassDef::addTypeConstraints() +void ClassDefImpl::addTypeConstraints() { if (m_impl->tempArgs) { @@ -2894,7 +3116,7 @@ void ClassDef::addTypeConstraints() } // C# Type Constraints: D<T> where T : C, I -void ClassDef::setTypeConstraints(ArgumentList *al) +void ClassDefImpl::setTypeConstraints(ArgumentList *al) { if (al==0) return; if (!m_impl->typeConstraints) delete m_impl->typeConstraints; @@ -2907,7 +3129,7 @@ void ClassDef::setTypeConstraints(ArgumentList *al) } } -void ClassDef::setTemplateArguments(ArgumentList *al) +void ClassDefImpl::setTemplateArguments(ArgumentList *al) { if (al==0) return; if (m_impl->tempArgs) delete m_impl->tempArgs; // delete old list if needed @@ -2924,7 +3146,7 @@ void ClassDef::setTemplateArguments(ArgumentList *al) /*! Returns \c TRUE iff this class or a class inheriting from this class * is \e not defined in an external tag file. */ -bool ClassDef::hasNonReferenceSuperClass() const +bool ClassDefImpl::hasNonReferenceSuperClass() const { bool found=!isReference() && isLinkableInProject() && !isHidden(); if (found) @@ -2961,7 +3183,7 @@ bool ClassDef::hasNonReferenceSuperClass() const /*! called from MemberDef::writeDeclaration() to (recursively) write the * definition of an anonymous struct, union or class. */ -void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, +void ClassDefImpl::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, ClassDef *inheritedFrom,const char *inheritId) { //printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup); @@ -3011,7 +3233,7 @@ void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, } /*! a link to this class is possible within this project */ -bool ClassDef::isLinkableInProject() const +bool ClassDefImpl::isLinkableInProject() const { static bool extractLocal = Config_getBool(EXTRACT_LOCAL_CLASSES); static bool extractStatic = Config_getBool(EXTRACT_STATIC); @@ -3033,7 +3255,7 @@ bool ClassDef::isLinkableInProject() const } } -bool ClassDef::isLinkable() const +bool ClassDefImpl::isLinkable() const { if (m_impl->templateMaster) { @@ -3047,7 +3269,7 @@ bool ClassDef::isLinkable() const /*! the class is visible in a class diagram, or class hierarchy */ -bool ClassDef::isVisibleInHierarchy() const +bool ClassDefImpl::isVisibleInHierarchy() const { static bool allExternals = Config_getBool(ALLEXTERNALS); static bool hideUndocClasses = Config_getBool(HIDE_UNDOC_CLASSES); @@ -3071,9 +3293,9 @@ bool ClassDef::isVisibleInHierarchy() const (!m_impl->isStatic || extractStatic); } -bool ClassDef::hasDocumentation() const +bool ClassDefImpl::hasDocumentation() const { - return Definition::hasDocumentation(); + return DefinitionImpl::hasDocumentation(); } //---------------------------------------------------------------------- @@ -3081,7 +3303,7 @@ bool ClassDef::hasDocumentation() const // returns TRUE iff class definition `bcd' represents an (in)direct base // class of class definition `cd'. -bool ClassDef::isBaseClass(ClassDef *bcd, bool followInstances,int level) const +bool ClassDefImpl::isBaseClass(const ClassDef *bcd, bool followInstances,int level) const { bool found=FALSE; //printf("isBaseClass(cd=%s) looking for %s\n",name().data(),bcd->name().data()); @@ -3111,7 +3333,7 @@ bool ClassDef::isBaseClass(ClassDef *bcd, bool followInstances,int level) const //---------------------------------------------------------------------- -bool ClassDef::isSubClass(ClassDef *cd,int level) const +bool ClassDefImpl::isSubClass(ClassDef *cd,int level) const { bool found=FALSE; if (level>256) @@ -3148,7 +3370,7 @@ static bool isStandardFunc(MemberDef *md) * with that of this class. Must only be called for classes without * subclasses! */ -void ClassDef::mergeMembers() +void ClassDefImpl::mergeMembers() { if (m_impl->membersMerged) return; @@ -3399,7 +3621,7 @@ void ClassDef::mergeMembers() /*! Merges the members of a Objective-C category into this class. */ -void ClassDef::mergeCategory(ClassDef *category) +void ClassDefImpl::mergeCategory(ClassDef *category) { static bool extractLocalMethods = Config_getBool(EXTRACT_LOCAL_METHODS); bool makePrivate = category->isLocal(); @@ -3537,7 +3759,7 @@ void ClassDef::mergeCategory(ClassDef *category) //---------------------------------------------------------------------------- -void ClassDef::addUsedClass(ClassDef *cd,const char *accessName, +void ClassDefImpl::addUsedClass(ClassDef *cd,const char *accessName, Protection prot) { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); @@ -3571,7 +3793,7 @@ void ClassDef::addUsedClass(ClassDef *cd,const char *accessName, ucd->addAccessor(acc); } -void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName, +void ClassDefImpl::addUsedByClass(ClassDef *cd,const char *accessName, Protection prot) { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); @@ -3612,7 +3834,7 @@ void ClassDef::addUsedByClass(ClassDef *cd,const char *accessName, * Must be called before mergeMembers() is called! */ -void ClassDef::determineImplUsageRelation() +void ClassDefImpl::determineImplUsageRelation() { MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; @@ -3726,7 +3948,7 @@ void ClassDef::determineImplUsageRelation() // I have disabled this code because the graphs it renders quickly become // too large to be of practical use. -void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) +void ClassDefImpl::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) { QCString type = typeStr; static const QRegExp re("[a-z_A-Z][a-z_A-Z0-9:]*"); @@ -3757,7 +3979,7 @@ void ClassDef::addUsedInterfaceClasses(MemberDef *md,const char *typeStr) } } -void ClassDef::determineIntfUsageRelation() +void ClassDefImpl::determineIntfUsageRelation() { MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoList); MemberNameInfo *mni; @@ -3803,7 +4025,7 @@ void ClassDef::determineIntfUsageRelation() } #endif -QCString ClassDef::compoundTypeString() const +QCString ClassDefImpl::compoundTypeString() const { if (getLanguage()==SrcLangExt_Fortran) { @@ -3837,7 +4059,7 @@ QCString ClassDef::compoundTypeString() const } } -QCString ClassDef::getOutputFileBase() const +QCString ClassDefImpl::getOutputFileBase() const { static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); static bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS); @@ -3874,12 +4096,12 @@ QCString ClassDef::getOutputFileBase() const return m_impl->fileName; } -QCString ClassDef::getInstanceOutputFileBase() const +QCString ClassDefImpl::getInstanceOutputFileBase() const { return m_impl->fileName; } -QCString ClassDef::getSourceFileBase() const +QCString ClassDefImpl::getSourceFileBase() const { if (m_impl->templateMaster) { @@ -3887,14 +4109,14 @@ QCString ClassDef::getSourceFileBase() const } else { - return Definition::getSourceFileBase(); + return DefinitionImpl::getSourceFileBase(); } } -void ClassDef::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) +void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) { gd->addClass(this); - //printf("ClassDef::setGroupDefForAllMembers(%s)\n",gd->name().data()); + //printf("ClassDefImpl::setGroupDefForAllMembers(%s)\n",gd->name().data()); if (m_impl->allMemberNameInfoSDict==0) return; MemberNameInfoSDict::Iterator mnili(*m_impl->allMemberNameInfoSDict); MemberNameInfo *mni; @@ -3913,7 +4135,7 @@ void ClassDef::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pri,co } } -void ClassDef::addInnerCompound(Definition *d) +void ClassDefImpl::addInnerCompound(Definition *d) { //printf("**** %s::addInnerCompound(%s)\n",name().data(),d->name().data()); if (d->definitionType()==Definition::TypeClass) // only classes can be @@ -3923,11 +4145,11 @@ void ClassDef::addInnerCompound(Definition *d) { m_impl->innerClasses = new ClassSDict(17); } - m_impl->innerClasses->inSort(d->localName(),(ClassDef *)d); + m_impl->innerClasses->inSort(d->localName(),dynamic_cast<ClassDef *>(d)); } } -Definition *ClassDef::findInnerCompound(const char *name) const +Definition *ClassDefImpl::findInnerCompound(const char *name) const { Definition *result=0; if (name==0) return 0; @@ -3938,7 +4160,7 @@ Definition *ClassDef::findInnerCompound(const char *name) const return result; } -//void ClassDef::initTemplateMapping() +//void ClassDefImpl::initTemplateMapping() //{ // m_impl->templateMapping->clear(); // ArgumentList *al = templateArguments(); @@ -3952,9 +4174,9 @@ Definition *ClassDef::findInnerCompound(const char *name) const // } // } //} -//void ClassDef::setTemplateArgumentMapping(const char *formal,const char *actual) +//void ClassDefImpl::setTemplateArgumentMapping(const char *formal,const char *actual) //{ -// //printf("ClassDef::setTemplateArgumentMapping(%s,%s)\n",formal,actual); +// //printf("ClassDefImpl::setTemplateArgumentMapping(%s,%s)\n",formal,actual); // if (m_impl->templateMapping && formal) // { // if (m_impl->templateMapping->find(formal)) @@ -3965,7 +4187,7 @@ Definition *ClassDef::findInnerCompound(const char *name) const // } //} // -//QCString ClassDef::getTemplateArgumentMapping(const char *formal) const +//QCString ClassDefImpl::getTemplateArgumentMapping(const char *formal) const //{ // if (m_impl->templateMapping && formal) // { @@ -3978,7 +4200,7 @@ Definition *ClassDef::findInnerCompound(const char *name) const // return ""; //} -ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, +ClassDef *ClassDefImpl::insertTemplateInstance(const QCString &fileName, int startLine, int startColumn, const QCString &templSpec,bool &freshInstance) { freshInstance = FALSE; @@ -3991,7 +4213,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, { Debug::print(Debug::Classes,0," New template instance class `%s'`%s'\n",qPrint(name()),qPrint(templSpec)); QCString tcname = removeRedundantWhiteSpace(localName()+templSpec); - templateClass = new ClassDef( + templateClass = new ClassDefImpl( fileName,startLine,startColumn,tcname,ClassDef::Class); templateClass->setTemplateMaster(this); templateClass->setOuterScope(getOuterScope()); @@ -4002,7 +4224,7 @@ ClassDef *ClassDef::insertTemplateInstance(const QCString &fileName, return templateClass; } -ClassDef *ClassDef::getVariableInstance(const char *templSpec) +ClassDef *ClassDefImpl::getVariableInstance(const char *templSpec) { if (m_impl->variableInstances==0) { @@ -4014,7 +4236,7 @@ ClassDef *ClassDef::getVariableInstance(const char *templSpec) { Debug::print(Debug::Classes,0," New template variable instance class `%s'`%s'\n",qPrint(name()),qPrint(templSpec)); QCString tcname = removeRedundantWhiteSpace(name()+templSpec); - templateClass = new ClassDef("<code>",1,1,tcname, + templateClass = new ClassDefImpl("<code>",1,1,tcname, ClassDef::Class,0,0,FALSE); templateClass->addMembersToTemplateInstance( this, templSpec ); templateClass->setTemplateMaster(this); @@ -4023,7 +4245,7 @@ ClassDef *ClassDef::getVariableInstance(const char *templSpec) return templateClass; } -void ClassDef::setTemplateBaseClassNames(QDict<int> *templateNames) +void ClassDefImpl::setTemplateBaseClassNames(QDict<int> *templateNames) { if (templateNames==0) return; if (m_impl->templBaseClassNames==0) @@ -4042,12 +4264,12 @@ void ClassDef::setTemplateBaseClassNames(QDict<int> *templateNames) } } -QDict<int> *ClassDef::getTemplateBaseClassNames() const +QDict<int> *ClassDefImpl::getTemplateBaseClassNames() const { return m_impl->templBaseClassNames; } -void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) +void ClassDefImpl::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) { //printf("%s::addMembersToTemplateInstance(%s,%s)\n",name().data(),cd->name().data(),templSpec); if (cd->memberNameInfoSDict()==0) return; @@ -4090,7 +4312,7 @@ void ClassDef::addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) } } -QCString ClassDef::getReference() const +QCString ClassDefImpl::getReference() const { if (m_impl->templateMaster) { @@ -4098,11 +4320,11 @@ QCString ClassDef::getReference() const } else { - return Definition::getReference(); + return DefinitionImpl::getReference(); } } -bool ClassDef::isReference() const +bool ClassDefImpl::isReference() const { if (m_impl->templateMaster) { @@ -4110,18 +4332,18 @@ bool ClassDef::isReference() const } else { - return Definition::isReference(); + return DefinitionImpl::isReference(); } } -void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const +void ClassDefImpl::getTemplateParameterLists(QList<ArgumentList> &lists) const { Definition *d=getOuterScope(); if (d) { if (d->definitionType()==Definition::TypeClass) { - ClassDef *cd=(ClassDef *)d; + ClassDef *cd=dynamic_cast<ClassDef *>(d); cd->getTemplateParameterLists(lists); } } @@ -4131,7 +4353,7 @@ void ClassDef::getTemplateParameterLists(QList<ArgumentList> &lists) const } } -QCString ClassDef::qualifiedNameWithTemplateParameters( +QCString ClassDefImpl::qualifiedNameWithTemplateParameters( QList<ArgumentList> *actualParams,int *actualParamIndex) const { //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); @@ -4143,7 +4365,7 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( { if (d->definitionType()==Definition::TypeClass) { - ClassDef *cd=(ClassDef *)d; + ClassDef *cd=dynamic_cast<ClassDef *>(d); scName = cd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex); } else if (!hideScopeNames) @@ -4190,7 +4412,7 @@ QCString ClassDef::qualifiedNameWithTemplateParameters( return scName; } -QCString ClassDef::className() const +QCString ClassDefImpl::className() const { if (m_impl->className.isEmpty()) { @@ -4202,12 +4424,12 @@ QCString ClassDef::className() const } }; -void ClassDef::setClassName(const char *name) +void ClassDefImpl::setClassName(const char *name) { m_impl->className = name; } -void ClassDef::addListReferences() +void ClassDefImpl::addListReferences() { SrcLangExt lang = getLanguage(); if (!isLinkableInProject()) return; @@ -4244,7 +4466,7 @@ void ClassDef::addListReferences() } } -MemberDef *ClassDef::getMemberByName(const QCString &name) const +MemberDef *ClassDefImpl::getMemberByName(const QCString &name) const { MemberDef *xmd = 0; if (m_impl->allMemberNameInfoSDict) @@ -4274,12 +4496,12 @@ MemberDef *ClassDef::getMemberByName(const QCString &name) const return xmd; } -bool ClassDef::isAccessibleMember(MemberDef *md) const +bool ClassDefImpl::isAccessibleMember(const MemberDef *md) const { return md->getClassDef() && isBaseClass(md->getClassDef(),TRUE); } -MemberList *ClassDef::createMemberList(MemberListType lt) +MemberList *ClassDefImpl::createMemberList(MemberListType lt) { m_impl->memberLists.setAutoDelete(TRUE); QListIterator<MemberList> mli(m_impl->memberLists); @@ -4297,7 +4519,7 @@ MemberList *ClassDef::createMemberList(MemberListType lt) return ml; } -MemberList *ClassDef::getMemberList(MemberListType lt) const +MemberList *ClassDefImpl::getMemberList(MemberListType lt) const { QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; @@ -4311,7 +4533,7 @@ MemberList *ClassDef::getMemberList(MemberListType lt) const return 0; } -void ClassDef::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief) +void ClassDefImpl::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); @@ -4323,7 +4545,7 @@ void ClassDef::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief) if ((ml->listType()&MemberListType_detailedLists)==0) md->setSectionList(this,ml); } -void ClassDef::sortMemberLists() +void ClassDefImpl::sortMemberLists() { QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; @@ -4337,7 +4559,7 @@ void ClassDef::sortMemberLists() } } -int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, +int ClassDefImpl::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) { //printf("%s: countMemberDeclarations for %d and %d\n",name().data(),lt,lt2); @@ -4380,7 +4602,7 @@ int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, } -int ClassDef::countInheritedDecMembers(MemberListType lt, +int ClassDefImpl::countInheritedDecMembers(MemberListType lt, ClassDef *inheritedFrom,bool invert,bool showAlways, QPtrDict<void> *visitedClasses) { @@ -4419,7 +4641,7 @@ int ClassDef::countInheritedDecMembers(MemberListType lt, return inhCount; } -void ClassDef::getTitleForMemberListType(MemberListType type, +void ClassDefImpl::getTitleForMemberListType(MemberListType type, QCString &title,QCString &subtitle) { SrcLangExt lang = getLanguage(); @@ -4443,7 +4665,7 @@ void ClassDef::getTitleForMemberListType(MemberListType type, subtitle=""; } -int ClassDef::countAdditionalInheritedMembers() +int ClassDefImpl::countAdditionalInheritedMembers() { int totalCount=0; QListIterator<LayoutDocEntry> eli( @@ -4469,7 +4691,7 @@ int ClassDef::countAdditionalInheritedMembers() return totalCount; } -void ClassDef::writeAdditionalInheritedMembers(OutputList &ol) +void ClassDefImpl::writeAdditionalInheritedMembers(OutputList &ol) { //printf("**** writeAdditionalInheritedMembers()\n"); QListIterator<LayoutDocEntry> eli( @@ -4489,7 +4711,7 @@ void ClassDef::writeAdditionalInheritedMembers(OutputList &ol) } } -int ClassDef::countMembersIncludingGrouped(MemberListType lt, +int ClassDefImpl::countMembersIncludingGrouped(MemberListType lt, ClassDef *inheritedFrom,bool additional) { int count=0; @@ -4518,7 +4740,7 @@ int ClassDef::countMembersIncludingGrouped(MemberListType lt, return count; } -void ClassDef::writeInheritedMemberDeclarations(OutputList &ol, +void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol, MemberListType lt,int lt2,const QCString &title, ClassDef *inheritedFrom,bool invert,bool showAlways, QPtrDict<void> *visitedClasses) @@ -4567,11 +4789,11 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol, ol.popGeneratorState(); } -void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, +void ClassDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title, const char *subTitle,bool showInline,ClassDef *inheritedFrom,int lt2, bool invert,bool showAlways,QPtrDict<void> *visitedClasses) { - //printf("%s: ClassDef::writeMemberDeclarations lt=%d lt2=%d\n",name().data(),lt,lt2); + //printf("%s: ClassDefImpl::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 @@ -4615,7 +4837,7 @@ void ClassDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC } } -void ClassDef::addGroupedInheritedMembers(OutputList &ol,MemberListType lt, +void ClassDefImpl::addGroupedInheritedMembers(OutputList &ol,MemberListType lt, ClassDef *inheritedFrom,const QCString &inheritId) { //printf("** %s::addGroupedInheritedMembers(%p) inheritId=%s\n",name().data(),m_impl->memberGroupSDict,inheritId.data()); @@ -4633,25 +4855,25 @@ void ClassDef::addGroupedInheritedMembers(OutputList &ol,MemberListType lt, } } -void ClassDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline) +void ClassDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title,bool showInline) { - //printf("%s: ClassDef::writeMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::writeMemberDocumentation()\n",name().data()); MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,displayName(),this,title,FALSE,showInline); } -void ClassDef::writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt) +void ClassDefImpl::writeSimpleMemberDocumentation(OutputList &ol,MemberListType lt) { - //printf("%s: ClassDef::writeSimpleMemberDocumentation()\n",name().data()); + //printf("%s: ClassDefImpl::writeSimpleMemberDocumentation()\n",name().data()); MemberList * ml = getMemberList(lt); if (ml) ml->writeSimpleDocumentation(ol,this); } -void ClassDef::writePlainMemberDeclaration(OutputList &ol, +void ClassDefImpl::writePlainMemberDeclaration(OutputList &ol, MemberListType lt,bool inGroup, ClassDef *inheritedFrom,const char *inheritId) { - //printf("%s: ClassDef::writePlainMemberDeclaration()\n",name().data()); + //printf("%s: ClassDefImpl::writePlainMemberDeclaration()\n",name().data()); MemberList * ml = getMemberList(lt); if (ml) { @@ -4660,222 +4882,227 @@ void ClassDef::writePlainMemberDeclaration(OutputList &ol, } } -bool ClassDef::isLocal() const +bool ClassDefImpl::isLocal() const { return m_impl->isLocal; } -ClassSDict *ClassDef::getClassSDict() const +ClassSDict *ClassDefImpl::getClassSDict() const { return m_impl->innerClasses; } -ClassDef::CompoundType ClassDef::compoundType() const +ClassDefImpl::CompoundType ClassDefImpl::compoundType() const { return m_impl->compType; } -BaseClassList *ClassDef::baseClasses() const +BaseClassList *ClassDefImpl::baseClasses() const { return m_impl->inherits; } -BaseClassList *ClassDef::subClasses() const +BaseClassList *ClassDefImpl::subClasses() const { return m_impl->inheritedBy; } -MemberNameInfoSDict *ClassDef::memberNameInfoSDict() const +MemberNameInfoSDict *ClassDefImpl::memberNameInfoSDict() const { return m_impl->allMemberNameInfoSDict; } -Protection ClassDef::protection() const +Protection ClassDefImpl::protection() const { return m_impl->prot; } -ArgumentList *ClassDef::templateArguments() const +ArgumentList *ClassDefImpl::templateArguments() const { return m_impl->tempArgs; } -NamespaceDef *ClassDef::getNamespaceDef() const +NamespaceDef *ClassDefImpl::getNamespaceDef() const { return m_impl->nspace; } -FileDef *ClassDef::getFileDef() const +FileDef *ClassDefImpl::getFileDef() const { return m_impl->fileDef; } -QDict<ClassDef> *ClassDef::getTemplateInstances() const +QDict<ClassDef> *ClassDefImpl::getTemplateInstances() const { return m_impl->templateInstances; } -ClassDef *ClassDef::templateMaster() const +ClassDef *ClassDefImpl::templateMaster() const { return m_impl->templateMaster; } -bool ClassDef::isTemplate() const +bool ClassDefImpl::isTemplate() const { return m_impl->tempArgs!=0; } -IncludeInfo *ClassDef::includeInfo() const +IncludeInfo *ClassDefImpl::includeInfo() const { return m_impl->incInfo; } -UsesClassDict *ClassDef::usedImplementationClasses() const +UsesClassDict *ClassDefImpl::usedImplementationClasses() const { return m_impl->usesImplClassDict; } -UsesClassDict *ClassDef::usedByImplementationClasses() const +UsesClassDict *ClassDefImpl::usedByImplementationClasses() const { return m_impl->usedByImplClassDict; } -UsesClassDict *ClassDef::usedInterfaceClasses() const +UsesClassDict *ClassDefImpl::usedInterfaceClasses() const { return m_impl->usesIntfClassDict; } -ConstraintClassDict *ClassDef::templateTypeConstraints() const +ConstraintClassDict *ClassDefImpl::templateTypeConstraints() const { return m_impl->constraintClassDict; } -bool ClassDef::isTemplateArgument() const +bool ClassDefImpl::isTemplateArgument() const { return m_impl->isTemplArg; } -bool ClassDef::isAbstract() const +bool ClassDefImpl::isAbstract() const { return m_impl->isAbstract || (m_impl->spec&Entry::Abstract); } -bool ClassDef::isFinal() const +bool ClassDefImpl::isFinal() const { return m_impl->spec&Entry::Final; } -bool ClassDef::isSealed() const +bool ClassDefImpl::isSealed() const { return m_impl->spec&Entry::Sealed; } -bool ClassDef::isPublished() const +bool ClassDefImpl::isPublished() const { return m_impl->spec&Entry::Published; } -bool ClassDef::isForwardDeclared() const +bool ClassDefImpl::isForwardDeclared() const { return m_impl->spec&Entry::ForwardDecl; } -bool ClassDef::isObjectiveC() const +bool ClassDefImpl::isInterface() const +{ + return m_impl->spec&Entry::Interface; +} + +bool ClassDefImpl::isObjectiveC() const { return getLanguage()==SrcLangExt_ObjC; } -bool ClassDef::isFortran() const +bool ClassDefImpl::isFortran() const { return getLanguage()==SrcLangExt_Fortran; } -bool ClassDef::isCSharp() const +bool ClassDefImpl::isCSharp() const { return getLanguage()==SrcLangExt_CSharp; } -ClassDef *ClassDef::categoryOf() const +ClassDef *ClassDefImpl::categoryOf() const { return m_impl->categoryOf; } -const QList<MemberList> &ClassDef::getMemberLists() const +const QList<MemberList> &ClassDefImpl::getMemberLists() const { return m_impl->memberLists; } -MemberGroupSDict *ClassDef::getMemberGroupSDict() const +MemberGroupSDict *ClassDefImpl::getMemberGroupSDict() const { return m_impl->memberGroupSDict; } -void ClassDef::setNamespace(NamespaceDef *nd) +void ClassDefImpl::setNamespace(NamespaceDef *nd) { m_impl->nspace = nd; } -void ClassDef::setFileDef(FileDef *fd) +void ClassDefImpl::setFileDef(FileDef *fd) { m_impl->fileDef=fd; } -void ClassDef::setSubGrouping(bool enabled) +void ClassDefImpl::setSubGrouping(bool enabled) { m_impl->subGrouping = enabled; } -void ClassDef::setProtection(Protection p) +void ClassDefImpl::setProtection(Protection p) { m_impl->prot=p; } -void ClassDef::setIsStatic(bool b) +void ClassDefImpl::setIsStatic(bool b) { m_impl->isStatic=b; } -void ClassDef::setCompoundType(CompoundType t) +void ClassDefImpl::setCompoundType(CompoundType t) { m_impl->compType = t; } -void ClassDef::setTemplateMaster(ClassDef *tm) +void ClassDefImpl::setTemplateMaster(ClassDef *tm) { m_impl->templateMaster=tm; } -void ClassDef::makeTemplateArgument(bool b) +void ClassDefImpl::makeTemplateArgument(bool b) { m_impl->isTemplArg = b; } -void ClassDef::setCategoryOf(ClassDef *cd) +void ClassDefImpl::setCategoryOf(ClassDef *cd) { m_impl->categoryOf = cd; } -void ClassDef::setUsedOnly(bool b) +void ClassDefImpl::setUsedOnly(bool b) { m_impl->usedOnly = b; } -bool ClassDef::isUsedOnly() const +bool ClassDefImpl::isUsedOnly() const { return m_impl->usedOnly; } -bool ClassDef::isSimple() const +bool ClassDefImpl::isSimple() const { return m_impl->isSimple; } -MemberDef *ClassDef::isSmartPointer() const +MemberDef *ClassDefImpl::isSmartPointer() const { return m_impl->arrowOperator; } -void ClassDef::reclassifyMember(MemberDef *md,MemberType t) +void ClassDefImpl::reclassifyMember(MemberDef *md,MemberType t) { md->setMemberType(t); QListIterator<MemberList> mli(m_impl->memberLists); @@ -4887,7 +5114,7 @@ void ClassDef::reclassifyMember(MemberDef *md,MemberType t) insertMember(md); } -QCString ClassDef::anchor() const +QCString ClassDefImpl::anchor() const { QCString anc; if (isEmbeddedInOuterScope() && !Doxygen::generatingXmlOutput) @@ -4905,7 +5132,7 @@ QCString ClassDef::anchor() const return anc; } -bool ClassDef::isEmbeddedInOuterScope() const +bool ClassDefImpl::isEmbeddedInOuterScope() const { static bool inlineGroupedClasses = Config_getBool(INLINE_GROUPED_CLASSES); static bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS); @@ -4935,12 +5162,12 @@ bool ClassDef::isEmbeddedInOuterScope() const return b1 || b2; // either reason will do } -const ClassList *ClassDef::taggedInnerClasses() const +const ClassList *ClassDefImpl::taggedInnerClasses() const { return m_impl->taggedInnerClasses; } -void ClassDef::addTaggedInnerClass(ClassDef *cd) +void ClassDefImpl::addTaggedInnerClass(ClassDef *cd) { if (m_impl->taggedInnerClasses==0) { @@ -4949,17 +5176,17 @@ void ClassDef::addTaggedInnerClass(ClassDef *cd) m_impl->taggedInnerClasses->append(cd); } -ClassDef *ClassDef::tagLessReference() const +ClassDef *ClassDefImpl::tagLessReference() const { return m_impl->tagLessRef; } -void ClassDef::setTagLessReference(ClassDef *cd) +void ClassDefImpl::setTagLessReference(ClassDef *cd) { m_impl->tagLessRef = cd; } -void ClassDef::removeMemberFromLists(MemberDef *md) +void ClassDefImpl::removeMemberFromLists(MemberDef *md) { QListIterator<MemberList> mli(m_impl->memberLists); MemberList *ml; @@ -4969,22 +5196,22 @@ void ClassDef::removeMemberFromLists(MemberDef *md) } } -bool ClassDef::isJavaEnum() const +bool ClassDefImpl::isJavaEnum() const { return m_impl->isJavaEnum; } -bool ClassDef::isGeneric() const +bool ClassDefImpl::isGeneric() const { return m_impl->isGeneric; } -void ClassDef::setClassSpecifier(uint64 spec) +void ClassDefImpl::setClassSpecifier(uint64 spec) { m_impl->spec = spec; } -bool ClassDef::isExtension() const +bool ClassDefImpl::isExtension() const { QCString n = name(); int si = n.find('('); @@ -4993,58 +5220,58 @@ bool ClassDef::isExtension() const return b; } -const ClassSDict *ClassDef::innerClasses() const +const ClassSDict *ClassDefImpl::innerClasses() const { return m_impl->innerClasses; } -const FileList &ClassDef::usedFiles() const +const FileList &ClassDefImpl::usedFiles() const { return m_impl->files; } -const ArgumentList *ClassDef::typeConstraints() const +const ArgumentList *ClassDefImpl::typeConstraints() const { return m_impl->typeConstraints; } -const ExampleSDict *ClassDef::exampleList() const +const ExampleSDict *ClassDefImpl::exampleList() const { return m_impl->exampleSDict; } -bool ClassDef::subGrouping() const +bool ClassDefImpl::subGrouping() const { return m_impl->subGrouping; } -bool ClassDef::isSliceLocal() const +bool ClassDefImpl::isSliceLocal() const { return m_impl->spec&Entry::Local; } -void ClassDef::setName(const char *name) +void ClassDefImpl::setName(const char *name) { m_impl->isAnonymous = QCString(name).find('@')!=-1; - Definition::setName(name); + DefinitionImpl::setName(name); } -void ClassDef::setMetaData(const char *md) +void ClassDefImpl::setMetaData(const char *md) { m_impl->metaData = md; } -bool ClassDef::isAnonymous() const +bool ClassDefImpl::isAnonymous() const { return m_impl->isAnonymous; } -QCString ClassDef::collaborationGraphFileName() const +QCString ClassDefImpl::collaborationGraphFileName() const { return m_impl->collabFileName; } -QCString ClassDef::inheritanceGraphFileName() const +QCString ClassDefImpl::inheritanceGraphFileName() const { return m_impl->inheritFileName; } diff --git a/src/classdef.h b/src/classdef.h index 1360612..58a3dee 100644 --- a/src/classdef.h +++ b/src/classdef.h @@ -50,13 +50,12 @@ class ClassDefImpl; class ArgumentList; class FTextStream; -/** A class representing of a compound symbol. +/** A abstract class representing of a compound symbol. * * A compound can be a class, struct, union, interface, service, singleton, * or exception. - * \note This class should be renamed to CompoundDef */ -class ClassDef : public Definition +class ClassDef : virtual public Definition { public: /** The various compound types */ @@ -71,398 +70,341 @@ class ClassDef : public Definition Singleton, //=Entry::CLASS_SEC }; - /** Creates a new compound definition. - * \param fileName full path and file name in which this compound was - * found. - * \param startLine line number where the definition of this compound - * starts. - * \param startColumn column number where the definition of this compound - * starts. - * \param name the name of this compound (including scope) - * \param ct the kind of Compound - * \param ref the tag file from which this compound is extracted - * or 0 if the compound doesn't come from a tag file - * \param fName the file name as found in the tag file. - * This overwrites the file that doxygen normally - * generates based on the compound type & name. - * \param isSymbol If TRUE this class name is added as a publicly - * visible (and referencable) symbol. - * \param isJavaEnum If TRUE this class is actually a Java enum. - * I didn't add this to CompoundType to avoid having - * to adapt all translators. - */ - ClassDef(const char *fileName,int startLine,int startColumn, - const char *name,CompoundType ct, - const char *ref=0,const char *fName=0, - bool isSymbol=TRUE,bool isJavaEnum=FALSE); - /** Destroys a compound definition. */ - ~ClassDef(); + virtual ~ClassDef() {} //----------------------------------------------------------------------------------- // --- getters //----------------------------------------------------------------------------------- /** Used for RTTI, this is a class */ - DefType definitionType() const { return TypeClass; } + virtual DefType definitionType() const = 0; /** Returns the unique base name (without extension) of the class's file on disk */ - QCString getOutputFileBase() const; - QCString getInstanceOutputFileBase() const; + virtual QCString getOutputFileBase() const = 0; + virtual QCString getInstanceOutputFileBase() const = 0; /** Returns the base name for the source code file */ - QCString getSourceFileBase() const; + virtual QCString getSourceFileBase() const = 0; /** If this class originated from a tagfile, this will return the tag file reference */ - QCString getReference() const; + virtual QCString getReference() const = 0; /** Returns TRUE if this class is imported via a tag file */ - bool isReference() const; + virtual bool isReference() const = 0; /** Returns TRUE if this is a local class definition, see EXTRACT_LOCAL_CLASSES */ - bool isLocal() const; + virtual bool isLocal() const = 0; /** returns the classes nested into this class */ - ClassSDict *getClassSDict() const; + virtual ClassSDict *getClassSDict() const = 0; /** returns TRUE if this class has documentation */ - bool hasDocumentation() const; + virtual bool hasDocumentation() const = 0; /** returns TRUE if this class has a non-empty detailed description */ - bool hasDetailedDescription() const; - + virtual bool hasDetailedDescription() const = 0; + /** returns the file name to use for the collaboration graph */ - QCString collaborationGraphFileName() const; + virtual QCString collaborationGraphFileName() const = 0; /** returns the file name to use for the inheritance graph */ - QCString inheritanceGraphFileName() const; + virtual QCString inheritanceGraphFileName() const = 0; /** Returns the name as it is appears in the documentation */ - QCString displayName(bool includeScope=TRUE) const; + virtual QCString displayName(bool includeScope=TRUE) const = 0; /** Returns the type of compound this is, i.e. class/struct/union/.. */ - CompoundType compoundType() const; + virtual CompoundType compoundType() const = 0; /** Returns the type of compound as a string */ - QCString compoundTypeString() const; + virtual QCString compoundTypeString() const = 0; /** Returns the list of base classes from which this class directly * inherits. */ - BaseClassList *baseClasses() const; - + virtual BaseClassList *baseClasses() const = 0; + /** Returns the list of sub classes that directly derive from this class */ - BaseClassList *subClasses() const; + virtual BaseClassList *subClasses() const = 0; - /** Returns a dictionary of all members. This includes any inherited + /** Returns a dictionary of all members. This includes any inherited * members. Members are sorted alphabetically. - */ - MemberNameInfoSDict *memberNameInfoSDict() const; + */ + virtual MemberNameInfoSDict *memberNameInfoSDict() const = 0; - /** Return the protection level (Public,Protected,Private) in which + /** Return the protection level (Public,Protected,Private) in which * this compound was found. */ - Protection protection() const; + virtual Protection protection() const = 0; /** returns TRUE iff a link is possible to this item within this project. */ - bool isLinkableInProject() const; + virtual bool isLinkableInProject() const = 0; - /** return TRUE iff a link to this class is possible (either within + /** return TRUE iff a link to this class is possible (either within * this project, or as a cross-reference to another project). */ - bool isLinkable() const; + virtual bool isLinkable() const = 0; /** the class is visible in a class diagram, or class hierarchy */ - bool isVisibleInHierarchy() const; - + virtual bool isVisibleInHierarchy() const = 0; + /** show this class in the declaration section of its parent? */ - bool visibleInParentsDeclList() const; + virtual bool visibleInParentsDeclList() const = 0; /** Returns the template arguments of this class * Will return 0 if not applicable. */ - ArgumentList *templateArguments() const; + virtual ArgumentList *templateArguments() const = 0; /** Returns the namespace this compound is in, or 0 if it has a global * scope. */ - NamespaceDef *getNamespaceDef() const; + virtual NamespaceDef *getNamespaceDef() const = 0; /** Returns the file in which this compound's definition can be found. * Should not return 0 (but it might be a good idea to check anyway). */ - FileDef *getFileDef() const; + virtual FileDef *getFileDef() const = 0; - /** Returns the Java package this class is in or 0 if not applicable. - */ + /** Returns the Java package this class is in or 0 if not applicable. + */ + + virtual MemberDef *getMemberByName(const QCString &) const = 0; - MemberDef *getMemberByName(const QCString &) const; - /** Returns TRUE iff \a bcd is a direct or indirect base class of this * class. This function will recursively traverse all branches of the * inheritance tree. */ - bool isBaseClass(ClassDef *bcd,bool followInstances,int level=0) const; + virtual bool isBaseClass(const ClassDef *bcd,bool followInstances,int level=0) const = 0; /** Returns TRUE iff \a bcd is a direct or indirect sub class of this * class. */ - bool isSubClass(ClassDef *bcd,int level=0) const; + virtual bool isSubClass(ClassDef *bcd,int level=0) const = 0; /** returns TRUE iff \a md is a member of this class or of the - * the public/protected members of a base class + * the public/protected members of a base class */ - bool isAccessibleMember(MemberDef *md) const; + virtual bool isAccessibleMember(const MemberDef *md) const = 0; /** Returns a sorted dictionary with all template instances found for * this template class. Returns 0 if not a template or no instances. */ - QDict<ClassDef> *getTemplateInstances() const; + virtual QDict<ClassDef> *getTemplateInstances() const = 0; /** Returns the template master of which this class is an instance. * Returns 0 if not applicable. */ - ClassDef *templateMaster() const; + virtual ClassDef *templateMaster() const = 0; /** Returns TRUE if this class is a template */ - bool isTemplate() const; + virtual bool isTemplate() const = 0; - IncludeInfo *includeInfo() const; - - UsesClassDict *usedImplementationClasses() const; + virtual IncludeInfo *includeInfo() const = 0; - UsesClassDict *usedByImplementationClasses() const; + virtual UsesClassDict *usedImplementationClasses() const = 0; - UsesClassDict *usedInterfaceClasses() const; + virtual UsesClassDict *usedByImplementationClasses() const = 0; - ConstraintClassDict *templateTypeConstraints() const; + virtual UsesClassDict *usedInterfaceClasses() const = 0; - bool isTemplateArgument() const; + virtual ConstraintClassDict *templateTypeConstraints() const = 0; + + virtual bool isTemplateArgument() const = 0; /** Returns the definition of a nested compound if * available, or 0 otherwise. * @param name The name of the nested compound */ - virtual Definition *findInnerCompound(const char *name) const; + virtual Definition *findInnerCompound(const char *name) const = 0; /** Returns the template parameter lists that form the template * declaration of this class. - * - * Example: <code>template<class T> class TC {};</code> + * + * Example: <code>template<class T> class TC {} = 0;</code> * will return a list with one ArgumentList containing one argument * with type="class" and name="T". */ - void getTemplateParameterLists(QList<ArgumentList> &lists) const; + virtual void getTemplateParameterLists(QList<ArgumentList> &lists) const = 0; - QCString qualifiedNameWithTemplateParameters( - QList<ArgumentList> *actualParams=0,int *actualParamIndex=0) const; + virtual QCString qualifiedNameWithTemplateParameters( + QList<ArgumentList> *actualParams=0,int *actualParamIndex=0) const = 0; /** Returns TRUE if there is at least one pure virtual member in this * class. */ - bool isAbstract() const; + virtual bool isAbstract() const = 0; /** Returns TRUE if this class is implemented in Objective-C */ - bool isObjectiveC() const; + virtual bool isObjectiveC() const = 0; /** Returns TRUE if this class is implemented in Fortran */ - bool isFortran() const; + virtual bool isFortran() const = 0; /** Returns TRUE if this class is implemented in C# */ - bool isCSharp() const; + virtual bool isCSharp() const = 0; /** Returns TRUE if this class is marked as final */ - bool isFinal() const; + virtual bool isFinal() const = 0; /** Returns TRUE if this class is marked as sealed */ - bool isSealed() const; + virtual bool isSealed() const = 0; /** Returns TRUE if this class is marked as published */ - bool isPublished() const; + virtual bool isPublished() const = 0; /** Returns TRUE if this class represents an Objective-C 2.0 extension (nameless category) */ - bool isExtension() const; + virtual bool isExtension() const = 0; /** Returns TRUE if this class represents a forward declaration of a template class */ - bool isForwardDeclared() const; + virtual bool isForwardDeclared() const = 0; + + /** Returns TRUE if this class represents an interface */ + virtual bool isInterface() const = 0; /** Returns the class of which this is a category (Objective-C only) */ - ClassDef *categoryOf() const; + virtual ClassDef *categoryOf() const = 0; /** Returns the name of the class including outer classes, but not * including namespaces. */ - QCString className() const; + virtual QCString className() const = 0; /** Returns the members in the list identified by \a lt */ - MemberList *getMemberList(MemberListType lt) const; + virtual MemberList *getMemberList(MemberListType lt) const = 0; /** Returns the list containing the list of members sorted per type */ - const QList<MemberList> &getMemberLists() const; + virtual const QList<MemberList> &getMemberLists() const = 0; /** Returns the member groups defined for this class */ - MemberGroupSDict *getMemberGroupSDict() const; + virtual MemberGroupSDict *getMemberGroupSDict() const = 0; - QDict<int> *getTemplateBaseClassNames() const; + virtual QDict<int> *getTemplateBaseClassNames() const = 0; - ClassDef *getVariableInstance(const char *templSpec); + virtual ClassDef *getVariableInstance(const char *templSpec) = 0; - bool isUsedOnly() const; + virtual bool isUsedOnly() const = 0; - QCString anchor() const; - bool isEmbeddedInOuterScope() const; + virtual QCString anchor() const = 0; + virtual bool isEmbeddedInOuterScope() const = 0; - bool isSimple() const; + virtual bool isSimple() const = 0; - const ClassList *taggedInnerClasses() const; - ClassDef *tagLessReference() const; + virtual const ClassList *taggedInnerClasses() const = 0; + virtual ClassDef *tagLessReference() const = 0; - MemberDef *isSmartPointer() const; + virtual MemberDef *isSmartPointer() const = 0; - bool isJavaEnum() const; + virtual bool isJavaEnum() const = 0; - bool isGeneric() const; - bool isAnonymous() const; - const ClassSDict *innerClasses() const; - QCString title() const; + virtual bool isGeneric() const = 0; + virtual bool isAnonymous() const = 0; + virtual const ClassSDict *innerClasses() const = 0; + virtual QCString title() const = 0; - QCString generatedFromFiles() const; - const FileList &usedFiles() const; + virtual QCString generatedFromFiles() const = 0; + virtual const FileList &usedFiles() const = 0; - const ArgumentList *typeConstraints() const; - const ExampleSDict *exampleList() const; - bool hasExamples() const; - QCString getMemberListFileName() const; - bool subGrouping() const; + virtual const ArgumentList *typeConstraints() const = 0; + virtual const ExampleSDict *exampleList() const = 0; + virtual bool hasExamples() const = 0; + virtual QCString getMemberListFileName() const = 0; + virtual bool subGrouping() const = 0; - bool isSliceLocal() const; + virtual bool isSliceLocal() const = 0; //----------------------------------------------------------------------------------- // --- setters ---- //----------------------------------------------------------------------------------- - void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0); - void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0); - void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force); - void insertMember(MemberDef *); - void insertUsedFile(FileDef *); - bool addExample(const char *anchor,const char *name, const char *file); - void mergeCategory(ClassDef *category); - void setNamespace(NamespaceDef *nd); - void setFileDef(FileDef *fd); - void setSubGrouping(bool enabled); - void setProtection(Protection p); - void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs); - void addInnerCompound(Definition *d); - ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, - const QCString &templSpec,bool &freshInstance); - void addUsedClass(ClassDef *cd,const char *accessName,Protection prot); - void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot); - void setIsStatic(bool b); - void setCompoundType(CompoundType t); - void setClassName(const char *name); - void setClassSpecifier(uint64 spec); - - void setTemplateArguments(ArgumentList *al); - void setTemplateBaseClassNames(QDict<int> *templateNames); - void setTemplateMaster(ClassDef *tm); - void setTypeConstraints(ArgumentList *al); - void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec); - void makeTemplateArgument(bool b=TRUE); - void setCategoryOf(ClassDef *cd); - void setUsedOnly(bool b); - - void addTaggedInnerClass(ClassDef *cd); - void setTagLessReference(ClassDef *cd); - void setName(const char *name); - - void setMetaData(const char *md); + virtual void insertBaseClass(ClassDef *,const char *name,Protection p,Specifier s,const char *t=0) = 0; + virtual void insertSubClass(ClassDef *,Protection p,Specifier s,const char *t=0) = 0; + virtual void setIncludeFile(FileDef *fd,const char *incName,bool local,bool force) = 0; + virtual void insertMember(MemberDef *) = 0; + virtual void insertUsedFile(FileDef *) = 0; + virtual bool addExample(const char *anchor,const char *name, const char *file) = 0; + virtual void mergeCategory(ClassDef *category) = 0; + virtual void setNamespace(NamespaceDef *nd) = 0; + virtual void setFileDef(FileDef *fd) = 0; + virtual void setSubGrouping(bool enabled) = 0; + virtual void setProtection(Protection p) = 0; + virtual void setGroupDefForAllMembers(GroupDef *g,Grouping::GroupPri_t pri,const QCString &fileName,int startLine,bool hasDocs) = 0; + virtual void addInnerCompound(Definition *d) = 0; + virtual ClassDef *insertTemplateInstance(const QCString &fileName,int startLine,int startColumn, + const QCString &templSpec,bool &freshInstance) = 0; + virtual void addUsedClass(ClassDef *cd,const char *accessName,Protection prot) = 0; + virtual void addUsedByClass(ClassDef *cd,const char *accessName,Protection prot) = 0; + virtual void setIsStatic(bool b) = 0; + virtual void setCompoundType(CompoundType t) = 0; + virtual void setClassName(const char *name) = 0; + virtual void setClassSpecifier(uint64 spec) = 0; + + virtual void setTemplateArguments(ArgumentList *al) = 0; + virtual void setTemplateBaseClassNames(QDict<int> *templateNames) = 0; + virtual void setTemplateMaster(ClassDef *tm) = 0; + virtual void setTypeConstraints(ArgumentList *al) = 0; + virtual void addMembersToTemplateInstance(ClassDef *cd,const char *templSpec) = 0; + virtual void makeTemplateArgument(bool b=TRUE) = 0; + virtual void setCategoryOf(ClassDef *cd) = 0; + virtual void setUsedOnly(bool b) = 0; + + virtual void addTaggedInnerClass(ClassDef *cd) = 0; + virtual void setTagLessReference(ClassDef *cd) = 0; + virtual void setName(const char *name) = 0; + + virtual void setMetaData(const char *md) = 0; //----------------------------------------------------------------------------------- // --- actions ---- //----------------------------------------------------------------------------------- - void findSectionsInDocumentation(); - void addMembersToMemberGroup(); - void addListReferences(); - void addTypeConstraints(); - void computeAnchors(); - void mergeMembers(); - void sortMemberLists(); - void distributeMemberGroupDocumentation(); - void writeDocumentation(OutputList &ol); - void writeDocumentationForInnerClasses(OutputList &ol); - void writeMemberPages(OutputList &ol); - void writeMemberList(OutputList &ol); - void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, - ClassDef *inheritedFrom,const char *inheritId); - void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const; - void writeSummaryLinks(OutputList &ol); - void reclassifyMember(MemberDef *md,MemberType t); - void writeInlineDocumentation(OutputList &ol); - void writeDeclarationLink(OutputList &ol,bool &found, - const char *header,bool localNames); - void removeMemberFromLists(MemberDef *md); - void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, - ClassDef *inheritedFrom,const QCString &inheritId); - int countMembersIncludingGrouped(MemberListType lt,ClassDef *inheritedFrom,bool additional); - int countInheritanceNodes(); - void writeTagFile(FTextStream &); - - bool visited; - - protected: - void addUsedInterfaceClasses(MemberDef *md,const char *typeStr); - bool hasNonReferenceSuperClass() const; - void showUsedFiles(OutputList &ol); - - private: - void writeDocumentationContents(OutputList &ol,const QCString &pageTitle); - void internalInsertMember(MemberDef *md,Protection prot,bool addToAllList); - void addMemberToList(MemberListType lt,MemberDef *md,bool isBrief); - MemberList *createMemberList(MemberListType lt); - 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,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); - void writeBriefDescription(OutputList &ol,bool exampleFlag); - void writeDetailedDescription(OutputList &ol,const QCString &pageType,bool exampleFlag, - const QCString &title,const QCString &anchor=QCString()); - void writeIncludeFiles(OutputList &ol); - void writeIncludeFilesForSlice(OutputList &ol); - //void writeAllMembersLink(OutputList &ol); - void writeInheritanceGraph(OutputList &ol); - void writeCollaborationGraph(OutputList &ol); - void writeMemberGroups(OutputList &ol,bool showInline=FALSE); - void writeNestedClasses(OutputList &ol,const QCString &title); - void writeInlineClasses(OutputList &ol); - void startMemberDeclarations(OutputList &ol); - void endMemberDeclarations(OutputList &ol); - void startMemberDocumentation(OutputList &ol); - void endMemberDocumentation(OutputList &ol); - void writeAuthorSection(OutputList &ol); - void writeMoreLink(OutputList &ol,const QCString &anchor); - void writeDetailedDocumentationBody(OutputList &ol); - - 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); - QCString includeStatement() const; - void addTypeConstraint(const QCString &typeConstraint,const QCString &type); - - ClassDefImpl *m_impl; + virtual void findSectionsInDocumentation() = 0; + virtual void addMembersToMemberGroup() = 0; + virtual void addListReferences() = 0; + virtual void addTypeConstraints() = 0; + virtual void computeAnchors() = 0; + virtual void mergeMembers() = 0; + virtual void sortMemberLists() = 0; + virtual void distributeMemberGroupDocumentation() = 0; + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeDocumentationForInnerClasses(OutputList &ol) = 0; + virtual void writeMemberPages(OutputList &ol) = 0; + virtual void writeMemberList(OutputList &ol) = 0; + virtual void writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, + ClassDef *inheritedFrom,const char *inheritId) = 0; + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *md) const = 0; + virtual void writeSummaryLinks(OutputList &ol) = 0; + virtual void reclassifyMember(MemberDef *md,MemberType t) = 0; + virtual void writeInlineDocumentation(OutputList &ol) = 0; + virtual void writeDeclarationLink(OutputList &ol,bool &found, + const char *header,bool localNames) = 0; + virtual void removeMemberFromLists(MemberDef *md) = 0; + virtual void addGroupedInheritedMembers(OutputList &ol,MemberListType lt, + ClassDef *inheritedFrom,const QCString &inheritId) = 0; + virtual int countMembersIncludingGrouped(MemberListType lt,ClassDef *inheritedFrom,bool additional) = 0; + virtual int countInheritanceNodes() = 0; + virtual void writeTagFile(FTextStream &) = 0; + + virtual void setVisited(bool visited) = 0; + virtual bool isVisited() const = 0; + virtual bool hasNonReferenceSuperClass() const = 0; + virtual int countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, + int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) = 0; + virtual 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,bool showAlways=FALSE, + QPtrDict<void> *visitedClasses=0) = 0; }; +/** Factory method to create a new ClassDef object */ +ClassDef *createClassDef( + const char *fileName,int startLine,int startColumn, + const char *name,ClassDef::CompoundType ct, + const char *ref=0,const char *fName=0, + bool isSymbol=TRUE,bool isJavaEnum=FALSE); + //------------------------------------------------------------------------ /** Class that contains information about a usage relation. @@ -841,7 +841,7 @@ static void updateCallContextForSmartPointer() Definition *d = g_theCallContext.getScope(); //printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : "<none>"); MemberDef *md; - if (d && d->definitionType()==Definition::TypeClass && (md=((ClassDef*)d)->isSmartPointer())) + if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast<ClassDef*>(d))->isSmartPointer())) { ClassDef *ncd = stripClassName(md->typeString(),md->getOuterScope()); if (ncd) @@ -1176,7 +1176,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,Definition *def,cons { if (def && def->definitionType()==Definition::TypeClass) { - ClassDef *cd = (ClassDef*)def; + ClassDef *cd = dynamic_cast<ClassDef*>(def); MemberDef *xmd = cd->getMemberByName(memName); //printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd); if (xmd) @@ -1197,7 +1197,7 @@ static bool generateClassMemberLink(CodeOutputInterface &ol,Definition *def,cons } else if (def && def->definitionType()==Definition::TypeNamespace) { - NamespaceDef *nd = (NamespaceDef*)def; + NamespaceDef *nd = dynamic_cast<NamespaceDef*>(def); //printf("Looking for %s inside namespace %s\n",memName,nd->name().data()); Definition *innerDef = nd->findInnerCompound(memName); if (innerDef) @@ -1483,7 +1483,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (g_currentDefinition && g_currentDefinition->definitionType()==Definition::TypeClass) { - ctx->objectType = (ClassDef *)g_currentDefinition; + ctx->objectType = dynamic_cast<ClassDef *>(g_currentDefinition); } } else @@ -1507,7 +1507,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (g_currentDefinition && g_currentDefinition->definitionType()==Definition::TypeClass) { - ctx->objectVar = ((ClassDef *)g_currentDefinition)->getMemberByName(ctx->objectTypeOrName); + ctx->objectVar = (dynamic_cast<ClassDef *>(g_currentDefinition))->getMemberByName(ctx->objectTypeOrName); //printf(" ctx->objectVar=%p\n",ctx->objectVar); if (ctx->objectVar) { @@ -1589,7 +1589,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (g_currentDefinition && g_currentDefinition->definitionType()==Definition::TypeClass) { - ctx->objectType = (ClassDef *)g_currentDefinition; + ctx->objectType = dynamic_cast<ClassDef *>(g_currentDefinition); if (ctx->objectType->categoryOf()) { ctx->objectType = ctx->objectType->categoryOf(); @@ -1608,7 +1608,7 @@ static void writeObjCMethodCall(ObjCCallCtx *ctx) if (g_currentDefinition && g_currentDefinition->definitionType()==Definition::TypeClass) { - ClassDef *cd = (ClassDef *)g_currentDefinition; + ClassDef *cd = dynamic_cast<ClassDef *>(g_currentDefinition); if (cd->categoryOf()) { cd = cd->categoryOf(); @@ -2295,7 +2295,7 @@ RAWEND ")"[^ \t\(\)\\]{0,16}\" if (getResolvedClass(g_currentDefinition,g_sourceFileDef,g_curClassName)==0) { DBG_CTX((stderr,"Adding new class %s\n",g_curClassName.data())); - ClassDef *ncd=new ClassDef("<code>",1,1, + ClassDef *ncd=createClassDef("<code>",1,1, g_curClassName,ClassDef::Class,0,0,FALSE); g_codeClassSDict->append(g_curClassName,ncd); // insert base classes. @@ -3769,7 +3769,7 @@ void parseCCode(CodeOutputInterface &od,const char *className,const QCString &s, if (fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",(exName?exName:"generated")); + g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } g_insideObjC = lang==SrcLangExt_ObjC; diff --git a/src/context.cpp b/src/context.cpp index 6ddc141..7b7c725 100644 --- a/src/context.cpp +++ b/src/context.cpp @@ -1582,9 +1582,9 @@ class DefinitionContext { fillPath(outerScope,list); } - else if (type==Definition::TypeFile && ((const FileDef*)def)->getDirDef()) + else if (type==Definition::TypeFile && (dynamic_cast<const FileDef*>(def))->getDirDef()) { - fillPath(((const FileDef*)def)->getDirDef(),list); + fillPath((dynamic_cast<const FileDef*>(def))->getDirDef(),list); } list->append(NavPathElemContext::alloc(def)); } @@ -1598,9 +1598,9 @@ class DefinitionContext { fillPath(m_def->getOuterScope(),list); } - else if (m_def->definitionType()==Definition::TypeFile && ((const FileDef *)m_def)->getDirDef()) + else if (m_def->definitionType()==Definition::TypeFile && (dynamic_cast<const FileDef *>(m_def))->getDirDef()) { - fillPath(((const FileDef *)m_def)->getDirDef(),list); + fillPath((dynamic_cast<const FileDef *>(m_def))->getDirDef(),list); } cache.navPath.reset(list); } @@ -2374,7 +2374,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> { addTemplateDecls(parent,tl); } - ClassDef *cd=(ClassDef *)d; + ClassDef *cd=dynamic_cast<ClassDef *>(d); if (cd->templateArguments()) { ArgumentListContext *al = ArgumentListContext::alloc(cd->templateArguments(),cd,relPathAsString()); @@ -6278,7 +6278,7 @@ class NestingNodeContext::Private { if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass) { - m_cache.classContext.reset(ClassContext::alloc((ClassDef*)m_def)); + m_cache.classContext.reset(ClassContext::alloc(dynamic_cast<ClassDef*>(m_def))); } if (m_cache.classContext) { @@ -6293,7 +6293,7 @@ class NestingNodeContext::Private { if (!m_cache.namespaceContext && m_def->definitionType()==Definition::TypeNamespace) { - m_cache.namespaceContext.reset(NamespaceContext::alloc((NamespaceDef*)m_def)); + m_cache.namespaceContext.reset(NamespaceContext::alloc(dynamic_cast<NamespaceDef*>(m_def))); } if (m_cache.namespaceContext) { @@ -6308,7 +6308,7 @@ class NestingNodeContext::Private { if (!m_cache.dirContext && m_def->definitionType()==Definition::TypeDir) { - m_cache.dirContext.reset(DirContext::alloc((DirDef*)m_def)); + m_cache.dirContext.reset(DirContext::alloc(dynamic_cast<DirDef*>(m_def))); } if (m_cache.dirContext) { @@ -6323,7 +6323,7 @@ class NestingNodeContext::Private { if (!m_cache.fileContext && m_def->definitionType()==Definition::TypeFile) { - m_cache.fileContext.reset(FileContext::alloc((FileDef*)m_def)); + m_cache.fileContext.reset(FileContext::alloc(dynamic_cast<FileDef*>(m_def))); } if (m_cache.fileContext) { @@ -6338,7 +6338,7 @@ class NestingNodeContext::Private { if (!m_cache.pageContext && m_def->definitionType()==Definition::TypePage) { - m_cache.pageContext.reset(PageContext::alloc((PageDef*)m_def,FALSE,FALSE)); + m_cache.pageContext.reset(PageContext::alloc(dynamic_cast<PageDef*>(m_def),FALSE,FALSE)); } if (m_cache.pageContext) { @@ -6353,7 +6353,7 @@ class NestingNodeContext::Private { if (!m_cache.moduleContext && m_def->definitionType()==Definition::TypeGroup) { - m_cache.moduleContext.reset(ModuleContext::alloc((GroupDef*)m_def)); + m_cache.moduleContext.reset(ModuleContext::alloc(dynamic_cast<GroupDef*>(m_def))); } if (m_cache.moduleContext) { @@ -6425,14 +6425,14 @@ class NestingNodeContext::Private void addClasses(bool inherit, bool hideSuper) { - ClassDef *cd = m_def->definitionType()==Definition::TypeClass ? (ClassDef*)m_def : 0; + ClassDef *cd = dynamic_cast<ClassDef*>(m_def); if (cd && inherit) { - bool hasChildren = !cd->visited && !hideSuper && classHasVisibleChildren(cd); + bool hasChildren = !cd->isVisited() && !hideSuper && classHasVisibleChildren(cd); if (hasChildren) { - bool wasVisited=cd->visited; - cd->visited=TRUE; + bool wasVisited=cd->isVisited(); + cd->setVisited(TRUE); if (cd->getLanguage()==SrcLangExt_VHDL) { m_children->addDerivedClasses(cd->baseClasses(),wasVisited); @@ -6453,7 +6453,7 @@ class NestingNodeContext::Private } void addNamespaces(bool addClasses) { - NamespaceDef *nd = m_def->definitionType()==Definition::TypeNamespace ? (NamespaceDef*)m_def : 0; + NamespaceDef *nd = dynamic_cast<NamespaceDef*>(m_def); if (nd && nd->getNamespaceSDict()) { m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses); @@ -6465,7 +6465,7 @@ class NestingNodeContext::Private } void addDirFiles() { - DirDef *dd = m_def->definitionType()==Definition::TypeDir ? (DirDef*)m_def : 0; + DirDef *dd = dynamic_cast<DirDef*>(m_def); if (dd) { m_children->addDirs(dd->subDirs()); @@ -6477,7 +6477,7 @@ class NestingNodeContext::Private } void addPages() { - PageDef *pd = m_def->definitionType()==Definition::TypePage ? (PageDef*)m_def : 0; + PageDef *pd = dynamic_cast<PageDef*>(m_def); if (pd && pd->getSubPages()) { m_children->addPages(*pd->getSubPages(),FALSE); @@ -6485,7 +6485,7 @@ class NestingNodeContext::Private } void addModules() { - GroupDef *gd = m_def->definitionType()==Definition::TypeGroup ? (GroupDef*)m_def : 0; + GroupDef *gd = dynamic_cast<GroupDef*>(m_def); if (gd && gd->getSubGroups()) { m_children->addModules(*gd->getSubGroups()); @@ -6744,7 +6744,7 @@ class NestingContext::Private : public GenericNodeListContext if (cd->isVisibleInHierarchy()) // should it be visible { // new root level class - NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,cd->visited); + NestingNodeContext *nnc = NestingNodeContext::alloc(m_parent,cd,m_index,m_level,TRUE,TRUE,cd->isVisited()); append(nnc); m_index++; } @@ -7805,11 +7805,11 @@ class NavPathElemContext::Private QCString text = m_def->localName(); if (type==Definition::TypeGroup) { - text = ((const GroupDef*)m_def)->groupTitle(); + text = (dynamic_cast<const GroupDef*>(m_def))->groupTitle(); } - else if (type==Definition::TypePage && (((const PageDef*)m_def)->hasTitle())) + else if (type==Definition::TypePage && ((dynamic_cast<const PageDef*>(m_def))->hasTitle())) { - text = ((const PageDef*)m_def)->title(); + text = (dynamic_cast<const PageDef*>(m_def))->title(); } else if (type==Definition::TypeClass) { @@ -9102,7 +9102,7 @@ class MemberListInfoContext::Private m_def->definitionType()==Definition::TypeClass) { InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc(); - ctx->addMemberList((ClassDef*)m_def,m_memberList->listType(),m_title,FALSE); + ctx->addMemberList(dynamic_cast<ClassDef*>(m_def),m_memberList->listType(),m_title,FALSE); m_cache.inherited.reset(ctx); } if (m_cache.inherited) @@ -9614,8 +9614,7 @@ class SymbolContext::Private const Definition *prev = m_prevDef; const Definition *nextScope = next ? next->getOuterScope() : 0; const Definition *prevScope = prev ? prev->getOuterScope() : 0; - bool isMemberDef = m_def->definitionType()==Definition::TypeMember; - const MemberDef *md = isMemberDef ? (const MemberDef*)m_def : 0; + const MemberDef *md = dynamic_cast<const MemberDef*>(m_def); bool isFunctionLike = md && (md->isFunction() || md->isSlot() || md->isSignal()); bool overloadedFunction = isFunctionLike && ((prevScope!=0 && scope==prevScope) || (scope && scope==nextScope)); @@ -10300,7 +10299,7 @@ void generateOutputViaTemplate() else { // TODO: for LaTeX output index should be main... => solve in template - Doxygen::mainPage = new PageDef("[generated]",1,"index","",theTranslator->trMainPage()); + Doxygen::mainPage = createPageDef("[generated]",1,"index","",theTranslator->trMainPage()); Doxygen::mainPage->setFileName("index"); SharedPtr<PageContext> mainPage(PageContext::alloc(Doxygen::mainPage,TRUE,FALSE)); ctx->set("mainPage",mainPage.get()); diff --git a/src/definition.cpp b/src/definition.cpp index a649700..28dfb47 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -22,7 +22,7 @@ #include <stdlib.h> #include <assert.h> #include "config.h" -#include "definition.h" +#include "definitionimpl.h" #include "doxygen.h" #include "language.h" #include "message.h" @@ -44,18 +44,14 @@ #include "pagedef.h" #include "bufstr.h" -#define START_MARKER 0x4445465B // DEF[ -#define END_MARKER 0x4445465D // DEF] - //----------------------------------------------------------------------------------------- - -/** Private data associated with a Symbol Definition object. */ -class DefinitionImpl +/** Private data associated with a Symbol DefinitionImpl object. */ +class DefinitionImpl::IMPL { public: - DefinitionImpl(); - ~DefinitionImpl(); + IMPL(); + ~IMPL(); void init(const char *df, const char *n); void setDefFileName(const QCString &df); @@ -90,9 +86,16 @@ class DefinitionImpl SrcLangExt lang; QCString id; // clang unique id + + QCString name; + bool isSymbol; + QCString symbolName; + int defLine; + int defColumn; + Cookie *cookie; }; -DefinitionImpl::DefinitionImpl() +DefinitionImpl::IMPL::IMPL() : sectionDict(0), sourceRefByDict(0), sourceRefsDict(0), xrefListItems(0), partOfGroups(0), details(0), inbodyDocs(0), brief(0), body(0), hidden(FALSE), isArtificial(FALSE), @@ -100,7 +103,7 @@ DefinitionImpl::DefinitionImpl() { } -DefinitionImpl::~DefinitionImpl() +DefinitionImpl::IMPL::~IMPL() { delete sectionDict; delete sourceRefByDict; @@ -113,7 +116,7 @@ DefinitionImpl::~DefinitionImpl() delete inbodyDocs; } -void DefinitionImpl::setDefFileName(const QCString &df) +void DefinitionImpl::IMPL::setDefFileName(const QCString &df) { defFileName = df; int lastDot = defFileName.findRev('.'); @@ -123,7 +126,7 @@ void DefinitionImpl::setDefFileName(const QCString &df) } } -void DefinitionImpl::init(const char *df, const char *n) +void DefinitionImpl::IMPL::init(const char *df, const char *n) { setDefFileName(df); QCString name = n; @@ -151,13 +154,14 @@ void DefinitionImpl::init(const char *df, const char *n) hidden = FALSE; isArtificial = FALSE; lang = SrcLangExt_Unknown; + cookie = 0; } -void Definition::setDefFile(const QCString &df,int defLine,int defCol) +void DefinitionImpl::setDefFile(const QCString &df,int defLine,int defCol) { m_impl->setDefFileName(df); - m_defLine = defLine; - m_defColumn = defCol; + m_impl->defLine = defLine; + m_impl->defColumn = defCol; } //----------------------------------------------------------------------------------------- @@ -219,7 +223,7 @@ static bool matchExcludedSymbols(const char *name) return FALSE; } -void Definition::addToMap(const char *name,Definition *d) +void DefinitionImpl::addToMap(const char *name,Definition *d) { bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); QCString symbolName = name; @@ -266,9 +270,9 @@ void Definition::addToMap(const char *name,Definition *d) } } -void Definition::removeFromMap(Definition *d) +void DefinitionImpl::removeFromMap(Definition *d) { - QCString symbolName = d->m_symbolName; + QCString symbolName = d->_symbolName(); if (!symbolName.isEmpty()) { //printf("******* removing symbol `%s' (%p)\n",symbolName.data(),d); @@ -296,16 +300,16 @@ void Definition::removeFromMap(Definition *d) } } -Definition::Definition(const char *df,int dl,int dc, +DefinitionImpl::DefinitionImpl(const char *df,int dl,int dc, const char *name,const char *b, - const char *d,bool isSymbol) : m_cookie(0) + const char *d,bool isSymbol) { - m_name = name; - m_defLine = dl; - m_defColumn = dc; - m_impl = new DefinitionImpl; + m_impl = new DefinitionImpl::IMPL; + m_impl->name = name; + m_impl->defLine = dl; + m_impl->defColumn = dc; m_impl->init(df,name); - m_isSymbol = isSymbol; + m_impl->isSymbol = isSymbol; if (isSymbol) addToMap(name,this); _setBriefDescription(b,df,dl); _setDocumentation(d,df,dl,TRUE,FALSE); @@ -315,12 +319,9 @@ Definition::Definition(const char *df,int dl,int dc, } } -Definition::Definition(const Definition &d) : DefinitionIntf(), m_cookie(0) +DefinitionImpl::DefinitionImpl(const DefinitionImpl &d) { - m_name = d.m_name; - m_defLine = d.m_defLine; - m_defColumn = d.m_defColumn; - m_impl = new DefinitionImpl; + m_impl = new DefinitionImpl::IMPL; *m_impl = *d.m_impl; m_impl->sectionDict = 0; m_impl->sourceRefByDict = 0; @@ -391,13 +392,12 @@ Definition::Definition(const Definition &d) : DefinitionIntf(), m_cookie(0) m_impl->inbodyDocs = new DocInfo(*d.m_impl->inbodyDocs); } - m_isSymbol = d.m_isSymbol; - if (m_isSymbol) addToMap(m_name,this); + if (m_impl->isSymbol) addToMap(m_impl->name,this); } -Definition::~Definition() +DefinitionImpl::~DefinitionImpl() { - if (m_isSymbol) + if (m_impl->isSymbol) { removeFromMap(this); } @@ -406,33 +406,31 @@ Definition::~Definition() delete m_impl; m_impl=0; } - delete m_cookie; - m_cookie=0; } -void Definition::setName(const char *name) +void DefinitionImpl::setName(const char *name) { if (name==0) return; - m_name = name; + m_impl->name = name; } -void Definition::setId(const char *id) +void DefinitionImpl::setId(const char *id) { if (id==0) return; m_impl->id = id; if (Doxygen::clangUsrMap) { - //printf("Definition::setId '%s'->'%s'\n",id,m_name.data()); + //printf("DefinitionImpl::setId '%s'->'%s'\n",id,m_name.data()); Doxygen::clangUsrMap->insert(id,this); } } -QCString Definition::id() const +QCString DefinitionImpl::id() const { return m_impl->id; } -void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) +void DefinitionImpl::addSectionsToDefinition(QList<SectionInfo> *anchorList) { if (!anchorList) return; //printf("%s: addSectionsToDefinition(%d)\n",name().data(),anchorList->count()); @@ -461,9 +459,9 @@ void Definition::addSectionsToDefinition(QList<SectionInfo> *anchorList) } } -bool Definition::hasSections() const +bool DefinitionImpl::hasSections() const { - //printf("Definition::hasSections(%s) #sections=%d\n",name().data(), + //printf("DefinitionImpl::hasSections(%s) #sections=%d\n",name().data(), // m_impl->sectionDict ? m_impl->sectionDict->count() : 0); if (m_impl->sectionDict==0) return FALSE; SDict<SectionInfo>::Iterator li(*m_impl->sectionDict); @@ -481,10 +479,10 @@ bool Definition::hasSections() const return FALSE; } -void Definition::addSectionsToIndex() +void DefinitionImpl::addSectionsToIndex() { if (m_impl->sectionDict==0) return; - //printf("Definition::addSectionsToIndex()\n"); + //printf("DefinitionImpl::addSectionsToIndex()\n"); SDict<SectionInfo>::Iterator li(*m_impl->sectionDict); SectionInfo *si; int level=1; @@ -534,7 +532,7 @@ void Definition::addSectionsToIndex() } } -void Definition::writeDocAnchorsToTagFile(FTextStream &tagFile) +void DefinitionImpl::writeDocAnchorsToTagFile(FTextStream &tagFile) { if (m_impl->sectionDict) { @@ -558,7 +556,7 @@ void Definition::writeDocAnchorsToTagFile(FTextStream &tagFile) } } -bool Definition::_docsAlreadyAdded(const QCString &doc,QCString &sigList) +bool DefinitionImpl::_docsAlreadyAdded(const QCString &doc,QCString &sigList) { uchar md5_sig[16]; QCString sigStr(33); @@ -580,7 +578,7 @@ bool Definition::_docsAlreadyAdded(const QCString &doc,QCString &sigList) } } -void Definition::_setDocumentation(const char *d,const char *docFile,int docLine, +void DefinitionImpl::_setDocumentation(const char *d,const char *docFile,int docLine, bool stripWhiteSpace,bool atTop) { //printf("%s::setDocumentation(%s,%s,%d,%d)\n",name().data(),d,docFile,docLine,stripWhiteSpace); @@ -626,7 +624,7 @@ void Definition::_setDocumentation(const char *d,const char *docFile,int docLine } } -void Definition::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) +void DefinitionImpl::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) { if (d==0) return; _setDocumentation(d,docFile,docLine,stripWhiteSpace,FALSE); @@ -646,7 +644,7 @@ static bool lastCharIsMultibyte(const QCString &s) return TRUE; } -void Definition::_setBriefDescription(const char *b,const char *briefFile,int briefLine) +void DefinitionImpl::_setBriefDescription(const char *b,const char *briefFile,int briefLine) { static QCString outputLanguage = Config_getEnum(OUTPUT_LANGUAGE); static bool needsDot = outputLanguage!="Japanese" && @@ -677,7 +675,7 @@ void Definition::_setBriefDescription(const char *b,const char *briefFile,int br } else { - //fprintf(stderr,"Definition::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine); + //fprintf(stderr,"DefinitionImpl::setBriefDescription(%s,%s,%d)\n",b,briefFile,briefLine); if (m_impl->brief==0) { m_impl->brief = new BriefInfo; @@ -701,13 +699,13 @@ void Definition::_setBriefDescription(const char *b,const char *briefFile,int br } } -void Definition::setBriefDescription(const char *b,const char *briefFile,int briefLine) +void DefinitionImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) { if (b==0) return; _setBriefDescription(b,briefFile,briefLine); } -void Definition::_setInbodyDocumentation(const char *doc,const char *inbodyFile,int inbodyLine) +void DefinitionImpl::_setInbodyDocumentation(const char *doc,const char *inbodyFile,int inbodyLine) { if (m_impl->inbodyDocs==0) { @@ -725,7 +723,7 @@ void Definition::_setInbodyDocumentation(const char *doc,const char *inbodyFile, } } -void Definition::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) +void DefinitionImpl::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) { if (d==0) return; _setInbodyDocumentation(d,inbodyFile,inbodyLine); @@ -1016,7 +1014,7 @@ bool readCodeFragment(const char *fileName, return found; } -QCString Definition::getSourceFileBase() const +QCString DefinitionImpl::getSourceFileBase() const { ASSERT(definitionType()!=Definition::TypeFile); // file overloads this method QCString fn; @@ -1029,7 +1027,7 @@ QCString Definition::getSourceFileBase() const return fn; } -QCString Definition::getSourceAnchor() const +QCString DefinitionImpl::getSourceAnchor() const { const int maxAnchorStrLen = 20; char anchorStr[maxAnchorStrLen]; @@ -1049,13 +1047,13 @@ QCString Definition::getSourceAnchor() const } /*! Write a reference to the source code defining this definition */ -void Definition::writeSourceDef(OutputList &ol,const char *) +void DefinitionImpl::writeSourceDef(OutputList &ol,const char *) { static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); static bool rtfSourceCode = Config_getBool(RTF_SOURCE_CODE); static bool docbookSourceCode = Config_getBool(DOCBOOK_PROGRAMLISTING); ol.pushGeneratorState(); - //printf("Definition::writeSourceRef %d %p\n",bodyLine,bodyDef); + //printf("DefinitionImpl::writeSourceRef %d %p\n",bodyLine,bodyDef); QCString fn = getSourceFileBase(); if (!fn.isEmpty()) { @@ -1239,7 +1237,7 @@ void Definition::writeSourceDef(OutputList &ol,const char *) ol.popGeneratorState(); } -void Definition::setBodySegment(int bls,int ble) +void DefinitionImpl::setBodySegment(int bls,int ble) { //printf("setBodySegment(%d,%d) for %s\n",bls,ble,name().data()); if (m_impl->body==0) m_impl->body = new BodyInfo; @@ -1247,13 +1245,13 @@ void Definition::setBodySegment(int bls,int ble) m_impl->body->endLine=ble; } -void Definition::setBodyDef(FileDef *fd) +void DefinitionImpl::setBodyDef(FileDef *fd) { if (m_impl->body==0) m_impl->body = new BodyInfo; m_impl->body->fileDef=fd; } -bool Definition::hasSources() const +bool DefinitionImpl::hasSources() const { return m_impl->body && m_impl->body->startLine!=-1 && m_impl->body->endLine>=m_impl->body->startLine && @@ -1261,7 +1259,7 @@ bool Definition::hasSources() const } /*! Write code of this definition into the documentation */ -void Definition::writeInlineCode(OutputList &ol,const char *scopeName) +void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) { static bool inlineSources = Config_getBool(INLINE_SOURCES); ol.pushGeneratorState(); @@ -1306,7 +1304,7 @@ void Definition::writeInlineCode(OutputList &ol,const char *scopeName) /*! Write a reference to the source code fragments in which this * definition is used. */ -void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, +void DefinitionImpl::_writeSourceRefList(OutputList &ol,const char *scopeName, const QCString &text,MemberSDict *members,bool /*funcOnly*/) { static bool latexSourceCode = Config_getBool(LATEX_SOURCE_CODE); @@ -1351,7 +1349,7 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, { name+="()"; } - //Definition *d = md->getOutputFileBase(); + //DefinitionImpl *d = md->getOutputFileBase(); //if (d==Doxygen::globalScope) d=md->getBodyDef(); if (sourceBrowser && !(md->isLinkable() && !refLinkSource) && @@ -1458,17 +1456,17 @@ void Definition::_writeSourceRefList(OutputList &ol,const char *scopeName, ol.popGeneratorState(); } -void Definition::writeSourceReffedBy(OutputList &ol,const char *scopeName) +void DefinitionImpl::writeSourceReffedBy(OutputList &ol,const char *scopeName) { _writeSourceRefList(ol,scopeName,theTranslator->trReferencedBy(),m_impl->sourceRefByDict,FALSE); } -void Definition::writeSourceRefs(OutputList &ol,const char *scopeName) +void DefinitionImpl::writeSourceRefs(OutputList &ol,const char *scopeName) { _writeSourceRefList(ol,scopeName,theTranslator->trReferences(),m_impl->sourceRefsDict,TRUE); } -bool Definition::hasDocumentation() const +bool DefinitionImpl::hasDocumentation() const { static bool extractAll = Config_getBool(EXTRACT_ALL); //static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); @@ -1483,7 +1481,7 @@ bool Definition::hasDocumentation() const return hasDocs; } -bool Definition::hasUserDocumentation() const +bool DefinitionImpl::hasUserDocumentation() const { bool hasDocs = (m_impl->details && !m_impl->details->doc.isEmpty()) || @@ -1493,7 +1491,7 @@ bool Definition::hasUserDocumentation() const } -void Definition::addSourceReferencedBy(MemberDef *md) +void DefinitionImpl::addSourceReferencedBy(MemberDef *md) { if (md) { @@ -1516,7 +1514,7 @@ void Definition::addSourceReferencedBy(MemberDef *md) } } -void Definition::addSourceReferences(MemberDef *md) +void DefinitionImpl::addSourceReferences(MemberDef *md) { if (md) { @@ -1539,17 +1537,17 @@ void Definition::addSourceReferences(MemberDef *md) } } -Definition *Definition::findInnerCompound(const char *) const +Definition *DefinitionImpl::findInnerCompound(const char *) const { return 0; } -void Definition::addInnerCompound(Definition *) +void DefinitionImpl::addInnerCompound(Definition *) { - err("Definition::addInnerCompound() called\n"); + err("DefinitionImpl::addInnerCompound() called\n"); } -QCString Definition::qualifiedName() const +QCString DefinitionImpl::qualifiedName() const { //static int count=0; //count++; @@ -1589,7 +1587,7 @@ QCString Definition::qualifiedName() const return m_impl->qualifiedName; } -void Definition::setOuterScope(Definition *d) +void DefinitionImpl::setOuterScope(Definition *d) { //printf("%s::setOuterScope(%s)\n",name().data(),d?d->name().data():"<none>"); Definition *p = m_impl->outerScope; @@ -1598,7 +1596,7 @@ void Definition::setOuterScope(Definition *d) while (p && !found) { found = (p==d); - p = p->m_impl->outerScope; + p = p->getOuterScope(); } if (!found) { @@ -1608,18 +1606,18 @@ void Definition::setOuterScope(Definition *d) m_impl->hidden = m_impl->hidden || d->isHidden(); } -QCString Definition::localName() const +QCString DefinitionImpl::localName() const { return m_impl->localName; } -void Definition::makePartOfGroup(GroupDef *gd) +void DefinitionImpl::makePartOfGroup(GroupDef *gd) { if (m_impl->partOfGroups==0) m_impl->partOfGroups = new GroupList; m_impl->partOfGroups->append(gd); } -void Definition::setRefItems(const QList<ListItemInfo> *sli) +void DefinitionImpl::setRefItems(const QList<ListItemInfo> *sli) { //printf("%s::setRefItems()\n",name().data()); if (sli) @@ -1639,7 +1637,7 @@ void Definition::setRefItems(const QList<ListItemInfo> *sli) } } -void Definition::mergeRefItems(Definition *d) +void DefinitionImpl::mergeRefItems(Definition *d) { //printf("%s::mergeRefItems()\n",name().data()); QList<ListItemInfo> *xrefList = d->xrefListItems(); @@ -1671,7 +1669,7 @@ void Definition::mergeRefItems(Definition *d) } } -int Definition::_getXRefListId(const char *listName) const +int DefinitionImpl::_getXRefListId(const char *listName) const { if (m_impl->xrefListItems) { @@ -1688,12 +1686,12 @@ int Definition::_getXRefListId(const char *listName) const return -1; } -QList<ListItemInfo> *Definition::xrefListItems() const +QList<ListItemInfo> *DefinitionImpl::xrefListItems() const { return m_impl->xrefListItems; } -QCString Definition::pathFragment() const +QCString DefinitionImpl::pathFragment() const { QCString result; if (m_impl->outerScope && m_impl->outerScope!=Doxygen::globalScope) @@ -1729,7 +1727,7 @@ QCString Definition::pathFragment() const /*! Returns the string used in the footer for $navpath when * GENERATE_TREEVIEW is enabled */ -QCString Definition::navigationPathAsString() const +QCString DefinitionImpl::navigationPathAsString() const { QCString result; Definition *outerScope = getOuterScope(); @@ -1738,22 +1736,22 @@ QCString Definition::navigationPathAsString() const { result+=outerScope->navigationPathAsString(); } - else if (definitionType()==Definition::TypeFile && ((const FileDef*)this)->getDirDef()) + else if (definitionType()==Definition::TypeFile && (dynamic_cast<const FileDef*>(this))->getDirDef()) { - result+=((const FileDef*)this)->getDirDef()->navigationPathAsString(); + result+=(dynamic_cast<const FileDef*>(this))->getDirDef()->navigationPathAsString(); } result+="<li class=\"navelem\">"; if (isLinkable()) { - if (definitionType()==Definition::TypeGroup && ((const GroupDef*)this)->groupTitle()) + if (definitionType()==Definition::TypeGroup && (dynamic_cast<const GroupDef*>(this))->groupTitle()) { result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ - convertToHtml(((const GroupDef*)this)->groupTitle())+"</a>"; + convertToHtml((dynamic_cast<const GroupDef*>(this))->groupTitle())+"</a>"; } - else if (definitionType()==Definition::TypePage && ((const PageDef*)this)->hasTitle()) + else if (definitionType()==Definition::TypePage && (dynamic_cast<const PageDef*>(this))->hasTitle()) { result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+ - convertToHtml(((const PageDef*)this)->title())+"</a>"; + convertToHtml((dynamic_cast<const PageDef*>(this))->title())+"</a>"; } else if (definitionType()==Definition::TypeClass) { @@ -1781,7 +1779,7 @@ QCString Definition::navigationPathAsString() const } // TODO: move to htmlgen -void Definition::writeNavigationPath(OutputList &ol) const +void DefinitionImpl::writeNavigationPath(OutputList &ol) const { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1798,7 +1796,7 @@ void Definition::writeNavigationPath(OutputList &ol) const } // TODO: move to htmlgen -void Definition::writeToc(OutputList &ol, const LocalToc &localToc) +void DefinitionImpl::writeToc(OutputList &ol, const LocalToc &localToc) { SectionDict *sectionDict = m_impl->sectionDict; if (sectionDict==0) return; @@ -1938,31 +1936,31 @@ void Definition::writeToc(OutputList &ol, const LocalToc &localToc) //---------------------------------------------------------------------------------------- -SectionDict * Definition::getSectionDict(void) +SectionDict * DefinitionImpl::getSectionDict(void) { return m_impl->sectionDict; } -QCString Definition::symbolName() const +QCString DefinitionImpl::symbolName() const { - return m_symbolName; + return m_impl->symbolName; } //---------------------- -QCString Definition::documentation() const +QCString DefinitionImpl::documentation() const { return m_impl->details ? m_impl->details->doc : QCString(""); } -int Definition::docLine() const +int DefinitionImpl::docLine() const { return m_impl->details ? m_impl->details->line : 1; } -QCString Definition::docFile() const +QCString DefinitionImpl::docFile() const { - return m_impl->details ? m_impl->details->file : QCString("<"+m_name+">"); + return m_impl->details ? m_impl->details->file : QCString("<"+m_impl->name+">"); } //---------------------------------------------------------------------------- @@ -2016,7 +2014,7 @@ QCString abbreviate(const char *s,const char *name) //---------------------- -QCString Definition::briefDescription(bool abbr) const +QCString DefinitionImpl::briefDescription(bool abbr) const { //printf("%s::briefDescription(%d)='%s'\n",name().data(),abbr,m_impl->brief?m_impl->brief->doc.data():"<none>"); return m_impl->brief ? @@ -2024,7 +2022,7 @@ QCString Definition::briefDescription(bool abbr) const QCString(""); } -QCString Definition::briefDescriptionAsTooltip() const +QCString DefinitionImpl::briefDescriptionAsTooltip() const { if (m_impl->brief) { @@ -2049,97 +2047,97 @@ QCString Definition::briefDescriptionAsTooltip() const return QCString(""); } -int Definition::briefLine() const +int DefinitionImpl::briefLine() const { return m_impl->brief ? m_impl->brief->line : 1; } -QCString Definition::briefFile() const +QCString DefinitionImpl::briefFile() const { - return m_impl->brief ? m_impl->brief->file : QCString("<"+m_name+">"); + return m_impl->brief ? m_impl->brief->file : QCString("<"+m_impl->name+">"); } //---------------------- -QCString Definition::inbodyDocumentation() const +QCString DefinitionImpl::inbodyDocumentation() const { return m_impl->inbodyDocs ? m_impl->inbodyDocs->doc : QCString(""); } -int Definition::inbodyLine() const +int DefinitionImpl::inbodyLine() const { return m_impl->inbodyDocs ? m_impl->inbodyDocs->line : 1; } -QCString Definition::inbodyFile() const +QCString DefinitionImpl::inbodyFile() const { - return m_impl->inbodyDocs ? m_impl->inbodyDocs->file : QCString("<"+m_name+">"); + return m_impl->inbodyDocs ? m_impl->inbodyDocs->file : QCString("<"+m_impl->name+">"); } //---------------------- -QCString Definition::getDefFileName() const +QCString DefinitionImpl::getDefFileName() const { return m_impl->defFileName; } -QCString Definition::getDefFileExtension() const +QCString DefinitionImpl::getDefFileExtension() const { return m_impl->defFileExt; } -bool Definition::isHidden() const +bool DefinitionImpl::isHidden() const { return m_impl->hidden; } -bool Definition::isVisibleInProject() const +bool DefinitionImpl::isVisibleInProject() const { return isLinkableInProject() && !m_impl->hidden; } -bool Definition::isVisible() const +bool DefinitionImpl::isVisible() const { return isLinkable() && !m_impl->hidden; } -bool Definition::isArtificial() const +bool DefinitionImpl::isArtificial() const { return m_impl->isArtificial; } -QCString Definition::getReference() const +QCString DefinitionImpl::getReference() const { return m_impl->ref; } -bool Definition::isReference() const +bool DefinitionImpl::isReference() const { return !m_impl->ref.isEmpty(); } -int Definition::getStartBodyLine() const +int DefinitionImpl::getStartBodyLine() const { return m_impl->body ? m_impl->body->startLine : -1; } -int Definition::getEndBodyLine() const +int DefinitionImpl::getEndBodyLine() const { return m_impl->body ? m_impl->body->endLine : -1; } -FileDef *Definition::getBodyDef() const +FileDef *DefinitionImpl::getBodyDef() const { return m_impl->body ? m_impl->body->fileDef : 0; } -GroupList *Definition::partOfGroups() const +GroupList *DefinitionImpl::partOfGroups() const { return m_impl->partOfGroups; } -bool Definition::isLinkableViaGroup() const +bool DefinitionImpl::isLinkableViaGroup() const { GroupList *gl = partOfGroups(); if (gl) @@ -2154,64 +2152,69 @@ bool Definition::isLinkableViaGroup() const return FALSE; } -Definition *Definition::getOuterScope() const +Definition *DefinitionImpl::getOuterScope() const { return m_impl->outerScope; } -MemberSDict *Definition::getReferencesMembers() const +MemberSDict *DefinitionImpl::getReferencesMembers() const { return m_impl->sourceRefsDict; } -MemberSDict *Definition::getReferencedByMembers() const +MemberSDict *DefinitionImpl::getReferencedByMembers() const { return m_impl->sourceRefByDict; } -void Definition::setReference(const char *r) +void DefinitionImpl::setReference(const char *r) { m_impl->ref=r; } -SrcLangExt Definition::getLanguage() const +SrcLangExt DefinitionImpl::getLanguage() const { return m_impl->lang; } -void Definition::setHidden(bool b) +void DefinitionImpl::setHidden(bool b) { m_impl->hidden = m_impl->hidden || b; } -void Definition::setArtificial(bool b) +void DefinitionImpl::setArtificial(bool b) { m_impl->isArtificial = b; } -void Definition::setLocalName(const QCString name) +void DefinitionImpl::setLocalName(const QCString name) { m_impl->localName=name; } -void Definition::setLanguage(SrcLangExt lang) +void DefinitionImpl::setLanguage(SrcLangExt lang) { m_impl->lang=lang; } -void Definition::_setSymbolName(const QCString &name) +void DefinitionImpl::_setSymbolName(const QCString &name) { - m_symbolName=name; + m_impl->symbolName=name; } -bool Definition::hasBriefDescription() const +QCString DefinitionImpl::_symbolName() const +{ + return m_impl->symbolName; +} + +bool DefinitionImpl::hasBriefDescription() const { static bool briefMemberDesc = Config_getBool(BRIEF_MEMBER_DESC); return !briefDescription().isEmpty() && briefMemberDesc; } -QCString Definition::externalReference(const QCString &relPath) const +QCString DefinitionImpl::externalReference(const QCString &relPath) const { QCString ref = getReference(); if (!ref.isEmpty()) @@ -2233,5 +2236,37 @@ QCString Definition::externalReference(const QCString &relPath) const return relPath; } +QCString DefinitionImpl::name() const +{ + return m_impl->name; +} + +int DefinitionImpl::getDefLine() const +{ + return m_impl->defLine; +} +int DefinitionImpl::getDefColumn() const +{ + return m_impl->defColumn; +} + +void DefinitionImpl::setCookie(Cookie *cookie) +{ + delete m_impl->cookie; + m_impl->cookie = cookie; +} + +Definition::Cookie *DefinitionImpl::cookie() const +{ + return m_impl->cookie; +} + +void DefinitionImpl::writeQuickMemberLinks(OutputList &,MemberDef *) const +{ +} + +void DefinitionImpl::writeSummaryLinks(OutputList &) +{ +} diff --git a/src/definition.h b/src/definition.h index c382013..a7bcf2a 100644 --- a/src/definition.h +++ b/src/definition.h @@ -33,7 +33,6 @@ class GroupList; struct ListItemInfo; struct SectionInfo; class Definition; -class DefinitionImpl; class FTextStream; /** Data associated with a detailed description. */ @@ -97,35 +96,26 @@ class Definition : public DefinitionIntf virtual ~Cookie() {} }; - /*! Create a new definition */ - Definition( - const char *defFileName,int defLine,int defColumn, - const char *name,const char *b=0,const char *d=0, - bool isSymbol=TRUE); - - /*! Destroys the definition */ - virtual ~Definition(); - //----------------------------------------------------------------------------------- // ---- getters ----- //----------------------------------------------------------------------------------- /*! Returns the name of the definition */ - const QCString& name() const { return m_name; } + virtual QCString name() const = 0; /*! Returns the name of the definition as it appears in the output */ virtual QCString displayName(bool includeScope=TRUE) const = 0; /*! Returns the local name without any scope qualifiers. */ - QCString localName() const; + virtual QCString localName() const = 0; /*! Returns the fully qualified name of this definition */ - virtual QCString qualifiedName() const; + virtual QCString qualifiedName() const = 0; /*! Returns the name of this definition as it appears in the symbol map. */ - QCString symbolName() const; + virtual QCString symbolName() const = 0; /*! Returns the base file name (without extension) of this definition. * as it is referenced to/written to disk. @@ -136,68 +126,68 @@ class Definition : public DefinitionIntf virtual QCString anchor() const = 0; /*! Returns the name of the source listing of this definition. */ - virtual QCString getSourceFileBase() const; + virtual QCString getSourceFileBase() const = 0; /*! Returns the anchor of the source listing of this definition. */ - virtual QCString getSourceAnchor() const; + virtual QCString getSourceAnchor() const = 0; /*! Returns the detailed description of this definition */ - virtual QCString documentation() const; + virtual QCString documentation() const = 0; /*! Returns the line number at which the detailed documentation was found. */ - int docLine() const; + virtual int docLine() const = 0; /*! Returns the file in which the detailed documentation block was found. * This can differ from getDefFileName(). */ - QCString docFile() const; + virtual QCString docFile() const = 0; /*! Returns the brief description of this definition. This can include commands. */ - virtual QCString briefDescription(bool abbreviate=FALSE) const; + virtual QCString briefDescription(bool abbreviate=FALSE) const = 0; /*! Returns a plain text version of the brief description suitable for use * as a tool tip. */ - QCString briefDescriptionAsTooltip() const; + virtual QCString briefDescriptionAsTooltip() const = 0; /*! Returns the line number at which the brief description was found. */ - int briefLine() const; + virtual int briefLine() const = 0; /*! Returns the documentation found inside the body of a member */ - QCString inbodyDocumentation() const; + virtual QCString inbodyDocumentation() const = 0; /*! Returns the file in which the in body documentation was found */ - QCString inbodyFile() const; + virtual QCString inbodyFile() const = 0; /*! Returns the line at which the first in body documentation part was found */ - int inbodyLine() const; + virtual int inbodyLine() const = 0; /*! Returns the file in which the brief description was found. * This can differ from getDefFileName(). */ - QCString briefFile() const; + virtual QCString briefFile() const = 0; /*! returns the file in which this definition was found */ - QCString getDefFileName() const; + virtual QCString getDefFileName() const = 0; /*! returns the extension of the file in which this definition was found */ - QCString getDefFileExtension() const; + virtual QCString getDefFileExtension() const = 0; /*! returns the line number at which the definition was found */ - int getDefLine() const { return m_defLine; } + virtual int getDefLine() const = 0; /*! returns the column number at which the definition was found */ - int getDefColumn() const { return m_defColumn; } + virtual int getDefColumn() const = 0; /*! Returns TRUE iff the definition is documented * (which could be generated documentation) * @see hasUserDocumentation() */ - virtual bool hasDocumentation() const; + virtual bool hasDocumentation() const = 0; /*! Returns TRUE iff the definition is documented by the user. */ - virtual bool hasUserDocumentation() const; + virtual bool hasUserDocumentation() const = 0; /*! Returns TRUE iff it is possible to link to this item within this * project. @@ -212,175 +202,152 @@ class Definition : public DefinitionIntf /*! Returns TRUE iff the name is part of this project and * may appear in the output */ - virtual bool isVisibleInProject() const; + virtual bool isVisibleInProject() const = 0; /*! Returns TRUE iff the name may appear in the output */ - virtual bool isVisible() const; + virtual bool isVisible() const = 0; /*! Returns TRUE iff this item is supposed to be hidden from the output. */ - bool isHidden() const; + virtual bool isHidden() const = 0; /*! returns TRUE if this entity was artificially introduced, for * instance because it is used to show a template instantiation relation. */ - bool isArtificial() const; + virtual bool isArtificial() const = 0; /*! If this definition was imported via a tag file, this function * returns the tagfile for the external project. This can be * translated into an external link target via * Doxygen::tagDestinationDict */ - virtual QCString getReference() const; + virtual QCString getReference() const = 0; /*! Returns TRUE if this definition is imported via a tag file. */ - virtual bool isReference() const; + virtual bool isReference() const = 0; /*! Convenience method to return a resolved external link */ - QCString externalReference(const QCString &relPath) const; + virtual QCString externalReference(const QCString &relPath) const = 0; /*! Returns the first line of the body of this item (applicable to classes and * functions). */ - int getStartBodyLine() const; + virtual int getStartBodyLine() const = 0; /*! Returns the last line of the body of this item (applicable to classes and * functions). */ - int getEndBodyLine() const; + virtual int getEndBodyLine() const = 0; /*! Returns the file in which the body of this item is located or 0 if no * body is available. */ - FileDef *getBodyDef() const; + virtual FileDef *getBodyDef() const = 0; /** Returns the programming language this definition was written in. */ - SrcLangExt getLanguage() const; + virtual SrcLangExt getLanguage() const = 0; - GroupList *partOfGroups() const; - bool isLinkableViaGroup() const; + virtual GroupList *partOfGroups() const = 0; + virtual bool isLinkableViaGroup() const = 0; - QList<ListItemInfo> *xrefListItems() const; + virtual QList<ListItemInfo> *xrefListItems() const = 0; - virtual Definition *findInnerCompound(const char *name) const ; - virtual Definition *getOuterScope() const; + virtual Definition *findInnerCompound(const char *name) const = 0; + virtual Definition *getOuterScope() const = 0; - MemberSDict *getReferencesMembers() const; - MemberSDict *getReferencedByMembers() const; + virtual MemberSDict *getReferencesMembers() const = 0; + virtual MemberSDict *getReferencedByMembers() const = 0; - bool hasSections() const; - bool hasSources() const; + virtual bool hasSections() const = 0; + virtual bool hasSources() const = 0; /** returns TRUE if this class has a brief description */ - bool hasBriefDescription() const; + virtual bool hasBriefDescription() const = 0; - QCString id() const; + virtual QCString id() const = 0; /** returns the section dictionary, only of importance for pagedef */ - SectionDict * getSectionDict(void); + virtual SectionDict * getSectionDict(void) = 0; //----------------------------------------------------------------------------------- // ---- setters ----- //----------------------------------------------------------------------------------- /*! Sets a new \a name for the definition */ - virtual void setName(const char *name); + virtual void setName(const char *name) = 0; /*! Sets a unique id for the symbol. Used for libclang integration. */ - void setId(const char *name); + virtual void setId(const char *name) = 0; /*! Set a new file name and position */ - void setDefFile(const QCString& df,int defLine,int defColumn); + virtual void setDefFile(const QCString& df,int defLine,int defColumn) = 0; /*! Sets the documentation of this definition to \a d. */ - virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); + virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; /*! Sets the brief description of this definition to \a b. * A dot is added to the sentence if not available. */ - virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine); + virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) = 0; /*! Set the documentation that was found inside the body of an item. * If there was already some documentation set, the new documentation * will be appended. */ - virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine); + virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine) = 0; /*! Sets the tag file id via which this definition was imported. */ - void setReference(const char *r); + virtual void setReference(const char *r) = 0; /*! Add the list of anchors that mark the sections that are found in the * documentation. */ - void addSectionsToDefinition(QList<SectionInfo> *anchorList); + virtual void addSectionsToDefinition(QList<SectionInfo> *anchorList) = 0; // source references - void setBodySegment(int bls,int ble); - void setBodyDef(FileDef *fd); - void addSourceReferencedBy(MemberDef *d); - void addSourceReferences(MemberDef *d); + virtual void setBodySegment(int bls,int ble) = 0; + virtual void setBodyDef(FileDef *fd) = 0; + virtual void addSourceReferencedBy(MemberDef *d) = 0; + virtual void addSourceReferences(MemberDef *d) = 0; - void setRefItems(const QList<ListItemInfo> *sli); - void mergeRefItems(Definition *d); - virtual void addInnerCompound(Definition *d); - virtual void setOuterScope(Definition *d); + virtual void setRefItems(const QList<ListItemInfo> *sli) = 0; + virtual void mergeRefItems(Definition *d) = 0; + virtual void addInnerCompound(Definition *d) = 0; + virtual void setOuterScope(Definition *d) = 0; - virtual void setHidden(bool b); + virtual void setHidden(bool b) = 0; - void setArtificial(bool b); - void setLanguage(SrcLangExt lang); + virtual void setArtificial(bool b) = 0; + virtual void setLanguage(SrcLangExt lang) = 0; //----------------------------------------------------------------------------------- // --- actions ---- //----------------------------------------------------------------------------------- - void writeSourceDef(OutputList &ol,const char *scopeName); - void writeInlineCode(OutputList &ol,const char *scopeName); - void writeSourceRefs(OutputList &ol,const char *scopeName); - void writeSourceReffedBy(OutputList &ol,const char *scopeName); - void makePartOfGroup(GroupDef *gd); - //void writePathFragment(OutputList &ol) const; - void writeNavigationPath(OutputList &ol) const; - QCString navigationPathAsString() const; - virtual void writeQuickMemberLinks(OutputList &,MemberDef *) const {} - virtual void writeSummaryLinks(OutputList &) {} - QCString pathFragment() const; + virtual void writeSourceDef(OutputList &ol,const char *scopeName) = 0; + virtual void writeInlineCode(OutputList &ol,const char *scopeName) = 0; + virtual void writeSourceRefs(OutputList &ol,const char *scopeName) = 0; + virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) = 0; + virtual void makePartOfGroup(GroupDef *gd) = 0; + virtual void writeNavigationPath(OutputList &ol) const = 0; + virtual QCString navigationPathAsString() const = 0; + virtual void writeQuickMemberLinks(OutputList &,MemberDef *) const = 0; + virtual void writeSummaryLinks(OutputList &) = 0; + virtual QCString pathFragment() const = 0; /*! Writes the documentation anchors of the definition to * the Doxygen::tagFile stream. */ - void writeDocAnchorsToTagFile(FTextStream &); - void setLocalName(const QCString name); - - void addSectionsToIndex(); - void writeToc(OutputList &ol, const LocalToc <); - - void setCookie(Cookie *cookie) { delete m_cookie; m_cookie = cookie; } - Cookie *cookie() const { return m_cookie; } - - protected: - - Definition(const Definition &d); - - private: - static void addToMap(const char *name,Definition *d); - static void removeFromMap(Definition *d); - - void _setSymbolName(const QCString &name); - - int _getXRefListId(const char *listName) const; - void _writeSourceRefList(OutputList &ol,const char *scopeName, - const QCString &text,MemberSDict *members,bool); - void _setBriefDescription(const char *b,const char *briefFile,int briefLine); - void _setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace,bool atTop); - void _setInbodyDocumentation(const char *d,const char *docFile,int docLine); - bool _docsAlreadyAdded(const QCString &doc,QCString &sigList); - DefinitionImpl *m_impl; // internal structure holding all private data - QCString m_name; - bool m_isSymbol; - QCString m_symbolName; - int m_defLine; - int m_defColumn; - Cookie *m_cookie; + virtual void writeDocAnchorsToTagFile(FTextStream &) = 0; + virtual void setLocalName(const QCString name) = 0; + + virtual void addSectionsToIndex() = 0; + virtual void writeToc(OutputList &ol, const LocalToc <) = 0; + + virtual void setCookie(Cookie *cookie) = 0; + virtual Cookie *cookie() const = 0; + + virtual void _setSymbolName(const QCString &name) = 0; + virtual QCString _symbolName() const = 0; }; /** A list of Definition objects. */ diff --git a/src/definitionimpl.h b/src/definitionimpl.h new file mode 100644 index 0000000..864d35b --- /dev/null +++ b/src/definitionimpl.h @@ -0,0 +1,144 @@ +/****************************************************************************** + * + * + * + * Copyright (C) 1997-2019 by Dimitri van Heesch. + * + * Permission to use, copy, modify, and distribute this software and its + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software + * for any purpose. It is provided "as is" without express or implied warranty. + * See the GNU General Public License for more details. + * + * Documents produced by Doxygen are derivative works derived from the + * input used in their production; they are not affected by this license. + * + */ + +#ifndef DEFINITIONIMPL_H +#define DEFINITIONIMPL_H + +#include "definition.h" + +class DefinitionImpl : virtual public Definition +{ + public: + /*! Create a new definition */ + DefinitionImpl( + const char *defFileName,int defLine,int defColumn, + const char *name,const char *b=0,const char *d=0, + bool isSymbol=TRUE); + virtual ~DefinitionImpl(); + + virtual QCString name() const; + virtual QCString displayName(bool includeScope=TRUE) const = 0; + virtual QCString localName() const; + virtual QCString qualifiedName() const; + virtual QCString symbolName() const; + virtual QCString getOutputFileBase() const = 0; + virtual QCString anchor() const = 0; + virtual QCString getSourceFileBase() const; + virtual QCString getSourceAnchor() const; + virtual QCString documentation() const; + virtual int docLine() const; + virtual QCString docFile() const; + virtual QCString briefDescription(bool abbreviate=FALSE) const; + virtual QCString briefDescriptionAsTooltip() const; + virtual int briefLine() const; + virtual QCString inbodyDocumentation() const; + virtual QCString inbodyFile() const; + virtual int inbodyLine() const; + virtual QCString briefFile() const; + virtual QCString getDefFileName() const; + virtual QCString getDefFileExtension() const; + virtual int getDefLine() const; + virtual int getDefColumn() const; + virtual bool hasDocumentation() const; + virtual bool hasUserDocumentation() const; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual bool isVisibleInProject() const; + virtual bool isVisible() const; + virtual bool isHidden() const; + virtual bool isArtificial() const; + virtual QCString getReference() const; + virtual bool isReference() const; + virtual QCString externalReference(const QCString &relPath) const; + virtual int getStartBodyLine() const; + virtual int getEndBodyLine() const; + virtual FileDef *getBodyDef() const; + virtual SrcLangExt getLanguage() const; + virtual GroupList *partOfGroups() const; + virtual bool isLinkableViaGroup() const; + virtual QList<ListItemInfo> *xrefListItems() const; + virtual Definition *findInnerCompound(const char *name) const; + virtual Definition *getOuterScope() const; + virtual MemberSDict *getReferencesMembers() const; + virtual MemberSDict *getReferencedByMembers() const; + virtual bool hasSections() const; + virtual bool hasSources() const; + virtual bool hasBriefDescription() const; + virtual QCString id() const; + virtual SectionDict * getSectionDict(void); + virtual void setName(const char *name); + virtual void setId(const char *name); + virtual void setDefFile(const QCString& df,int defLine,int defColumn); + virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); + virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine); + virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine); + virtual void setReference(const char *r); + virtual void addSectionsToDefinition(QList<SectionInfo> *anchorList); + virtual void setBodySegment(int bls,int ble); + virtual void setBodyDef(FileDef *fd); + virtual void addSourceReferencedBy(MemberDef *d); + virtual void addSourceReferences(MemberDef *d); + virtual void setRefItems(const QList<ListItemInfo> *sli); + virtual void mergeRefItems(Definition *d); + virtual void addInnerCompound(Definition *d); + virtual void setOuterScope(Definition *d); + virtual void setHidden(bool b); + virtual void setArtificial(bool b); + virtual void setLanguage(SrcLangExt lang); + virtual void writeSourceDef(OutputList &ol,const char *scopeName); + virtual void writeInlineCode(OutputList &ol,const char *scopeName); + virtual void writeSourceRefs(OutputList &ol,const char *scopeName); + virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName); + virtual void makePartOfGroup(GroupDef *gd); + virtual void writeNavigationPath(OutputList &ol) const; + virtual QCString navigationPathAsString() const; + virtual void writeQuickMemberLinks(OutputList &,MemberDef *) const; + virtual void writeSummaryLinks(OutputList &); + virtual QCString pathFragment() const; + virtual void writeDocAnchorsToTagFile(FTextStream &); + virtual void setLocalName(const QCString name); + virtual void addSectionsToIndex(); + virtual void writeToc(OutputList &ol, const LocalToc <); + virtual void setCookie(Cookie *cookie); + virtual Cookie *cookie() const; + + protected: + + DefinitionImpl(const DefinitionImpl &d); + + private: + static void addToMap(const char *name,Definition *d); + static void removeFromMap(Definition *d); + + virtual void _setSymbolName(const QCString &name); + virtual QCString _symbolName() const ; + + int _getXRefListId(const char *listName) const; + void _writeSourceRefList(OutputList &ol,const char *scopeName, + const QCString &text,MemberSDict *members,bool); + void _setBriefDescription(const char *b,const char *briefFile,int briefLine); + void _setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace,bool atTop); + void _setInbodyDocumentation(const char *d,const char *docFile,int docLine); + bool _docsAlreadyAdded(const QCString &doc,QCString &sigList); + + // PIMPL idiom + class IMPL; + IMPL *m_impl; // internal structure holding all private data +}; + + +#endif diff --git a/src/diagram.cpp b/src/diagram.cpp index 7e2fe15..808191e 100644 --- a/src/diagram.cpp +++ b/src/diagram.cpp @@ -1020,7 +1020,7 @@ void clearVisitFlags() ClassDef *cd; for (;(cd=cli.current());++cli) { - cd->visited=FALSE; + cd->setVisited(FALSE); } } diff --git a/src/dirdef.cpp b/src/dirdef.cpp index 7294e4f..ae3a6a3 100644 --- a/src/dirdef.cpp +++ b/src/dirdef.cpp @@ -12,13 +12,85 @@ #include "ftextstream.h" #include "config.h" #include "docparser.h" +#include "definitionimpl.h" + +//---------------------------------------------------------------------- + +class DirDefImpl : public DefinitionImpl, public DirDef +{ + public: + DirDefImpl(const char *path); + virtual ~DirDefImpl(); + + virtual DefType definitionType() const { return TypeDir; } + virtual QCString getOutputFileBase() const; + virtual QCString anchor() const { return QCString(); } + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual QCString displayName(bool=TRUE) const { return m_dispName; } + virtual const QCString &shortName() const { return m_shortName; } + virtual void addSubDir(DirDef *subdir); + virtual FileList * getFiles() const { return m_fileList; } + virtual void addFile(FileDef *fd); + virtual const DirList &subDirs() const { return m_subdirs; } + virtual bool isCluster() const { return m_subdirs.count()>0; } + virtual int level() const { return m_level; } + virtual DirDef *parent() const { return m_parent; } + virtual int dirCount() const { return m_dirCount; } + virtual const QDict<UsedDir> *usedDirs() const { return m_usedDirs; } + virtual bool isParentOf(DirDef *dir) const; + virtual bool depGraphIsTrivial() const; + virtual QCString shortTitle() const; + virtual bool hasDetailedDescription() const; + virtual void writeDocumentation(OutputList &ol); + virtual void writeTagFile(FTextStream &t); + virtual void setDiskName(const QCString &name) { m_diskName = name; } + virtual void sort(); + virtual void setParent(DirDef *parent); + virtual void setLevel(); + virtual void addUsesDependency(DirDef *usedDir,FileDef *srcFd, + FileDef *dstFd,bool inherited); + virtual void computeDependencies(); + + public: + static DirDef *mergeDirectoryInTree(const QCString &path); + + private: + + void writeDetailedDescription(OutputList &ol,const QCString &title); + void writeBriefDescription(OutputList &ol); + void writeDirectoryGraph(OutputList &ol); + void writeSubDirList(OutputList &ol); + void writeFileList(OutputList &ol); + void startMemberDeclarations(OutputList &ol); + void endMemberDeclarations(OutputList &ol); + + static DirDef *createNewDir(const char *path); + static bool matchPath(const QCString &path,QStrList &l); + + DirList m_subdirs; + QCString m_dispName; + QCString m_shortName; + QCString m_diskName; + FileList *m_fileList; // list of files in the group + int m_dirCount; + int m_level; + DirDef *m_parent; + QDict<UsedDir> *m_usedDirs; +}; + +DirDef *createDirDef(const char *path) +{ + return new DirDefImpl(path); +} + //---------------------------------------------------------------------- // method implementation static int g_dirCount=0; -DirDef::DirDef(const char *path) : Definition(path,1,1,path), visited(FALSE) +DirDefImpl::DirDefImpl(const char *path) : DefinitionImpl(path,1,1,path) { bool fullPathNames = Config_getBool(FULL_PATH_NAMES); // get display name (stipping the paths mentioned in STRIP_FROM_PATH) @@ -49,36 +121,41 @@ DirDef::DirDef(const char *path) : Definition(path,1,1,path), visited(FALSE) m_parent=0; } -DirDef::~DirDef() +DirDefImpl::~DirDefImpl() { delete m_fileList; delete m_usedDirs; } -bool DirDef::isLinkableInProject() const +bool DirDefImpl::isLinkableInProject() const { return !isReference(); } -bool DirDef::isLinkable() const +bool DirDefImpl::isLinkable() const { return isReference() || isLinkableInProject(); } -void DirDef::addSubDir(DirDef *subdir) +void DirDefImpl::addSubDir(DirDef *subdir) { m_subdirs.append(subdir); subdir->setOuterScope(this); - subdir->m_parent=this; + subdir->setParent(this); +} + +void DirDefImpl::setParent(DirDef *p) +{ + m_parent=p; } -void DirDef::addFile(FileDef *fd) +void DirDefImpl::addFile(FileDef *fd) { m_fileList->append(fd); fd->setDirDef(this); } -void DirDef::sort() +void DirDefImpl::sort() { m_subdirs.sort(); m_fileList->sort(); @@ -116,14 +193,14 @@ static QCString encodeDirName(const QCString &anchor) // return result; } -QCString DirDef::getOutputFileBase() const +QCString DirDefImpl::getOutputFileBase() const { - //printf("DirDef::getOutputFileBase() %s->dir_%s\n", + //printf("DirDefImpl::getOutputFileBase() %s->dir_%s\n", // m_diskName.data(),encodeDirName(m_diskName).data()); return "dir_"+encodeDirName(m_diskName); } -void DirDef::writeDetailedDescription(OutputList &ol,const QCString &title) +void DirDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || !documentation().isEmpty()) @@ -168,7 +245,7 @@ void DirDef::writeDetailedDescription(OutputList &ol,const QCString &title) } } -void DirDef::writeBriefDescription(OutputList &ol) +void DirDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { @@ -205,7 +282,7 @@ void DirDef::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void DirDef::writeDirectoryGraph(OutputList &ol) +void DirDefImpl::writeDirectoryGraph(OutputList &ol) { // write graph dependency graph if (Config_getBool(DIRECTORY_GRAPH) && Config_getBool(HAVE_DOT)) @@ -225,7 +302,7 @@ void DirDef::writeDirectoryGraph(OutputList &ol) } } -void DirDef::writeSubDirList(OutputList &ol) +void DirDefImpl::writeSubDirList(OutputList &ol) { int numSubdirs = 0; QListIterator<DirDef> it(m_subdirs); @@ -275,7 +352,7 @@ void DirDef::writeSubDirList(OutputList &ol) } } -void DirDef::writeFileList(OutputList &ol) +void DirDefImpl::writeFileList(OutputList &ol) { int numFiles = 0; QListIterator<FileDef> it(*m_fileList); @@ -347,28 +424,28 @@ void DirDef::writeFileList(OutputList &ol) } } -void DirDef::startMemberDeclarations(OutputList &ol) +void DirDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } -void DirDef::endMemberDeclarations(OutputList &ol) +void DirDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } -QCString DirDef::shortTitle() const +QCString DirDefImpl::shortTitle() const { return theTranslator->trDirReference(m_shortName); } -bool DirDef::hasDetailedDescription() const +bool DirDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty(); } -void DirDef::writeTagFile(FTextStream &tagFile) +void DirDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"dir\">" << endl; tagFile << " <name>" << convertToXML(displayName()) << "</name>" << endl; @@ -415,7 +492,7 @@ void DirDef::writeTagFile(FTextStream &tagFile) tagFile << " </compound>" << endl; } -void DirDef::writeDocumentation(OutputList &ol) +void DirDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); @@ -529,7 +606,7 @@ void DirDef::writeDocumentation(OutputList &ol) ol.popGeneratorState(); } -void DirDef::setLevel() +void DirDefImpl::setLevel() { if (m_level==-1) // level not set before { @@ -549,7 +626,7 @@ void DirDef::setLevel() /** Add as "uses" dependency between \a this dir and \a dir, * that was caused by a dependency on file \a fd. */ -void DirDef::addUsesDependency(DirDef *dir,FileDef *srcFd, +void DirDefImpl::addUsesDependency(DirDef *dir,FileDef *srcFd, FileDef *dstFd,bool inherited) { if (this==dir) return; // do not add self-dependencies @@ -603,7 +680,7 @@ void DirDef::addUsesDependency(DirDef *dir,FileDef *srcFd, /** Computes the dependencies between directories */ -void DirDef::computeDependencies() +void DirDefImpl::computeDependencies() { FileList *fl = m_fileList; if (fl) @@ -649,7 +726,7 @@ void DirDef::computeDependencies() } } -bool DirDef::isParentOf(DirDef *dir) const +bool DirDefImpl::isParentOf(DirDef *dir) const { if (dir->parent()==this) // this is a parent of dir return TRUE; @@ -659,7 +736,7 @@ bool DirDef::isParentOf(DirDef *dir) const return FALSE; } -bool DirDef::depGraphIsTrivial() const +bool DirDefImpl::depGraphIsTrivial() const { return m_usedDirs->count()==0; } @@ -704,21 +781,21 @@ FilePair *UsedDir::findFilePair(const char *name) return n.isEmpty() ? 0 : m_filePairs.find(n); } -DirDef *DirDef::createNewDir(const char *path) +DirDef *DirDefImpl::createNewDir(const char *path) { ASSERT(path!=0); DirDef *dir = Doxygen::directories->find(path); if (dir==0) // new dir { //printf("Adding new dir %s\n",path); - dir = new DirDef(path); + dir = createDirDef(path); //printf("createNewDir %s short=%s\n",path,dir->shortName().data()); Doxygen::directories->append(path,dir); } return dir; } -bool DirDef::matchPath(const QCString &path,QStrList &l) +bool DirDefImpl::matchPath(const QCString &path,QStrList &l) { const char *s=l.first(); while (s) @@ -736,9 +813,9 @@ bool DirDef::matchPath(const QCString &path,QStrList &l) /*! strip part of \a path if it matches * one of the paths in the Config_getList(STRIP_FROM_PATH) list */ -DirDef *DirDef::mergeDirectoryInTree(const QCString &path) +DirDef *DirDefImpl::mergeDirectoryInTree(const QCString &path) { - //printf("DirDef::mergeDirectoryInTree(%s)\n",path.data()); + //printf("DirDefImpl::mergeDirectoryInTree(%s)\n",path.data()); int p=0,i=0; DirDef *dir=0; while ((i=path.find('/',p))!=-1) @@ -941,7 +1018,7 @@ void buildDirectories() DirDef *dir; if ((dir=Doxygen::directories->find(fd->getPath()))==0) // new directory { - dir = DirDef::mergeDirectoryInTree(fd->getPath()); + dir = DirDefImpl::mergeDirectoryInTree(fd->getPath()); } if (dir && !fd->isDocumentationFile()) dir->addFile(fd); } @@ -967,7 +1044,7 @@ void buildDirectories() if (parent) { parent->addSubDir(dir); - //printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n", + //printf("DirDefImpl::addSubdir(): Adding subdir\n%s to\n%s\n", // dir->displayName().data(), parent->displayName().data()); } } diff --git a/src/dirdef.h b/src/dirdef.h index 2fb04f5..2bca93e 100644 --- a/src/dirdef.h +++ b/src/dirdef.h @@ -41,70 +41,44 @@ class DirList : public QList<DirDef> }; /** A model of a directory symbol. */ -class DirDef : public Definition +class DirDef : virtual public Definition { public: - DirDef(const char *path); - virtual ~DirDef(); + virtual ~DirDef() {} // accessors - DefType definitionType() const { return TypeDir; } - QCString getOutputFileBase() const; - QCString anchor() const { return QCString(); } - bool isLinkableInProject() const; - bool isLinkable() const; - QCString displayName(bool=TRUE) const { return m_dispName; } - const QCString &shortName() const { return m_shortName; } - void addSubDir(DirDef *subdir); - FileList * getFiles() const { return m_fileList; } - void addFile(FileDef *fd); - const DirList &subDirs() const { return m_subdirs; } - bool isCluster() const { return m_subdirs.count()>0; } - int level() const { return m_level; } - DirDef *parent() const { return m_parent; } - int dirCount() const { return m_dirCount; } - const QDict<UsedDir> *usedDirs() const { return m_usedDirs; } - bool isParentOf(DirDef *dir) const; - bool depGraphIsTrivial() const; - QCString shortTitle() const; - bool hasDetailedDescription() const; + virtual DefType definitionType() const = 0; + virtual QCString getOutputFileBase() const = 0; + virtual QCString anchor() const = 0; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual QCString displayName(bool=TRUE) const = 0; + virtual const QCString &shortName() const = 0; + virtual void addSubDir(DirDef *subdir) = 0; + virtual FileList * getFiles() const = 0; + virtual void addFile(FileDef *fd) = 0; + virtual const DirList &subDirs() const = 0; + virtual bool isCluster() const = 0; + virtual int level() const = 0; + virtual DirDef *parent() const = 0; + virtual int dirCount() const = 0; + virtual const QDict<UsedDir> *usedDirs() const = 0; + virtual bool isParentOf(DirDef *dir) const = 0; + virtual bool depGraphIsTrivial() const = 0; + virtual QCString shortTitle() const = 0; + virtual bool hasDetailedDescription() const = 0; // generate output - void writeDocumentation(OutputList &ol); - void writeTagFile(FTextStream &t); - - static DirDef *mergeDirectoryInTree(const QCString &path); - bool visited; - void setDiskName(const QCString &name) { m_diskName = name; } - void sort(); - - private: - friend void computeDirDependencies(); - - void writeDetailedDescription(OutputList &ol,const QCString &title); - void writeBriefDescription(OutputList &ol); - void writeDirectoryGraph(OutputList &ol); - void writeSubDirList(OutputList &ol); - void writeFileList(OutputList &ol); - void startMemberDeclarations(OutputList &ol); - void endMemberDeclarations(OutputList &ol); - - void setLevel(); - static DirDef *createNewDir(const char *path); - static bool matchPath(const QCString &path,QStrList &l); - void addUsesDependency(DirDef *usedDir,FileDef *srcFd, - FileDef *dstFd,bool inherited); - void computeDependencies(); - - DirList m_subdirs; - QCString m_dispName; - QCString m_shortName; - QCString m_diskName; - FileList *m_fileList; // list of files in the group - int m_dirCount; - int m_level; - DirDef *m_parent; - QDict<UsedDir> *m_usedDirs; + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeTagFile(FTextStream &t) = 0; + + virtual void setDiskName(const QCString &name) = 0; + virtual void sort() = 0; + virtual void setParent(DirDef *parent) = 0; + virtual void setLevel() = 0; + virtual void addUsesDependency(DirDef *usedDir,FileDef *srcFd, + FileDef *dstFd,bool inherited) = 0; + virtual void computeDependencies() = 0; }; /** Class representing a pair of FileDef objects */ diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index c36bb00..3e4874d 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -386,13 +386,14 @@ DB_VIS_C { m_t << "<literallayout><computeroutput>"; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), - inc->exampleFile(), &fd); + inc->exampleFile(), fd); + delete fd; m_t << "</computeroutput></literallayout>"; } break; @@ -432,7 +433,7 @@ DB_VIS_C case DocInclude::SnipWithLines: { QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); m_t << "<literallayout><computeroutput>"; Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, @@ -441,13 +442,14 @@ DB_VIS_C langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment 0, // memberDef TRUE // show line number ); + delete fd; m_t << "</computeroutput></literallayout>"; } break; diff --git a/src/docparser.cpp b/src/docparser.cpp index aff7411..f1ac262 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -1157,7 +1157,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor } else if (compound->definitionType()==Definition::TypeGroup) { - name=((GroupDef*)compound)->groupTitle(); + name=(dynamic_cast<GroupDef*>(compound))->groupTitle(); } children.append(new DocLinkedWord(parent,name, @@ -1169,7 +1169,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor ); } else if (compound->definitionType()==Definition::TypeFile && - ((FileDef*)compound)->generateSourceFile() + (dynamic_cast<FileDef*>(compound))->generateSourceFile() ) // undocumented file that has source code we can link to { children.append(new @@ -2569,16 +2569,16 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : { if (anchor.isEmpty() && /* compound link */ compound->definitionType()==Definition::TypeGroup && /* is group */ - ((GroupDef *)compound)->groupTitle() /* with title */ + (dynamic_cast<GroupDef *>(compound))->groupTitle() /* with title */ ) { - m_text=((GroupDef *)compound)->groupTitle(); // use group's title as link + m_text=(dynamic_cast<GroupDef *>(compound))->groupTitle(); // use group's title as link } else if (compound->definitionType()==Definition::TypeMember && - ((MemberDef*)compound)->isObjCMethod()) + (dynamic_cast<MemberDef*>(compound))->isObjCMethod()) { // Objective C Method - MemberDef *member = (MemberDef*)compound; + MemberDef *member = dynamic_cast<MemberDef*>(compound); bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE; m_text = member->objCMethodName(localLink,g_inSeeBlock); } @@ -2590,7 +2590,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) : return; } else if (compound && compound->definitionType()==Definition::TypeFile && - ((FileDef*)compound)->generateSourceFile() + (dynamic_cast<FileDef*>(compound))->generateSourceFile() ) // undocumented file that has source code we can link to { m_file = compound->getSourceFileBase(); @@ -2729,8 +2729,8 @@ DocLink::DocLink(DocNode *parent,const QCString &target) m_file = compound->getOutputFileBase(); m_ref = compound->getReference(); } - else if (compound && compound->definitionType()==Definition::TypeFile && - ((FileDef*)compound)->generateSourceFile() + else if (compound && compound->definitionType()==Definition::TypeFile && + (dynamic_cast<FileDef*>(compound))->generateSourceFile() ) // undocumented file that has source code we can link to { m_file = compound->getSourceFileBase(); @@ -7546,12 +7546,12 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, } else if (ctx && ctx->definitionType()==Definition::TypePage) { - Definition *scope = ((PageDef*)ctx)->getPageScope(); + Definition *scope = (dynamic_cast<PageDef*>(ctx))->getPageScope(); if (scope && scope!=Doxygen::globalScope) g_context = scope->name(); } else if (ctx && ctx->definitionType()==Definition::TypeGroup) { - Definition *scope = ((GroupDef*)ctx)->getGroupScope(); + Definition *scope = (dynamic_cast<GroupDef*>(ctx))->getGroupScope(); if (scope && scope!=Doxygen::globalScope) g_context = scope->name(); } else diff --git a/src/docsets.cpp b/src/docsets.cpp index 1327d80..1d79c9d 100644 --- a/src/docsets.cpp +++ b/src/docsets.cpp @@ -432,15 +432,15 @@ void DocSets::addIndexItem(Definition *context,MemberDef *md, { if (fd==0 && context->definitionType()==Definition::TypeFile) { - fd = (FileDef*)context; + fd = dynamic_cast<FileDef*>(context); } if (cd==0 && context->definitionType()==Definition::TypeClass) { - cd = (ClassDef*)context; + cd = dynamic_cast<ClassDef*>(context); } if (nd==0 && context->definitionType()==Definition::TypeNamespace) { - nd = (NamespaceDef*)context; + nd = dynamic_cast<NamespaceDef*>(context); } if (fd) { diff --git a/src/dot.cpp b/src/dot.cpp index 6972005..40a7210 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -2530,10 +2530,10 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,ClassDef *cd,bool hideSuper) //printf(" inserting %s (%p)\n",bClass->name().data(),bn); m_usedNodes->insert(bClass->name(),bn); // add node to the used list } - if (!bClass->visited && !hideSuper && bClass->subClasses()) + if (!bClass->isVisited() && !hideSuper && bClass->subClasses()) { - bool wasVisited=bClass->visited; - bClass->visited=TRUE; + bool wasVisited=bClass->isVisited(); + bClass->setVisited(TRUE); addHierarchy(bn,bClass,wasVisited); } } @@ -2583,10 +2583,10 @@ void DotGfxHierarchyTable::addClassList(ClassSDict *cl) //m_usedNodes->clear(); m_usedNodes->insert(cd->name(),n); m_rootNodes->insert(0,n); - if (!cd->visited && cd->subClasses()) + if (!cd->isVisited() && cd->subClasses()) { - addHierarchy(n,cd,cd->visited); - cd->visited=TRUE; + addHierarchy(n,cd,cd->isVisited()); + cd->setVisited(TRUE); } } } diff --git a/src/doxygen.cpp b/src/doxygen.cpp index caa13a6..85ca7a3 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -650,12 +650,12 @@ static void buildGroupListFiltered(Entry *root,bool additional, bool includeExte { if (root->tagInfo) { - gd = new GroupDef(root->fileName,root->startLine,root->name,root->type,root->tagInfo->fileName); + gd = createGroupDef(root->fileName,root->startLine,root->name,root->type,root->tagInfo->fileName); gd->setReference(root->tagInfo->tagName); } else { - gd = new GroupDef(root->fileName,root->startLine,root->name,root->type); + gd = createGroupDef(root->fileName,root->startLine,root->name,root->type); } gd->setBriefDescription(root->brief,root->briefFile,root->briefLine); // allow empty docs for group @@ -1000,7 +1000,7 @@ static Definition *buildScopeFromQualifiedName(const QCString name, { // introduce bogus namespace //printf("++ adding dummy namespace %s to %s tagInfo=%p\n",nsName.data(),prevScope->name().data(),tagInfo); - nd=new NamespaceDef( + nd=createNamespaceDef( "[generated]",1,1,fullScope, tagInfo?tagInfo->tagName:QCString(), tagInfo?tagInfo->fileName:QCString()); @@ -1309,7 +1309,7 @@ static void addClassToContext(Entry *root) { tArgList = getTemplateArgumentsFromName(fullName,root->tArgLists); } - cd=new ClassDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn, + cd=createClassDef(tagInfo?tagName:root->fileName,root->startLine,root->startColumn, fullName,sec,tagName,refFileName,TRUE,root->spec&Entry::Enum); Debug::print(Debug::Classes,0," New class `%s' (sec=0x%08x)! #tArgLists=%d tagInfo=%p\n", qPrint(fullName),sec,root->tArgLists ? (int)root->tArgLists->count() : -1, tagInfo); @@ -1400,7 +1400,7 @@ static void buildClassDocList(Entry *root) static void resolveClassNestingRelations() { ClassSDict::Iterator cli(*Doxygen::classSDict); - for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; + for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); bool done=FALSE; int iteration=0; @@ -1411,7 +1411,7 @@ static void resolveClassNestingRelations() ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) { - if (!cd->visited) + if (!cd->isVisited()) { QCString name = stripAnonymousNamespaceScope(cd->name()); //printf("processing=%s, iteration=%d\n",cd->name().data(),iteration); @@ -1423,7 +1423,7 @@ static void resolveClassNestingRelations() //printf("****** adding %s to scope %s in iteration %d\n",cd->name().data(),d->name().data(),iteration); d->addInnerCompound(cd); cd->setOuterScope(d); - cd->visited=TRUE; + cd->setVisited(TRUE); done=FALSE; } //else @@ -1438,7 +1438,7 @@ static void resolveClassNestingRelations() ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) { - if (!cd->visited) + if (!cd->isVisited()) { QCString name = stripAnonymousNamespaceScope(cd->name()); //printf("processing unresolved=%s, iteration=%d\n",cd->name().data(),iteration); @@ -1468,14 +1468,14 @@ void distributeClassGroupRelations() //printf("** distributeClassGroupRelations()\n"); ClassSDict::Iterator cli(*Doxygen::classSDict); - for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; + for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { //printf("Checking %s\n",cd->name().data()); // distribute the group to nested classes as well - if (!cd->visited && cd->partOfGroups()!=0 && cd->getClassSDict()) + if (!cd->isVisited() && cd->partOfGroups()!=0 && cd->getClassSDict()) { //printf(" Candidate for merging\n"); ClassSDict::Iterator ncli(*cd->getClassSDict()); @@ -1491,7 +1491,7 @@ void distributeClassGroupRelations() gd->addClass(ncd); } } - cd->visited=TRUE; // only visit every class once + cd->setVisited(TRUE); // only visit every class once } } } @@ -1503,7 +1503,7 @@ static ClassDef *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,const QC QCString fullName = removeAnonymousScopes(templ->name()); if (fullName.right(2)=="::") fullName=fullName.left(fullName.length()-2); fullName+="."+fieldName; - ClassDef *cd = new ClassDef(templ->getDefFileName(), + ClassDef *cd = createClassDef(templ->getDefFileName(), templ->getDefLine(), templ->getDefColumn(), fullName, @@ -1548,7 +1548,7 @@ static ClassDef *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,const QC for (li.toFirst();(md=li.current());++li) { //printf(" Member %s type=%s\n",md->name().data(),md->typeString()); - MemberDef *imd = new MemberDef(md->getDefFileName(),md->getDefLine(),md->getDefColumn(), + MemberDef *imd = createMemberDef(md->getDefFileName(),md->getDefLine(),md->getDefColumn(), md->typeString(),md->name(),md->argsString(),md->excpString(), md->protection(),md->virtualness(),md->isStatic(),Member, md->memberType(), @@ -1741,7 +1741,7 @@ static void buildNamespaceList(Entry *root) tagFileName = tagInfo->fileName; } //printf("++ new namespace %s lang=%s tagName=%s\n",fullName.data(),langToString(root->lang).data(),tagName.data()); - NamespaceDef *nd=new NamespaceDef(tagInfo?tagName:root->fileName,root->startLine, + NamespaceDef *nd=createNamespaceDef(tagInfo?tagName:root->fileName,root->startLine, root->startColumn,fullName,tagName,tagFileName, root->type,root->spec&Entry::Published); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition @@ -1879,7 +1879,7 @@ static void findUsingDirectives(Entry *root) Definition *s = pnd->getOuterScope(); if (s && s->definitionType()==Definition::TypeNamespace) { - pnd = (NamespaceDef*)s; + pnd = dynamic_cast<NamespaceDef*>(s); } else { @@ -1913,7 +1913,7 @@ static void findUsingDirectives(Entry *root) else // unknown namespace, but add it anyway. { //printf("++ new unknown namespace %s lang=%s\n",name.data(),langToString(root->lang).data()); - NamespaceDef *nd=new NamespaceDef(root->fileName,root->startLine,root->startColumn,name); + NamespaceDef *nd=createNamespaceDef(root->fileName,root->startLine,root->startColumn,name); nd->setDocumentation(root->doc,root->docFile,root->docLine); // copy docs to definition nd->setBriefDescription(root->brief,root->briefFile,root->briefLine); nd->addSectionsToDefinition(root->anchors); @@ -2026,7 +2026,7 @@ static void findUsingDeclarations(Entry *root) { Debug::print(Debug::Classes,0," New using class `%s' (sec=0x%08x)! #tArgLists=%d\n", qPrint(name),root->section,root->tArgLists ? (int)root->tArgLists->count() : -1); - usingCd = new ClassDef( + usingCd = createClassDef( "<using>",1,1, name, ClassDef::Class); @@ -2107,7 +2107,7 @@ static void findUsingDeclImports(Entry *root) } ArgumentList *templAl = md->templateArguments(); ArgumentList *al = md->templateArguments(); - newMd = new MemberDef( + newMd = createMemberDef( fileName,root->startLine,root->startColumn, md->typeString(),memName,md->argsString(), md->excpString(),root->protection,root->virt, @@ -2169,7 +2169,7 @@ static void findIncludedUsingDirectives() FileDef *fd; for (;(fd=fni.current());++fni) { - fd->visited=FALSE; + fd->setVisited(FALSE); } } // then recursively add using directives found in #include files @@ -2180,7 +2180,7 @@ static void findIncludedUsingDirectives() FileDef *fd; for (fni.toFirst();(fd=fni.current());++fni) { - if (!fd->visited) + if (!fd->isVisited()) { //printf("----- adding using directives for file %s\n",fd->name().data()); fd->addIncludedUsingDirectives(); @@ -2299,7 +2299,7 @@ static MemberDef *addVariableToClass( } // new member variable, typedef or enum value - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, root->type,name,root->args,root->exception, prot,Normal,root->stat,related, @@ -2556,7 +2556,7 @@ static MemberDef *addVariableToFile( Debug::print(Debug::Variables,0, " new variable, nd=%s tagInfo=%p!\n",nd?qPrint(nd->name()):"<global>",root->tagInfo); // new global variable, enum value or typedef - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, root->type,name,root->args,0, root->protection, Normal,root->stat,Member, @@ -3117,7 +3117,7 @@ static void addInterfaceOrServiceToServiceOrSingleton( { fileName = root->tagInfo->tagName; } - MemberDef *const md = new MemberDef( + MemberDef *const md = createMemberDef( fileName, root->startLine, root->startColumn, root->type, rname, "", "", root->protection, root->virt, root->stat, Member, type, 0, root->argList, root->metaData); @@ -3295,7 +3295,7 @@ static void addMethodToClass(Entry *root,ClassDef *cd, // ); // adding class member - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( fileName,root->startLine,root->startColumn, root->type,name,root->args,root->exception, root->protection,root->virt, @@ -3695,7 +3695,7 @@ static void buildFunctionList(Entry *root) // new global function ArgumentList *tArgList = root->tArgLists ? root->tArgLists->getLast() : 0; QCString name=removeRedundantWhiteSpace(rname); - md=new MemberDef( + md=createMemberDef( root->fileName,root->startLine,root->startColumn, root->type,name,root->args,root->exception, root->protection,root->virt,root->stat,Member, @@ -4201,7 +4201,7 @@ static void findUsedClassesForClass(Entry *root, QDict<int> *templateNames=0 ) { - masterCd->visited=TRUE; + masterCd->setVisited(TRUE); ArgumentList *formalArgs = masterCd->templateArguments(); if (masterCd->memberNameInfoSDict()) { @@ -4286,7 +4286,7 @@ static void findUsedClassesForClass(Entry *root, ClassDef *usedCd = Doxygen::hiddenClasses->find(usedName); if (usedCd==0) { - usedCd = new ClassDef( + usedCd = createClassDef( masterCd->getDefFileName(),masterCd->getDefLine(), masterCd->getDefColumn(), usedName, @@ -4335,7 +4335,7 @@ static void findUsedClassesForClass(Entry *root, type+=md->argsString(); } Debug::print(Debug::Classes,0," New undocumented used class `%s'\n", qPrint(type)); - usedCd = new ClassDef( + usedCd = createClassDef( masterCd->getDefFileName(),masterCd->getDefLine(), masterCd->getDefColumn(), type,ClassDef::Class); @@ -4373,7 +4373,7 @@ static void findBaseClassesForClass( ) { //if (masterCd->visited) return; - masterCd->visited=TRUE; + masterCd->setVisited(TRUE); // The base class could ofcouse also be a non-nested class ArgumentList *formalArgs = masterCd->templateArguments(); QListIterator<BaseInfo> bii(*root->extends); @@ -4845,7 +4845,7 @@ static bool findClassRelation( baseClass=Doxygen::hiddenClasses->find(baseClassName); if (baseClass==0) { - baseClass=new ClassDef(root->fileName,root->startLine,root->startColumn, + baseClass=createClassDef(root->fileName,root->startLine,root->startColumn, baseClassName, ClassDef::Class); Doxygen::hiddenClasses->append(baseClassName,baseClass); @@ -4860,7 +4860,7 @@ static bool findClassRelation( // baseClassName.data(),baseClass,biName.data(),templSpec.data()); if (baseClass==0) { - baseClass=new ClassDef(root->fileName,root->startLine,root->startColumn, + baseClass=createClassDef(root->fileName,root->startLine,root->startColumn, baseClassName, ClassDef::Class); Doxygen::classSDict->append(baseClassName,baseClass); @@ -4995,7 +4995,7 @@ static QCString extractClassName(Entry *root) static void findInheritedTemplateInstances() { ClassSDict::Iterator cli(*Doxygen::classSDict); - for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; + for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); QDictIterator<Entry> edi(g_classEntries); Entry *root; for (;(root=edi.current());++edi) @@ -5014,7 +5014,7 @@ static void findInheritedTemplateInstances() static void findUsedTemplateInstances() { ClassSDict::Iterator cli(*Doxygen::classSDict); - for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; + for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); QDictIterator<Entry> edi(g_classEntries); Entry *root; for (;(root=edi.current());++edi) @@ -5033,7 +5033,7 @@ static void findUsedTemplateInstances() static void computeClassRelations() { ClassSDict::Iterator cli(*Doxygen::classSDict); - for (cli.toFirst();cli.current();++cli) cli.current()->visited=FALSE; + for (cli.toFirst();cli.current();++cli) cli.current()->setVisited(FALSE); QDictIterator<Entry> edi(g_classEntries); Entry *root; for (;(root=edi.current());++edi) @@ -5179,28 +5179,6 @@ static void computeMemberReferences() static void addListReferences() { - MemberNameSDict::Iterator mnli(*Doxygen::memberNameSDict); - MemberName *mn=0; - for (mnli.toFirst();(mn=mnli.current());++mnli) - { - MemberNameIterator mni(*mn); - MemberDef *md=0; - for (mni.toFirst();(md=mni.current());++mni) - { - md->visited=FALSE; - } - } - MemberNameSDict::Iterator fmnli(*Doxygen::functionNameSDict); - for (fmnli.toFirst();(mn=fmnli.current());++fmnli) - { - MemberNameIterator mni(*mn); - MemberDef *md=0; - for (mni.toFirst();(md=mni.current());++mni) - { - md->visited=FALSE; - } - } - ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd=0; for (cli.toFirst();(cd=cli.current());++cli) @@ -5614,7 +5592,7 @@ static bool scopeIsTemplate(Definition *d) bool result=FALSE; if (d && d->definitionType()==Definition::TypeClass) { - result = ((ClassDef*)d)->templateArguments() || scopeIsTemplate(d->getOuterScope()); + result = (dynamic_cast<ClassDef*>(d))->templateArguments() || scopeIsTemplate(d->getOuterScope()); } return result; } @@ -6410,7 +6388,7 @@ static void findMember(Entry *root, MemberType mtype=MemberType_Function; ArgumentList *tArgList = new ArgumentList; // getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); - md=new MemberDef( + md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, declMd ? declMd->protection() : root->protection, @@ -6480,7 +6458,7 @@ static void findMember(Entry *root, ArgumentList *tArgList = getTemplateArgumentsFromName(cd->name()+"::"+funcName,root->tArgLists); //printf("new related member %s args=`%s'\n",md->name().data(),funcArgs.data()); - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Related, @@ -6616,7 +6594,7 @@ static void findMember(Entry *root, // this accurately reflects the template arguments of // the related function, which don't have to do with // those of the related class. - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, root->protection,root->virt, @@ -6760,7 +6738,7 @@ localObjCMethod: Debug::print(Debug::FindMembers,0,"4. Local objective C method %s\n" " scopeName=%s className=%s\n",qPrint(root->name),qPrint(scopeName),qPrint(className)); //printf("Local objective C method `%s' of class `%s' found\n",root->name.data(),cd->name().data()); - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( root->fileName,root->startLine,root->startColumn, funcType,funcName,funcArgs,exceptions, root->protection,root->virt,root->stat,Member, @@ -7083,7 +7061,7 @@ static void findEnums(Entry *root) if (!name.isEmpty()) { // new enum type - md = new MemberDef( + md = createMemberDef( root->fileName,root->startLine,root->startColumn, 0,name,0,0, root->protection,Normal,FALSE, @@ -7303,7 +7281,7 @@ static void addEnumValuesToEnums(Entry *root) { fileName = e->tagInfo->tagName; } - MemberDef *fmd=new MemberDef( + MemberDef *fmd=createMemberDef( fileName,e->startLine,e->startColumn, e->type,e->name,e->args,0, e->protection, Normal,e->stat,Member, @@ -8165,7 +8143,7 @@ static void combineUsingRelations() FileDef *fd; for (fni.toFirst();(fd=fni.current());++fni) { - fd->visited=FALSE; + fd->setVisited(FALSE); } } for (fnli.toFirst();(fn=fnli.current());++fnli) @@ -8183,7 +8161,7 @@ static void combineUsingRelations() NamespaceDef *nd; for (nli.toFirst() ; (nd=nli.current()) ; ++nli ) { - nd->visited=FALSE; + nd->setVisited(FALSE); } for (nli.toFirst() ; (nd=nli.current()) ; ++nli ) { @@ -8425,7 +8403,7 @@ static void findDefineDocumentation(Entry *root) if (root->tagInfo && !root->name.isEmpty()) // define read from a tag file { - MemberDef *md=new MemberDef(root->tagInfo->tagName,1,1, + MemberDef *md=createMemberDef(root->tagInfo->tagName,1,1, "#define",root->name,root->args,0, Public,Normal,FALSE,Member,MemberType_Define,0,0,""); md->setTagInfo(root->tagInfo); @@ -8653,7 +8631,7 @@ static void findMainPage(Entry *root) QCString title=root->args.stripWhiteSpace(); //QCString indexName=Config_getBool(GENERATE_TREEVIEW)?"main":"index"; QCString indexName="index"; - Doxygen::mainPage = new PageDef(root->docFile,root->docLine, + Doxygen::mainPage = createPageDef(root->docFile,root->docLine, indexName, root->brief+root->doc+root->inbodyDocs,title); //setFileNameForSections(root->anchors,"index",Doxygen::mainPage); Doxygen::mainPage->setBriefDescription(root->brief,root->briefFile,root->briefLine); @@ -8810,7 +8788,7 @@ static void resolveUserReferences() GroupDef *gd=0; if (si->definition->definitionType()==Definition::TypeMember) { - gd = ((MemberDef *)si->definition)->getGroupDef(); + gd = (dynamic_cast<MemberDef *>(si->definition))->getGroupDef(); } if (gd) @@ -8869,7 +8847,7 @@ static void buildExampleList(Entry *root) } else { - PageDef *pd=new PageDef(root->fileName,root->startLine, + PageDef *pd=createPageDef(root->fileName,root->startLine, root->name,root->brief+root->doc+root->inbodyDocs,root->args); pd->setBriefDescription(root->brief,root->briefFile,root->briefLine); pd->setFileName(convertNameToFile(pd->name()+"-example",FALSE,TRUE)); @@ -9577,7 +9555,7 @@ int readDir(QFileInfo *fi, //printf("New file %s\n",name.data()); if (fnDict) { - FileDef *fd=new FileDef(cfi->dirPath().utf8()+"/",name); + FileDef *fd=createFileDef(cfi->dirPath().utf8()+"/",name); FileName *fn=0; if (!name.isEmpty() && (fn=(*fnDict)[name])) { @@ -9676,7 +9654,7 @@ int readFileOrDirectory(const char *s, //printf("New file %s\n",name.data()); if (fnDict) { - FileDef *fd=new FileDef(dirPath+"/",name); + FileDef *fd=createFileDef(dirPath+"/",name); FileName *fn=0; if (!name.isEmpty() && (fn=(*fnDict)[name])) { @@ -9879,7 +9857,7 @@ static void dumpSymbol(FTextStream &t,Definition *d) QCString anchor; if (d->definitionType()==Definition::TypeMember) { - MemberDef *md = (MemberDef *)d; + MemberDef *md = dynamic_cast<MemberDef *>(d); anchor=":"+md->anchor(); } QCString scope; @@ -10544,7 +10522,7 @@ void checkConfiguration() /** adjust globals that depend on configuration settings. */ void adjustConfiguration() { - Doxygen::globalScope = new NamespaceDef("<globalScope>",1,1,"<globalScope>"); + Doxygen::globalScope = createNamespaceDef("<globalScope>",1,1,"<globalScope>"); Doxygen::inputNameDict = new FileNameDict(10007); Doxygen::includeNameDict = new FileNameDict(10007); Doxygen::exampleNameDict = new FileNameDict(1009); diff --git a/src/filedef.cpp b/src/filedef.cpp index 187b665..130679e 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -43,6 +43,144 @@ #include "config.h" #include "clangparser.h" #include "settings.h" +#include "definitionimpl.h" + +//--------------------------------------------------------------------------- + +class FileDefImpl : public DefinitionImpl, public FileDef +{ + public: + FileDefImpl(const char *p,const char *n,const char *ref=0,const char *dn=0); + virtual ~FileDefImpl(); + + virtual DefType definitionType() const { return TypeFile; } + virtual QCString name() const; + virtual QCString displayName(bool=TRUE) const { return name(); } + virtual QCString fileName() const { return m_fileName; } + virtual QCString getOutputFileBase() const; + virtual QCString anchor() const { return QCString(); } + virtual QCString getSourceFileBase() const; + virtual QCString includeName() const; + virtual QCString includeDependencyGraphFileName() const; + virtual QCString includedByDependencyGraphFileName() const; + virtual QCString absFilePath() const { return m_filePath; } + virtual const QCString &docName() const { return m_docname; } + virtual bool isSource() const { return m_isSource; } + virtual bool isDocumentationFile() const; + virtual Definition *getSourceDefinition(int lineNr) const; + virtual MemberDef *getSourceMember(int lineNr) const; + virtual QCString getPath() const { return m_path; } + virtual QCString getVersion() const { return m_fileVersion; } + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const { return isLinkableInProject() || isReference(); } + virtual bool isIncluded(const QCString &name) const; + virtual PackageDef *packageDef() const { return m_package; } + virtual DirDef *getDirDef() const { return m_dir; } + virtual NamespaceSDict *getUsedNamespaces() const; + virtual SDict<Definition> *getUsedClasses() const { return m_usingDeclList; } + virtual QList<IncludeInfo> *includeFileList() const { return m_includeList; } + virtual QList<IncludeInfo> *includedByFileList() const { return m_includedByList; } + virtual void getAllIncludeFilesRecursively(QStrList &incFiles) const; + virtual MemberList *getMemberList(MemberListType lt) const; + virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; } + virtual MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; } + virtual NamespaceSDict *getNamespaceSDict() const { return m_namespaceSDict; } + virtual ClassSDict *getClassSDict() const { return m_classSDict; } + virtual QCString title() const; + virtual bool hasDetailedDescription() const; + virtual QCString fileVersion() const; + virtual bool subGrouping() const { return m_subGrouping; } + virtual void addSourceRef(int line,Definition *d,MemberDef *md); + virtual void writeDocumentation(OutputList &ol); + virtual void writeMemberPages(OutputList &ol); + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; + virtual void writeSummaryLinks(OutputList &ol); + virtual void writeTagFile(FTextStream &t); + virtual void startParsing(); + virtual void writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu); + virtual void parseSource(bool sameTu,QStrList &filesInSameTu); + virtual void finishParsing(); + virtual void setDiskName(const QCString &name); + virtual void insertMember(MemberDef *md); + virtual void insertClass(ClassDef *cd); + virtual void insertNamespace(NamespaceDef *nd); + virtual void computeAnchors(); + virtual void setPackageDef(PackageDef *pd) { m_package=pd; } + virtual void setDirDef(DirDef *dd) { m_dir=dd; } + virtual void addUsingDirective(NamespaceDef *nd); + virtual void addUsingDeclaration(Definition *def); + virtual void combineUsingRelations(); + virtual bool generateSourceFile() const; + virtual void sortMemberLists(); + virtual void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported,bool indirect); + virtual void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported); + virtual void addMembersToMemberGroup(); + virtual void distributeMemberGroupDocumentation(); + virtual void findSectionsInDocumentation(); + virtual void addIncludedUsingDirectives(); + virtual void addListReferences(); + virtual void setVisited(bool v) { m_visited = v; } + virtual bool isVisited() const { return m_visited; } + + private: + bool m_visited; + void acquireFileVersion(); + MemberList *createMemberList(MemberListType lt); + void addMemberToList(MemberListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); + void writeIncludeFiles(OutputList &ol); + void writeIncludeGraph(OutputList &ol); + void writeIncludedByGraph(OutputList &ol); + void writeMemberGroups(OutputList &ol); + void writeAuthorSection(OutputList &ol); + void writeSourceLink(OutputList &ol); + void writeNamespaceDeclarations(OutputList &ol,const QCString &title, + bool isConstantGroup); + void writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d); + void writeInlineClasses(OutputList &ol); + void startMemberDeclarations(OutputList &ol); + void endMemberDeclarations(OutputList &ol); + void startMemberDocumentation(OutputList &ol); + void endMemberDocumentation(OutputList &ol); + void writeDetailedDescription(OutputList &ol,const QCString &title); + void writeBriefDescription(OutputList &ol); + void writeClassesToTagFile(FTextStream &t,ClassSDict *d); + + QDict<IncludeInfo> *m_includeDict; + QList<IncludeInfo> *m_includeList; + QDict<IncludeInfo> *m_includedByDict; + QList<IncludeInfo> *m_includedByList; + NamespaceSDict *m_usingDirList; + SDict<Definition> *m_usingDeclList; + QCString m_path; + QCString m_filePath; + QCString m_inclDepFileName; + QCString m_inclByDepFileName; + QCString m_outputDiskName; + QCString m_fileName; + QCString m_docname; + QIntDict<Definition> *m_srcDefDict; + QIntDict<MemberDef> *m_srcMemberDict; + bool m_isSource; + QCString m_fileVersion; + PackageDef *m_package; + DirDef *m_dir; + QList<MemberList> m_memberLists; + MemberGroupSDict *m_memberGroupSDict; + NamespaceSDict *m_namespaceSDict; + ClassSDict *m_classSDict; + ClassSDict *m_interfaceSDict; + ClassSDict *m_structSDict; + ClassSDict *m_exceptionSDict; + bool m_subGrouping; +}; + +FileDef *createFileDef(const char *p,const char *n,const char *ref,const char *dn) +{ + return new FileDefImpl(p,n,ref,dn); +} + //--------------------------------------------------------------------------- @@ -75,9 +213,9 @@ class DevNullCodeDocInterface : public CodeOutputInterface \a nm the file name, and \a lref is an HTML anchor name if the file was read from a tag file or 0 otherwise */ -FileDef::FileDef(const char *p,const char *nm, +FileDefImpl::FileDefImpl(const char *p,const char *nm, const char *lref,const char *dn) - : Definition((QCString)p+nm,1,1,nm) + : DefinitionImpl((QCString)p+nm,1,1,nm) { m_path=p; m_filePath=m_path+nm; @@ -101,6 +239,7 @@ FileDef::FileDef(const char *p,const char *nm, m_isSource = guessSection(nm)==Entry::SOURCE_SEC; m_docname = nm; m_dir = 0; + m_visited = FALSE; if (Config_getBool(FULL_PATH_NAMES)) { m_docname.prepend(stripFromPath(m_path.copy())); @@ -112,7 +251,7 @@ FileDef::FileDef(const char *p,const char *nm, } /*! destroy the file definition */ -FileDef::~FileDef() +FileDefImpl::~FileDefImpl() { delete m_classSDict; delete m_interfaceSDict; @@ -130,7 +269,7 @@ FileDef::~FileDef() delete m_memberGroupSDict; } -void FileDef::setDiskName(const QCString &name) +void FileDefImpl::setDiskName(const QCString &name) { if (isReference()) { @@ -147,15 +286,15 @@ void FileDef::setDiskName(const QCString &name) } /*! Compute the HTML anchor names for all members in the class */ -void FileDef::computeAnchors() +void FileDefImpl::computeAnchors() { MemberList *ml = getMemberList(MemberListType_allMembersList); if (ml) setAnchors(ml); } -void FileDef::distributeMemberGroupDocumentation() +void FileDefImpl::distributeMemberGroupDocumentation() { - //printf("FileDef::distributeMemberGroupDocumentation()\n"); + //printf("FileDefImpl::distributeMemberGroupDocumentation()\n"); if (m_memberGroupSDict) { MemberGroupSDict::Iterator mgli(*m_memberGroupSDict); @@ -167,7 +306,7 @@ void FileDef::distributeMemberGroupDocumentation() } } -void FileDef::findSectionsInDocumentation() +void FileDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); if (m_memberGroupSDict) @@ -191,7 +330,7 @@ void FileDef::findSectionsInDocumentation() } } -bool FileDef::hasDetailedDescription() const +bool FileDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); @@ -201,7 +340,7 @@ bool FileDef::hasDetailedDescription() const ); } -void FileDef::writeTagFile(FTextStream &tagFile) +void FileDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"file\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; @@ -314,7 +453,7 @@ void FileDef::writeTagFile(FTextStream &tagFile) tagFile << " </compound>" << endl; } -void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) +void FileDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if (hasDetailedDescription()) { @@ -393,7 +532,7 @@ void FileDef::writeDetailedDescription(OutputList &ol,const QCString &title) } } -void FileDef::writeBriefDescription(OutputList &ol) +void FileDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { @@ -430,7 +569,7 @@ void FileDef::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void FileDef::writeClassesToTagFile(FTextStream &tagFile, ClassSDict *d) +void FileDefImpl::writeClassesToTagFile(FTextStream &tagFile, ClassSDict *d) { SDict<ClassDef>::Iterator ci(*d); ClassDef *cd; @@ -444,7 +583,7 @@ void FileDef::writeClassesToTagFile(FTextStream &tagFile, ClassSDict *d) } } -void FileDef::writeIncludeFiles(OutputList &ol) +void FileDefImpl::writeIncludeFiles(OutputList &ol) { if (m_includeList && m_includeList->count()>0) { @@ -513,7 +652,7 @@ void FileDef::writeIncludeFiles(OutputList &ol) } } -void FileDef::writeIncludeGraph(OutputList &ol) +void FileDefImpl::writeIncludeGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(INCLUDE_GRAPH)*/) { @@ -537,7 +676,7 @@ void FileDef::writeIncludeGraph(OutputList &ol) } } -void FileDef::writeIncludedByGraph(OutputList &ol) +void FileDefImpl::writeIncludedByGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(INCLUDED_BY_GRAPH)*/) { @@ -562,7 +701,7 @@ void FileDef::writeIncludedByGraph(OutputList &ol) } -void FileDef::writeSourceLink(OutputList &ol) +void FileDefImpl::writeSourceLink(OutputList &ol) { //printf("%s: generateSourceFile()=%d\n",name().data(),generateSourceFile()); if (generateSourceFile()) @@ -577,20 +716,20 @@ void FileDef::writeSourceLink(OutputList &ol) } } -void FileDef::writeNamespaceDeclarations(OutputList &ol,const QCString &title, +void FileDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool const isConstantGroup) { // write list of namespaces if (m_namespaceSDict) m_namespaceSDict->writeDeclaration(ol,title,isConstantGroup); } -void FileDef::writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d) +void FileDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d) { // write list of classes if (d) d->writeDeclaration(ol,0,title,FALSE); } -void FileDef::writeInlineClasses(OutputList &ol) +void FileDefImpl::writeInlineClasses(OutputList &ol) { // temporarily undo the disbling could be done by startMemberDocumentation() // as a result of setting SEPARATE_MEMBER_PAGES to YES; see bug730512 @@ -603,17 +742,17 @@ void FileDef::writeInlineClasses(OutputList &ol) if (!isEnabled) ol.disable(OutputGenerator::Html); } -void FileDef::startMemberDeclarations(OutputList &ol) +void FileDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } -void FileDef::endMemberDeclarations(OutputList &ol) +void FileDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } -void FileDef::startMemberDocumentation(OutputList &ol) +void FileDefImpl::startMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { @@ -622,7 +761,7 @@ void FileDef::startMemberDocumentation(OutputList &ol) } } -void FileDef::endMemberDocumentation(OutputList &ol) +void FileDefImpl::endMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { @@ -631,7 +770,7 @@ void FileDef::endMemberDocumentation(OutputList &ol) } } -void FileDef::writeMemberGroups(OutputList &ol) +void FileDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ if (m_memberGroupSDict) @@ -650,7 +789,7 @@ void FileDef::writeMemberGroups(OutputList &ol) } } -void FileDef::writeAuthorSection(OutputList &ol) +void FileDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); @@ -662,7 +801,7 @@ void FileDef::writeAuthorSection(OutputList &ol) ol.popGeneratorState(); } -void FileDef::writeSummaryLinks(OutputList &ol) +void FileDefImpl::writeSummaryLinks(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -729,7 +868,7 @@ void FileDef::writeSummaryLinks(OutputList &ol) /*! Write the documentation page for this file to the file of output generators \a ol. */ -void FileDef::writeDocumentation(OutputList &ol) +void FileDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //funcList->countDecMembers(); @@ -946,7 +1085,7 @@ void FileDef::writeDocumentation(OutputList &ol) } } -void FileDef::writeMemberPages(OutputList &ol) +void FileDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -964,7 +1103,7 @@ void FileDef::writeMemberPages(OutputList &ol) ol.popGeneratorState(); } -void FileDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const +void FileDefImpl::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const { static bool createSubDirs=Config_getBool(CREATE_SUBDIRS); @@ -1008,7 +1147,7 @@ void FileDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const } /*! Write a source listing of this file to the output */ -void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) +void FileDefImpl::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); @@ -1126,7 +1265,7 @@ void FileDef::writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) ol.enableAll(); } -void FileDef::parseSource(bool sameTu,QStrList &filesInSameTu) +void FileDefImpl::parseSource(bool sameTu,QStrList &filesInSameTu) { static bool filterSourceFiles = Config_getBool(FILTER_SOURCE_FILES); DevNullCodeDocInterface devNullIntf; @@ -1161,16 +1300,16 @@ void FileDef::parseSource(bool sameTu,QStrList &filesInSameTu) } } -void FileDef::startParsing() +void FileDefImpl::startParsing() { } -void FileDef::finishParsing() +void FileDefImpl::finishParsing() { ClangParser::instance()->finish(); } -void FileDef::addMembersToMemberGroup() +void FileDefImpl::addMembersToMemberGroup() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1199,10 +1338,10 @@ void FileDef::addMembersToMemberGroup() } /*! Adds member definition \a md to the list of all members of this file */ -void FileDef::insertMember(MemberDef *md) +void FileDefImpl::insertMember(MemberDef *md) { if (md->isHidden()) return; - //printf("%s:FileDef::insertMember(%s (=%p) list has %d elements)\n", + //printf("%s:FileDefImpl::insertMember(%s (=%p) list has %d elements)\n", // name().data(),md->name().data(),md,allMemberList.count()); MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList && allMemberList->findRef(md)!=-1) // TODO optimize the findRef! @@ -1251,7 +1390,7 @@ void FileDef::insertMember(MemberDef *md) addMemberToList(MemberListType_docDefineMembers,md); break; default: - err("FileDef::insertMembers(): " + err("FileDefImpl::insertMembers(): " "member `%s' with class scope `%s' inserted in file scope `%s'!\n", md->name().data(), md->getClassDef() ? md->getClassDef()->name().data() : "<global>", @@ -1261,7 +1400,7 @@ void FileDef::insertMember(MemberDef *md) } /*! Adds compound definition \a cd to the list of all compounds of this file */ -void FileDef::insertClass(ClassDef *cd) +void FileDefImpl::insertClass(ClassDef *cd) { if (cd->isHidden()) return; @@ -1298,7 +1437,7 @@ void FileDef::insertClass(ClassDef *cd) } /*! Adds namespace definition \a nd to the list of all compounds of this file */ -void FileDef::insertNamespace(NamespaceDef *nd) +void FileDefImpl::insertNamespace(NamespaceDef *nd) { if (nd->isHidden()) return; if (!nd->name().isEmpty() && @@ -1319,17 +1458,17 @@ void FileDef::insertNamespace(NamespaceDef *nd) } } -QCString FileDef::name() const +QCString FileDefImpl::name() const { if (Config_getBool(FULL_PATH_NAMES)) return m_fileName; else - return Definition::name(); + return DefinitionImpl::name(); } -void FileDef::addSourceRef(int line,Definition *d,MemberDef *md) +void FileDefImpl::addSourceRef(int line,Definition *d,MemberDef *md) { - //printf("FileDef::addSourceDef(%d,%p,%p)\n",line,d,md); + //printf("FileDefImpl::addSourceDef(%d,%p,%p)\n",line,d,md); if (d) { if (m_srcDefDict==0) m_srcDefDict = new QIntDict<Definition>(257); @@ -1341,7 +1480,7 @@ void FileDef::addSourceRef(int line,Definition *d,MemberDef *md) } } -Definition *FileDef::getSourceDefinition(int lineNr) const +Definition *FileDefImpl::getSourceDefinition(int lineNr) const { Definition *result=0; if (m_srcDefDict) @@ -1352,7 +1491,7 @@ Definition *FileDef::getSourceDefinition(int lineNr) const return result; } -MemberDef *FileDef::getSourceMember(int lineNr) const +MemberDef *FileDefImpl::getSourceMember(int lineNr) const { MemberDef *result=0; if (m_srcMemberDict) @@ -1364,7 +1503,7 @@ MemberDef *FileDef::getSourceMember(int lineNr) const } -void FileDef::addUsingDirective(NamespaceDef *nd) +void FileDefImpl::addUsingDirective(NamespaceDef *nd) { if (m_usingDirList==0) { @@ -1374,16 +1513,16 @@ void FileDef::addUsingDirective(NamespaceDef *nd) { m_usingDirList->append(nd->qualifiedName(),nd); } - //printf("%p: FileDef::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); + //printf("%p: FileDefImpl::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); } -NamespaceSDict *FileDef::getUsedNamespaces() const +NamespaceSDict *FileDefImpl::getUsedNamespaces() const { - //printf("%p: FileDef::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); + //printf("%p: FileDefImpl::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); return m_usingDirList; } -void FileDef::addUsingDeclaration(Definition *d) +void FileDefImpl::addUsingDeclaration(Definition *d) { if (m_usingDeclList==0) { @@ -1395,10 +1534,10 @@ void FileDef::addUsingDeclaration(Definition *d) } } -void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local, +void FileDefImpl::addIncludeDependency(FileDef *fd,const char *incName,bool local, bool imported,bool indirect) { - //printf("FileDef::addIncludeDependency(%p,%s,%d)\n",fd,incName,local); + //printf("FileDefImpl::addIncludeDependency(%p,%s,%d)\n",fd,incName,local); QCString iName = fd ? fd->absFilePath().data() : incName; if (!iName.isEmpty() && (!m_includeDict || m_includeDict->find(iName)==0)) { @@ -1419,11 +1558,11 @@ void FileDef::addIncludeDependency(FileDef *fd,const char *incName,bool local, } } -void FileDef::addIncludedUsingDirectives() +void FileDefImpl::addIncludedUsingDirectives() { - if (visited) return; - visited=TRUE; - //printf("( FileDef::addIncludedUsingDirectives for file %s\n",name().data()); + if (m_visited) return; + m_visited=TRUE; + //printf("( FileDefImpl::addIncludedUsingDirectives for file %s\n",name().data()); if (m_includeList) // file contains #includes { @@ -1432,7 +1571,7 @@ void FileDef::addIncludedUsingDirectives() IncludeInfo *ii; for (iii.toFirst();(ii=iii.current());++iii) // foreach #include... { - if (ii->fileDef && !ii->fileDef->visited) // ...that is a known file + if (ii->fileDef && !ii->fileDef->isVisited()) // ...that is a known file { // recurse into this file ii->fileDef->addIncludedUsingDirectives(); @@ -1448,7 +1587,7 @@ void FileDef::addIncludedUsingDirectives() if (ii->fileDef && ii->fileDef!=this) { // add using directives - NamespaceSDict *unl = ii->fileDef->m_usingDirList; + NamespaceSDict *unl = ii->fileDef->getUsedNamespaces(); if (unl) { NamespaceSDict::Iterator nli(*unl); @@ -1466,7 +1605,7 @@ void FileDef::addIncludedUsingDirectives() } } // add using declarations - SDict<Definition> *udl = ii->fileDef->m_usingDeclList; + SDict<Definition> *udl = ii->fileDef->getUsedClasses(); if (udl) { SDict<Definition>::Iterator udi(*udl); @@ -1488,14 +1627,14 @@ void FileDef::addIncludedUsingDirectives() } } } - //printf(") end FileDef::addIncludedUsingDirectives for file %s\n",name().data()); + //printf(") end FileDefImpl::addIncludedUsingDirectives for file %s\n",name().data()); } -void FileDef::addIncludedByDependency(FileDef *fd,const char *incName, +void FileDefImpl::addIncludedByDependency(FileDef *fd,const char *incName, bool local,bool imported) { - //printf("FileDef::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); + //printf("FileDefImpl::addIncludedByDependency(%p,%s,%d)\n",fd,incName,local); QCString iName = fd ? fd->absFilePath().data() : incName; if (!iName.isEmpty() && (m_includedByDict==0 || m_includedByDict->find(iName)==0)) { @@ -1516,13 +1655,13 @@ void FileDef::addIncludedByDependency(FileDef *fd,const char *incName, } } -bool FileDef::isIncluded(const QCString &name) const +bool FileDefImpl::isIncluded(const QCString &name) const { if (name.isEmpty()) return FALSE; return m_includeDict!=0 && m_includeDict->find(name)!=0; } -bool FileDef::generateSourceFile() const +bool FileDefImpl::generateSourceFile() const { static bool sourceBrowser = Config_getBool(SOURCE_BROWSER); static bool verbatimHeaders = Config_getBool(VERBATIM_HEADERS); @@ -1534,7 +1673,7 @@ bool FileDef::generateSourceFile() const } -void FileDef::addListReferences() +void FileDefImpl::addListReferences() { { QList<ListItemInfo> *xrefItems = xrefListItems(); @@ -1762,7 +1901,7 @@ static void addDirsAsGroups(Directory *root,GroupDef *parent,int level) GroupDef *gd=0; if (root->kind()==DirEntry::Dir) { - gd = new GroupDef("[generated]", + gd = createGroupDef("[generated]", 1, root->path(), // name root->name() // title @@ -1812,10 +1951,10 @@ void generateFileTree() //------------------------------------------------------------------- -void FileDef::combineUsingRelations() +void FileDefImpl::combineUsingRelations() { - if (visited) return; // already done - visited=TRUE; + if (m_visited) return; // already done + m_visited=TRUE; if (m_usingDirList) { NamespaceSDict::Iterator nli(*m_usingDirList); @@ -1852,7 +1991,7 @@ void FileDef::combineUsingRelations() } } -bool FileDef::isDocumentationFile() const +bool FileDefImpl::isDocumentationFile() const { return name().right(4)==".doc" || name().right(4)==".txt" || @@ -1861,7 +2000,7 @@ bool FileDef::isDocumentationFile() const name().right(9)==".markdown"; } -void FileDef::acquireFileVersion() +void FileDefImpl::acquireFileVersion() { QCString vercmd = Config_getString(FILE_VERSION_FILTER); if (!vercmd.isEmpty() && !m_filePath.isEmpty() && @@ -1895,7 +2034,7 @@ void FileDef::acquireFileVersion() } -QCString FileDef::getSourceFileBase() const +QCString FileDefImpl::getSourceFileBase() const { if (Htags::useHtags) { @@ -1907,18 +2046,18 @@ QCString FileDef::getSourceFileBase() const } } -QCString FileDef::getOutputFileBase() const +QCString FileDefImpl::getOutputFileBase() const { return m_outputDiskName; } /*! Returns the name of the verbatim copy of this file (if any). */ -QCString FileDef::includeName() const +QCString FileDefImpl::includeName() const { return getSourceFileBase(); } -MemberList *FileDef::createMemberList(MemberListType lt) +MemberList *FileDefImpl::createMemberList(MemberListType lt) { m_memberLists.setAutoDelete(TRUE); QListIterator<MemberList> mli(m_memberLists); @@ -1936,7 +2075,7 @@ MemberList *FileDef::createMemberList(MemberListType lt) return ml; } -void FileDef::addMemberToList(MemberListType lt,MemberDef *md) +void FileDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); @@ -1958,7 +2097,7 @@ void FileDef::addMemberToList(MemberListType lt,MemberDef *md) if (ml->listType()&MemberListType_declarationLists) md->setSectionList(this,ml); } -void FileDef::sortMemberLists() +void FileDefImpl::sortMemberLists() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1980,7 +2119,7 @@ void FileDef::sortMemberLists() } -MemberList *FileDef::getMemberList(MemberListType lt) const +MemberList *FileDefImpl::getMemberList(MemberListType lt) const { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1994,7 +2133,7 @@ MemberList *FileDef::getMemberList(MemberListType lt) const return 0; } -void FileDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) +void FileDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { static bool optVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); MemberList * ml = getMemberList(lt); @@ -2012,13 +2151,13 @@ void FileDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCS } } -void FileDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) +void FileDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,name(),this,title); } -bool FileDef::isLinkableInProject() const +bool FileDefImpl::isLinkableInProject() const { static bool showFiles = Config_getBool(SHOW_FILES); return hasDocumentation() && !isReference() && (showFiles || isLinkableViaGroup()); @@ -2036,7 +2175,7 @@ static void getAllIncludeFilesRecursively( if (ii->fileDef && !ii->fileDef->isReference() && !filesVisited->find(ii->fileDef->absFilePath())) { - //printf("FileDef::addIncludeDependency(%s)\n",ii->fileDef->absFilePath().data()); + //printf("FileDefImpl::addIncludeDependency(%s)\n",ii->fileDef->absFilePath().data()); incFiles.append(ii->fileDef->absFilePath()); filesVisited->insert(ii->fileDef->absFilePath(),(void*)0x8); getAllIncludeFilesRecursively(filesVisited,ii->fileDef,incFiles); @@ -2045,28 +2184,28 @@ static void getAllIncludeFilesRecursively( } } -void FileDef::getAllIncludeFilesRecursively(QStrList &incFiles) const +void FileDefImpl::getAllIncludeFilesRecursively(QStrList &incFiles) const { QDict<void> includes(257); ::getAllIncludeFilesRecursively(&includes,this,incFiles); } -QCString FileDef::title() const +QCString FileDefImpl::title() const { return theTranslator->trFileReference(name()); } -QCString FileDef::fileVersion() const +QCString FileDefImpl::fileVersion() const { return m_fileVersion; } -QCString FileDef::includeDependencyGraphFileName() const +QCString FileDefImpl::includeDependencyGraphFileName() const { return m_inclDepFileName; } -QCString FileDef::includedByDependencyGraphFileName() const +QCString FileDefImpl::includedByDependencyGraphFileName() const { return m_inclByDepFileName; } diff --git a/src/filedef.h b/src/filedef.h index fe3c81d..63cacf5 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -61,185 +61,127 @@ struct IncludeInfo * The member writeDocumentation() can be used to generate the page of * documentation to HTML and LaTeX. */ -class FileDef : public Definition +class FileDef : virtual public Definition { public: - //enum FileType { Source, Header, Unknown }; - - FileDef(const char *p,const char *n,const char *ref=0,const char *dn=0); - ~FileDef(); + ~FileDef() {} // ---------------------------------------------------------------------- - DefType definitionType() const { return TypeFile; } + virtual DefType definitionType() const = 0; /*! Returns the unique file name (this may include part of the path). */ - QCString name() const; - QCString displayName(bool=TRUE) const { return name(); } - QCString fileName() const { return m_fileName; } - - QCString getOutputFileBase() const; + virtual QCString name() const = 0; + virtual QCString displayName(bool=TRUE) const = 0; + virtual QCString fileName() const = 0; + + virtual QCString getOutputFileBase() const = 0; + + virtual QCString anchor() const = 0; - QCString anchor() const { return QCString(); } + virtual QCString getSourceFileBase() const = 0; - QCString getSourceFileBase() const; - /*! Returns the name of the verbatim copy of this file (if any). */ - QCString includeName() const; + virtual QCString includeName() const = 0; - QCString includeDependencyGraphFileName() const; + virtual QCString includeDependencyGraphFileName() const = 0; + + virtual QCString includedByDependencyGraphFileName() const = 0; - QCString includedByDependencyGraphFileName() const; - /*! Returns the absolute path including the file name. */ - QCString absFilePath() const { return m_filePath; } - + virtual QCString absFilePath() const = 0; + /*! Returns the name as it is used in the documentation */ - const QCString &docName() const { return m_docname; } + virtual const QCString &docName() const = 0; /*! Returns TRUE if this file is a source file. */ - bool isSource() const { return m_isSource; } + virtual bool isSource() const = 0; - bool isDocumentationFile() const; - - Definition *getSourceDefinition(int lineNr) const; - MemberDef *getSourceMember(int lineNr) const; + virtual bool isDocumentationFile() const = 0; - /*! Returns the absolute path of this file. */ - QCString getPath() const { return m_path; } + virtual Definition *getSourceDefinition(int lineNr) const = 0; + virtual MemberDef *getSourceMember(int lineNr) const = 0; + + /*! Returns the absolute path of this file. */ + virtual QCString getPath() const = 0; /*! Returns version of this file. */ - QCString getVersion() const { return m_fileVersion; } - - bool isLinkableInProject() const; + virtual QCString getVersion() const = 0; + + virtual bool isLinkableInProject() const = 0; - bool isLinkable() const { return isLinkableInProject() || isReference(); } - bool isIncluded(const QCString &name) const; + virtual bool isLinkable() const = 0; + virtual bool isIncluded(const QCString &name) const = 0; - PackageDef *packageDef() const { return m_package; } - DirDef *getDirDef() const { return m_dir; } - NamespaceSDict *getUsedNamespaces() const; - SDict<Definition> *getUsedClasses() const { return m_usingDeclList; } - QList<IncludeInfo> *includeFileList() const { return m_includeList; } - QList<IncludeInfo> *includedByFileList() const { return m_includedByList; } - void getAllIncludeFilesRecursively(QStrList &incFiles) const; + virtual PackageDef *packageDef() const = 0; + virtual DirDef *getDirDef() const = 0; + virtual NamespaceSDict *getUsedNamespaces() const = 0; + virtual SDict<Definition> *getUsedClasses() const = 0; + virtual QList<IncludeInfo> *includeFileList() const = 0; + virtual QList<IncludeInfo> *includedByFileList() const = 0; + virtual void getAllIncludeFilesRecursively(QStrList &incFiles) const = 0; - MemberList *getMemberList(MemberListType lt) const; - const QList<MemberList> &getMemberLists() const { return m_memberLists; } + virtual MemberList *getMemberList(MemberListType lt) const = 0; + virtual const QList<MemberList> &getMemberLists() const = 0; /* user defined member groups */ - MemberGroupSDict *getMemberGroupSDict() const { return m_memberGroupSDict; } - NamespaceSDict *getNamespaceSDict() const { return m_namespaceSDict; } - ClassSDict *getClassSDict() const { return m_classSDict; } + virtual MemberGroupSDict *getMemberGroupSDict() const = 0; + virtual NamespaceSDict *getNamespaceSDict() const = 0; + virtual ClassSDict *getClassSDict() const = 0; + + virtual QCString title() const = 0; + virtual bool hasDetailedDescription() const = 0; + virtual QCString fileVersion() const = 0; - QCString title() const; - bool hasDetailedDescription() const; - QCString fileVersion() const; + virtual bool subGrouping() const = 0; - bool subGrouping() const { return m_subGrouping; } - //--------------------------------- - void addSourceRef(int line,Definition *d,MemberDef *md); + virtual void addSourceRef(int line,Definition *d,MemberDef *md) = 0; - void writeDocumentation(OutputList &ol); - void writeMemberPages(OutputList &ol); - void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; - void writeSummaryLinks(OutputList &ol); - void writeTagFile(FTextStream &t); + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeMemberPages(OutputList &ol) = 0; + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const = 0; + virtual void writeSummaryLinks(OutputList &ol) = 0; + virtual void writeTagFile(FTextStream &t) = 0; - void startParsing(); - void writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu); - void parseSource(bool sameTu,QStrList &filesInSameTu); - void finishParsing(); - void setDiskName(const QCString &name); + virtual void startParsing() = 0; + virtual void writeSource(OutputList &ol,bool sameTu,QStrList &filesInSameTu) = 0; + virtual void parseSource(bool sameTu,QStrList &filesInSameTu) = 0; + virtual void finishParsing() = 0; + virtual void setDiskName(const QCString &name) = 0; - void insertMember(MemberDef *md); - void insertClass(ClassDef *cd); - void insertNamespace(NamespaceDef *nd); - void computeAnchors(); + virtual void insertMember(MemberDef *md) = 0; + virtual void insertClass(ClassDef *cd) = 0; + virtual void insertNamespace(NamespaceDef *nd) = 0; + virtual void computeAnchors() = 0; - void setPackageDef(PackageDef *pd) { m_package=pd; } - void setDirDef(DirDef *dd) { m_dir=dd; } + virtual void setPackageDef(PackageDef *pd) = 0; + virtual void setDirDef(DirDef *dd) = 0; - void addUsingDirective(NamespaceDef *nd); - void addUsingDeclaration(Definition *def); - void combineUsingRelations(); + virtual void addUsingDirective(NamespaceDef *nd) = 0; + virtual void addUsingDeclaration(Definition *def) = 0; + virtual void combineUsingRelations() = 0; - bool generateSourceFile() const; - void sortMemberLists(); + virtual bool generateSourceFile() const = 0; + virtual void sortMemberLists() = 0; - void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported,bool indirect); - void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported); + virtual void addIncludeDependency(FileDef *fd,const char *incName,bool local,bool imported,bool indirect) = 0; + virtual void addIncludedByDependency(FileDef *fd,const char *incName,bool local,bool imported) = 0; - void addMembersToMemberGroup(); - void distributeMemberGroupDocumentation(); - void findSectionsInDocumentation(); - void addIncludedUsingDirectives(); + virtual void addMembersToMemberGroup() = 0; + virtual void distributeMemberGroupDocumentation() = 0; + virtual void findSectionsInDocumentation() = 0; + virtual void addIncludedUsingDirectives() = 0; - void addListReferences(); - //bool includes(FileDef *incFile,QDict<FileDef> *includedFiles) const; - //bool includesByName(const QCString &name) const; - bool visited; + virtual void addListReferences() = 0; - protected: - /** - * Retrieves the file version from version control system. - */ - void acquireFileVersion(); - - private: - MemberList *createMemberList(MemberListType lt); - void addMemberToList(MemberListType lt,MemberDef *md); - void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); - void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); - void writeIncludeFiles(OutputList &ol); - void writeIncludeGraph(OutputList &ol); - void writeIncludedByGraph(OutputList &ol); - void writeMemberGroups(OutputList &ol); - void writeAuthorSection(OutputList &ol); - void writeSourceLink(OutputList &ol); - void writeNamespaceDeclarations(OutputList &ol,const QCString &title, - bool isConstantGroup); - void writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d); - void writeInlineClasses(OutputList &ol); - void startMemberDeclarations(OutputList &ol); - void endMemberDeclarations(OutputList &ol); - void startMemberDocumentation(OutputList &ol); - void endMemberDocumentation(OutputList &ol); - void writeDetailedDescription(OutputList &ol,const QCString &title); - void writeBriefDescription(OutputList &ol); - void writeClassesToTagFile(FTextStream &t,ClassSDict *d); - - QDict<IncludeInfo> *m_includeDict; - QList<IncludeInfo> *m_includeList; - QDict<IncludeInfo> *m_includedByDict; - QList<IncludeInfo> *m_includedByList; - NamespaceSDict *m_usingDirList; - SDict<Definition> *m_usingDeclList; - QCString m_path; - QCString m_filePath; - QCString m_inclDepFileName; - QCString m_inclByDepFileName; - QCString m_outputDiskName; - QCString m_fileName; - QCString m_docname; - QIntDict<Definition> *m_srcDefDict; - QIntDict<MemberDef> *m_srcMemberDict; - bool m_isSource; - QCString m_fileVersion; - PackageDef *m_package; - DirDef *m_dir; - QList<MemberList> m_memberLists; - MemberGroupSDict *m_memberGroupSDict; - NamespaceSDict *m_namespaceSDict; - ClassSDict *m_classSDict; - ClassSDict *m_interfaceSDict; - ClassSDict *m_structSDict; - ClassSDict *m_exceptionSDict; - bool m_subGrouping; + virtual void setVisited(bool v) = 0; + virtual bool isVisited() const = 0; }; +FileDef *createFileDef(const char *p,const char *n,const char *ref=0,const char *dn=0); + /** Class representing a list of FileDef objects. */ class FileList : public QList<FileDef> { diff --git a/src/fortrancode.l b/src/fortrancode.l index 616df5b..7a30deb 100644 --- a/src/fortrancode.l +++ b/src/fortrancode.l @@ -1357,7 +1357,7 @@ void parseFortranCode(CodeOutputInterface &od,const char *className,const QCStri if (exBlock && fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",exName); + g_sourceFileDef = createFileDef("",exName); } if (g_sourceFileDef) { diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp index 9e58591..d66a935 100644 --- a/src/ftvhelp.cpp +++ b/src/ftvhelp.cpp @@ -223,7 +223,7 @@ static QCString node2URL(FTVNode *n,bool overruleFile=FALSE,bool srcLink=FALSE) { if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile) { - FileDef *fd = (FileDef*)n->def; + FileDef *fd = dynamic_cast<FileDef*>(n->def); if (srcLink) { url = fd->getSourceFileBase(); @@ -417,9 +417,9 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in { FileDef *srcRef=0; if (n->def && n->def->definitionType()==Definition::TypeFile && - ((FileDef*)n->def)->generateSourceFile()) + (dynamic_cast<FileDef*>(n->def))->generateSourceFile()) { - srcRef = (FileDef*)n->def; + srcRef = dynamic_cast<FileDef*>(n->def); } if (srcRef) { @@ -560,7 +560,7 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t, { if (n->def && n->def->definitionType()==Definition::TypeFile) { - FileDef *fd = (FileDef*)n->def; + FileDef *fd = dynamic_cast<FileDef*>(n->def); bool doc,src; doc = fileVisibleInIndex(fd,src); if (doc) diff --git a/src/groupdef.cpp b/src/groupdef.cpp index 397b254..31eb7fe 100644 --- a/src/groupdef.cpp +++ b/src/groupdef.cpp @@ -40,11 +40,129 @@ #include "membername.h" #include "dirdef.h" #include "config.h" +#include "definitionimpl.h" //--------------------------------------------------------------------------- -GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, - const char *refFileName) : Definition(df,dl,1,na) +class GroupDefImpl : public DefinitionImpl, public GroupDef +{ + public: + GroupDefImpl(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0); + virtual ~GroupDefImpl(); + + virtual DefType definitionType() const { return TypeGroup; } + virtual QCString getOutputFileBase() const; + virtual QCString anchor() const { return QCString(); } + virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : DefinitionImpl::name(); } + virtual const char *groupTitle() const { return title; } + virtual void setGroupTitle( const char *newtitle ); + virtual bool hasGroupTitle( ) const { return titleSet; } + virtual void addFile(const FileDef *def); + virtual bool addClass(const ClassDef *def); + virtual bool addNamespace(const NamespaceDef *def); + virtual void addGroup(const GroupDef *def); + virtual void addPage(PageDef *def); + virtual void addExample(const PageDef *def); + virtual void addDir(const DirDef *dd); + virtual bool insertMember(MemberDef *def,bool docOnly=FALSE); + virtual void removeMember(MemberDef *md); + virtual bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group + virtual void writeDocumentation(OutputList &ol); + virtual void writeMemberPages(OutputList &ol); + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; + virtual void writeTagFile(FTextStream &); + virtual int countMembers() const; + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual bool isASubGroup() const; + virtual void computeAnchors(); + + virtual void addMembersToMemberGroup(); + virtual void distributeMemberGroupDocumentation(); + virtual void findSectionsInDocumentation(); + + virtual void addListReferences(); + virtual void sortMemberLists(); + virtual bool subGrouping() const { return m_subGrouping; } + + virtual void setGroupScope(Definition *d) { groupScope = d; } + virtual Definition *getGroupScope() const { return groupScope; } + + virtual MemberList *getMemberList(MemberListType lt) const; + virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; } + + /* user defined member groups */ + virtual MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + + virtual FileList * getFiles() const { return fileList; } + virtual ClassSDict * getClasses() const { return classSDict; } + virtual NamespaceSDict * getNamespaces() const { return namespaceSDict; } + virtual GroupList * getSubGroups() const { return groupList; } + virtual PageSDict * getPages() const { return pageDict; } + virtual DirList * getDirs() const { return dirList; } + virtual PageSDict * getExamples() const { return exampleDict; } + virtual bool hasDetailedDescription() const; + virtual void sortSubGroups(); + + private: + void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); + MemberList *createMemberList(MemberListType lt); + void addMemberToList(MemberListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); + void removeMemberFromList(MemberListType lt,MemberDef *md); + void writeGroupGraph(OutputList &ol); + void writeFiles(OutputList &ol,const QCString &title); + void writeNamespaces(OutputList &ol,const QCString &title); + void writeNestedGroups(OutputList &ol,const QCString &title); + void writeDirs(OutputList &ol,const QCString &title); + void writeClasses(OutputList &ol,const QCString &title); + void writeInlineClasses(OutputList &ol); + void writePageDocumentation(OutputList &ol); + void writeDetailedDescription(OutputList &ol,const QCString &title); + void writeBriefDescription(OutputList &ol); + void writeMemberGroups(OutputList &ol); + void startMemberDeclarations(OutputList &ol); + void endMemberDeclarations(OutputList &ol); + void startMemberDocumentation(OutputList &ol); + void endMemberDocumentation(OutputList &ol); + void writeAuthorSection(OutputList &ol); + void writeSummaryLinks(OutputList &ol); + void updateLanguage(const Definition *); + + QCString title; // title of the group + bool titleSet; // true if title is not the same as the name + QCString fileName; // base name of the generated file + FileList *fileList; // list of files in the group + ClassSDict *classSDict; // list of classes in the group + NamespaceSDict *namespaceSDict; // list of namespaces in the group + GroupList *groupList; // list of sub groups. + PageSDict *pageDict; // list of pages in the group + PageSDict *exampleDict; // list of examples in the group + DirList *dirList; // list of directories in the group + + MemberList *allMemberList; + MemberNameInfoSDict *allMemberNameInfoSDict; + + Definition *groupScope; + + QList<MemberList> m_memberLists; + MemberGroupSDict *memberGroupSDict; + bool m_subGrouping; + +}; + +GroupDef *createGroupDef(const char *fileName,int line,const char *name, + const char *title,const char *refFileName) +{ + return new GroupDefImpl(fileName,line,name,title,refFileName); +} + + +//--------------------------------------------------------------------------- + +GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t, + const char *refFileName) : DefinitionImpl(df,dl,1,na) { fileList = new FileList; classSDict = new ClassSDict(17); @@ -69,12 +187,12 @@ GroupDef::GroupDef(const char *df,int dl,const char *na,const char *t, allMemberList = new MemberList(MemberListType_allMembersList); - visited = 0; + //visited = 0; groupScope = 0; m_subGrouping=Config_getBool(SUBGROUPING); } -GroupDef::~GroupDef() +GroupDefImpl::~GroupDefImpl() { delete fileList; delete classSDict; @@ -88,7 +206,7 @@ GroupDef::~GroupDef() delete dirList; } -void GroupDef::setGroupTitle( const char *t ) +void GroupDefImpl::setGroupTitle( const char *t ) { if ( t && qstrlen(t) ) { @@ -104,7 +222,7 @@ void GroupDef::setGroupTitle( const char *t ) } -void GroupDef::distributeMemberGroupDocumentation() +void GroupDefImpl::distributeMemberGroupDocumentation() { MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; @@ -114,7 +232,7 @@ void GroupDef::distributeMemberGroupDocumentation() } } -void GroupDef::findSectionsInDocumentation() +void GroupDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); MemberGroupSDict::Iterator mgli(*memberGroupSDict); @@ -135,7 +253,7 @@ void GroupDef::findSectionsInDocumentation() } } -void GroupDef::addFile(const FileDef *def) +void GroupDefImpl::addFile(const FileDef *def) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (def->isHidden()) return; @@ -146,7 +264,7 @@ void GroupDef::addFile(const FileDef *def) fileList->append(def); } -bool GroupDef::addClass(const ClassDef *cd) +bool GroupDefImpl::addClass(const ClassDef *cd) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (cd->isHidden()) return FALSE; @@ -194,7 +312,7 @@ bool GroupDef::addClass(const ClassDef *cd) return FALSE; } -bool GroupDef::addNamespace(const NamespaceDef *def) +bool GroupDefImpl::addNamespace(const NamespaceDef *def) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (def->isHidden()) return FALSE; @@ -210,7 +328,7 @@ bool GroupDef::addNamespace(const NamespaceDef *def) return FALSE; } -void GroupDef::addDir(const DirDef *def) +void GroupDefImpl::addDir(const DirDef *def) { if (def->isHidden()) return; if (Config_getBool(SORT_BRIEF_DOCS)) @@ -219,7 +337,7 @@ void GroupDef::addDir(const DirDef *def) dirList->append(def); } -void GroupDef::addPage(PageDef *def) +void GroupDefImpl::addPage(PageDef *def) { if (def->isHidden()) return; //printf("Making page %s part of a group\n",def->name.data()); @@ -227,14 +345,14 @@ void GroupDef::addPage(PageDef *def) def->makePartOfGroup(this); } -void GroupDef::addExample(const PageDef *def) +void GroupDefImpl::addExample(const PageDef *def) { if (def->isHidden()) return; exampleDict->append(def->name(),def); } -void GroupDef::addMembersToMemberGroup() +void GroupDefImpl::addMembersToMemberGroup() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -246,7 +364,7 @@ void GroupDef::addMembersToMemberGroup() } } - //printf("GroupDef::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count()); + //printf("GroupDefImpl::addMembersToMemberGroup() memberGroupList=%d\n",memberGroupList->count()); MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) @@ -256,7 +374,7 @@ void GroupDef::addMembersToMemberGroup() } -bool GroupDef::insertMember(MemberDef *md,bool docOnly) +bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly) { if (md->isHidden()) return FALSE; updateLanguage(md); @@ -412,7 +530,7 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly) addMemberToList(MemberListType_docFriendMembers,md); break; default: - err("GroupDef::insertMembers(): " + err("GroupDefImpl::insertMembers(): " "member `%s' (typeid=%d) with scope `%s' inserted in group scope `%s'!\n", md->name().data(),md->memberType(), md->getClassDef() ? md->getClassDef()->name().data() : "", @@ -421,7 +539,7 @@ bool GroupDef::insertMember(MemberDef *md,bool docOnly) return TRUE; } -void GroupDef::removeMember(MemberDef *md) +void GroupDefImpl::removeMember(MemberDef *md) { // fprintf(stderr, "GroupDef(%s)::removeMember( %s )\n", title.data(), md->name().data()); MemberNameInfo *mni = allMemberNameInfoSDict->find(md->name()); @@ -503,12 +621,12 @@ void GroupDef::removeMember(MemberDef *md) removeMemberFromList(MemberListType_docFriendMembers,md); break; default: - err("GroupDef::removeMember(): unexpected member remove in file!\n"); + err("GroupDefImpl::removeMember(): unexpected member remove in file!\n"); } } } -bool GroupDef::findGroup(const GroupDef *def) const +bool GroupDefImpl::findGroup(const GroupDef *def) const { if (this==def) { @@ -529,7 +647,7 @@ bool GroupDef::findGroup(const GroupDef *def) const return FALSE; } -void GroupDef::addGroup(const GroupDef *def) +void GroupDefImpl::addGroup(const GroupDef *def) { //printf("adding group `%s' to group `%s'\n",def->name().data(),name().data()); //if (Config_getBool(SORT_MEMBER_DOCS)) @@ -538,13 +656,13 @@ void GroupDef::addGroup(const GroupDef *def) groupList->append(def); } -bool GroupDef::isASubGroup() const +bool GroupDefImpl::isASubGroup() const { GroupList *groups = partOfGroups(); return groups!=0 && groups->count()!=0; } -int GroupDef::countMembers() const +int GroupDefImpl::countMembers() const { return fileList->count()+ classSDict->count()+ @@ -556,13 +674,13 @@ int GroupDef::countMembers() const } /*! Compute the HTML anchor names for all members in the group */ -void GroupDef::computeAnchors() +void GroupDefImpl::computeAnchors() { - //printf("GroupDef::computeAnchors()\n"); + //printf("GroupDefImpl::computeAnchors()\n"); setAnchors(allMemberList); } -void GroupDef::writeTagFile(FTextStream &tagFile) +void GroupDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"group\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; @@ -705,7 +823,7 @@ void GroupDef::writeTagFile(FTextStream &tagFile) tagFile << " </compound>" << endl; } -void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title) +void GroupDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if ((!briefDescription().isEmpty() && Config_getBool(REPEAT_BRIEF)) || !documentation().isEmpty() || !inbodyDocumentation().isEmpty() @@ -766,7 +884,7 @@ void GroupDef::writeDetailedDescription(OutputList &ol,const QCString &title) } } -void GroupDef::writeBriefDescription(OutputList &ol) +void GroupDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { @@ -802,7 +920,7 @@ void GroupDef::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void GroupDef::writeGroupGraph(OutputList &ol) +void GroupDefImpl::writeGroupGraph(OutputList &ol) { if (Config_getBool(HAVE_DOT) /*&& Config_getBool(GROUP_GRAPHS)*/ ) { @@ -822,7 +940,7 @@ void GroupDef::writeGroupGraph(OutputList &ol) } } -void GroupDef::writeFiles(OutputList &ol,const QCString &title) +void GroupDefImpl::writeFiles(OutputList &ol,const QCString &title) { // write list of files if (fileList->count()>0) @@ -854,13 +972,13 @@ void GroupDef::writeFiles(OutputList &ol,const QCString &title) } } -void GroupDef::writeNamespaces(OutputList &ol,const QCString &title) +void GroupDefImpl::writeNamespaces(OutputList &ol,const QCString &title) { // write list of namespaces namespaceSDict->writeDeclaration(ol,title); } -void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) +void GroupDefImpl::writeNestedGroups(OutputList &ol,const QCString &title) { // write list of groups int count=0; @@ -910,7 +1028,7 @@ void GroupDef::writeNestedGroups(OutputList &ol,const QCString &title) } } -void GroupDef::writeDirs(OutputList &ol,const QCString &title) +void GroupDefImpl::writeDirs(OutputList &ol,const QCString &title) { // write list of directories if (dirList->count()>0) @@ -943,18 +1061,18 @@ void GroupDef::writeDirs(OutputList &ol,const QCString &title) } } -void GroupDef::writeClasses(OutputList &ol,const QCString &title) +void GroupDefImpl::writeClasses(OutputList &ol,const QCString &title) { // write list of classes classSDict->writeDeclaration(ol,0,title,FALSE); } -void GroupDef::writeInlineClasses(OutputList &ol) +void GroupDefImpl::writeInlineClasses(OutputList &ol) { classSDict->writeDocumentation(ol); } -void GroupDef::writePageDocumentation(OutputList &ol) +void GroupDefImpl::writePageDocumentation(OutputList &ol) { PageDef *pd=0; PageSDict::Iterator pdi(*pageDict); @@ -977,7 +1095,7 @@ void GroupDef::writePageDocumentation(OutputList &ol) } } -void GroupDef::writeMemberGroups(OutputList &ol) +void GroupDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ if (memberGroupSDict) @@ -993,19 +1111,19 @@ void GroupDef::writeMemberGroups(OutputList &ol) } } -void GroupDef::startMemberDeclarations(OutputList &ol) +void GroupDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } -void GroupDef::endMemberDeclarations(OutputList &ol) +void GroupDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } -void GroupDef::startMemberDocumentation(OutputList &ol) +void GroupDefImpl::startMemberDocumentation(OutputList &ol) { - //printf("** GroupDef::startMemberDocumentation()\n"); + //printf("** GroupDefImpl::startMemberDocumentation()\n"); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.pushGeneratorState(); @@ -1014,9 +1132,9 @@ void GroupDef::startMemberDocumentation(OutputList &ol) } } -void GroupDef::endMemberDocumentation(OutputList &ol) +void GroupDefImpl::endMemberDocumentation(OutputList &ol) { - //printf("** GroupDef::endMemberDocumentation()\n"); + //printf("** GroupDefImpl::endMemberDocumentation()\n"); if (Config_getBool(SEPARATE_MEMBER_PAGES)) { ol.popGeneratorState(); @@ -1024,7 +1142,7 @@ void GroupDef::endMemberDocumentation(OutputList &ol) } } -void GroupDef::writeAuthorSection(OutputList &ol) +void GroupDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); @@ -1036,7 +1154,7 @@ void GroupDef::writeAuthorSection(OutputList &ol) ol.popGeneratorState(); } -void GroupDef::writeSummaryLinks(OutputList &ol) +void GroupDefImpl::writeSummaryLinks(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1081,7 +1199,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol) ol.popGeneratorState(); } -void GroupDef::writeDocumentation(OutputList &ol) +void GroupDefImpl::writeDocumentation(OutputList &ol) { //static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); ol.pushGeneratorState(); @@ -1258,7 +1376,7 @@ void GroupDef::writeDocumentation(OutputList &ol) } -void GroupDef::writeMemberPages(OutputList &ol) +void GroupDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -1276,7 +1394,7 @@ void GroupDef::writeMemberPages(OutputList &ol) ol.popGeneratorState(); } -void GroupDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const +void GroupDefImpl::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const { static bool createSubDirs=Config_getBool(CREATE_SUBDIRS); @@ -1525,12 +1643,12 @@ void addExampleToGroups(Entry *root,PageDef *eg) } } -QCString GroupDef::getOutputFileBase() const +QCString GroupDefImpl::getOutputFileBase() const { return fileName; } -void GroupDef::addListReferences() +void GroupDefImpl::addListReferences() { { QList<ListItemInfo> *xrefItems = xrefListItems(); @@ -1559,7 +1677,7 @@ void GroupDef::addListReferences() } } -MemberList *GroupDef::createMemberList(MemberListType lt) +MemberList *GroupDefImpl::createMemberList(MemberListType lt) { m_memberLists.setAutoDelete(TRUE); QListIterator<MemberList> mli(m_memberLists); @@ -1578,7 +1696,7 @@ MemberList *GroupDef::createMemberList(MemberListType lt) return ml; } -void GroupDef::addMemberToList(MemberListType lt,MemberDef *md) +void GroupDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); @@ -1589,7 +1707,7 @@ void GroupDef::addMemberToList(MemberListType lt,MemberDef *md) ml->append(md); } -void GroupDef::sortMemberLists() +void GroupDefImpl::sortMemberLists() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1599,7 +1717,7 @@ void GroupDef::sortMemberLists() } } -MemberList *GroupDef::getMemberList(MemberListType lt) const +MemberList *GroupDefImpl::getMemberList(MemberListType lt) const { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1613,7 +1731,7 @@ MemberList *GroupDef::getMemberList(MemberListType lt) const return 0; } -void GroupDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) +void GroupDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { static bool optimizeVhdl = Config_getBool(OPTIMIZE_OUTPUT_VHDL); @@ -1629,36 +1747,36 @@ void GroupDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QC } } -void GroupDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) +void GroupDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,name(),this,title); } -void GroupDef::removeMemberFromList(MemberListType lt,MemberDef *md) +void GroupDefImpl::removeMemberFromList(MemberListType lt,MemberDef *md) { MemberList *ml = getMemberList(lt); if (ml) ml->remove(md); } -void GroupDef::sortSubGroups() +void GroupDefImpl::sortSubGroups() { groupList->sort(); } -bool GroupDef::isLinkableInProject() const +bool GroupDefImpl::isLinkableInProject() const { return !isReference() && isLinkable(); } -bool GroupDef::isLinkable() const +bool GroupDefImpl::isLinkable() const { return hasUserDocumentation(); } // let the "programming language" for a group depend on what is inserted into it. // First item that has an associated languages determines the language for the whole group. -void GroupDef::updateLanguage(const Definition *d) +void GroupDefImpl::updateLanguage(const Definition *d) { if (getLanguage()==SrcLangExt_Unknown && d->getLanguage()!=SrcLangExt_Unknown) { @@ -1666,7 +1784,7 @@ void GroupDef::updateLanguage(const Definition *d) } } -bool GroupDef::hasDetailedDescription() const +bool GroupDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); return ((!briefDescription().isEmpty() && repeatBrief) || diff --git a/src/groupdef.h b/src/groupdef.h index be4475f..2649de7 100644 --- a/src/groupdef.h +++ b/src/groupdef.h @@ -42,122 +42,70 @@ class MemberDef; class FTextStream; /** A model of a group of symbols. */ -class GroupDef : public Definition +class GroupDef : virtual public Definition { public: - GroupDef(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0); - ~GroupDef(); - DefType definitionType() const { return TypeGroup; } - QCString getOutputFileBase() const; - QCString anchor() const { return QCString(); } - QCString displayName(bool=TRUE) const { return hasGroupTitle() ? title : Definition::name(); } - const char *groupTitle() const { return title; } - void setGroupTitle( const char *newtitle ); - bool hasGroupTitle( ) const { return titleSet; } - void addFile(const FileDef *def); - bool addClass(const ClassDef *def); - bool addNamespace(const NamespaceDef *def); - void addGroup(const GroupDef *def); - void addParentGroup(const GroupDef *def); - void addPage(PageDef *def); - void addExample(const PageDef *def); - void addDir(const DirDef *dd); - bool insertMember(MemberDef *def,bool docOnly=FALSE); - void removeMember(MemberDef *md); - bool findGroup(const GroupDef *def) const; // true if def is a subgroup of this group - void writeDocumentation(OutputList &ol); - void writeMemberPages(OutputList &ol); - void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; - void writeTagFile(FTextStream &); - int countMembers() const; - bool isLinkableInProject() const; - bool isLinkable() const; - bool isASubGroup() const; - void computeAnchors(); - - void addMembersToMemberGroup(); - void distributeMemberGroupDocumentation(); - void findSectionsInDocumentation(); - - void addListReferences(); - void sortMemberLists(); - bool subGrouping() const { return m_subGrouping; } - - bool visited; // number of times accessed for output - KPW - - //friend void writeGroupTreeNode(OutputList&, GroupDef*, int, FTVHelp*); - // make accessible for writing tree view of group in index.cpp - KPW - - void setGroupScope(Definition *d) { groupScope = d; } - Definition *getGroupScope() const { return groupScope; } - - MemberList *getMemberList(MemberListType lt) const; - const QList<MemberList> &getMemberLists() const { return m_memberLists; } + ~GroupDef() {} + + virtual DefType definitionType() const = 0; + virtual QCString getOutputFileBase() const = 0; + virtual QCString anchor() const = 0; + virtual QCString displayName(bool=TRUE) const = 0; + virtual const char *groupTitle() const = 0; + virtual void setGroupTitle( const char *newtitle ) = 0; + virtual bool hasGroupTitle( ) const = 0; + virtual void addFile(const FileDef *def) = 0; + virtual bool addClass(const ClassDef *def) = 0; + virtual bool addNamespace(const NamespaceDef *def) = 0; + virtual void addGroup(const GroupDef *def) = 0; + virtual void addPage(PageDef *def) = 0; + virtual void addExample(const PageDef *def) = 0; + virtual void addDir(const DirDef *dd) = 0; + virtual bool insertMember(MemberDef *def,bool docOnly=FALSE) = 0; + virtual void removeMember(MemberDef *md) = 0; + virtual bool findGroup(const GroupDef *def) const = 0; + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeMemberPages(OutputList &ol) = 0; + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const = 0; + virtual void writeTagFile(FTextStream &) = 0; + virtual int countMembers() const = 0; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual bool isASubGroup() const = 0; + virtual void computeAnchors() = 0; + + virtual void addMembersToMemberGroup() = 0; + virtual void distributeMemberGroupDocumentation() = 0; + virtual void findSectionsInDocumentation() = 0; + + virtual void addListReferences() = 0; + virtual void sortMemberLists() = 0; + virtual bool subGrouping() const = 0; + + virtual void setGroupScope(Definition *d) = 0; + virtual Definition *getGroupScope() const = 0; + + virtual MemberList *getMemberList(MemberListType lt) const = 0; + virtual const QList<MemberList> &getMemberLists() const = 0; /* user defined member groups */ - MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } - - FileList * getFiles() const { return fileList; } - ClassSDict * getClasses() const { return classSDict; } - NamespaceSDict * getNamespaces() const { return namespaceSDict; } - GroupList * getSubGroups() const { return groupList; } - PageSDict * getPages() const { return pageDict; } - DirList * getDirs() const { return dirList; } - PageSDict * getExamples() const { return exampleDict; } - bool hasDetailedDescription() const; - //MemberList* getMembers() const { return allMemberList; } - void sortSubGroups(); - - protected: - void addMemberListToGroup(MemberList *,bool (MemberDef::*)() const); - - private: - MemberList *createMemberList(MemberListType lt); - void addMemberToList(MemberListType lt,MemberDef *md); - void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); - void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); - void removeMemberFromList(MemberListType lt,MemberDef *md); - void writeGroupGraph(OutputList &ol); - void writeFiles(OutputList &ol,const QCString &title); - void writeNamespaces(OutputList &ol,const QCString &title); - void writeNestedGroups(OutputList &ol,const QCString &title); - void writeDirs(OutputList &ol,const QCString &title); - void writeClasses(OutputList &ol,const QCString &title); - void writeInlineClasses(OutputList &ol); - void writePageDocumentation(OutputList &ol); - void writeDetailedDescription(OutputList &ol,const QCString &title); - void writeBriefDescription(OutputList &ol); - void writeMemberGroups(OutputList &ol); - void startMemberDeclarations(OutputList &ol); - void endMemberDeclarations(OutputList &ol); - void startMemberDocumentation(OutputList &ol); - void endMemberDocumentation(OutputList &ol); - void writeAuthorSection(OutputList &ol); - void writeSummaryLinks(OutputList &ol); - void updateLanguage(const Definition *); - - QCString title; // title of the group - bool titleSet; // true if title is not the same as the name - QCString fileName; // base name of the generated file - FileList *fileList; // list of files in the group - ClassSDict *classSDict; // list of classes in the group - NamespaceSDict *namespaceSDict; // list of namespaces in the group - GroupList *groupList; // list of sub groups. - PageSDict *pageDict; // list of pages in the group - PageSDict *exampleDict; // list of examples in the group - DirList *dirList; // list of directories in the group - - MemberList *allMemberList; - MemberNameInfoSDict *allMemberNameInfoSDict; - - Definition *groupScope; - - QList<MemberList> m_memberLists; - MemberGroupSDict *memberGroupSDict; - bool m_subGrouping; + virtual MemberGroupSDict *getMemberGroupSDict() const = 0; + + virtual FileList * getFiles() const = 0; + virtual ClassSDict * getClasses() const = 0; + virtual NamespaceSDict * getNamespaces() const = 0; + virtual GroupList * getSubGroups() const = 0; + virtual PageSDict * getPages() const = 0; + virtual DirList * getDirs() const = 0; + virtual PageSDict * getExamples() const = 0; + virtual bool hasDetailedDescription() const = 0; + virtual void sortSubGroups() = 0; }; +GroupDef *createGroupDef(const char *fileName,int line,const char *name, + const char *title,const char *refFileName=0); + /** A sorted dictionary of GroupDef objects. */ class GroupSDict : public SDict<GroupDef> { diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index ee8aab3..81d28eb 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -649,7 +649,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) forceEndParagraph(inc); m_t << PREFRAG_START; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), @@ -657,7 +657,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, // fileDef, + fd, // fileDef, -1, // start line -1, // end line FALSE, // inline fragment @@ -665,6 +665,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) TRUE, // show line numbers m_ctx // search context ); + delete fd; m_t << PREFRAG_END; forceStartParagraph(inc); } @@ -715,7 +716,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) forceEndParagraph(inc); m_t << PREFRAG_START; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), @@ -723,7 +724,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment @@ -731,6 +732,7 @@ void HtmlDocVisitor::visit(DocInclude *inc) TRUE, // show line number m_ctx // search context ); + delete fd; m_t << PREFRAG_END; forceStartParagraph(inc); } diff --git a/src/index.cpp b/src/index.cpp index 913f31b..b401a0a 100644 --- a/src/index.cpp +++ b/src/index.cpp @@ -490,7 +490,7 @@ static void writeClassTree(OutputList &ol,const BaseClassList *bcl,bool hideSupe } ol.startIndexListItem(); //printf("Passed...\n"); - bool hasChildren = !cd->visited && !hideSuper && classHasVisibleChildren(cd); + bool hasChildren = !cd->isVisited() && !hideSuper && classHasVisibleChildren(cd); //printf("tree4: Has children %s: %d\n",cd->name().data(),hasChildren); if (cd->isLinkable()) { @@ -537,8 +537,8 @@ static void writeClassTree(OutputList &ol,const BaseClassList *bcl,bool hideSupe if (hasChildren) { //printf("Class %s at %p visited=%d\n",cd->name().data(),cd,cd->visited); - bool wasVisited=cd->visited; - cd->visited=TRUE; + bool wasVisited=cd->isVisited(); + cd->setVisited(TRUE); if (cd->getLanguage()==SrcLangExt_VHDL) { writeClassTree(ol,cd->baseClasses(),wasVisited,level+1,ftv,addToIndex); @@ -872,7 +872,7 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT started=TRUE; } ol.startIndexListItem(); - bool hasChildren = !cd->visited && classHasVisibleChildren(cd); + bool hasChildren = !cd->isVisited() && classHasVisibleChildren(cd); //printf("list: Has children %s: %d\n",cd->name().data(),hasChildren); if (cd->isLinkable()) { @@ -913,13 +913,13 @@ static void writeClassTreeForList(OutputList &ol,ClassSDict *cl,bool &started,FT } if (cd->getLanguage()==SrcLangExt_VHDL && hasChildren) { - writeClassTree(ol,cd->baseClasses(),cd->visited,1,ftv,addToIndex); - cd->visited=TRUE; + writeClassTree(ol,cd->baseClasses(),cd->isVisited(),1,ftv,addToIndex); + cd->setVisited(TRUE); } else if (hasChildren) { - writeClassTree(ol,cd->subClasses(),cd->visited,1,ftv,addToIndex); - cd->visited=TRUE; + writeClassTree(ol,cd->subClasses(),cd->isVisited(),1,ftv,addToIndex); + cd->setVisited(TRUE); } ol.endIndexListItem(); } @@ -3889,7 +3889,7 @@ static int countGroups() { if (!gd->isReference()) { - gd->visited=FALSE; + //gd->visited=FALSE; count++; } } @@ -3907,7 +3907,6 @@ static int countDirs() { if (dd->isLinkableInProject()) { - dd->visited=FALSE; count++; } } @@ -3947,8 +3946,9 @@ void writeGraphInfo(OutputList &ol) legendDocs = legendDocs.left(s+8) + "[!-- SVG 0 --]\n" + legendDocs.mid(e); //printf("legendDocs=%s\n",legendDocs.data()); } - FileDef fd("","graph_legend"); - ol.generateDoc("graph_legend",1,&fd,0,legendDocs,FALSE,FALSE); + FileDef *fd = createFileDef("","graph_legend"); + ol.generateDoc("graph_legend",1,fd,0,legendDocs,FALSE,FALSE); + delete fd; // restore config settings stripCommentsStateRef = oldStripCommentsState; diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 463eedf..61f39b7 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -458,20 +458,21 @@ void LatexDocVisitor::visit(DocInclude *inc) m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n"; LatexCodeGenerator::setDoxyCodeOpen(TRUE); QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile(), - &fd, // fileDef, + fd, // fileDef, -1, // start line -1, // end line FALSE, // inline fragment 0, // memberDef TRUE // show line numbers ); + delete fd; LatexCodeGenerator::setDoxyCodeOpen(FALSE); m_t << "\\end{DoxyCodeInclude}" << endl; } @@ -524,7 +525,7 @@ void LatexDocVisitor::visit(DocInclude *inc) case DocInclude::SnipWithLines: { QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); m_t << "\n\\begin{DoxyCodeInclude}{" << usedTableLevels() << "}\n"; LatexCodeGenerator::setDoxyCodeOpen(TRUE); Doxygen::parserManager->getParser(inc->extension()) @@ -534,13 +535,14 @@ void LatexDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment 0, // memberDef TRUE // show line number ); + delete fd; LatexCodeGenerator::setDoxyCodeOpen(FALSE); m_t << "\\end{DoxyCodeInclude}" << endl; } diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp index beef632..df6af42 100644 --- a/src/mandocvisitor.cpp +++ b/src/mandocvisitor.cpp @@ -254,20 +254,21 @@ void ManDocVisitor::visit(DocInclude *inc) m_t << ".PP" << endl; m_t << ".nf" << endl; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile(), - &fd, // fileDef, + fd, // fileDef, -1, // start line -1, // end line FALSE, // inline fragment 0, // memberDef TRUE ); + delete fd; if (!m_firstCol) m_t << endl; m_t << ".fi" << endl; m_t << ".PP" << endl; @@ -335,7 +336,7 @@ void ManDocVisitor::visit(DocInclude *inc) m_t << ".PP" << endl; m_t << ".nf" << endl; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), @@ -343,13 +344,14 @@ void ManDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment 0, // memberDef TRUE // show line number ); + delete fd; if (!m_firstCol) m_t << endl; m_t << ".fi" << endl; m_t << ".PP" << endl; diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 683f8c3..a73975d 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -43,10 +43,334 @@ #include "namespacedef.h" #include "filedef.h" #include "config.h" +#include "definitionimpl.h" //----------------------------------------------------------------------------- -int MemberDef::s_indentLevel = 0; +class MemberDefImpl : public DefinitionImpl, public MemberDef +{ + public: + MemberDefImpl(const char *defFileName,int defLine,int defColumn, + const char *type,const char *name,const char *args, + const char *excp,Protection prot,Specifier virt,bool stat, + Relationship related,MemberType t,const ArgumentList *tal, + const ArgumentList *al,const char *metaData); + virtual ~MemberDefImpl(); + + virtual DefType definitionType() const { return TypeMember; } + virtual MemberDef *deepCopy() const; + virtual void moveTo(Definition *); + virtual QCString getOutputFileBase() const; + virtual QCString getReference() const; + virtual QCString anchor() const; + virtual const char *declaration() const; + virtual const char *definition() const; + virtual const char *typeString() const; + virtual const char *argsString() const; + virtual const char *excpString() const; + virtual const char *bitfieldString() const; + virtual const char *extraTypeChars() const; + virtual const QCString &initializer() const; + virtual int initializerLines() const; + virtual uint64 getMemberSpecifiers() const; + virtual MemberList *getSectionList(Definition *d) const; + virtual QCString displayDefinition() const; + virtual ClassDef *getClassDef() const; + virtual FileDef *getFileDef() const; + virtual NamespaceDef* getNamespaceDef() const; + virtual ClassDef *accessorClass() const; + virtual const char *getReadAccessor() const; + virtual const char *getWriteAccessor() const; + virtual GroupDef *getGroupDef() const; + virtual Grouping::GroupPri_t getGroupPri() const; + virtual const char *getGroupFileName() const; + virtual int getGroupStartLine() const; + virtual bool getGroupHasDocs() const; + virtual QCString qualifiedName() const; + virtual QCString objCMethodName(bool localLink,bool showStatic) const; + virtual Protection protection() const; + virtual Specifier virtualness(int count=0) const; + virtual MemberType memberType() const; + virtual QCString memberTypeName() const; + virtual bool isSignal() const; + virtual bool isSlot() const; + virtual bool isVariable() const; + virtual bool isEnumerate() const; + virtual bool isEnumValue() const; + virtual bool isTypedef() const; + virtual bool isSequence() const; + virtual bool isDictionary() const; + virtual bool isFunction() const; + virtual bool isFunctionPtr() const; + virtual bool isDefine() const; + virtual bool isFriend() const; + virtual bool isDCOP() const; + virtual bool isProperty() const; + virtual bool isEvent() const; + virtual bool isRelated() const; + virtual bool isForeign() const; + virtual bool isStatic() const; + virtual bool isInline() const; + virtual bool isExplicit() const; + virtual bool isMutable() const; + virtual bool isGettable() const; + virtual bool isPrivateGettable() const; + virtual bool isProtectedGettable() const; + virtual bool isSettable() const; + virtual bool isPrivateSettable() const; + virtual bool isProtectedSettable() const; + virtual bool isReadable() const; + virtual bool isWritable() const; + virtual bool isAddable() const; + virtual bool isRemovable() const; + virtual bool isRaisable() const; + virtual bool isFinal() const; + virtual bool isAbstract() const; + virtual bool isOverride() const; + virtual bool isInitonly() const; + virtual bool isOptional() const; + virtual bool isRequired() const; + virtual bool isNonAtomic() const; + virtual bool isCopy() const; + virtual bool isAssign() const; + virtual bool isRetain() const; + virtual bool isWeak() const; + virtual bool isStrong() const; + virtual bool isUnretained() const; + virtual bool isNew() const; + virtual bool isSealed() const; + virtual bool isImplementation() const; + virtual bool isExternal() const; + virtual bool isAlias() const; + virtual bool isDefault() const; + virtual bool isDelete() const; + virtual bool isNoExcept() const; + virtual bool isAttribute() const; + virtual bool isUNOProperty() const; + virtual bool isReadonly() const; + virtual bool isBound() const; + virtual bool isConstrained() const; + virtual bool isTransient() const; + virtual bool isMaybeVoid() const; + virtual bool isMaybeDefault() const; + virtual bool isMaybeAmbiguous() const; + virtual bool isPublished() const; + virtual bool isTemplateSpecialization() const; + virtual bool hasDocumentedParams() const; + virtual bool hasDocumentedReturnType() const; + virtual bool isObjCMethod() const; + virtual bool isObjCProperty() const; + virtual bool isConstructor() const; + virtual bool isDestructor() const; + virtual bool hasOneLineInitializer() const; + virtual bool hasMultiLineInitializer() const; + virtual bool showInCallGraph() const; + virtual bool isStrongEnumValue() const; + virtual bool livesInsideEnum() const; + virtual bool isSliceLocal() const; + virtual bool isConstExpr() const; + virtual bool isFriendToHide() const; + virtual bool isNotFriend() const; + virtual bool isFunctionOrSignalSlot() const; + virtual bool isRelatedOrFriend() const; + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual bool hasDocumentation() const; + virtual bool isDeleted() const; + virtual bool isBriefSectionVisible() const; + virtual bool isDetailedSectionVisible(bool inGroup,bool inFile) const; + virtual bool isDetailedSectionLinkable() const; + virtual bool isFriendClass() const; + virtual bool isDocumentedFriendClass() const; + virtual MemberDef *reimplements() const; + virtual MemberList *reimplementedBy() const; + virtual bool isReimplementedBy(ClassDef *cd) const; + virtual ClassDef *relatedAlso() const; + virtual bool hasDocumentedEnumValues() const; + virtual MemberDef *getAnonymousEnumType() const; + virtual bool isDocsForDefinition() const; + virtual MemberDef *getEnumScope() const; + virtual MemberList *enumFieldList() const; + virtual void setEnumBaseType(const QCString &type); + virtual QCString enumBaseType() const; + virtual bool hasExamples(); + virtual ExampleSDict *getExamples() const; + virtual bool isPrototype() const; + virtual ArgumentList *argumentList() const; + virtual ArgumentList *declArgumentList() const; + virtual ArgumentList *templateArguments() const; + virtual QList<ArgumentList> *definitionTemplateParameterLists() const; + virtual int getMemberGroupId() const; + virtual MemberGroup *getMemberGroup() const; + virtual bool fromAnonymousScope() const; + virtual bool anonymousDeclShown() const; + virtual MemberDef *fromAnonymousMember() const; + virtual bool hasCallGraph() const; + virtual bool hasCallerGraph() const; + virtual bool visibleMemberGroup(bool hideNoHeader); + virtual bool hasReferencesRelation() const; + virtual bool hasReferencedByRelation() const; + virtual MemberDef *templateMaster() const; + virtual QCString getScopeString() const; + virtual ClassDef *getClassDefOfAnonymousType(); + virtual bool isTypedefValCached() const; + virtual ClassDef *getCachedTypedefVal() const; + virtual QCString getCachedTypedefTemplSpec() const; + virtual QCString getCachedResolvedTypedef() const; + virtual MemberDef *memberDefinition() const; + virtual MemberDef *memberDeclaration() const; + virtual MemberDef *inheritsDocsFrom() const; + virtual MemberDef *getGroupAlias() const; + virtual ClassDef *category() const; + virtual MemberDef *categoryRelation() const; + virtual QCString displayName(bool=TRUE) const; + virtual QCString getDeclType() const; + virtual void getLabels(QStrList &sl,Definition *container) const; + virtual const ArgumentList *typeConstraints() const; + virtual QCString documentation() const; + virtual QCString briefDescription(bool abbr=FALSE) const; + virtual QCString fieldType() const; + virtual bool isReference() const; + virtual QCString getDeclFileName() const; + virtual int getDeclLine() const; + virtual int getDeclColumn() const; + virtual void setMemberType(MemberType t); + virtual void setDefinition(const char *d); + virtual void setFileDef(FileDef *fd); + virtual void setAnchor(); + virtual void setProtection(Protection p); + virtual void setMemberSpecifiers(uint64 s); + virtual void mergeMemberSpecifiers(uint64 s); + virtual void setInitializer(const char *i); + virtual void setBitfields(const char *s); + virtual void setMaxInitLines(int lines); + virtual void setMemberClass(ClassDef *cd); + virtual void setSectionList(Definition *d,MemberList *sl); + virtual void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, + const QCString &fileName,int startLine,bool hasDocs, + MemberDef *member=0); + virtual void setReadAccessor(const char *r); + virtual void setWriteAccessor(const char *w); + virtual void setTemplateSpecialization(bool b); + virtual void makeRelated(); + virtual void makeForeign(); + virtual void setHasDocumentedParams(bool b); + virtual void setHasDocumentedReturnType(bool b); + virtual void setInheritsDocsFrom(MemberDef *md); + virtual void setTagInfo(TagInfo *i); + virtual void setArgsString(const char *as); + virtual void setReimplements(MemberDef *md); + virtual void insertReimplementedBy(MemberDef *md); + virtual void setRelatedAlso(ClassDef *cd); + virtual void insertEnumField(MemberDef *md); + virtual void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE); + virtual void setEnumClassScope(ClassDef *cd); + virtual void setDocumentedEnumValues(bool value); + virtual void setAnonymousEnumType(MemberDef *md); + virtual bool addExample(const char *anchor,const char *name,const char *file); + virtual void setPrototype(bool p,const QCString &df,int line, int column); + virtual void setExplicitExternal(bool b,const QCString &df,int line,int column); + virtual void setDeclFile(const QCString &df,int line,int column); + virtual void setArgumentList(ArgumentList *al); + virtual void setDeclArgumentList(ArgumentList *al); + virtual void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists); + virtual void setTypeConstraints(ArgumentList *al); + virtual void setType(const char *t); + virtual void setAccessorType(ClassDef *cd,const char *t); + virtual void setNamespace(NamespaceDef *nd); + virtual void setMemberGroup(MemberGroup *grp); + virtual void setMemberGroupId(int id); + virtual void makeImplementationDetail(); + virtual void setFromAnonymousScope(bool b); + virtual void setFromAnonymousMember(MemberDef *m); + virtual void enableCallGraph(bool e); + virtual void enableCallerGraph(bool e); + virtual void enableReferencedByRelation(bool e); + virtual void enableReferencesRelation(bool e); + virtual void setTemplateMaster(MemberDef *mt); + virtual void addListReference(Definition *d); + virtual void setDocsForDefinition(bool b); + virtual void setGroupAlias(MemberDef *md); + virtual void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType); + virtual void invalidateTypedefValCache(); + virtual void invalidateCachedArgumentTypes(); + virtual void setMemberDefinition(MemberDef *md); + virtual void setMemberDeclaration(MemberDef *md); + virtual void setAnonymousUsed(); + virtual void copyArgumentNames(MemberDef *bmd); + virtual void setCategory(ClassDef *); + virtual void setCategoryRelation(MemberDef *); + virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); + virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine); + virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine); + virtual void setHidden(bool b); + virtual void writeDeclaration(OutputList &ol, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, + bool inGroup, ClassDef *inheritFrom=0,const char *inheritId=0); + virtual void writeDocumentation(MemberList *ml,int memCount,int memTotal,OutputList &ol, + const char *scopeName,Definition *container, + bool inGroup,bool showEnumValues=FALSE,bool + showInline=FALSE); + virtual void writeMemberDocSimple(OutputList &ol,Definition *container); + virtual void writeEnumDeclaration(OutputList &typeDecl, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd); + virtual void writeTagFile(FTextStream &); + virtual void warnIfUndocumented(); + virtual void warnIfUndocumentedParams(); + virtual MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, + ArgumentList *actualArgs); + virtual void findSectionsInDocumentation(); + virtual void writeLink(OutputList &ol, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, + bool onlyText=FALSE); + virtual void addToSearchIndex(); + + private: + void _computeLinkableInProject(); + void _computeIsConstructor(); + void _computeIsDestructor(); + void _writeGroupInclude(OutputList &ol,bool inGroup); + void _writeCallGraph(OutputList &ol); + void _writeCallerGraph(OutputList &ol); + void _writeReimplements(OutputList &ol); + void _writeReimplementedBy(OutputList &ol); + void _writeExamples(OutputList &ol); + void _writeTypeConstraints(OutputList &ol); + void _writeEnumValues(OutputList &ol,Definition *container, + const QCString &cfname,const QCString &ciname, + const QCString &cname); + void _writeCategoryRelation(OutputList &ol); + void _writeTagData(const DefType); + + static int s_indentLevel; + + // disable copying of member defs + MemberDefImpl(const MemberDefImpl &); + MemberDefImpl &operator=(const MemberDefImpl &); + + + // PIMPL idiom + class IMPL; + IMPL *m_impl; + uchar m_isLinkableCached; // 0 = not cached, 1=FALSE, 2=TRUE + uchar m_isConstructorCached; // 0 = not cached, 1=FALSE, 2=TRUE + uchar m_isDestructorCached; // 0 = not cached, 1=FALSE, 2=TRUE +}; + +MemberDef *createMemberDef(const char *defFileName,int defLine,int defColumn, + const char *type,const char *name,const char *args, + const char *excp,Protection prot,Specifier virt,bool stat, + Relationship related,MemberType t,const ArgumentList *tal, + const ArgumentList *al,const char *metaData) +{ + return new MemberDefImpl(defFileName,defLine,defColumn,type,name,args,excp,prot,virt, + stat,related,t,tal,al,metaData); +} + + +//----------------------------------------------------------------------------- + +int MemberDefImpl::s_indentLevel = 0; //----------------------------------------------------------------------------- @@ -193,9 +517,9 @@ static bool writeDefArgumentList(OutputList &ol,Definition *scope,MemberDef *md) cName=cName.mid(il,ir-il+1); //printf("1. cName=%s\n",cName.data()); } - else if (scope->definitionType()==Definition::TypeClass && ((ClassDef*)scope)->templateArguments()) + else if (scope->definitionType()==Definition::TypeClass && (dynamic_cast<ClassDef*>(scope))->templateArguments()) { - cName=tempArgListToString(((ClassDef*)scope)->templateArguments(),scope->getLanguage()); + cName=tempArgListToString((dynamic_cast<ClassDef*>(scope))->templateArguments(),scope->getLanguage()); //printf("2. cName=%s\n",cName.data()); } else // no template specifier @@ -475,11 +799,11 @@ static void writeTemplatePrefix(OutputList &ol,ArgumentList *al) //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- -class MemberDefImpl +class MemberDefImpl::IMPL { public: - MemberDefImpl(); - ~MemberDefImpl(); + IMPL(); + ~IMPL(); void init(Definition *def,const char *t,const char *a,const char *e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList *tal, @@ -600,7 +924,7 @@ class MemberDefImpl int declColumn; }; -MemberDefImpl::MemberDefImpl() : +MemberDefImpl::IMPL::IMPL() : enumFields(0), redefinedBy(0), exampleSDict(0), @@ -617,7 +941,7 @@ MemberDefImpl::MemberDefImpl() : { } -MemberDefImpl::~MemberDefImpl() +MemberDefImpl::IMPL::~IMPL() { delete redefinedBy; delete exampleSDict; @@ -630,7 +954,7 @@ MemberDefImpl::~MemberDefImpl() delete declArgList; } -void MemberDefImpl::init(Definition *def, +void MemberDefImpl::IMPL::init(Definition *def, const char *t,const char *a,const char *e, Protection p,Specifier v,bool s,Relationship r, MemberType mt,const ArgumentList *tal, @@ -762,32 +1086,32 @@ void MemberDefImpl::init(Definition *def, * \param meta Slice metadata. */ -MemberDef::MemberDef(const char *df,int dl,int dc, +MemberDefImpl::MemberDefImpl(const char *df,int dl,int dc, const char *t,const char *na,const char *a,const char *e, Protection p,Specifier v,bool s,Relationship r,MemberType mt, const ArgumentList *tal,const ArgumentList *al,const char *meta - ) : Definition(df,dl,dc,removeRedundantWhiteSpace(na)), visited(FALSE) + ) : DefinitionImpl(df,dl,dc,removeRedundantWhiteSpace(na)) { - //printf("MemberDef::MemberDef(%s)\n",na); - m_impl = new MemberDefImpl; + //printf("MemberDefImpl::MemberDef(%s)\n",na); + m_impl = new MemberDefImpl::IMPL; m_impl->init(this,t,a,e,p,v,s,r,mt,tal,al,meta); m_isLinkableCached = 0; m_isConstructorCached = 0; m_isDestructorCached = 0; } -MemberDef::MemberDef(const MemberDef &md) : Definition(md), visited(FALSE) +MemberDefImpl::MemberDefImpl(const MemberDefImpl &md) : DefinitionImpl(md) { - m_impl = new MemberDefImpl; + m_impl = new MemberDefImpl::IMPL; m_isLinkableCached = 0; m_isConstructorCached = 0; m_isDestructorCached = 0; } -MemberDef *MemberDef::deepCopy() const +MemberDef *MemberDefImpl::deepCopy() const { //MemberDef *result = new MemberDef(getDefFileName(),getDefLine(),name()); - MemberDef *result = new MemberDef(*this); + MemberDefImpl *result = new MemberDefImpl(*this); // first copy everything by reference *result->m_impl = *m_impl; // clear pointers owned by object @@ -858,20 +1182,20 @@ MemberDef *MemberDef::deepCopy() const return result; } -void MemberDef::moveTo(Definition *scope) +void MemberDefImpl::moveTo(Definition *scope) { setOuterScope(scope); if (scope->definitionType()==Definition::TypeClass) { - m_impl->classDef = (ClassDef*)scope; + m_impl->classDef = dynamic_cast<ClassDef*>(scope); } else if (scope->definitionType()==Definition::TypeFile) { - m_impl->fileDef = (FileDef*)scope; + m_impl->fileDef = dynamic_cast<FileDef*>(scope); } else if (scope->definitionType()==Definition::TypeNamespace) { - m_impl->nspace = (NamespaceDef*)scope; + m_impl->nspace = dynamic_cast<NamespaceDef*>(scope); } m_isLinkableCached = 0; m_isConstructorCached = 0; @@ -879,19 +1203,19 @@ void MemberDef::moveTo(Definition *scope) /*! Destroys the member definition. */ -MemberDef::~MemberDef() +MemberDefImpl::~MemberDefImpl() { delete m_impl; //printf("%p: ~MemberDef()\n",this); m_impl=0; } -void MemberDef::setReimplements(MemberDef *md) +void MemberDefImpl::setReimplements(MemberDef *md) { m_impl->redefines = md; } -void MemberDef::insertReimplementedBy(MemberDef *md) +void MemberDefImpl::insertReimplementedBy(MemberDef *md) { if (m_impl->templateMaster) { @@ -904,17 +1228,17 @@ void MemberDef::insertReimplementedBy(MemberDef *md) } } -MemberDef *MemberDef::reimplements() const +MemberDef *MemberDefImpl::reimplements() const { return m_impl->redefines; } -MemberList *MemberDef::reimplementedBy() const +MemberList *MemberDefImpl::reimplementedBy() const { return m_impl->redefinedBy; } -bool MemberDef::isReimplementedBy(ClassDef *cd) const +bool MemberDefImpl::isReimplementedBy(ClassDef *cd) const { if (cd && m_impl->redefinedBy) { @@ -935,13 +1259,13 @@ bool MemberDef::isReimplementedBy(ClassDef *cd) const return FALSE; } -void MemberDef::insertEnumField(MemberDef *md) +void MemberDefImpl::insertEnumField(MemberDef *md) { if (m_impl->enumFields==0) m_impl->enumFields=new MemberList(MemberListType_enumFields); m_impl->enumFields->append(md); } -bool MemberDef::addExample(const char *anchor,const char *nameStr, +bool MemberDefImpl::addExample(const char *anchor,const char *nameStr, const char *file) { //printf("%s::addExample(%s,%s,%s)\n",name().data(),anchor,nameStr,file); @@ -959,7 +1283,7 @@ bool MemberDef::addExample(const char *anchor,const char *nameStr, return FALSE; } -bool MemberDef::hasExamples() +bool MemberDefImpl::hasExamples() { if (m_impl->exampleSDict==0) return FALSE; @@ -967,7 +1291,7 @@ bool MemberDef::hasExamples() return m_impl->exampleSDict->count()>0; } -QCString MemberDef::getOutputFileBase() const +QCString MemberDefImpl::getOutputFileBase() const { static bool separateMemberPages = Config_getBool(SEPARATE_MEMBER_PAGES); static bool inlineSimpleClasses = Config_getBool(INLINE_SIMPLE_STRUCTS); @@ -1027,9 +1351,9 @@ QCString MemberDef::getOutputFileBase() const return baseName; } -QCString MemberDef::getReference() const +QCString MemberDefImpl::getReference() const { - QCString ref = Definition::getReference(); + QCString ref = DefinitionImpl::getReference(); if (!ref.isEmpty()) { return ref; @@ -1057,7 +1381,7 @@ QCString MemberDef::getReference() const return ""; } -QCString MemberDef::anchor() const +QCString MemberDefImpl::anchor() const { QCString result=m_impl->anc; if (m_impl->groupAlias) return m_impl->groupAlias->anchor(); @@ -1080,12 +1404,12 @@ QCString MemberDef::anchor() const return result; } -void MemberDef::_computeLinkableInProject() +void MemberDefImpl::_computeLinkableInProject() { static bool extractStatic = Config_getBool(EXTRACT_STATIC); static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); m_isLinkableCached = 2; // linkable - //printf("MemberDef::isLinkableInProject(name=%s)\n",name().data()); + //printf("MemberDefImpl::isLinkableInProject(name=%s)\n",name().data()); if (isHidden()) { //printf("is hidden\n"); @@ -1154,42 +1478,42 @@ void MemberDef::_computeLinkableInProject() return; // linkable! } -void MemberDef::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) +void MemberDefImpl::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace) { - Definition::setDocumentation(d,docFile,docLine,stripWhiteSpace); + DefinitionImpl::setDocumentation(d,docFile,docLine,stripWhiteSpace); m_isLinkableCached = 0; } -void MemberDef::setBriefDescription(const char *b,const char *briefFile,int briefLine) +void MemberDefImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine) { - Definition::setBriefDescription(b,briefFile,briefLine); + DefinitionImpl::setBriefDescription(b,briefFile,briefLine); m_isLinkableCached = 0; } -void MemberDef::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) +void MemberDefImpl::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) { - Definition::setInbodyDocumentation(d,inbodyFile,inbodyLine); + DefinitionImpl::setInbodyDocumentation(d,inbodyFile,inbodyLine); m_isLinkableCached = 0; } -void MemberDef::setHidden(bool b) +void MemberDefImpl::setHidden(bool b) { - Definition::setHidden(b); + DefinitionImpl::setHidden(b); m_isLinkableCached = 0; } -bool MemberDef::isLinkableInProject() const +bool MemberDefImpl::isLinkableInProject() const { if (m_isLinkableCached==0) { - MemberDef *that = (MemberDef*)this; + MemberDefImpl *that = (MemberDefImpl*)this; that->_computeLinkableInProject(); } ASSERT(m_isLinkableCached>0); return m_isLinkableCached==2; } -bool MemberDef::isLinkable() const +bool MemberDefImpl::isLinkable() const { if (m_impl->templateMaster) { @@ -1202,7 +1526,7 @@ bool MemberDef::isLinkable() const } -void MemberDef::setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) +void MemberDefImpl::setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) { if (lists) { @@ -1211,7 +1535,7 @@ void MemberDef::setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) } } -void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, +void MemberDefImpl::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, FileDef *fd,GroupDef *gd,bool onlyText) { SrcLangExt lang = getLanguage(); @@ -1264,7 +1588,7 @@ void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, /*! If this member has an anonymous class/struct/union as its type, then * this method will return the ClassDef that describes this return type. */ -ClassDef *MemberDef::getClassDefOfAnonymousType() +ClassDef *MemberDefImpl::getClassDefOfAnonymousType() { if (m_impl->cachedAnonymousType) return m_impl->cachedAnonymousType; @@ -1317,7 +1641,7 @@ ClassDef *MemberDef::getClassDefOfAnonymousType() /*! This methods returns TRUE iff the brief section (also known as * declaration section) is visible in the documentation. */ -bool MemberDef::isBriefSectionVisible() const +bool MemberDefImpl::isBriefSectionVisible() const { static bool extractStatic = Config_getBool(EXTRACT_STATIC); static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); @@ -1411,11 +1735,11 @@ bool MemberDef::isBriefSectionVisible() const /*visibleIfDocVirtual &&*/ visibleIfNotDefaultCDTor && visibleIfFriendCompound && !m_impl->annScope && !isHidden(); - //printf("MemberDef::isBriefSectionVisible() %d\n",visible); + //printf("MemberDefImpl::isBriefSectionVisible() %d\n",visible); return visible; } -QCString MemberDef::getDeclType() const +QCString MemberDefImpl::getDeclType() const { QCString ltype(m_impl->type); if (isTypedef() && getLanguage() != SrcLangExt_Slice) @@ -1443,11 +1767,11 @@ QCString MemberDef::getDeclType() const return ltype; } -void MemberDef::writeDeclaration(OutputList &ol, +void MemberDefImpl::writeDeclaration(OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, bool inGroup, ClassDef *inheritedFrom,const char *inheritId) { - //printf("%s MemberDef::writeDeclaration() inGroup=%d\n",qualifiedName().data(),inGroup); + //printf("%s MemberDefImpl::writeDeclaration() inGroup=%d\n",qualifiedName().data(),inGroup); // hide enum value, since they appear already as part of the enum, unless they // are explicitly grouped. @@ -1465,7 +1789,7 @@ void MemberDef::writeDeclaration(OutputList &ol, } //_writeTagData(compoundType); - _addToSearchIndex(); + addToSearchIndex(); QCString cname = d->name(); QCString cdname = d->displayName(); @@ -1898,7 +2222,7 @@ void MemberDef::writeDeclaration(OutputList &ol, warnIfUndocumented(); } -bool MemberDef::isDetailedSectionLinkable() const +bool MemberDefImpl::isDetailedSectionLinkable() const { static bool extractAll = Config_getBool(EXTRACT_ALL); static bool alwaysDetailedSec = Config_getBool(ALWAYS_DETAILED_SEC); @@ -1968,7 +2292,7 @@ bool MemberDef::isDetailedSectionLinkable() const return result; } -bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const +bool MemberDefImpl::isDetailedSectionVisible(bool inGroup,bool inFile) const { static bool separateMemPages = Config_getBool(SEPARATE_MEMBER_PAGES); static bool inlineSimpleStructs = Config_getBool(INLINE_SIMPLE_STRUCTS); @@ -1986,7 +2310,7 @@ bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const return result; } -void MemberDef::getLabels(QStrList &sl,Definition *container) const +void MemberDefImpl::getLabels(QStrList &sl,Definition *container) const { static bool inlineInfo = Config_getBool(INLINE_INFO); @@ -2104,7 +2428,7 @@ void MemberDef::getLabels(QStrList &sl,Definition *container) const } } -void MemberDef::_writeCallGraph(OutputList &ol) +void MemberDefImpl::_writeCallGraph(OutputList &ol) { // write call graph if (m_impl->hasCallGraph @@ -2128,7 +2452,7 @@ void MemberDef::_writeCallGraph(OutputList &ol) } } -void MemberDef::_writeCallerGraph(OutputList &ol) +void MemberDefImpl::_writeCallerGraph(OutputList &ol) { if (m_impl->hasCallerGraph && (isFunction() || isSlot() || isSignal()) && Config_getBool(HAVE_DOT) @@ -2151,7 +2475,7 @@ void MemberDef::_writeCallerGraph(OutputList &ol) } } -void MemberDef::_writeReimplements(OutputList &ol) +void MemberDefImpl::_writeReimplements(OutputList &ol) { MemberDef *bmd=reimplements(); ClassDef *bcd=0; @@ -2210,7 +2534,7 @@ void MemberDef::_writeReimplements(OutputList &ol) } } -void MemberDef::_writeReimplementedBy(OutputList &ol) +void MemberDefImpl::_writeReimplementedBy(OutputList &ol) { MemberList *bml=reimplementedBy(); if (bml) @@ -2285,7 +2609,7 @@ void MemberDef::_writeReimplementedBy(OutputList &ol) } } -void MemberDef::_writeCategoryRelation(OutputList &ol) +void MemberDefImpl::_writeCategoryRelation(OutputList &ol) { if (m_impl->classDef) // this should be a member of a class/category { @@ -2338,7 +2662,7 @@ void MemberDef::_writeCategoryRelation(OutputList &ol) } } -void MemberDef::_writeExamples(OutputList &ol) +void MemberDefImpl::_writeExamples(OutputList &ol) { // write the list of examples that use this member if (hasExamples()) @@ -2351,7 +2675,7 @@ void MemberDef::_writeExamples(OutputList &ol) } } -void MemberDef::_writeTypeConstraints(OutputList &ol) +void MemberDefImpl::_writeTypeConstraints(OutputList &ol) { if (m_impl->typeConstraints) { @@ -2359,7 +2683,7 @@ void MemberDef::_writeTypeConstraints(OutputList &ol) } } -void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, +void MemberDefImpl::_writeEnumValues(OutputList &ol,Definition *container, const QCString &cfname,const QCString &ciname, const QCString &cname) { @@ -2433,7 +2757,7 @@ void MemberDef::_writeEnumValues(OutputList &ol,Definition *container, } } -QCString MemberDef::displayDefinition() const +QCString MemberDefImpl::displayDefinition() const { QCString ldef = definition(); QCString title = name(); @@ -2516,7 +2840,7 @@ QCString MemberDef::displayDefinition() const return substitute(ldef,"::",sep); } -void MemberDef::_writeGroupInclude(OutputList &ol,bool inGroup) +void MemberDefImpl::_writeGroupInclude(OutputList &ol,bool inGroup) { // only write out the include file if this is not part of a class or file // definition @@ -2560,7 +2884,7 @@ void MemberDef::_writeGroupInclude(OutputList &ol,bool inGroup) /*! Writes the "detailed documentation" section of this member to * all active output formats. */ -void MemberDef::writeDocumentation(MemberList *ml, +void MemberDefImpl::writeDocumentation(MemberList *ml, int memCount,int memTotal, OutputList &ol, const char *scName, @@ -2575,7 +2899,7 @@ void MemberDef::writeDocumentation(MemberList *ml, bool inFile = container->definitionType()==Definition::TypeFile; bool hasDocs = isDetailedSectionVisible(inGroup,inFile); - //printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d sectionLinkable=%d\n", + //printf("MemberDefImpl::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d sectionLinkable=%d\n", // name().data(),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable()); //if ( !hasDocs ) return; @@ -2595,7 +2919,7 @@ void MemberDef::writeDocumentation(MemberList *ml, if (getClassDef()) { scopeName=getClassDef()->displayName(); scopedContainer=getClassDef(); } else if (getNamespaceDef()) { scopeName=getNamespaceDef()->displayName(); scopedContainer=getNamespaceDef(); } else if (getFileDef()) { scopeName=getFileDef()->displayName(); scopedContainer=getFileDef(); } - ciname = ((GroupDef *)container)->groupTitle(); + ciname = (dynamic_cast<GroupDef *>(container))->groupTitle(); } else if (container->definitionType()==TypeFile && getNamespaceDef() && lang != SrcLangExt_Python) { // member is in a namespace, but is written as part of the file documentation @@ -3139,7 +3463,7 @@ static Definition *getClassFromType(Definition *scope,const QCString &type,SrcLa } #endif -QCString MemberDef::fieldType() const +QCString MemberDefImpl::fieldType() const { QCString type = m_impl->accessorType; if (type.isEmpty()) @@ -3151,7 +3475,7 @@ QCString MemberDef::fieldType() const return simplifyTypeForTable(type); } -void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) +void MemberDefImpl::writeMemberDocSimple(OutputList &ol, Definition *container) { Definition *scope = getOuterScope(); QCString doxyName = name(); @@ -3169,7 +3493,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) //printf("===> %s::anonymous: %s\n",name().data(),cd?cd->name().data():"<none>"); if (container && container->definitionType()==Definition::TypeClass && - !((ClassDef*)container)->isJavaEnum()) + !(dynamic_cast<ClassDef*>(container))->isJavaEnum()) { ol.startInlineMemberType(); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); @@ -3246,7 +3570,7 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) ol.endInlineMemberDoc(); } -QCString MemberDef::memberTypeName() const +QCString MemberDefImpl::memberTypeName() const { switch (m_impl->mtype) { @@ -3270,7 +3594,7 @@ QCString MemberDef::memberTypeName() const } } -void MemberDef::warnIfUndocumented() +void MemberDefImpl::warnIfUndocumented() { /* * Removed bug_303020: @@ -3318,7 +3642,7 @@ void MemberDef::warnIfUndocumented() } -void MemberDef::warnIfUndocumentedParams() +void MemberDefImpl::warnIfUndocumentedParams() { if (!Config_getBool(EXTRACT_ALL) && Config_getBool(WARN_IF_UNDOCUMENTED) && @@ -3342,14 +3666,14 @@ void MemberDef::warnIfUndocumentedParams() } } -bool MemberDef::isFriendClass() const +bool MemberDefImpl::isFriendClass() const { return (isFriend() && (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union")); } -bool MemberDef::isDocumentedFriendClass() const +bool MemberDefImpl::isDocumentedFriendClass() const { ClassDef *fcd=0; QCString baseName=name(); @@ -3359,39 +3683,39 @@ bool MemberDef::isDocumentedFriendClass() const (fcd=getClass(baseName)) && fcd->isLinkable()); } -bool MemberDef::isDeleted() const +bool MemberDefImpl::isDeleted() const { return m_impl->defArgList && m_impl->defArgList->isDeleted; } -bool MemberDef::hasDocumentation() const +bool MemberDefImpl::hasDocumentation() const { - return Definition::hasDocumentation() || + return DefinitionImpl::hasDocumentation() || (m_impl->mtype==MemberType_Enumeration && m_impl->docEnumValues) || // has enum values (m_impl->defArgList!=0 && m_impl->defArgList->hasDocumentation()); // has doc arguments } #if 0 -bool MemberDef::hasUserDocumentation() const +bool MemberDefImpl::hasUserDocumentation() const { - bool hasDocs = Definition::hasUserDocumentation(); + bool hasDocs = DefinitionImpl::hasUserDocumentation(); return hasDocs; } #endif -void MemberDef::setMemberGroup(MemberGroup *grp) +void MemberDefImpl::setMemberGroup(MemberGroup *grp) { m_impl->memberGroup = grp; } -bool MemberDef::visibleMemberGroup(bool hideNoHeader) +bool MemberDefImpl::visibleMemberGroup(bool hideNoHeader) { return m_impl->memberGroup!=0 && (!hideNoHeader || m_impl->memberGroup->header()!="[NOHEADER]"); } -QCString MemberDef::getScopeString() const +QCString MemberDefImpl::getScopeString() const { QCString result; if (getClassDef()) result=getClassDef()->displayName(); @@ -3424,7 +3748,7 @@ static QCString escapeAnchor(const QCString &anchor) } #endif -void MemberDef::setAnchor() +void MemberDefImpl::setAnchor() { QCString memAnchor = name(); if (!m_impl->args.isEmpty()) memAnchor+=m_impl->args; @@ -3453,11 +3777,11 @@ void MemberDef::setAnchor() m_impl->anc = "a"+sigStr; } -void MemberDef::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, +void MemberDefImpl::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine, bool hasDocs,MemberDef *member) { - //printf("%s MemberDef::setGroupDef(%s)\n",name().data(),gd->name().data()); + //printf("%s MemberDefImpl::setGroupDef(%s)\n",name().data(),gd->name().data()); m_impl->group=gd; m_impl->grouppri=pri; m_impl->groupFileName=fileName; @@ -3467,7 +3791,7 @@ void MemberDef::setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, m_isLinkableCached = 0; } -void MemberDef::setEnumScope(MemberDef *md,bool livesInsideEnum) +void MemberDefImpl::setEnumScope(MemberDef *md,bool livesInsideEnum) { m_impl->enumScope=md; m_impl->livesInsideEnum=livesInsideEnum; @@ -3482,7 +3806,7 @@ void MemberDef::setEnumScope(MemberDef *md,bool livesInsideEnum) } } -void MemberDef::setMemberClass(ClassDef *cd) +void MemberDefImpl::setMemberClass(ClassDef *cd) { m_impl->classDef=cd; m_isLinkableCached = 0; @@ -3490,13 +3814,13 @@ void MemberDef::setMemberClass(ClassDef *cd) setOuterScope(cd); } -void MemberDef::setNamespace(NamespaceDef *nd) +void MemberDefImpl::setNamespace(NamespaceDef *nd) { m_impl->nspace=nd; setOuterScope(nd); } -MemberDef *MemberDef::createTemplateInstanceMember( +MemberDef *MemberDefImpl::createTemplateInstanceMember( ArgumentList *formalArgs,ArgumentList *actualArgs) { //printf(" Member %s %s %s\n",typeString(),name().data(),argsString()); @@ -3522,7 +3846,7 @@ MemberDef *MemberDef::createTemplateInstanceMember( methodName=substituteTemplateArgumentsInString(methodName,formalArgs,actualArgs); } - MemberDef *imd = new MemberDef( + MemberDef *imd = createMemberDef( getDefFileName(),getDefLine(),getDefColumn(), substituteTemplateArgumentsInString(m_impl->type,formalArgs,actualArgs), methodName, @@ -3541,7 +3865,7 @@ MemberDef *MemberDef::createTemplateInstanceMember( return imd; } -bool MemberDef::hasOneLineInitializer() const +bool MemberDefImpl::hasOneLineInitializer() const { //printf("%s: init=%s, initLines=%d maxInitLines=%d userInitLines=%d\n", // name().data(),m_impl->initializer.data(),m_impl->initLines, @@ -3550,7 +3874,7 @@ bool MemberDef::hasOneLineInitializer() const ((m_impl->maxInitLines>0 && m_impl->userInitLines==-1) || m_impl->userInitLines>0); // enabled by default or explicitly } -bool MemberDef::hasMultiLineInitializer() const +bool MemberDefImpl::hasMultiLineInitializer() const { //printf("initLines=%d userInitLines=%d maxInitLines=%d\n", // initLines,userInitLines,maxInitLines); @@ -3560,7 +3884,7 @@ bool MemberDef::hasMultiLineInitializer() const ); } -void MemberDef::setInitializer(const char *initializer) +void MemberDefImpl::setInitializer(const char *initializer) { m_impl->initializer=initializer; int l=m_impl->initializer.length(); @@ -3571,14 +3895,13 @@ void MemberDef::setInitializer(const char *initializer) //printf("%s::setInitializer(%s)\n",name().data(),m_impl->initializer.data()); } -void MemberDef::addListReference(Definition *) +void MemberDefImpl::addListReference(Definition *) { static bool optimizeOutputForC = Config_getBool(OPTIMIZE_OUTPUT_FOR_C); //static bool hideScopeNames = Config_getBool(HIDE_SCOPE_NAMES); //static bool optimizeOutputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); SrcLangExt lang = getLanguage(); - visited=TRUE; if (!isLinkableInProject()) return; QCString memLabel; if (optimizeOutputForC) @@ -3596,7 +3919,7 @@ void MemberDef::addListReference(Definition *) QCString memName = name(); Definition *pd=getOuterScope(); QCString pdName = pd->definitionType()==Definition::TypeClass ? - ((ClassDef*)pd)->displayName() : pd->name(); + (dynamic_cast<ClassDef*>(pd))->displayName() : pd->name(); QCString sep = getLanguageSpecificSeparator(lang,TRUE); QCString memArgs; if (!isRelated() @@ -3631,16 +3954,16 @@ void MemberDef::addListReference(Definition *) } } -MemberList *MemberDef::getSectionList(Definition *d) const +MemberList *MemberDefImpl::getSectionList(Definition *d) const { char key[20]; sprintf(key,"%p",d); return (d!=0 && m_impl->classSectionSDict) ? m_impl->classSectionSDict->find(key) : 0; } -void MemberDef::setSectionList(Definition *d, MemberList *sl) +void MemberDefImpl::setSectionList(Definition *d, MemberList *sl) { - //printf("MemberDef::setSectionList(%p,%p) name=%s\n",d,sl,name().data()); + //printf("MemberDefImpl::setSectionList(%p,%p) name=%s\n",d,sl,name().data()); char key[20]; sprintf(key,"%p",d); if (m_impl->classSectionSDict==0) @@ -3650,7 +3973,7 @@ void MemberDef::setSectionList(Definition *d, MemberList *sl) m_impl->classSectionSDict->append(key,sl); } -Specifier MemberDef::virtualness(int count) const +Specifier MemberDefImpl::virtualness(int count) const { if (count>25) { @@ -3670,7 +3993,7 @@ Specifier MemberDef::virtualness(int count) const return v; } -void MemberDef::writeTagFile(FTextStream &tagFile) +void MemberDefImpl::writeTagFile(FTextStream &tagFile) { if (!isLinkableInProject()) return; tagFile << " <member kind=\""; @@ -3751,7 +4074,7 @@ void MemberDef::writeTagFile(FTextStream &tagFile) tagFile << " </member>" << endl; } -void MemberDef::_computeIsConstructor() +void MemberDefImpl::_computeIsConstructor() { m_isConstructorCached=1; // FALSE if (m_impl->classDef) @@ -3794,11 +4117,11 @@ void MemberDef::_computeIsConstructor() } } -bool MemberDef::isConstructor() const +bool MemberDefImpl::isConstructor() const { if (m_isConstructorCached==0) { - MemberDef *that = (MemberDef*)this; + MemberDefImpl *that = (MemberDefImpl*)this; that->_computeIsConstructor(); } ASSERT(m_isConstructorCached>0); @@ -3806,7 +4129,7 @@ bool MemberDef::isConstructor() const } -void MemberDef::_computeIsDestructor() +void MemberDefImpl::_computeIsDestructor() { bool isDestructor; if (m_impl->isDMember) // for D @@ -3835,18 +4158,18 @@ void MemberDef::_computeIsDestructor() m_isDestructorCached = isDestructor ? 2 : 1; } -bool MemberDef::isDestructor() const +bool MemberDefImpl::isDestructor() const { if (m_isDestructorCached==0) { - MemberDef *that=(MemberDef*)this; + MemberDefImpl *that=(MemberDefImpl*)this; that->_computeIsDestructor(); } ASSERT(m_isDestructorCached>0); return m_isDestructorCached==2; } -void MemberDef::writeEnumDeclaration(OutputList &typeDecl, +void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd) { int enumMemCount=0; @@ -3875,7 +4198,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, if (isLinkableInProject() || hasDocumentedEnumValues()) { //_writeTagData(compoundType); - _addToSearchIndex(); + addToSearchIndex(); writeLink(typeDecl,cd,nd,fd,gd); } else @@ -3926,7 +4249,7 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, if (fmd->hasDocumentation()) // enum value has docs { //fmd->_writeTagData(compoundType); - fmd->_addToSearchIndex(); + fmd->addToSearchIndex(); fmd->writeLink(typeDecl,cd,nd,fd,gd); } else // no docs for this enum value @@ -3970,19 +4293,19 @@ void MemberDef::writeEnumDeclaration(OutputList &typeDecl, } } -void MemberDef::setArgumentList(ArgumentList *al) +void MemberDefImpl::setArgumentList(ArgumentList *al) { if (m_impl->defArgList) delete m_impl->defArgList; m_impl->defArgList = al; } -void MemberDef::setDeclArgumentList(ArgumentList *al) +void MemberDefImpl::setDeclArgumentList(ArgumentList *al) { if (m_impl->declArgList) delete m_impl->declArgList; m_impl->declArgList = al; } -void MemberDef::setTypeConstraints(ArgumentList *al) +void MemberDefImpl::setTypeConstraints(ArgumentList *al) { if (al==0) return; if (m_impl->typeConstraints) delete m_impl->typeConstraints; @@ -3996,53 +4319,53 @@ void MemberDef::setTypeConstraints(ArgumentList *al) } } -void MemberDef::setType(const char *t) +void MemberDefImpl::setType(const char *t) { m_impl->type = t; } -void MemberDef::setAccessorType(ClassDef *cd,const char *t) +void MemberDefImpl::setAccessorType(ClassDef *cd,const char *t) { m_impl->accessorClass = cd; m_impl->accessorType = t; } -ClassDef *MemberDef::accessorClass() const +ClassDef *MemberDefImpl::accessorClass() const { return m_impl->accessorClass; } -void MemberDef::findSectionsInDocumentation() +void MemberDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); } -void MemberDef::enableCallGraph(bool e) +void MemberDefImpl::enableCallGraph(bool e) { m_impl->hasCallGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } -void MemberDef::enableCallerGraph(bool e) +void MemberDefImpl::enableCallerGraph(bool e) { m_impl->hasCallerGraph=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } -void MemberDef::enableReferencedByRelation(bool e) +void MemberDefImpl::enableReferencedByRelation(bool e) { m_impl->hasReferencedByRelation=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } -void MemberDef::enableReferencesRelation(bool e) +void MemberDefImpl::enableReferencesRelation(bool e) { m_impl->hasReferencesRelation=e; if (e) Doxygen::parseSourcesNeeded = TRUE; } #if 0 -bool MemberDef::protectionVisible() const +bool MemberDefImpl::protectionVisible() const { return m_impl->prot==Public || (m_impl->prot==Private && Config_getBool(EXTRACT_PRIVATE)) || @@ -4052,7 +4375,7 @@ bool MemberDef::protectionVisible() const #endif #if 0 -void MemberDef::setInbodyDocumentation(const char *docs, +void MemberDefImpl::setInbodyDocumentation(const char *docs, const char *docFile,int docLine) { m_impl->inbodyDocs = docs; @@ -4062,19 +4385,19 @@ void MemberDef::setInbodyDocumentation(const char *docs, } #endif -bool MemberDef::isObjCMethod() const +bool MemberDefImpl::isObjCMethod() const { if (m_impl->classDef && m_impl->classDef->isObjectiveC() && isFunction()) return TRUE; return FALSE; } -bool MemberDef::isObjCProperty() const +bool MemberDefImpl::isObjCProperty() const { if (m_impl->classDef && m_impl->classDef->isObjectiveC() && isProperty()) return TRUE; return FALSE; } -QCString MemberDef::qualifiedName() const +QCString MemberDefImpl::qualifiedName() const { if (isObjCMethod()) { @@ -4094,11 +4417,11 @@ QCString MemberDef::qualifiedName() const } else { - return Definition::qualifiedName(); + return DefinitionImpl::qualifiedName(); } } -void MemberDef::setTagInfo(TagInfo *ti) +void MemberDefImpl::setTagInfo(TagInfo *ti) { if (ti) { @@ -4109,7 +4432,7 @@ void MemberDef::setTagInfo(TagInfo *ti) } } -QCString MemberDef::objCMethodName(bool localLink,bool showStatic) const +QCString MemberDefImpl::objCMethodName(bool localLink,bool showStatic) const { QCString qm; if (showStatic) @@ -4126,455 +4449,455 @@ QCString MemberDef::objCMethodName(bool localLink,bool showStatic) const return qm; } -const char *MemberDef::declaration() const +const char *MemberDefImpl::declaration() const { return m_impl->decl; } -const char *MemberDef::definition() const +const char *MemberDefImpl::definition() const { return m_impl->def; } -const char *MemberDef::extraTypeChars() const +const char *MemberDefImpl::extraTypeChars() const { return m_impl->extraTypeChars; } -const char *MemberDef::typeString() const +const char *MemberDefImpl::typeString() const { return m_impl->type; } -const char *MemberDef::argsString() const +const char *MemberDefImpl::argsString() const { return m_impl->args; } -const char *MemberDef::excpString() const +const char *MemberDefImpl::excpString() const { return m_impl->exception; } -const char *MemberDef::bitfieldString() const +const char *MemberDefImpl::bitfieldString() const { return m_impl->bitfields; } -const QCString &MemberDef::initializer() const +const QCString &MemberDefImpl::initializer() const { return m_impl->initializer; } -int MemberDef::initializerLines() const +int MemberDefImpl::initializerLines() const { return m_impl->initLines; } -uint64 MemberDef::getMemberSpecifiers() const +uint64 MemberDefImpl::getMemberSpecifiers() const { return m_impl->memSpec; } -ClassDef *MemberDef::getClassDef() const +ClassDef *MemberDefImpl::getClassDef() const { return m_impl->classDef; } -FileDef *MemberDef::getFileDef() const +FileDef *MemberDefImpl::getFileDef() const { return m_impl->fileDef; } -NamespaceDef* MemberDef::getNamespaceDef() const +NamespaceDef* MemberDefImpl::getNamespaceDef() const { return m_impl->nspace; } -const char *MemberDef::getReadAccessor() const +const char *MemberDefImpl::getReadAccessor() const { return m_impl->read; } -const char *MemberDef::getWriteAccessor() const +const char *MemberDefImpl::getWriteAccessor() const { return m_impl->write; } -GroupDef *MemberDef::getGroupDef() const +GroupDef *MemberDefImpl::getGroupDef() const { return m_impl->group; } -Grouping::GroupPri_t MemberDef::getGroupPri() const +Grouping::GroupPri_t MemberDefImpl::getGroupPri() const { return m_impl->grouppri; } -const char *MemberDef::getGroupFileName() const +const char *MemberDefImpl::getGroupFileName() const { return m_impl->groupFileName; } -int MemberDef::getGroupStartLine() const +int MemberDefImpl::getGroupStartLine() const { return m_impl->groupStartLine; } -bool MemberDef::getGroupHasDocs() const +bool MemberDefImpl::getGroupHasDocs() const { return m_impl->groupHasDocs; } -Protection MemberDef::protection() const +Protection MemberDefImpl::protection() const { return m_impl->prot; } -MemberType MemberDef::memberType() const +MemberType MemberDefImpl::memberType() const { return m_impl->mtype; } -bool MemberDef::isSignal() const +bool MemberDefImpl::isSignal() const { return m_impl->mtype==MemberType_Signal; } -bool MemberDef::isSlot() const +bool MemberDefImpl::isSlot() const { return m_impl->mtype==MemberType_Slot; } -bool MemberDef::isVariable() const +bool MemberDefImpl::isVariable() const { return m_impl->mtype==MemberType_Variable; } -bool MemberDef::isEnumerate() const +bool MemberDefImpl::isEnumerate() const { return m_impl->mtype==MemberType_Enumeration; } -bool MemberDef::isEnumValue() const +bool MemberDefImpl::isEnumValue() const { return m_impl->mtype==MemberType_EnumValue; } -bool MemberDef::isTypedef() const +bool MemberDefImpl::isTypedef() const { return m_impl->mtype==MemberType_Typedef; } -bool MemberDef::isSequence() const +bool MemberDefImpl::isSequence() const { return m_impl->mtype==MemberType_Sequence; } -bool MemberDef::isDictionary() const +bool MemberDefImpl::isDictionary() const { return m_impl->mtype==MemberType_Dictionary; } -bool MemberDef::isFunction() const +bool MemberDefImpl::isFunction() const { return m_impl->mtype==MemberType_Function; } -bool MemberDef::isFunctionPtr() const +bool MemberDefImpl::isFunctionPtr() const { return m_impl->mtype==MemberType_Variable && QCString(argsString()).find(")(")!=-1; } -bool MemberDef::isDefine() const +bool MemberDefImpl::isDefine() const { return m_impl->mtype==MemberType_Define; } -bool MemberDef::isFriend() const +bool MemberDefImpl::isFriend() const { return m_impl->mtype==MemberType_Friend; } -bool MemberDef::isDCOP() const +bool MemberDefImpl::isDCOP() const { return m_impl->mtype==MemberType_DCOP; } -bool MemberDef::isProperty() const +bool MemberDefImpl::isProperty() const { return m_impl->mtype==MemberType_Property; } -bool MemberDef::isEvent() const +bool MemberDefImpl::isEvent() const { return m_impl->mtype==MemberType_Event; } -bool MemberDef::isRelated() const +bool MemberDefImpl::isRelated() const { return m_impl->related == Related; } -bool MemberDef::isForeign() const +bool MemberDefImpl::isForeign() const { return m_impl->related == Foreign; } -bool MemberDef::isStatic() const +bool MemberDefImpl::isStatic() const { return m_impl->stat; } -bool MemberDef::isInline() const +bool MemberDefImpl::isInline() const { return (m_impl->memSpec&Entry::Inline)!=0; } -bool MemberDef::isExplicit() const +bool MemberDefImpl::isExplicit() const { return (m_impl->memSpec&Entry::Explicit)!=0; } -bool MemberDef::isMutable() const +bool MemberDefImpl::isMutable() const { return (m_impl->memSpec&Entry::Mutable)!=0; } -bool MemberDef::isGettable() const +bool MemberDefImpl::isGettable() const { return (m_impl->memSpec&Entry::Gettable)!=0; } -bool MemberDef::isPrivateGettable() const +bool MemberDefImpl::isPrivateGettable() const { return (m_impl->memSpec&Entry::PrivateGettable)!=0; } -bool MemberDef::isProtectedGettable() const +bool MemberDefImpl::isProtectedGettable() const { return (m_impl->memSpec&Entry::ProtectedGettable)!=0; } -bool MemberDef::isSettable() const +bool MemberDefImpl::isSettable() const { return (m_impl->memSpec&Entry::Settable)!=0; } -bool MemberDef::isPrivateSettable() const +bool MemberDefImpl::isPrivateSettable() const { return (m_impl->memSpec&Entry::PrivateSettable)!=0; } -bool MemberDef::isProtectedSettable() const +bool MemberDefImpl::isProtectedSettable() const { return (m_impl->memSpec&Entry::ProtectedSettable)!=0; } -bool MemberDef::isAddable() const +bool MemberDefImpl::isAddable() const { return (m_impl->memSpec&Entry::Addable)!=0; } -bool MemberDef::isRemovable() const +bool MemberDefImpl::isRemovable() const { return (m_impl->memSpec&Entry::Removable)!=0; } -bool MemberDef::isRaisable() const +bool MemberDefImpl::isRaisable() const { return (m_impl->memSpec&Entry::Raisable)!=0; } -bool MemberDef::isReadable() const +bool MemberDefImpl::isReadable() const { return (m_impl->memSpec&Entry::Readable)!=0; } -bool MemberDef::isWritable() const +bool MemberDefImpl::isWritable() const { return (m_impl->memSpec&Entry::Writable)!=0; } -bool MemberDef::isFinal() const +bool MemberDefImpl::isFinal() const { return (m_impl->memSpec&Entry::Final)!=0; } -bool MemberDef::isNew() const +bool MemberDefImpl::isNew() const { return (m_impl->memSpec&Entry::New)!=0; } -bool MemberDef::isSealed() const +bool MemberDefImpl::isSealed() const { return (m_impl->memSpec&Entry::Sealed)!=0; } -bool MemberDef::isOverride() const +bool MemberDefImpl::isOverride() const { return (m_impl->memSpec&Entry::Override)!=0; } -bool MemberDef::isInitonly() const +bool MemberDefImpl::isInitonly() const { return (m_impl->memSpec&Entry::Initonly)!=0; } -bool MemberDef::isAbstract() const +bool MemberDefImpl::isAbstract() const { return (m_impl->memSpec&Entry::Abstract)!=0; } -bool MemberDef::isOptional() const +bool MemberDefImpl::isOptional() const { return (m_impl->memSpec&Entry::Optional)!=0; } -bool MemberDef::isRequired() const +bool MemberDefImpl::isRequired() const { return (m_impl->memSpec&Entry::Required)!=0; } -bool MemberDef::isNonAtomic() const +bool MemberDefImpl::isNonAtomic() const { return (m_impl->memSpec&Entry::NonAtomic)!=0; } -bool MemberDef::isCopy() const +bool MemberDefImpl::isCopy() const { return (m_impl->memSpec&Entry::Copy)!=0; } -bool MemberDef::isAssign() const +bool MemberDefImpl::isAssign() const { return (m_impl->memSpec&Entry::Assign)!=0; } -bool MemberDef::isRetain() const +bool MemberDefImpl::isRetain() const { return (m_impl->memSpec&Entry::Retain)!=0; } -bool MemberDef::isWeak() const +bool MemberDefImpl::isWeak() const { return (m_impl->memSpec&Entry::Weak)!=0; } -bool MemberDef::isStrong() const +bool MemberDefImpl::isStrong() const { return (m_impl->memSpec&Entry::Strong)!=0; } -bool MemberDef::isStrongEnumValue() const +bool MemberDefImpl::isStrongEnumValue() const { return m_impl->mtype==MemberType_EnumValue && m_impl->enumScope && m_impl->enumScope->isStrong(); } -bool MemberDef::isUnretained() const +bool MemberDefImpl::isUnretained() const { return (m_impl->memSpec&Entry::Unretained)!=0; } -bool MemberDef::isAlias() const +bool MemberDefImpl::isAlias() const { return (m_impl->memSpec&Entry::Alias)!=0; } -bool MemberDef::isDefault() const +bool MemberDefImpl::isDefault() const { return (m_impl->memSpec&Entry::Default)!=0; } -bool MemberDef::isDelete() const +bool MemberDefImpl::isDelete() const { return (m_impl->memSpec&Entry::Delete)!=0; } -bool MemberDef::isNoExcept() const +bool MemberDefImpl::isNoExcept() const { return (m_impl->memSpec&Entry::NoExcept)!=0; } -bool MemberDef::isAttribute() const +bool MemberDefImpl::isAttribute() const { return (m_impl->memSpec&Entry::Attribute)!=0; } -bool MemberDef::isUNOProperty() const +bool MemberDefImpl::isUNOProperty() const { return (m_impl->memSpec&Entry::Property)!=0; } -bool MemberDef::isReadonly() const +bool MemberDefImpl::isReadonly() const { return (m_impl->memSpec&Entry::Readonly)!=0; } -bool MemberDef::isBound() const +bool MemberDefImpl::isBound() const { return (m_impl->memSpec&Entry::Bound)!=0; } -bool MemberDef::isConstrained() const +bool MemberDefImpl::isConstrained() const { return (m_impl->memSpec&Entry::Constrained)!=0; } -bool MemberDef::isTransient() const +bool MemberDefImpl::isTransient() const { return (m_impl->memSpec&Entry::Transient)!=0; } -bool MemberDef::isMaybeVoid() const +bool MemberDefImpl::isMaybeVoid() const { return (m_impl->memSpec&Entry::MaybeVoid)!=0; } -bool MemberDef::isMaybeDefault() const +bool MemberDefImpl::isMaybeDefault() const { return (m_impl->memSpec&Entry::MaybeDefault)!=0; } -bool MemberDef::isMaybeAmbiguous() const +bool MemberDefImpl::isMaybeAmbiguous() const { return (m_impl->memSpec&Entry::MaybeAmbiguous)!=0; } -bool MemberDef::isPublished() const +bool MemberDefImpl::isPublished() const { return (m_impl->memSpec&Entry::Published)!=0; } -bool MemberDef::isImplementation() const +bool MemberDefImpl::isImplementation() const { return m_impl->implOnly; } -bool MemberDef::isExternal() const +bool MemberDefImpl::isExternal() const { return m_impl->explExt; } -bool MemberDef::isTemplateSpecialization() const +bool MemberDefImpl::isTemplateSpecialization() const { return m_impl->tspec; } -bool MemberDef::hasDocumentedParams() const +bool MemberDefImpl::hasDocumentedParams() const { return m_impl->hasDocumentedParams; } -bool MemberDef::hasDocumentedReturnType() const +bool MemberDefImpl::hasDocumentedReturnType() const { return m_impl->hasDocumentedReturnType; } -bool MemberDef::showInCallGraph() const +bool MemberDefImpl::showInCallGraph() const { return isFunction() || isSlot() || @@ -4583,183 +4906,183 @@ bool MemberDef::showInCallGraph() const isObjCMethod(); } -ClassDef *MemberDef::relatedAlso() const +ClassDef *MemberDefImpl::relatedAlso() const { return m_impl->relatedAlso; } -bool MemberDef::hasDocumentedEnumValues() const +bool MemberDefImpl::hasDocumentedEnumValues() const { return m_impl->docEnumValues; } -MemberDef *MemberDef::getAnonymousEnumType() const +MemberDef *MemberDefImpl::getAnonymousEnumType() const { return m_impl->annEnumType; } -bool MemberDef::isDocsForDefinition() const +bool MemberDefImpl::isDocsForDefinition() const { return m_impl->docsForDefinition; } -MemberDef *MemberDef::getEnumScope() const +MemberDef *MemberDefImpl::getEnumScope() const { return m_impl->enumScope; } -bool MemberDef::livesInsideEnum() const +bool MemberDefImpl::livesInsideEnum() const { return m_impl->livesInsideEnum; } -bool MemberDef::isSliceLocal() const +bool MemberDefImpl::isSliceLocal() const { return (m_impl->memSpec&Entry::Local)!=0; } -bool MemberDef::isConstExpr() const +bool MemberDefImpl::isConstExpr() const { return (m_impl->memSpec&Entry::ConstExpr)!=0; } -MemberList *MemberDef::enumFieldList() const +MemberList *MemberDefImpl::enumFieldList() const { return m_impl->enumFields; } -ExampleSDict *MemberDef::getExamples() const +ExampleSDict *MemberDefImpl::getExamples() const { return m_impl->exampleSDict; } -bool MemberDef::isPrototype() const +bool MemberDefImpl::isPrototype() const { return m_impl->proto; } -ArgumentList *MemberDef::argumentList() const +ArgumentList *MemberDefImpl::argumentList() const { return m_impl->defArgList; } -ArgumentList *MemberDef::declArgumentList() const +ArgumentList *MemberDefImpl::declArgumentList() const { return m_impl->declArgList; } -ArgumentList *MemberDef::templateArguments() const +ArgumentList *MemberDefImpl::templateArguments() const { return m_impl->tArgList; } -QList<ArgumentList> *MemberDef::definitionTemplateParameterLists() const +QList<ArgumentList> *MemberDefImpl::definitionTemplateParameterLists() const { return m_impl->defTmpArgLists; } -int MemberDef::getMemberGroupId() const +int MemberDefImpl::getMemberGroupId() const { return m_impl->grpId; } -MemberGroup *MemberDef::getMemberGroup() const +MemberGroup *MemberDefImpl::getMemberGroup() const { return m_impl->memberGroup; } -bool MemberDef::fromAnonymousScope() const +bool MemberDefImpl::fromAnonymousScope() const { return m_impl->annScope; } -bool MemberDef::anonymousDeclShown() const +bool MemberDefImpl::anonymousDeclShown() const { return m_impl->annUsed; } -void MemberDef::setAnonymousUsed() +void MemberDefImpl::setAnonymousUsed() { m_impl->annUsed = TRUE; } -bool MemberDef::hasCallGraph() const +bool MemberDefImpl::hasCallGraph() const { return m_impl->hasCallGraph; } -bool MemberDef::hasCallerGraph() const +bool MemberDefImpl::hasCallerGraph() const { return m_impl->hasCallerGraph; } -bool MemberDef::hasReferencedByRelation() const +bool MemberDefImpl::hasReferencedByRelation() const { return m_impl->hasReferencedByRelation; } -bool MemberDef::hasReferencesRelation() const +bool MemberDefImpl::hasReferencesRelation() const { return m_impl->hasReferencesRelation; } -MemberDef *MemberDef::templateMaster() const +MemberDef *MemberDefImpl::templateMaster() const { return m_impl->templateMaster; } -bool MemberDef::isTypedefValCached() const +bool MemberDefImpl::isTypedefValCached() const { return m_impl->isTypedefValCached; } -ClassDef *MemberDef::getCachedTypedefVal() const +ClassDef *MemberDefImpl::getCachedTypedefVal() const { return m_impl->cachedTypedefValue; } -QCString MemberDef::getCachedTypedefTemplSpec() const +QCString MemberDefImpl::getCachedTypedefTemplSpec() const { return m_impl->cachedTypedefTemplSpec; } -QCString MemberDef::getCachedResolvedTypedef() const +QCString MemberDefImpl::getCachedResolvedTypedef() const { - //printf("MemberDef::getCachedResolvedTypedef()=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); + //printf("MemberDefImpl::getCachedResolvedTypedef()=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); return m_impl->cachedResolvedType; } -MemberDef *MemberDef::memberDefinition() const +MemberDef *MemberDefImpl::memberDefinition() const { return m_impl->memDef; } -MemberDef *MemberDef::memberDeclaration() const +MemberDef *MemberDefImpl::memberDeclaration() const { return m_impl->memDec; } -MemberDef *MemberDef::inheritsDocsFrom() const +MemberDef *MemberDefImpl::inheritsDocsFrom() const { return m_impl->docProvider; } -MemberDef *MemberDef::getGroupAlias() const +MemberDef *MemberDefImpl::getGroupAlias() const { return m_impl->groupAlias; } -QCString MemberDef::getDeclFileName() const +QCString MemberDefImpl::getDeclFileName() const { return m_impl->declFileName; } -int MemberDef::getDeclLine() const +int MemberDefImpl::getDeclLine() const { return m_impl->declLine; } -int MemberDef::getDeclColumn() const +int MemberDefImpl::getDeclColumn() const { return m_impl->declColumn; } @@ -4767,18 +5090,18 @@ int MemberDef::getDeclColumn() const //---------------------------------------------- -void MemberDef::setMemberType(MemberType t) +void MemberDefImpl::setMemberType(MemberType t) { m_impl->mtype=t; m_isLinkableCached = 0; } -void MemberDef::setDefinition(const char *d) +void MemberDefImpl::setDefinition(const char *d) { m_impl->def=d; } -void MemberDef::setFileDef(FileDef *fd) +void MemberDefImpl::setFileDef(FileDef *fd) { m_impl->fileDef=fd; m_isLinkableCached = 0; @@ -4786,28 +5109,28 @@ void MemberDef::setFileDef(FileDef *fd) m_isDestructorCached = 0; } -void MemberDef::setProtection(Protection p) +void MemberDefImpl::setProtection(Protection p) { m_impl->prot=p; m_isLinkableCached = 0; } -void MemberDef::setMemberSpecifiers(uint64 s) +void MemberDefImpl::setMemberSpecifiers(uint64 s) { m_impl->memSpec=s; } -void MemberDef::mergeMemberSpecifiers(uint64 s) +void MemberDefImpl::mergeMemberSpecifiers(uint64 s) { m_impl->memSpec|=s; } -void MemberDef::setBitfields(const char *s) +void MemberDefImpl::setBitfields(const char *s) { m_impl->bitfields = QCString(s).simplifyWhiteSpace(); } -void MemberDef::setMaxInitLines(int lines) +void MemberDefImpl::setMaxInitLines(int lines) { if (lines!=-1) { @@ -4815,76 +5138,76 @@ void MemberDef::setMaxInitLines(int lines) } } -void MemberDef::setReadAccessor(const char *r) +void MemberDefImpl::setReadAccessor(const char *r) { m_impl->read=r; } -void MemberDef::setWriteAccessor(const char *w) +void MemberDefImpl::setWriteAccessor(const char *w) { m_impl->write=w; } -void MemberDef::setTemplateSpecialization(bool b) +void MemberDefImpl::setTemplateSpecialization(bool b) { m_impl->tspec=b; } -void MemberDef::makeRelated() +void MemberDefImpl::makeRelated() { m_impl->related = Related; m_isLinkableCached = 0; } -void MemberDef::makeForeign() +void MemberDefImpl::makeForeign() { m_impl->related = Foreign; m_isLinkableCached = 0; } -void MemberDef::setHasDocumentedParams(bool b) +void MemberDefImpl::setHasDocumentedParams(bool b) { m_impl->hasDocumentedParams = b; } -void MemberDef::setHasDocumentedReturnType(bool b) +void MemberDefImpl::setHasDocumentedReturnType(bool b) { m_impl->hasDocumentedReturnType = b; } -void MemberDef::setInheritsDocsFrom(MemberDef *md) +void MemberDefImpl::setInheritsDocsFrom(MemberDef *md) { m_impl->docProvider = md; } -void MemberDef::setArgsString(const char *as) +void MemberDefImpl::setArgsString(const char *as) { m_impl->args = as; } -void MemberDef::setRelatedAlso(ClassDef *cd) +void MemberDefImpl::setRelatedAlso(ClassDef *cd) { m_impl->relatedAlso=cd; } -void MemberDef::setEnumClassScope(ClassDef *cd) +void MemberDefImpl::setEnumClassScope(ClassDef *cd) { m_impl->classDef = cd; m_isLinkableCached = 0; m_isConstructorCached = 0; } -void MemberDef::setDocumentedEnumValues(bool value) +void MemberDefImpl::setDocumentedEnumValues(bool value) { m_impl->docEnumValues=value; } -void MemberDef::setAnonymousEnumType(MemberDef *md) +void MemberDefImpl::setAnonymousEnumType(MemberDef *md) { m_impl->annEnumType = md; } -void MemberDef::setPrototype(bool p,const QCString &df,int line,int column) +void MemberDefImpl::setPrototype(bool p,const QCString &df,int line,int column) { m_impl->proto=p; if (p) @@ -4897,7 +5220,7 @@ void MemberDef::setPrototype(bool p,const QCString &df,int line,int column) } } -void MemberDef::setExplicitExternal(bool b,const QCString &df,int line,int column) +void MemberDefImpl::setExplicitExternal(bool b,const QCString &df,int line,int column) { m_impl->explExt=b; if (b) @@ -4911,110 +5234,110 @@ void MemberDef::setExplicitExternal(bool b,const QCString &df,int line,int colum } -void MemberDef::setDeclFile(const QCString &df,int line,int column) +void MemberDefImpl::setDeclFile(const QCString &df,int line,int column) { m_impl->declFileName = df; m_impl->declLine = line; m_impl->declColumn = column; } -void MemberDef::setMemberGroupId(int id) +void MemberDefImpl::setMemberGroupId(int id) { m_impl->grpId=id; } -void MemberDef::makeImplementationDetail() +void MemberDefImpl::makeImplementationDetail() { m_impl->implOnly=TRUE; } -void MemberDef::setFromAnonymousScope(bool b) +void MemberDefImpl::setFromAnonymousScope(bool b) { m_impl->annScope=b; } -void MemberDef::setFromAnonymousMember(MemberDef *m) +void MemberDefImpl::setFromAnonymousMember(MemberDef *m) { m_impl->annMemb=m; } -MemberDef *MemberDef::fromAnonymousMember() const +MemberDef *MemberDefImpl::fromAnonymousMember() const { return m_impl->annMemb; } -void MemberDef::setTemplateMaster(MemberDef *mt) +void MemberDefImpl::setTemplateMaster(MemberDef *mt) { m_impl->templateMaster=mt; m_isLinkableCached = 0; } -void MemberDef::setDocsForDefinition(bool b) +void MemberDefImpl::setDocsForDefinition(bool b) { m_impl->docsForDefinition = b; } -void MemberDef::setGroupAlias(MemberDef *md) +void MemberDefImpl::setGroupAlias(MemberDef *md) { m_impl->groupAlias = md; } -void MemberDef::invalidateTypedefValCache() +void MemberDefImpl::invalidateTypedefValCache() { m_impl->isTypedefValCached=FALSE; } -void MemberDef::setMemberDefinition(MemberDef *md) +void MemberDefImpl::setMemberDefinition(MemberDef *md) { m_impl->memDef=md; } -void MemberDef::setMemberDeclaration(MemberDef *md) +void MemberDefImpl::setMemberDeclaration(MemberDef *md) { m_impl->memDec=md; } -ClassDef *MemberDef::category() const +ClassDef *MemberDefImpl::category() const { return m_impl->category; } -void MemberDef::setCategory(ClassDef *def) +void MemberDefImpl::setCategory(ClassDef *def) { m_impl->category = def; } -MemberDef *MemberDef::categoryRelation() const +MemberDef *MemberDefImpl::categoryRelation() const { return m_impl->categoryRelation; } -void MemberDef::setCategoryRelation(MemberDef *md) +void MemberDefImpl::setCategoryRelation(MemberDef *md) { m_impl->categoryRelation = md; } -void MemberDef::setEnumBaseType(const QCString &type) +void MemberDefImpl::setEnumBaseType(const QCString &type) { m_impl->enumBaseType = type; } -QCString MemberDef::enumBaseType() const +QCString MemberDefImpl::enumBaseType() const { return m_impl->enumBaseType; } -void MemberDef::cacheTypedefVal(ClassDef*val, const QCString & templSpec, const QCString &resolvedType) +void MemberDefImpl::cacheTypedefVal(ClassDef*val, const QCString & templSpec, const QCString &resolvedType) { m_impl->isTypedefValCached=TRUE; m_impl->cachedTypedefValue=val; m_impl->cachedTypedefTemplSpec=templSpec; m_impl->cachedResolvedType=resolvedType; - //printf("MemberDef::cacheTypedefVal=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); + //printf("MemberDefImpl::cacheTypedefVal=%s m_impl=%p\n",m_impl->cachedResolvedType.data(),m_impl); } -void MemberDef::copyArgumentNames(MemberDef *bmd) +void MemberDefImpl::copyArgumentNames(MemberDef *bmd) { { ArgumentList *arguments = bmd->argumentList(); @@ -5057,7 +5380,7 @@ static void invalidateCachedTypesInArgumentList(ArgumentList *al) } } -void MemberDef::invalidateCachedArgumentTypes() +void MemberDefImpl::invalidateCachedArgumentTypes() { invalidateCachedTypesInArgumentList(m_impl->defArgList); invalidateCachedTypesInArgumentList(m_impl->declArgList); @@ -5065,12 +5388,12 @@ void MemberDef::invalidateCachedArgumentTypes() //---------------- -QCString MemberDef::displayName(bool) const +QCString MemberDefImpl::displayName(bool) const { - return Definition::name(); + return DefinitionImpl::name(); } -void MemberDef::_addToSearchIndex() +void MemberDefImpl::addToSearchIndex() { // write search index info if (Doxygen::searchIndex && isLinkableInProject()) @@ -5256,7 +5579,7 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) } } -QCString MemberDef::briefDescription(bool abbr) const +QCString MemberDefImpl::briefDescription(bool abbr) const { if (m_impl->templateMaster) { @@ -5264,11 +5587,11 @@ QCString MemberDef::briefDescription(bool abbr) const } else { - return Definition::briefDescription(abbr); + return DefinitionImpl::briefDescription(abbr); } } -QCString MemberDef::documentation() const +QCString MemberDefImpl::documentation() const { if (m_impl->templateMaster) { @@ -5276,16 +5599,16 @@ QCString MemberDef::documentation() const } else { - return Definition::documentation(); + return DefinitionImpl::documentation(); } } -const ArgumentList *MemberDef::typeConstraints() const +const ArgumentList *MemberDefImpl::typeConstraints() const { return m_impl->typeConstraints; } -bool MemberDef::isFriendToHide() const +bool MemberDefImpl::isFriendToHide() const { static bool hideFriendCompounds = Config_getBool(HIDE_FRIEND_COMPOUNDS); bool isFriendToHide = hideFriendCompounds && @@ -5295,24 +5618,24 @@ bool MemberDef::isFriendToHide() const return isFriendToHide; } -bool MemberDef::isNotFriend() const +bool MemberDefImpl::isNotFriend() const { return !(isFriend() && isFriendToHide()); } -bool MemberDef::isFunctionOrSignalSlot() const +bool MemberDefImpl::isFunctionOrSignalSlot() const { return isFunction() || isSlot() || isSignal(); } -bool MemberDef::isRelatedOrFriend() const +bool MemberDefImpl::isRelatedOrFriend() const { return isRelated() || isForeign() || (isFriend() && !isFriendToHide()); } -bool MemberDef::isReference() const +bool MemberDefImpl::isReference() const { - return Definition::isReference() || + return DefinitionImpl::isReference() || (m_impl->templateMaster && m_impl->templateMaster->isReference()); } diff --git a/src/memberdef.h b/src/memberdef.h index d96b9c9..555935a 100644 --- a/src/memberdef.h +++ b/src/memberdef.h @@ -35,424 +35,379 @@ class OutputList; class GroupDef; class QTextStream; class ArgumentList; -class MemberDefImpl; class QStrList; struct TagInfo; /** A model of a class/file/namespace member symbol. */ -class MemberDef : public Definition +class MemberDef : virtual public Definition { public: - - MemberDef(const char *defFileName,int defLine,int defColumn, - const char *type,const char *name,const char *args, - const char *excp,Protection prot,Specifier virt,bool stat, - Relationship related,MemberType t,const ArgumentList *tal, - const ArgumentList *al,const char *metaData); - ~MemberDef(); - DefType definitionType() const { return TypeMember; } + virtual ~MemberDef() {} + virtual DefType definitionType() const = 0; // move this member into a different scope - MemberDef *deepCopy() const; - void moveTo(Definition *); + virtual MemberDef *deepCopy() const =0; + virtual void moveTo(Definition *) = 0; //----------------------------------------------------------------------------------- // ---- getters ----- //----------------------------------------------------------------------------------- // link id - QCString getOutputFileBase() const; - QCString getReference() const; - QCString anchor() const; - - const char *declaration() const; - const char *definition() const; - const char *typeString() const; - const char *argsString() const; - const char *excpString() const; - const char *bitfieldString() const; - const char *extraTypeChars() const; - const QCString &initializer() const; - int initializerLines() const; - uint64 getMemberSpecifiers() const; - MemberList *getSectionList(Definition *d) const; - QCString displayDefinition() const; + virtual QCString getOutputFileBase() const = 0; + virtual QCString getReference() const = 0; + virtual QCString anchor() const = 0; + + virtual const char *declaration() const = 0; + virtual const char *definition() const = 0; + virtual const char *typeString() const = 0; + virtual const char *argsString() const = 0; + virtual const char *excpString() const = 0; + virtual const char *bitfieldString() const = 0; + virtual const char *extraTypeChars() const = 0; + virtual const QCString &initializer() const = 0; + virtual int initializerLines() const = 0; + virtual uint64 getMemberSpecifiers() const = 0; + virtual MemberList *getSectionList(Definition *d) const = 0; + virtual QCString displayDefinition() const = 0; // scope query members - ClassDef *getClassDef() const; - FileDef *getFileDef() const; - NamespaceDef* getNamespaceDef() const; - ClassDef *accessorClass() const; + virtual ClassDef *getClassDef() const = 0; + virtual FileDef *getFileDef() const = 0; + virtual NamespaceDef* getNamespaceDef() const = 0; + virtual ClassDef *accessorClass() const = 0; // grabbing the property read/write accessor names - const char *getReadAccessor() const; - const char *getWriteAccessor() const; + virtual const char *getReadAccessor() const = 0; + virtual const char *getWriteAccessor() const = 0; // querying the grouping definition - GroupDef *getGroupDef() const; - Grouping::GroupPri_t getGroupPri() const; - const char *getGroupFileName() const; - int getGroupStartLine() const; - bool getGroupHasDocs() const; - QCString qualifiedName() const; - QCString objCMethodName(bool localLink,bool showStatic) const; + virtual GroupDef *getGroupDef() const = 0; + virtual Grouping::GroupPri_t getGroupPri() const = 0; + virtual const char *getGroupFileName() const = 0; + virtual int getGroupStartLine() const = 0; + virtual bool getGroupHasDocs() const = 0; + virtual QCString qualifiedName() const = 0; + virtual QCString objCMethodName(bool localLink,bool showStatic) const = 0; // direct kind info - Protection protection() const; - Specifier virtualness(int count=0) const; - MemberType memberType() const; - QCString memberTypeName() const; + virtual Protection protection() const = 0; + virtual Specifier virtualness(int count=0) const = 0; + virtual MemberType memberType() const = 0; + virtual QCString memberTypeName() const = 0; // getter methods - bool isSignal() const; - bool isSlot() const; - bool isVariable() const; - bool isEnumerate() const; - bool isEnumValue() const; - bool isTypedef() const; - bool isSequence() const; - bool isDictionary() const; - bool isFunction() const; - bool isFunctionPtr() const; - bool isDefine() const; - bool isFriend() const; - bool isDCOP() const; - bool isProperty() const; - bool isEvent() const; - bool isRelated() const; - bool isForeign() const; - bool isStatic() const; - bool isInline() const; - bool isExplicit() const; - bool isMutable() const; - bool isGettable() const; - bool isPrivateGettable() const; - bool isProtectedGettable() const; - bool isSettable() const; - bool isPrivateSettable() const; - bool isProtectedSettable() const; - bool isReadable() const; - bool isWritable() const; - bool isAddable() const; - bool isRemovable() const; - bool isRaisable() const; - bool isFinal() const; - bool isAbstract() const; - bool isOverride() const; - bool isInitonly() const; - bool isOptional() const; - bool isRequired() const; - bool isNonAtomic() const; - bool isCopy() const; - bool isAssign() const; - bool isRetain() const; - bool isWeak() const; - bool isStrong() const; - bool isUnretained() const; - bool isNew() const; - bool isSealed() const; - bool isImplementation() const; - bool isExternal() const; - bool isAlias() const; - bool isDefault() const; - bool isDelete() const; - bool isNoExcept() const; - bool isAttribute() const; // UNO IDL attribute - bool isUNOProperty() const; // UNO IDL property - bool isReadonly() const; - bool isBound() const; - bool isConstrained() const; - bool isTransient() const; - bool isMaybeVoid() const; - bool isMaybeDefault() const; - bool isMaybeAmbiguous() const; - bool isPublished() const; // UNO IDL published - bool isTemplateSpecialization() const; - bool hasDocumentedParams() const; - bool hasDocumentedReturnType() const; - bool isObjCMethod() const; - bool isObjCProperty() const; - bool isConstructor() const; - bool isDestructor() const; - bool hasOneLineInitializer() const; - bool hasMultiLineInitializer() const; - bool protectionVisible() const; - bool showInCallGraph() const; - bool isStrongEnumValue() const; - bool livesInsideEnum() const; - bool isSliceLocal() const; - bool isConstExpr() const; + virtual bool isSignal() const = 0; + virtual bool isSlot() const = 0; + virtual bool isVariable() const = 0; + virtual bool isEnumerate() const = 0; + virtual bool isEnumValue() const = 0; + virtual bool isTypedef() const = 0; + virtual bool isSequence() const = 0; + virtual bool isDictionary() const = 0; + virtual bool isFunction() const = 0; + virtual bool isFunctionPtr() const = 0; + virtual bool isDefine() const = 0; + virtual bool isFriend() const = 0; + virtual bool isDCOP() const = 0; + virtual bool isProperty() const = 0; + virtual bool isEvent() const = 0; + virtual bool isRelated() const = 0; + virtual bool isForeign() const = 0; + virtual bool isStatic() const = 0; + virtual bool isInline() const = 0; + virtual bool isExplicit() const = 0; + virtual bool isMutable() const = 0; + virtual bool isGettable() const = 0; + virtual bool isPrivateGettable() const = 0; + virtual bool isProtectedGettable() const = 0; + virtual bool isSettable() const = 0; + virtual bool isPrivateSettable() const = 0; + virtual bool isProtectedSettable() const = 0; + virtual bool isReadable() const = 0; + virtual bool isWritable() const = 0; + virtual bool isAddable() const = 0; + virtual bool isRemovable() const = 0; + virtual bool isRaisable() const = 0; + virtual bool isFinal() const = 0; + virtual bool isAbstract() const = 0; + virtual bool isOverride() const = 0; + virtual bool isInitonly() const = 0; + virtual bool isOptional() const = 0; + virtual bool isRequired() const = 0; + virtual bool isNonAtomic() const = 0; + virtual bool isCopy() const = 0; + virtual bool isAssign() const = 0; + virtual bool isRetain() const = 0; + virtual bool isWeak() const = 0; + virtual bool isStrong() const = 0; + virtual bool isUnretained() const = 0; + virtual bool isNew() const = 0; + virtual bool isSealed() const = 0; + virtual bool isImplementation() const = 0; + virtual bool isExternal() const = 0; + virtual bool isAlias() const = 0; + virtual bool isDefault() const = 0; + virtual bool isDelete() const = 0; + virtual bool isNoExcept() const = 0; + virtual bool isAttribute() const = 0; // UNO IDL attribute + virtual bool isUNOProperty() const = 0; // UNO IDL property + virtual bool isReadonly() const = 0; + virtual bool isBound() const = 0; + virtual bool isConstrained() const = 0; + virtual bool isTransient() const = 0; + virtual bool isMaybeVoid() const = 0; + virtual bool isMaybeDefault() const = 0; + virtual bool isMaybeAmbiguous() const = 0; + virtual bool isPublished() const = 0; // UNO IDL published + virtual bool isTemplateSpecialization() const = 0; + virtual bool hasDocumentedParams() const = 0; + virtual bool hasDocumentedReturnType() const = 0; + virtual bool isObjCMethod() const = 0; + virtual bool isObjCProperty() const = 0; + virtual bool isConstructor() const = 0; + virtual bool isDestructor() const = 0; + virtual bool hasOneLineInitializer() const = 0; + virtual bool hasMultiLineInitializer() const = 0; + virtual bool showInCallGraph() const = 0; + virtual bool isStrongEnumValue() const = 0; + virtual bool livesInsideEnum() const = 0; + virtual bool isSliceLocal() const = 0; + virtual bool isConstExpr() const = 0; // derived getters - bool isFriendToHide() const; - bool isNotFriend() const; - bool isFunctionOrSignalSlot() const; - bool isRelatedOrFriend() const; + virtual bool isFriendToHide() const = 0; + virtual bool isNotFriend() const = 0; + virtual bool isFunctionOrSignalSlot() const = 0; + virtual bool isRelatedOrFriend() const = 0; // output info - bool isLinkableInProject() const; - bool isLinkable() const; - bool hasDocumentation() const; // overrides hasDocumentation in definition.h - //bool hasUserDocumentation() const; // overrides hasUserDocumentation - bool isDeleted() const; - bool isBriefSectionVisible() const; - bool isDetailedSectionVisible(bool inGroup,bool inFile) const; - bool isDetailedSectionLinkable() const; - bool isFriendClass() const; - bool isDocumentedFriendClass() const; - - MemberDef *reimplements() const; - MemberList *reimplementedBy() const; - bool isReimplementedBy(ClassDef *cd) const; - - //int inbodyLine() const; - //QCString inbodyFile() const; - //const QCString &inbodyDocumentation() const; - - ClassDef *relatedAlso() const; - - bool hasDocumentedEnumValues() const; - MemberDef *getAnonymousEnumType() const; - bool isDocsForDefinition() const; - MemberDef *getEnumScope() const; - MemberList *enumFieldList() const; - void setEnumBaseType(const QCString &type); - QCString enumBaseType() const; - - bool hasExamples(); - ExampleSDict *getExamples() const; - bool isPrototype() const; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual bool hasDocumentation() const = 0; // overrides hasDocumentation in definition.h + //bool hasUserDocumentation() const = 0; // overrides hasUserDocumentation + virtual bool isDeleted() const = 0; + virtual bool isBriefSectionVisible() const = 0; + virtual bool isDetailedSectionVisible(bool inGroup,bool inFile) const = 0; + virtual bool isDetailedSectionLinkable() const = 0; + virtual bool isFriendClass() const = 0; + virtual bool isDocumentedFriendClass() const = 0; + + virtual MemberDef *reimplements() const = 0; + virtual MemberList *reimplementedBy() const = 0; + virtual bool isReimplementedBy(ClassDef *cd) const = 0; + + virtual ClassDef *relatedAlso() const = 0; + + virtual bool hasDocumentedEnumValues() const = 0; + virtual MemberDef *getAnonymousEnumType() const = 0; + virtual bool isDocsForDefinition() const = 0; + virtual MemberDef *getEnumScope() const = 0; + virtual MemberList *enumFieldList() const = 0; + virtual void setEnumBaseType(const QCString &type) = 0; + virtual QCString enumBaseType() const = 0; + + virtual bool hasExamples() = 0; + virtual ExampleSDict *getExamples() const = 0; + virtual bool isPrototype() const = 0; // argument related members - ArgumentList *argumentList() const; - ArgumentList *declArgumentList() const; - ArgumentList *templateArguments() const; - QList<ArgumentList> *definitionTemplateParameterLists() const; + virtual ArgumentList *argumentList() const = 0; + virtual ArgumentList *declArgumentList() const = 0; + virtual ArgumentList *templateArguments() const = 0; + virtual QList<ArgumentList> *definitionTemplateParameterLists() const = 0; // member group related members - int getMemberGroupId() const; - MemberGroup *getMemberGroup() const; + virtual int getMemberGroupId() const = 0; + virtual MemberGroup *getMemberGroup() const = 0; - bool fromAnonymousScope() const; - bool anonymousDeclShown() const; - MemberDef *fromAnonymousMember() const; + virtual bool fromAnonymousScope() const = 0; + virtual bool anonymousDeclShown() const = 0; + virtual MemberDef *fromAnonymousMember() const = 0; // callgraph related members - bool hasCallGraph() const; - bool hasCallerGraph() const; - bool visibleMemberGroup(bool hideNoHeader); + virtual bool hasCallGraph() const = 0; + virtual bool hasCallerGraph() const = 0; + virtual bool visibleMemberGroup(bool hideNoHeader) = 0; // refrenced related members - bool hasReferencesRelation() const; - bool hasReferencedByRelation() const; + virtual bool hasReferencesRelation() const = 0; + virtual bool hasReferencedByRelation() const = 0; - MemberDef *templateMaster() const; - QCString getScopeString() const; - ClassDef *getClassDefOfAnonymousType(); + virtual MemberDef *templateMaster() const = 0; + virtual QCString getScopeString() const = 0; + virtual ClassDef *getClassDefOfAnonymousType() = 0; // cached typedef functions - bool isTypedefValCached() const; - ClassDef *getCachedTypedefVal() const; - QCString getCachedTypedefTemplSpec() const; - QCString getCachedResolvedTypedef() const; + virtual bool isTypedefValCached() const = 0; + virtual ClassDef *getCachedTypedefVal() const = 0; + virtual QCString getCachedTypedefTemplSpec() const = 0; + virtual QCString getCachedResolvedTypedef() const = 0; - MemberDef *memberDefinition() const; - MemberDef *memberDeclaration() const; - MemberDef *inheritsDocsFrom() const; - MemberDef *getGroupAlias() const; + virtual MemberDef *memberDefinition() const = 0; + virtual MemberDef *memberDeclaration() const = 0; + virtual MemberDef *inheritsDocsFrom() const = 0; + virtual MemberDef *getGroupAlias() const = 0; - ClassDef *category() const; - MemberDef *categoryRelation() const; + virtual ClassDef *category() const = 0; + virtual MemberDef *categoryRelation() const = 0; - QCString displayName(bool=TRUE) const; - QCString getDeclType() const; - void getLabels(QStrList &sl,Definition *container) const; + virtual QCString displayName(bool=TRUE) const = 0; + virtual QCString getDeclType() const = 0; + virtual void getLabels(QStrList &sl,Definition *container) const = 0; - const ArgumentList *typeConstraints() const; + virtual const ArgumentList *typeConstraints() const = 0; // overrules - QCString documentation() const; - QCString briefDescription(bool abbr=FALSE) const; - QCString fieldType() const; - bool isReference() const; + virtual QCString documentation() const = 0; + virtual QCString briefDescription(bool abbr=FALSE) const = 0; + virtual QCString fieldType() const = 0; + virtual bool isReference() const = 0; - QCString getDeclFileName() const; - int getDeclLine() const; - int getDeclColumn() const; + virtual QCString getDeclFileName() const = 0; + virtual int getDeclLine() const = 0; + virtual int getDeclColumn() const = 0; //----------------------------------------------------------------------------------- // ---- setters ----- //----------------------------------------------------------------------------------- // set functions - void setMemberType(MemberType t); - void setDefinition(const char *d); - void setFileDef(FileDef *fd); - void setAnchor(); - void setProtection(Protection p); - void setMemberSpecifiers(uint64 s); - void mergeMemberSpecifiers(uint64 s); - void setInitializer(const char *i); - void setBitfields(const char *s); - void setMaxInitLines(int lines); - void setMemberClass(ClassDef *cd); - void setSectionList(Definition *d,MemberList *sl); - void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, + virtual void setMemberType(MemberType t) = 0; + virtual void setDefinition(const char *d) = 0; + virtual void setFileDef(FileDef *fd) = 0; + virtual void setAnchor() = 0; + virtual void setProtection(Protection p) = 0; + virtual void setMemberSpecifiers(uint64 s) = 0; + virtual void mergeMemberSpecifiers(uint64 s) = 0; + virtual void setInitializer(const char *i) = 0; + virtual void setBitfields(const char *s) = 0; + virtual void setMaxInitLines(int lines) = 0; + virtual void setMemberClass(ClassDef *cd) = 0; + virtual void setSectionList(Definition *d,MemberList *sl) = 0; + virtual void setGroupDef(GroupDef *gd,Grouping::GroupPri_t pri, const QCString &fileName,int startLine,bool hasDocs, - MemberDef *member=0); - void setReadAccessor(const char *r); - void setWriteAccessor(const char *w); - void setTemplateSpecialization(bool b); + MemberDef *member=0) = 0; + virtual void setReadAccessor(const char *r) = 0; + virtual void setWriteAccessor(const char *w) = 0; + virtual void setTemplateSpecialization(bool b) = 0; - void makeRelated(); - void makeForeign(); - void setHasDocumentedParams(bool b); - void setHasDocumentedReturnType(bool b); - void setInheritsDocsFrom(MemberDef *md); - void setTagInfo(TagInfo *i); - void setArgsString(const char *as); + virtual void makeRelated() = 0; + virtual void makeForeign() = 0; + virtual void setHasDocumentedParams(bool b) = 0; + virtual void setHasDocumentedReturnType(bool b) = 0; + virtual void setInheritsDocsFrom(MemberDef *md) = 0; + virtual void setTagInfo(TagInfo *i) = 0; + virtual void setArgsString(const char *as) = 0; // relation to other members - void setReimplements(MemberDef *md); - void insertReimplementedBy(MemberDef *md); - - // in-body documentation - //void setInbodyDocumentation(const char *docs,const char *file,int line); + virtual void setReimplements(MemberDef *md) = 0; + virtual void insertReimplementedBy(MemberDef *md) = 0; - void setRelatedAlso(ClassDef *cd); + virtual void setRelatedAlso(ClassDef *cd) = 0; // enumeration specific members - void insertEnumField(MemberDef *md); - void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE); - void setEnumClassScope(ClassDef *cd); - void setDocumentedEnumValues(bool value); - void setAnonymousEnumType(MemberDef *md); + virtual void insertEnumField(MemberDef *md) = 0; + virtual void setEnumScope(MemberDef *md,bool livesInsideEnum=FALSE) = 0; + virtual void setEnumClassScope(ClassDef *cd) = 0; + virtual void setDocumentedEnumValues(bool value) = 0; + virtual void setAnonymousEnumType(MemberDef *md) = 0; // example related members - bool addExample(const char *anchor,const char *name,const char *file); + virtual bool addExample(const char *anchor,const char *name,const char *file) = 0; // prototype related members - void setPrototype(bool p,const QCString &df,int line, int column); - void setExplicitExternal(bool b,const QCString &df,int line,int column); - void setDeclFile(const QCString &df,int line,int column); + virtual void setPrototype(bool p,const QCString &df,int line, int column) = 0; + virtual void setExplicitExternal(bool b,const QCString &df,int line,int column) = 0; + virtual void setDeclFile(const QCString &df,int line,int column) = 0; // argument related members - void setArgumentList(ArgumentList *al); - void setDeclArgumentList(ArgumentList *al); - void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists); - void setTypeConstraints(ArgumentList *al); - void setType(const char *t); - void setAccessorType(ClassDef *cd,const char *t); + virtual void setArgumentList(ArgumentList *al) = 0; + virtual void setDeclArgumentList(ArgumentList *al) = 0; + virtual void setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) = 0; + virtual void setTypeConstraints(ArgumentList *al) = 0; + virtual void setType(const char *t) = 0; + virtual void setAccessorType(ClassDef *cd,const char *t) = 0; // namespace related members - void setNamespace(NamespaceDef *nd); + virtual void setNamespace(NamespaceDef *nd) = 0; // member group related members - void setMemberGroup(MemberGroup *grp); - void setMemberGroupId(int id); - void makeImplementationDetail(); + virtual void setMemberGroup(MemberGroup *grp) = 0; + virtual void setMemberGroupId(int id) = 0; + virtual void makeImplementationDetail() = 0; // anonymous scope members - void setFromAnonymousScope(bool b); - void setFromAnonymousMember(MemberDef *m); + virtual void setFromAnonymousScope(bool b) = 0; + virtual void setFromAnonymousMember(MemberDef *m) = 0; - void enableCallGraph(bool e); - void enableCallerGraph(bool e); + virtual void enableCallGraph(bool e) = 0; + virtual void enableCallerGraph(bool e) = 0; - void enableReferencedByRelation(bool e); - void enableReferencesRelation(bool e); + virtual void enableReferencedByRelation(bool e) = 0; + virtual void enableReferencesRelation(bool e) = 0; - void setTemplateMaster(MemberDef *mt); - void addListReference(Definition *d); - void setDocsForDefinition(bool b); - void setGroupAlias(MemberDef *md); + virtual void setTemplateMaster(MemberDef *mt) = 0; + virtual void addListReference(Definition *d) = 0; + virtual void setDocsForDefinition(bool b) = 0; + virtual void setGroupAlias(MemberDef *md) = 0; - void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType); - void invalidateTypedefValCache(); + virtual void cacheTypedefVal(ClassDef *val,const QCString &templSpec,const QCString &resolvedType) = 0; + virtual void invalidateTypedefValCache() = 0; - void invalidateCachedArgumentTypes(); + virtual void invalidateCachedArgumentTypes() = 0; // declaration <-> definition relation - void setMemberDefinition(MemberDef *md); - void setMemberDeclaration(MemberDef *md); + virtual void setMemberDefinition(MemberDef *md) = 0; + virtual void setMemberDeclaration(MemberDef *md) = 0; - void setAnonymousUsed(); - void copyArgumentNames(MemberDef *bmd); + virtual void setAnonymousUsed() = 0; + virtual void copyArgumentNames(MemberDef *bmd) = 0; - void setCategory(ClassDef *); - void setCategoryRelation(MemberDef *); + virtual void setCategory(ClassDef *) = 0; + virtual void setCategoryRelation(MemberDef *) = 0; - void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE); - void setBriefDescription(const char *b,const char *briefFile,int briefLine); - void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine); + virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE) = 0; + virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine) = 0; + virtual void setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine) = 0; - void setHidden(bool b); + virtual void setHidden(bool b) = 0; //----------------------------------------------------------------------------------- // --- actions ---- //----------------------------------------------------------------------------------- // output generation - void writeDeclaration(OutputList &ol, + virtual void writeDeclaration(OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - bool inGroup, ClassDef *inheritFrom=0,const char *inheritId=0); - void writeDocumentation(MemberList *ml,int memCount,int memTotal,OutputList &ol, + bool inGroup, ClassDef *inheritFrom=0,const char *inheritId=0) = 0; + virtual void writeDocumentation(MemberList *ml,int memCount,int memTotal,OutputList &ol, const char *scopeName,Definition *container, bool inGroup,bool showEnumValues=FALSE,bool - showInline=FALSE); - void writeMemberDocSimple(OutputList &ol,Definition *container); - void writeEnumDeclaration(OutputList &typeDecl, - ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd); - void writeTagFile(FTextStream &); - void warnIfUndocumented(); - void warnIfUndocumentedParams(); - - MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, - ArgumentList *actualArgs); - - void findSectionsInDocumentation(); - - bool visited; - - protected: - void flushToDisk() const; - void loadFromDisk() const; - private: - void lock() const; - void unlock() const; - void saveToDisk() const; - void makeResident() const; - void _computeLinkableInProject(); - void _computeIsConstructor(); - void _computeIsDestructor(); - void _writeGroupInclude(OutputList &ol,bool inGroup); - void _writeCallGraph(OutputList &ol); - void _writeCallerGraph(OutputList &ol); - void _writeReimplements(OutputList &ol); - void _writeReimplementedBy(OutputList &ol); - void _writeExamples(OutputList &ol); - void _writeTypeConstraints(OutputList &ol); - void _writeEnumValues(OutputList &ol,Definition *container, - const QCString &cfname,const QCString &ciname, - const QCString &cname); - void _writeCategoryRelation(OutputList &ol); - void _writeTagData(const DefType); - void _addToSearchIndex(); - - static int s_indentLevel; - - // disable copying of member defs - MemberDef(const MemberDef &); - MemberDef &operator=(const MemberDef &); - - void writeLink(OutputList &ol, + showInline=FALSE) = 0; + virtual void writeMemberDocSimple(OutputList &ol,Definition *container) = 0; + virtual void writeEnumDeclaration(OutputList &typeDecl, + ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd) = 0; + virtual void writeTagFile(FTextStream &) = 0; + virtual void warnIfUndocumented() = 0; + virtual void warnIfUndocumentedParams() = 0; + + virtual MemberDef *createTemplateInstanceMember(ArgumentList *formalArgs, + ArgumentList *actualArgs) = 0; + + virtual void findSectionsInDocumentation() = 0; + virtual void writeLink(OutputList &ol, ClassDef *cd,NamespaceDef *nd,FileDef *fd,GroupDef *gd, - bool onlyText=FALSE); + bool onlyText=FALSE) = 0; + virtual void addToSearchIndex() = 0; - MemberDefImpl *m_impl; - uchar m_isLinkableCached; // 0 = not cached, 1=FALSE, 2=TRUE - uchar m_isConstructorCached; // 0 = not cached, 1=FALSE, 2=TRUE - uchar m_isDestructorCached; // 0 = not cached, 1=FALSE, 2=TRUE }; +/** Factory method to create a new instance of a MemberDef */ +MemberDef *createMemberDef(const char *defFileName,int defLine,int defColumn, + const char *type,const char *name,const char *args, + const char *excp,Protection prot,Specifier virt,bool stat, + Relationship related,MemberType t,const ArgumentList *tal, + const ArgumentList *al,const char *metaData); + void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef); #endif diff --git a/src/memberlist.cpp b/src/memberlist.cpp index 8d88863..418b24a 100644 --- a/src/memberlist.cpp +++ b/src/memberlist.cpp @@ -767,7 +767,7 @@ void MemberList::writeSimpleDocumentation(OutputList &ol, ClassDef *cd = 0; if (container && container->definitionType()==Definition::TypeClass) { - cd = (ClassDef*)container; + cd = dynamic_cast<ClassDef*>(container); } ol.startMemberDocSimple(cd && cd->isJavaEnum()); MemberListIterator mli(*this); diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp index bc8bb47..0740512 100644 --- a/src/namespacedef.cpp +++ b/src/namespacedef.cpp @@ -30,14 +30,131 @@ #include "layout.h" #include "membergroup.h" #include "config.h" +#include "definitionimpl.h" //------------------------------------------------------------------ -NamespaceDef::NamespaceDef(const char *df,int dl,int dc, +class NamespaceDefImpl : public DefinitionImpl, public NamespaceDef +{ + public: + NamespaceDefImpl(const char *defFileName,int defLine,int defColumn, + const char *name,const char *ref=0, + const char *refFile=0,const char*type=0, + bool isPublished=false); + virtual ~NamespaceDefImpl(); + virtual DefType definitionType() const { return TypeNamespace; } + virtual QCString getOutputFileBase() const; + virtual QCString anchor() const { return QCString(); } + virtual void insertUsedFile(FileDef *fd); + virtual void writeDocumentation(OutputList &ol); + virtual void writeMemberPages(OutputList &ol); + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; + virtual void writeTagFile(FTextStream &); + virtual void insertClass(ClassDef *cd); + virtual void insertNamespace(NamespaceDef *nd); + virtual void insertMember(MemberDef *md); + virtual void computeAnchors(); + virtual int countMembers(); + virtual void addUsingDirective(NamespaceDef *nd); + virtual NamespaceSDict *getUsedNamespaces() const; + virtual void addUsingDeclaration(Definition *def); + virtual SDict<Definition> *getUsedClasses() const { return usingDeclList; } + virtual void combineUsingRelations(); + virtual QCString displayName(bool=TRUE) const; + virtual QCString localName() const; + virtual void setInline(bool isInline) { m_inline = isInline; } + virtual bool isConstantGroup() const { return CONSTANT_GROUP == m_type; } + virtual bool isModule() const { return MODULE == m_type; } + virtual bool isLibrary() const { return LIBRARY == m_type; } + virtual bool isInline() const { return m_inline; } + virtual bool isLinkableInProject() const; + virtual bool isLinkable() const; + virtual bool hasDetailedDescription() const; + virtual void addMembersToMemberGroup(); + virtual void distributeMemberGroupDocumentation(); + virtual void findSectionsInDocumentation(); + virtual void sortMemberLists(); + virtual Definition *findInnerCompound(const char *name) const; + virtual void addInnerCompound(Definition *d); + virtual void addListReferences(); + virtual void setFileName(const QCString &fn); + virtual bool subGrouping() const { return m_subGrouping; } + virtual MemberList *getMemberList(MemberListType lt) const; + virtual const QList<MemberList> &getMemberLists() const { return m_memberLists; } + virtual MemberDef *getMemberByName(const QCString &) const; + virtual MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + virtual ClassSDict *getClassSDict() const { return classSDict; } + virtual ClassSDict *getInterfaceSDict() const { return interfaceSDict; } + virtual ClassSDict *getStructSDict() const { return structSDict; } + virtual ClassSDict *getExceptionSDict() const { return exceptionSDict; } + virtual NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } + + virtual QCString title() const; + virtual QCString compoundTypeString() const; + + virtual void setMetaData(const QCString &m); + void setVisited(bool v) { m_visited = v; } + bool isVisited() const { return m_visited; } + + private: + bool m_visited; + MemberList *createMemberList(MemberListType lt); + void addMemberToList(MemberListType lt,MemberDef *md); + void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); + void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); + void writeDetailedDescription(OutputList &ol,const QCString &title); + void writeBriefDescription(OutputList &ol); + void startMemberDeclarations(OutputList &ol); + void endMemberDeclarations(OutputList &ol); + void writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d); + void writeInlineClasses(OutputList &ol); + void writeNamespaceDeclarations(OutputList &ol,const QCString &title, + bool isConstantGroup=false); + void writeMemberGroups(OutputList &ol); + void writeAuthorSection(OutputList &ol); + void startMemberDocumentation(OutputList &ol); + void endMemberDocumentation(OutputList &ol); + void writeSummaryLinks(OutputList &ol); + void addNamespaceAttributes(OutputList &ol); + void writeClassesToTagFile(FTextStream &,ClassSDict *d); + + QCString fileName; + FileList files; + + NamespaceSDict *usingDirList; + SDict<Definition> *usingDeclList; + SDict<Definition> *m_innerCompounds; + + MemberSDict *m_allMembersDict; + QList<MemberList> m_memberLists; + MemberGroupSDict *memberGroupSDict; + ClassSDict *classSDict; + ClassSDict *interfaceSDict; + ClassSDict *structSDict; + ClassSDict *exceptionSDict; + NamespaceSDict *namespaceSDict; + bool m_subGrouping; + enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; + bool m_isPublished; + QCString metaData; + bool m_inline; +}; + +NamespaceDef *createNamespaceDef(const char *defFileName,int defLine,int defColumn, + const char *name,const char *ref, + const char *refFile,const char*type, + bool isPublished) +{ + return new NamespaceDefImpl(defFileName,defLine,defColumn,name,ref,refFile,type,isPublished); +} + +//------------------------------------------------------------------ + +NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc, const char *name,const char *lref, const char *fName, const char*type, bool isPublished) : - Definition(df,dl,dc,name) + DefinitionImpl(df,dl,dc,name) ,m_isPublished(isPublished) { if (fName) @@ -67,7 +184,7 @@ NamespaceDef::NamespaceDef(const char *df,int dl,int dc, setReference(lref); memberGroupSDict = new MemberGroupSDict; memberGroupSDict->setAutoDelete(TRUE); - visited=FALSE; + m_visited=FALSE; m_subGrouping=Config_getBool(SUBGROUPING); if (type && !strcmp("module", type)) { @@ -87,7 +204,7 @@ NamespaceDef::NamespaceDef(const char *df,int dl,int dc, } } -NamespaceDef::~NamespaceDef() +NamespaceDefImpl::~NamespaceDefImpl() { delete classSDict; delete interfaceSDict; @@ -101,7 +218,7 @@ NamespaceDef::~NamespaceDef() delete m_allMembersDict; } -void NamespaceDef::setFileName(const QCString &fn) +void NamespaceDefImpl::setFileName(const QCString &fn) { if (isReference()) { @@ -113,7 +230,7 @@ void NamespaceDef::setFileName(const QCString &fn) } } -void NamespaceDef::distributeMemberGroupDocumentation() +void NamespaceDefImpl::distributeMemberGroupDocumentation() { MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; @@ -123,7 +240,7 @@ void NamespaceDef::distributeMemberGroupDocumentation() } } -void NamespaceDef::findSectionsInDocumentation() +void NamespaceDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); MemberGroupSDict::Iterator mgli(*memberGroupSDict); @@ -143,7 +260,7 @@ void NamespaceDef::findSectionsInDocumentation() } } -void NamespaceDef::insertUsedFile(FileDef *fd) +void NamespaceDefImpl::insertUsedFile(FileDef *fd) { if (fd==0) return; if (files.find(fd)==-1) @@ -155,20 +272,20 @@ void NamespaceDef::insertUsedFile(FileDef *fd) } } -void NamespaceDef::addInnerCompound(Definition *d) +void NamespaceDefImpl::addInnerCompound(Definition *d) { m_innerCompounds->append(d->localName(),d); if (d->definitionType()==Definition::TypeNamespace) { - insertNamespace((NamespaceDef *)d); + insertNamespace(dynamic_cast<NamespaceDef *>(d)); } else if (d->definitionType()==Definition::TypeClass) { - insertClass((ClassDef *)d); + insertClass(dynamic_cast<ClassDef *>(d)); } } -void NamespaceDef::insertClass(ClassDef *cd) +void NamespaceDefImpl::insertClass(ClassDef *cd) { ClassSDict *d = classSDict; @@ -201,7 +318,7 @@ void NamespaceDef::insertClass(ClassDef *cd) } } -void NamespaceDef::insertNamespace(NamespaceDef *nd) +void NamespaceDefImpl::insertNamespace(NamespaceDef *nd) { if (namespaceSDict->find(nd->name())==0) { @@ -213,7 +330,7 @@ void NamespaceDef::insertNamespace(NamespaceDef *nd) } -void NamespaceDef::addMembersToMemberGroup() +void NamespaceDefImpl::addMembersToMemberGroup() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -241,7 +358,7 @@ void NamespaceDef::addMembersToMemberGroup() } } -void NamespaceDef::insertMember(MemberDef *md) +void NamespaceDefImpl::insertMember(MemberDef *md) { if (md->isHidden()) return; MemberList *allMemberList = getMemberList(MemberListType_allMembersList); @@ -292,7 +409,7 @@ void NamespaceDef::insertMember(MemberDef *md) addMemberToList(MemberListType_docDefineMembers,md); break; default: - err("NamespaceDef::insertMembers(): " + err("NamespaceDefImpl::insertMembers(): " "member `%s' with class scope `%s' inserted in namespace scope `%s'!\n", md->name().data(), md->getClassDef() ? md->getClassDef()->name().data() : "", @@ -300,20 +417,20 @@ void NamespaceDef::insertMember(MemberDef *md) } } -void NamespaceDef::computeAnchors() +void NamespaceDefImpl::computeAnchors() { MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList) setAnchors(allMemberList); } -bool NamespaceDef::hasDetailedDescription() const +bool NamespaceDefImpl::hasDetailedDescription() const { static bool repeatBrief = Config_getBool(REPEAT_BRIEF); return ((!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty()); } -void NamespaceDef::writeTagFile(FTextStream &tagFile) +void NamespaceDefImpl::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"namespace\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; @@ -401,7 +518,7 @@ void NamespaceDef::writeTagFile(FTextStream &tagFile) tagFile << " </compound>" << endl; } -void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title) +void NamespaceDefImpl::writeDetailedDescription(OutputList &ol,const QCString &title) { if (hasDetailedDescription()) { @@ -443,7 +560,7 @@ void NamespaceDef::writeDetailedDescription(OutputList &ol,const QCString &title } } -void NamespaceDef::writeBriefDescription(OutputList &ol) +void NamespaceDefImpl::writeBriefDescription(OutputList &ol) { if (hasBriefDescription()) { @@ -501,17 +618,17 @@ void NamespaceDef::writeBriefDescription(OutputList &ol) ol.writeSynopsis(); } -void NamespaceDef::startMemberDeclarations(OutputList &ol) +void NamespaceDefImpl::startMemberDeclarations(OutputList &ol) { ol.startMemberSections(); } -void NamespaceDef::endMemberDeclarations(OutputList &ol) +void NamespaceDefImpl::endMemberDeclarations(OutputList &ol) { ol.endMemberSections(); } -void NamespaceDef::startMemberDocumentation(OutputList &ol) +void NamespaceDefImpl::startMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { @@ -520,7 +637,7 @@ void NamespaceDef::startMemberDocumentation(OutputList &ol) } } -void NamespaceDef::endMemberDocumentation(OutputList &ol) +void NamespaceDefImpl::endMemberDocumentation(OutputList &ol) { if (Config_getBool(SEPARATE_MEMBER_PAGES)) { @@ -529,23 +646,23 @@ void NamespaceDef::endMemberDocumentation(OutputList &ol) } } -void NamespaceDef::writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d) +void NamespaceDefImpl::writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d) { if (d) d->writeDeclaration(ol,0,title,TRUE); } -void NamespaceDef::writeInlineClasses(OutputList &ol) +void NamespaceDefImpl::writeInlineClasses(OutputList &ol) { if (classSDict) classSDict->writeDocumentation(ol,this); } -void NamespaceDef::writeNamespaceDeclarations(OutputList &ol,const QCString &title, +void NamespaceDefImpl::writeNamespaceDeclarations(OutputList &ol,const QCString &title, bool const isConstantGroup) { if (namespaceSDict) namespaceSDict->writeDeclaration(ol,title,isConstantGroup,TRUE); } -void NamespaceDef::writeMemberGroups(OutputList &ol) +void NamespaceDefImpl::writeMemberGroups(OutputList &ol) { /* write user defined member groups */ if (memberGroupSDict) @@ -564,7 +681,7 @@ void NamespaceDef::writeMemberGroups(OutputList &ol) } } -void NamespaceDef::writeAuthorSection(OutputList &ol) +void NamespaceDefImpl::writeAuthorSection(OutputList &ol) { // write Author section (Man only) ol.pushGeneratorState(); @@ -576,7 +693,7 @@ void NamespaceDef::writeAuthorSection(OutputList &ol) ol.popGeneratorState(); } -void NamespaceDef::writeSummaryLinks(OutputList &ol) +void NamespaceDefImpl::writeSummaryLinks(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -640,7 +757,7 @@ void NamespaceDef::writeSummaryLinks(OutputList &ol) ol.popGeneratorState(); } -void NamespaceDef::addNamespaceAttributes(OutputList &ol) +void NamespaceDefImpl::addNamespaceAttributes(OutputList &ol) { // UNO IDL constant groups may be published if (getLanguage()==SrcLangExt_IDL && isConstantGroup() && m_isPublished) @@ -654,7 +771,7 @@ void NamespaceDef::addNamespaceAttributes(OutputList &ol) } } -void NamespaceDef::writeClassesToTagFile(FTextStream &tagFile,ClassSDict *d) +void NamespaceDefImpl::writeClassesToTagFile(FTextStream &tagFile,ClassSDict *d) { SDict<ClassDef>::Iterator ci(*d); ClassDef *cd; @@ -668,7 +785,7 @@ void NamespaceDef::writeClassesToTagFile(FTextStream &tagFile,ClassSDict *d) } } -void NamespaceDef::writeDocumentation(OutputList &ol) +void NamespaceDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //static bool outputJava = Config_getBool(OPTIMIZE_OUTPUT_JAVA); @@ -838,7 +955,7 @@ void NamespaceDef::writeDocumentation(OutputList &ol) } } -void NamespaceDef::writeMemberPages(OutputList &ol) +void NamespaceDefImpl::writeMemberPages(OutputList &ol) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); @@ -855,7 +972,7 @@ void NamespaceDef::writeMemberPages(OutputList &ol) ol.popGeneratorState(); } -void NamespaceDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const +void NamespaceDefImpl::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const { static bool createSubDirs=Config_getBool(CREATE_SUBDIRS); @@ -898,7 +1015,7 @@ void NamespaceDef::writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) co ol.writeString(" </div>\n"); } -int NamespaceDef::countMembers() +int NamespaceDefImpl::countMembers() { MemberList *allMemberList = getMemberList(MemberListType_allMembersList); if (allMemberList) allMemberList->countDocMembers(); @@ -906,7 +1023,7 @@ int NamespaceDef::countMembers() classSDict->count() + interfaceSDict->count() + structSDict->count() + exceptionSDict->count(); } -void NamespaceDef::addUsingDirective(NamespaceDef *nd) +void NamespaceDefImpl::addUsingDirective(NamespaceDef *nd) { if (usingDirList==0) { @@ -916,16 +1033,16 @@ void NamespaceDef::addUsingDirective(NamespaceDef *nd) { usingDirList->append(nd->qualifiedName(),nd); } - //printf("%p: NamespaceDef::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); + //printf("%p: NamespaceDefImpl::addUsingDirective: %s:%d\n",this,name().data(),usingDirList->count()); } -NamespaceSDict *NamespaceDef::getUsedNamespaces() const +NamespaceSDict *NamespaceDefImpl::getUsedNamespaces() const { - //printf("%p: NamespaceDef::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); + //printf("%p: NamespaceDefImpl::getUsedNamespace: %s:%d\n",this,name().data(),usingDirList?usingDirList->count():0); return usingDirList; } -void NamespaceDef::addUsingDeclaration(Definition *d) +void NamespaceDefImpl::addUsingDeclaration(Definition *d) { if (usingDeclList==0) { @@ -937,12 +1054,12 @@ void NamespaceDef::addUsingDeclaration(Definition *d) } } -QCString NamespaceDef::getOutputFileBase() const +QCString NamespaceDefImpl::getOutputFileBase() const { return fileName; } -Definition *NamespaceDef::findInnerCompound(const char *n) const +Definition *NamespaceDefImpl::findInnerCompound(const char *n) const { if (n==0) return 0; Definition *d = m_innerCompounds->find(n); @@ -960,7 +1077,7 @@ Definition *NamespaceDef::findInnerCompound(const char *n) const return d; } -void NamespaceDef::addListReferences() +void NamespaceDefImpl::addListReferences() { //bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); { @@ -992,7 +1109,7 @@ void NamespaceDef::addListReferences() } } -QCString NamespaceDef::displayName(bool includeScope) const +QCString NamespaceDefImpl::displayName(bool includeScope) const { QCString result=includeScope ? name() : localName(); SrcLangExt lang = getLanguage(); @@ -1001,11 +1118,11 @@ QCString NamespaceDef::displayName(bool includeScope) const { result = substitute(result,"::",sep); } - //printf("NamespaceDef::displayName() %s->%s lang=%d\n",name().data(),result.data(),lang); + //printf("NamespaceDefImpl::displayName() %s->%s lang=%d\n",name().data(),result.data(),lang); return result; } -QCString NamespaceDef::localName() const +QCString NamespaceDefImpl::localName() const { QCString result=name(); int i=result.findRev("::"); @@ -1016,10 +1133,10 @@ QCString NamespaceDef::localName() const return result; } -void NamespaceDef::combineUsingRelations() +void NamespaceDefImpl::combineUsingRelations() { - if (visited) return; // already done - visited=TRUE; + if (m_visited) return; // already done + m_visited=TRUE; if (usingDirList) { NamespaceSDict::Iterator nli(*usingDirList); @@ -1152,7 +1269,7 @@ void NamespaceSDict::writeDeclaration(OutputList &ol,const char *title, ol.endMemberList(); } -MemberList *NamespaceDef::createMemberList(MemberListType lt) +MemberList *NamespaceDefImpl::createMemberList(MemberListType lt) { m_memberLists.setAutoDelete(TRUE); QListIterator<MemberList> mli(m_memberLists); @@ -1170,7 +1287,7 @@ MemberList *NamespaceDef::createMemberList(MemberListType lt) return ml; } -void NamespaceDef::addMemberToList(MemberListType lt,MemberDef *md) +void NamespaceDefImpl::addMemberToList(MemberListType lt,MemberDef *md) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); static bool sortMemberDocs = Config_getBool(SORT_MEMBER_DOCS); @@ -1190,7 +1307,7 @@ void NamespaceDef::addMemberToList(MemberListType lt,MemberDef *md) if (ml->listType()&MemberListType_declarationLists) md->setSectionList(this,ml); } -void NamespaceDef::sortMemberLists() +void NamespaceDefImpl::sortMemberLists() { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1220,7 +1337,7 @@ void NamespaceDef::sortMemberLists() } } -MemberList *NamespaceDef::getMemberList(MemberListType lt) const +MemberList *NamespaceDefImpl::getMemberList(MemberListType lt) const { QListIterator<MemberList> mli(m_memberLists); MemberList *ml; @@ -1234,20 +1351,20 @@ MemberList *NamespaceDef::getMemberList(MemberListType lt) const return 0; } -void NamespaceDef::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) +void NamespaceDefImpl::writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDeclarations(ol,0,this,0,0,title,0); } -void NamespaceDef::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) +void NamespaceDefImpl::writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title) { MemberList * ml = getMemberList(lt); if (ml) ml->writeDocumentation(ol,displayName(),this,title); } -bool NamespaceDef::isLinkableInProject() const +bool NamespaceDefImpl::isLinkableInProject() const { int i = name().findRev("::"); if (i==-1) i=0; else i+=2; @@ -1265,12 +1382,12 @@ bool NamespaceDef::isLinkableInProject() const !isArtificial(); // or artificial } -bool NamespaceDef::isLinkable() const +bool NamespaceDefImpl::isLinkable() const { return isLinkableInProject() || isReference(); } -MemberDef * NamespaceDef::getMemberByName(const QCString &n) const +MemberDef * NamespaceDefImpl::getMemberByName(const QCString &n) const { MemberDef *md = 0; if (m_allMembersDict && !n.isEmpty()) @@ -1281,7 +1398,7 @@ MemberDef * NamespaceDef::getMemberByName(const QCString &n) const return md; } -QCString NamespaceDef::title() const +QCString NamespaceDefImpl::title() const { SrcLangExt lang = getLanguage(); QCString pageTitle; @@ -1306,7 +1423,7 @@ QCString NamespaceDef::title() const return pageTitle; } -QCString NamespaceDef::compoundTypeString() const +QCString NamespaceDefImpl::compoundTypeString() const { SrcLangExt lang = getLanguage(); if (lang==SrcLangExt_Java) @@ -1343,7 +1460,7 @@ QCString NamespaceDef::compoundTypeString() const return ""; } -void NamespaceDef::setMetaData(const QCString &m) +void NamespaceDefImpl::setMetaData(const QCString &m) { metaData = m; } diff --git a/src/namespacedef.h b/src/namespacedef.h index 6f406d8..bfa8c42 100644 --- a/src/namespacedef.h +++ b/src/namespacedef.h @@ -26,142 +26,99 @@ class MemberList; class ClassDef; -class ClassList; class OutputList; class ClassSDict; class MemberDef; -class NamespaceList; class MemberGroupSDict; class NamespaceSDict; class FTextStream; -/** A model of a namespace symbol. */ -class NamespaceDef : public Definition +/** An abstract interface of a namespace symbol. */ +class NamespaceDef : virtual public Definition { public: - NamespaceDef(const char *defFileName,int defLine,int defColumn, - const char *name,const char *ref=0, - const char *refFile=0,const char*type=0, - bool isPublished=false); - ~NamespaceDef(); - DefType definitionType() const { return TypeNamespace; } - QCString getOutputFileBase() const; - QCString anchor() const { return QCString(); } - void insertUsedFile(FileDef *fd); - - void writeDocumentation(OutputList &ol); - void writeMemberPages(OutputList &ol); - void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const; - void writeTagFile(FTextStream &); - - void insertClass(ClassDef *cd); - void insertNamespace(NamespaceDef *nd); - void insertMember(MemberDef *md); - - void computeAnchors(); - int countMembers(); - void addUsingDirective(NamespaceDef *nd); - NamespaceSDict *getUsedNamespaces() const; - void addUsingDeclaration(Definition *def); - SDict<Definition> *getUsedClasses() const { return usingDeclList; } - void combineUsingRelations(); - QCString displayName(bool=TRUE) const; - QCString localName() const; - void setInline(bool isInline) { m_inline = isInline; } - - bool isConstantGroup() const { return CONSTANT_GROUP == m_type; } - bool isModule() const { return MODULE == m_type; } - bool isLibrary() const { return LIBRARY == m_type; } - bool isInline() const { return m_inline; } - - bool isLinkableInProject() const; - bool isLinkable() const; - bool hasDetailedDescription() const; - void addMembersToMemberGroup(); - void distributeMemberGroupDocumentation(); - void findSectionsInDocumentation(); - void sortMemberLists(); - - virtual Definition *findInnerCompound(const char *name) const; - void addInnerCompound(Definition *d); - void addListReferences(); - void setFileName(const QCString &fn); - - bool subGrouping() const { return m_subGrouping; } - - MemberList *getMemberList(MemberListType lt) const; - const QList<MemberList> &getMemberLists() const { return m_memberLists; } - MemberDef *getMemberByName(const QCString &) const; + virtual ~NamespaceDef() {} + virtual DefType definitionType() const = 0; + virtual QCString getOutputFileBase() const = 0; + virtual QCString anchor() const = 0; + virtual void insertUsedFile(FileDef *fd) = 0; + + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeMemberPages(OutputList &ol) = 0; + virtual void writeQuickMemberLinks(OutputList &ol,MemberDef *currentMd) const = 0; + virtual void writeTagFile(FTextStream &) = 0; + + virtual void insertClass(ClassDef *cd) = 0; + virtual void insertNamespace(NamespaceDef *nd) = 0; + virtual void insertMember(MemberDef *md) = 0; + + virtual void computeAnchors() = 0; + virtual int countMembers() = 0; + virtual void addUsingDirective(NamespaceDef *nd) = 0; + virtual NamespaceSDict *getUsedNamespaces() const = 0; + virtual void addUsingDeclaration(Definition *def) = 0; + virtual SDict<Definition> *getUsedClasses() const = 0; + virtual void combineUsingRelations() = 0; + virtual QCString displayName(bool=TRUE) const = 0; + virtual QCString localName() const = 0; + virtual void setInline(bool isInline) = 0; + + virtual bool isConstantGroup() const = 0; + virtual bool isModule() const = 0; + virtual bool isLibrary() const = 0; + virtual bool isInline() const = 0; + + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual bool hasDetailedDescription() const = 0; + virtual void addMembersToMemberGroup() = 0; + virtual void distributeMemberGroupDocumentation() = 0; + virtual void findSectionsInDocumentation() = 0; + virtual void sortMemberLists() = 0; + + virtual Definition *findInnerCompound(const char *name) const = 0; + virtual void addInnerCompound(Definition *d) = 0; + virtual void addListReferences() = 0; + virtual void setFileName(const QCString &fn) = 0; + + virtual bool subGrouping() const = 0; + + virtual MemberList *getMemberList(MemberListType lt) const = 0; + virtual const QList<MemberList> &getMemberLists() const = 0; + virtual MemberDef *getMemberByName(const QCString &) const = 0; /*! Returns the user defined member groups */ - MemberGroupSDict *getMemberGroupSDict() const { return memberGroupSDict; } + virtual MemberGroupSDict *getMemberGroupSDict() const = 0; /*! Returns the classes contained in this namespace */ - ClassSDict *getClassSDict() const { return classSDict; } + virtual ClassSDict *getClassSDict() const = 0; /*! Returns the Slice interfaces contained in this namespace */ - ClassSDict *getInterfaceSDict() const { return interfaceSDict; } + virtual ClassSDict *getInterfaceSDict() const = 0; /*! Returns the Slice structs contained in this namespace */ - ClassSDict *getStructSDict() const { return structSDict; } + virtual ClassSDict *getStructSDict() const = 0; /*! Returns the Slice exceptions contained in this namespace */ - ClassSDict *getExceptionSDict() const { return exceptionSDict; } + virtual ClassSDict *getExceptionSDict() const = 0; /*! Returns the namespaces contained in this namespace */ - NamespaceSDict *getNamespaceSDict() const { return namespaceSDict; } - - - QCString title() const; - QCString compoundTypeString() const; - - void setMetaData(const QCString &m); + virtual NamespaceSDict *getNamespaceSDict() const = 0; - bool visited; + virtual QCString title() const = 0; + virtual QCString compoundTypeString() const = 0; - private: - MemberList *createMemberList(MemberListType lt); - void addMemberToList(MemberListType lt,MemberDef *md); - void writeMemberDeclarations(OutputList &ol,MemberListType lt,const QCString &title); - void writeMemberDocumentation(OutputList &ol,MemberListType lt,const QCString &title); - void writeDetailedDescription(OutputList &ol,const QCString &title); - void writeBriefDescription(OutputList &ol); - void startMemberDeclarations(OutputList &ol); - void endMemberDeclarations(OutputList &ol); - void writeClassDeclarations(OutputList &ol,const QCString &title,ClassSDict *d); - void writeInlineClasses(OutputList &ol); - void writeNamespaceDeclarations(OutputList &ol,const QCString &title, - bool isConstantGroup=false); - void writeMemberGroups(OutputList &ol); - void writeAuthorSection(OutputList &ol); - void startMemberDocumentation(OutputList &ol); - void endMemberDocumentation(OutputList &ol); - void writeSummaryLinks(OutputList &ol); - void addNamespaceAttributes(OutputList &ol); - void writeClassesToTagFile(FTextStream &,ClassSDict *d); - - QCString fileName; - FileList files; - - NamespaceSDict *usingDirList; - SDict<Definition> *usingDeclList; - SDict<Definition> *m_innerCompounds; - - MemberSDict *m_allMembersDict; - QList<MemberList> m_memberLists; - MemberGroupSDict *memberGroupSDict; - ClassSDict *classSDict; - ClassSDict *interfaceSDict; - ClassSDict *structSDict; - ClassSDict *exceptionSDict; - NamespaceSDict *namespaceSDict; - bool m_subGrouping; - enum { NAMESPACE, MODULE, CONSTANT_GROUP, LIBRARY } m_type; - bool m_isPublished; - QCString metaData; - bool m_inline; + virtual void setMetaData(const QCString &m) = 0; + virtual void setVisited(bool v) = 0; + virtual bool isVisited() const = 0; }; +/** Factory method to create new NamespaceDef instance */ +NamespaceDef *createNamespaceDef(const char *defFileName,int defLine,int defColumn, + const char *name,const char *ref=0, + const char *refFile=0,const char*type=0, + bool isPublished=false); + /** A list of NamespaceDef objects. */ class NamespaceList : public QList<NamespaceDef> { diff --git a/src/pagedef.cpp b/src/pagedef.cpp index 93d5817..8272cf6 100644 --- a/src/pagedef.cpp +++ b/src/pagedef.cpp @@ -25,10 +25,64 @@ #include "language.h" #include "namespacedef.h" #include "reflist.h" +#include "definitionimpl.h" -PageDef::PageDef(const char *f,int l,const char *n, +//------------------------------------------------------------------------------------------ + +class PageDefImpl : public DefinitionImpl, public PageDef +{ + public: + PageDefImpl(const char *f,int l,const char *n,const char *d,const char *t); + virtual ~PageDefImpl(); + + virtual void setFileName(const char *name); + virtual void setLocalToc(const LocalToc &tl); + virtual void setShowLineNo(bool); + virtual DefType definitionType() const { return TypePage; } + virtual bool isLinkableInProject() const { return /*hasDocumentation() &&*/ !isReference(); } + virtual bool isLinkable() const { return isLinkableInProject() || isReference(); } + virtual QCString getOutputFileBase() const; + virtual QCString anchor() const { return QCString(); } + virtual void findSectionsInDocumentation(); + virtual QCString title() const { return m_title; } + virtual GroupDef * getGroupDef() const; + virtual PageSDict * getSubPages() const { return m_subPageDict; } + virtual void addInnerCompound(Definition *d); + virtual bool visibleInIndex() const; + virtual bool documentedPage() const; + virtual bool hasSubPages() const; + virtual bool hasParentPage() const; + virtual bool hasTitle() const; + virtual LocalToc localToc() const { return m_localToc; } + virtual void setPageScope(Definition *d){ m_pageScope = d; } + virtual Definition *getPageScope() const { return m_pageScope; } + virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionImpl::name(); } + virtual bool showLineNo() const; + virtual void writeDocumentation(OutputList &ol); + virtual void writeTagFile(FTextStream &); + virtual void setNestingLevel(int l); + virtual void writePageDocumentation(OutputList &ol); + + private: + QCString m_fileName; + QCString m_title; + PageSDict *m_subPageDict; // list of pages in the group + Definition *m_pageScope; + int m_nestingLevel; + LocalToc m_localToc; + bool m_showLineNo; +}; + +PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t) +{ + return new PageDefImpl(f,l,n,d,t); +} + +//------------------------------------------------------------------------------------------ + +PageDefImpl::PageDefImpl(const char *f,int l,const char *n, const char *d,const char *t) - : Definition(f,l,1,n), m_title(t) + : DefinitionImpl(f,l,1,n), m_title(t) { setDocumentation(d,f,l); m_subPageDict = new PageSDict(7); @@ -38,23 +92,23 @@ PageDef::PageDef(const char *f,int l,const char *n, m_showLineNo = FALSE; } -PageDef::~PageDef() +PageDefImpl::~PageDefImpl() { delete m_subPageDict; } -void PageDef::findSectionsInDocumentation() +void PageDefImpl::findSectionsInDocumentation() { docFindSections(documentation(),this,0,docFile()); } -GroupDef *PageDef::getGroupDef() const +GroupDef *PageDefImpl::getGroupDef() const { GroupList *groups = partOfGroups(); return groups!=0 ? groups->getFirst() : 0; } -QCString PageDef::getOutputFileBase() const +QCString PageDefImpl::getOutputFileBase() const { if (getGroupDef()) return getGroupDef()->getOutputFileBase(); @@ -62,16 +116,16 @@ QCString PageDef::getOutputFileBase() const return m_fileName; } -void PageDef::setFileName(const char *name) +void PageDefImpl::setFileName(const char *name) { m_fileName = name; } -void PageDef::addInnerCompound(Definition *def) +void PageDefImpl::addInnerCompound(Definition *def) { if (def->definitionType()==Definition::TypePage) { - PageDef *pd = (PageDef*)def; + PageDef *pd = dynamic_cast<PageDef*>(def); m_subPageDict->append(pd->name(),pd); def->setOuterScope(this); if (this==Doxygen::mainPage) @@ -85,13 +139,13 @@ void PageDef::addInnerCompound(Definition *def) } } -bool PageDef::hasParentPage() const +bool PageDefImpl::hasParentPage() const { return getOuterScope() && getOuterScope()->definitionType()==Definition::TypePage; } -void PageDef::writeTagFile(FTextStream &tagFile) +void PageDefImpl::writeTagFile(FTextStream &tagFile) { bool found = name()=="citelist"; QDictIterator<RefList> rli(*Doxygen::xrefLists); @@ -115,7 +169,7 @@ void PageDef::writeTagFile(FTextStream &tagFile) } } -void PageDef::writeDocumentation(OutputList &ol) +void PageDefImpl::writeDocumentation(OutputList &ol) { static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); @@ -124,7 +178,7 @@ void PageDef::writeDocumentation(OutputList &ol) pageName = escapeCharsInString(name(),FALSE,TRUE); manPageName = escapeCharsInString(name(),TRUE,TRUE); - //printf("PageDef::writeDocumentation: %s\n",getOutputFileBase().data()); + //printf("PageDefImpl::writeDocumentation: %s\n",getOutputFileBase().data()); ol.pushGeneratorState(); //1.{ @@ -232,7 +286,7 @@ void PageDef::writeDocumentation(OutputList &ol) Doxygen::indexList->addIndexItem(this,0,0,filterTitle(title())); } -void PageDef::writePageDocumentation(OutputList &ol) +void PageDefImpl::writePageDocumentation(OutputList &ol) { bool markdownEnabled = Doxygen::markdownSupport; @@ -300,7 +354,7 @@ void PageDef::writePageDocumentation(OutputList &ol) } } -bool PageDef::visibleInIndex() const +bool PageDefImpl::visibleInIndex() const { static bool externalPages = Config_getBool(EXTERNAL_PAGES); return // not part of a group @@ -310,7 +364,7 @@ bool PageDef::visibleInIndex() const ; } -bool PageDef::documentedPage() const +bool PageDefImpl::documentedPage() const { return // not part of a group !getGroupDef() && @@ -318,32 +372,32 @@ bool PageDef::documentedPage() const !isReference(); } -bool PageDef::hasSubPages() const +bool PageDefImpl::hasSubPages() const { return m_subPageDict->count()>0; } -void PageDef::setNestingLevel(int l) +void PageDefImpl::setNestingLevel(int l) { m_nestingLevel = l; } -void PageDef::setLocalToc(const LocalToc <) +void PageDefImpl::setLocalToc(const LocalToc <) { m_localToc = lt; } -void PageDef::setShowLineNo(bool b) +void PageDefImpl::setShowLineNo(bool b) { m_showLineNo = b; } -bool PageDef::showLineNo() const +bool PageDefImpl::showLineNo() const { return m_showLineNo; } -bool PageDef::hasTitle() const +bool PageDefImpl::hasTitle() const { return !m_title.isEmpty() && m_title.lower()!="notitle"; } diff --git a/src/pagedef.h b/src/pagedef.h index e958617..f0b68d1 100644 --- a/src/pagedef.h +++ b/src/pagedef.h @@ -26,63 +26,47 @@ class OutputList; class FTextStream; /** @brief A model of a page symbol. */ -class PageDef : public Definition +class PageDef : virtual public Definition { public: - PageDef(const char *f,int l,const char *n,const char *d,const char *t); - ~PageDef(); + virtual ~PageDef() {} // setters - void setFileName(const char *name); - void setLocalToc(const LocalToc &tl); - void setShowLineNo(bool); + virtual void setFileName(const char *name) = 0; + virtual void setLocalToc(const LocalToc &tl) = 0; + virtual void setShowLineNo(bool) = 0; // getters - DefType definitionType() const { return TypePage; } - bool isLinkableInProject() const - { - return /*hasDocumentation() &&*/ !isReference(); - } - bool isLinkable() const - { - return isLinkableInProject() || isReference(); - } - - // functions to get a uniform interface with Definitions - QCString getOutputFileBase() const; - QCString anchor() const { return QCString(); } - void findSectionsInDocumentation(); - QCString title() const { return m_title; } - GroupDef * getGroupDef() const; - PageSDict * getSubPages() const { return m_subPageDict; } - void addInnerCompound(Definition *d); - bool visibleInIndex() const; - bool documentedPage() const; - bool hasSubPages() const; - bool hasParentPage() const; - bool hasTitle() const; - LocalToc localToc() const { return m_localToc; } - void setPageScope(Definition *d){ m_pageScope = d; } - Definition *getPageScope() const { return m_pageScope; } - QCString displayName(bool=TRUE) const - { return hasTitle() ? m_title : Definition::name(); } - bool showLineNo() const; + virtual DefType definitionType() const = 0; + virtual bool isLinkableInProject() const = 0; + virtual bool isLinkable() const = 0; + virtual QCString getOutputFileBase() const = 0; + virtual QCString anchor() const = 0; + virtual void findSectionsInDocumentation() = 0; + virtual QCString title() const = 0; + virtual GroupDef * getGroupDef() const = 0; + virtual PageSDict * getSubPages() const = 0; + virtual void addInnerCompound(Definition *d) = 0; + virtual bool visibleInIndex() const = 0; + virtual bool documentedPage() const = 0; + virtual bool hasSubPages() const = 0; + virtual bool hasParentPage() const = 0; + virtual bool hasTitle() const = 0; + virtual LocalToc localToc() const = 0; + virtual void setPageScope(Definition *d) = 0; + virtual Definition *getPageScope() const = 0; + virtual QCString displayName(bool=TRUE) const = 0; + virtual bool showLineNo() const = 0; - void writeDocumentation(OutputList &ol); - void writeTagFile(FTextStream &); + virtual void writeDocumentation(OutputList &ol) = 0; + virtual void writeTagFile(FTextStream &) = 0; + virtual void setNestingLevel(int l) = 0; + virtual void writePageDocumentation(OutputList &ol) = 0; - private: - void setNestingLevel(int l); - void writePageDocumentation(OutputList &ol); - QCString m_fileName; - QCString m_title; - PageSDict *m_subPageDict; // list of pages in the group - Definition *m_pageScope; - int m_nestingLevel; - LocalToc m_localToc; - bool m_showLineNo; }; +PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t); + class PageSDict : public SDict<PageDef> { public: @@ -1402,7 +1402,7 @@ void addDefine() //printf("addDefine %s %s\n",g_defName.data(),g_defArgsStr.data()); //ArgumentList *al = new ArgumentList; //stringToArgumentList(g_defArgsStr,al); - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( g_yyFileName,g_yyLineNr-g_yyMLines,g_yyColNr, "#define",g_defName,g_defArgsStr,0, Public,Normal,FALSE,Member,MemberType_Define,0,0,""); diff --git a/src/pycode.l b/src/pycode.l index 8f2279e..4fb27f1 100644 --- a/src/pycode.l +++ b/src/pycode.l @@ -786,13 +786,13 @@ static bool findMemberLink(CodeOutputInterface &ol,Definition *sym,const char *s sym->getOuterScope()->definitionType()==Definition::TypeClass && g_currentDefinition->definitionType()==Definition::TypeClass) { - ClassDef *cd = (ClassDef*)sym->getOuterScope(); - ClassDef *thisCd = (ClassDef *)g_currentDefinition; + ClassDef *cd = dynamic_cast<ClassDef*>(sym->getOuterScope()); + ClassDef *thisCd = dynamic_cast<ClassDef *>(g_currentDefinition); if (sym->definitionType()==Definition::TypeMember) { if (g_currentMemberDef && g_collectXRefs) { - addDocCrossReference(g_currentMemberDef,(MemberDef*)sym); + addDocCrossReference(g_currentMemberDef,dynamic_cast<MemberDef*>(sym)); } } DBG_CTX((stderr,"cd=%s thisCd=%s\n",cd?cd->name().data():"<none>",thisCd?thisCd->name().data():"<none>")); @@ -1086,7 +1086,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBUT // Push a class scope - ClassDef *classDefToAdd = new ClassDef("<code>",1,1,g_curClassName,ClassDef::Class,0,0,FALSE); + ClassDef *classDefToAdd = createClassDef("<code>",1,1,g_curClassName,ClassDef::Class,0,0,FALSE); g_codeClassSDict.append(g_curClassName,classDefToAdd); char *s=g_curClassBases.first(); while (s) @@ -1594,7 +1594,7 @@ void parsePythonCode(CodeOutputInterface &od,const char * /*className*/, if (exBlock && fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",(exName?exName:"generated")); + g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } if (g_sourceFileDef) diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp index f44da77..afe6dee 100644 --- a/src/rtfdocvisitor.cpp +++ b/src/rtfdocvisitor.cpp @@ -429,20 +429,21 @@ void RTFDocVisitor::visit(DocInclude *inc) m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile(), - &fd, // fileDef, + fd, // fileDef, -1, // start line -1, // end line FALSE, // inline fragment 0, // memberDef TRUE // show line numbers ); + delete fd; m_t << "\\par"; m_t << "}" << endl; } @@ -496,7 +497,7 @@ void RTFDocVisitor::visit(DocInclude *inc) case DocInclude::SnipWithLines: { QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); m_t << "{" << endl; if (!m_lastIsPara) m_t << "\\par" << endl; m_t << rtf_Style_Reset << getStyle("CodeExample"); @@ -507,13 +508,14 @@ void RTFDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment 0, // memberDef TRUE // show line number ); + delete fd; m_t << "}"; } break; diff --git a/src/searchindex.cpp b/src/searchindex.cpp index 52378cd..cfa8ed2 100644 --- a/src/searchindex.cpp +++ b/src/searchindex.cpp @@ -91,7 +91,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource if (ctx==0) return; assert(!isSourceFile || ctx->definitionType()==Definition::TypeFile); //printf("SearchIndex::setCurrentDoc(%s,%s,%s)\n",name,baseName,anchor); - QCString url=isSourceFile ? ((FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase(); + QCString url=isSourceFile ? (dynamic_cast<FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); url+=Config_getString(HTML_FILE_EXTENSION); QCString baseUrl = url; if (anchor) url+=QCString("#")+anchor; @@ -99,7 +99,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource QCString name=ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) { - MemberDef *md = (MemberDef *)ctx; + MemberDef *md = dynamic_cast<MemberDef *>(ctx); name.prepend((md->getLanguage()==SrcLangExt_Fortran ? theTranslator->trSubprogram(TRUE,TRUE) : theTranslator->trMember(TRUE,TRUE))+" "); @@ -116,7 +116,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource { case Definition::TypePage: { - PageDef *pd = (PageDef *)ctx; + PageDef *pd = dynamic_cast<PageDef *>(ctx); if (pd->hasTitle()) { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); @@ -129,7 +129,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource break; case Definition::TypeClass: { - ClassDef *cd = (ClassDef *)ctx; + ClassDef *cd = dynamic_cast<ClassDef *>(ctx); name.prepend(cd->compoundTypeString()+" "); } break; @@ -151,7 +151,7 @@ void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSource break; case Definition::TypeGroup: { - GroupDef *gd = (GroupDef *)ctx; + GroupDef *gd = dynamic_cast<GroupDef *>(ctx); if (gd->groupTitle()) { name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle(); @@ -446,7 +446,7 @@ static QCString definitionToName(Definition *ctx) { if (ctx && ctx->definitionType()==Definition::TypeMember) { - MemberDef *md = (MemberDef*)ctx; + MemberDef *md = dynamic_cast<MemberDef*>(ctx); if (md->isFunction()) return "function"; else if (md->isSlot()) @@ -477,7 +477,7 @@ static QCString definitionToName(Definition *ctx) switch(ctx->definitionType()) { case Definition::TypeClass: - return ((ClassDef*)ctx)->compoundTypeString(); + return (dynamic_cast<ClassDef*>(ctx))->compoundTypeString(); case Definition::TypeFile: return "file"; case Definition::TypeNamespace: @@ -500,7 +500,7 @@ static QCString definitionToName(Definition *ctx) void SearchIndexExternal::setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile) { QCString extId = stripPath(Config_getString(EXTERNAL_SEARCH_ID)); - QCString baseName = isSourceFile ? ((FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase(); + QCString baseName = isSourceFile ? (dynamic_cast<FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase(); QCString url = baseName + Doxygen::htmlFileExtension; if (anchor) url+=QCString("#")+anchor; QCString key = extId+";"+url; @@ -514,7 +514,7 @@ void SearchIndexExternal::setCurrentDoc(Definition *ctx,const char *anchor,bool e->name = ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) { - e->args = ((MemberDef*)ctx)->argsString(); + e->args = (dynamic_cast<MemberDef*>(ctx))->argsString(); } e->extId = extId; e->url = url; @@ -1047,9 +1047,7 @@ void writeJavascriptSearchIndex() if (dl->count()==1) // item with a unique name { - MemberDef *md = 0; - bool isMemberDef = d->definitionType()==Definition::TypeMember; - if (isMemberDef) md = (MemberDef*)d; + MemberDef *md = dynamic_cast<MemberDef*>(d); QCString anchor = d->anchor(); ti << "'" << externalRef("../",d->getReference(),TRUE) @@ -1101,9 +1099,7 @@ void writeJavascriptSearchIndex() Definition *scope = d->getOuterScope(); Definition *next = di.current(); Definition *nextScope = 0; - MemberDef *md = 0; - bool isMemberDef = d->definitionType()==Definition::TypeMember; - if (isMemberDef) md = (MemberDef*)d; + MemberDef *md = dynamic_cast<MemberDef*>(d); if (next) nextScope = next->getOuterScope(); QCString anchor = d->anchor(); @@ -1147,12 +1143,12 @@ void writeJavascriptSearchIndex() QCString name; if (d->definitionType()==Definition::TypeClass) { - name = convertToXML(((ClassDef*)d)->displayName()); + name = convertToXML((dynamic_cast<ClassDef*>(d))->displayName()); found = TRUE; } else if (d->definitionType()==Definition::TypeNamespace) { - name = convertToXML(((NamespaceDef*)d)->displayName()); + name = convertToXML((dynamic_cast<NamespaceDef*>(d))->displayName()); found = TRUE; } else if (scope==0 || scope==Doxygen::globalScope) // in global scope @@ -1327,11 +1323,11 @@ void SearchIndexList::append(Definition *d) { if (d->definitionType()==Definition::TypeGroup) { - dispName = ((GroupDef*)d)->groupTitle(); + dispName = (dynamic_cast<GroupDef*>(d))->groupTitle(); } else if (d->definitionType()==Definition::TypePage) { - dispName = ((PageDef*)d)->title(); + dispName = (dynamic_cast<PageDef*>(d))->title(); } l=new SearchDefinitionList(searchId(dispName),dispName); SDict< SearchDefinitionList >::append(dispName,l); diff --git a/src/sqlcode.l b/src/sqlcode.l index cbc6c3a..5e45083 100644 --- a/src/sqlcode.l +++ b/src/sqlcode.l @@ -381,7 +381,7 @@ void parseSqlCode( if (exBlock && fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",(exName?exName:"generated")); + g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } diff --git a/src/tagreader.cpp b/src/tagreader.cpp index 45543de..da2f3f1 100644 --- a/src/tagreader.cpp +++ b/src/tagreader.cpp @@ -1393,8 +1393,8 @@ void TagFileParser::buildLists(Entry *root) QCString fullName = m_tagName+":"+tfi->path+stripPath(tfi->name); fe->fileName = fullName; - //printf("new FileDef() filename=%s\n",tfi->filename.data()); - FileDef *fd = new FileDef(m_tagName+":"+tfi->path, + //printf("createFileDef() filename=%s\n",tfi->filename.data()); + FileDef *fd = createFileDef(m_tagName+":"+tfi->path, tfi->name,m_tagName, tfi->filename ); diff --git a/src/tooltip.cpp b/src/tooltip.cpp index 91da583..2c6f6e1 100644 --- a/src/tooltip.cpp +++ b/src/tooltip.cpp @@ -114,7 +114,7 @@ void TooltipManager::writeTooltips(CodeOutputInterface &ol) QCString decl; if (d->definitionType()==Definition::TypeMember) { - MemberDef *md = (MemberDef*)d; + MemberDef *md = dynamic_cast<MemberDef*>(d); decl = md->declaration(); if (!decl.isEmpty() && decl.at(0)=='@') // hide enum values { diff --git a/src/util.cpp b/src/util.cpp index b99753e..4a2f4fe 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -689,7 +689,7 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co if (d->definitionType()==Definition::TypeMember) { // that are also typedefs - MemberDef *md = (MemberDef *)d; + MemberDef *md = dynamic_cast<MemberDef *>(d); if (md->isTypedef()) // d is a typedef { // test accessibility of typedef within scope. @@ -708,7 +708,7 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co { Definition *d = (Definition*)di; // that are also typedefs - MemberDef *md = (MemberDef *)di; + MemberDef *md = dynamic_cast<MemberDef *>(di); if (md->isTypedef()) // d is a typedef { // test accessibility of typedef within scope. @@ -786,12 +786,12 @@ static const Definition *followPath(const Definition *start,const FileDef *fileS if (current->definitionType()==Definition::TypeNamespace) { next = endOfPathIsUsedClass( - ((NamespaceDef *)current)->getUsedClasses(),qualScopePart); + (dynamic_cast<const NamespaceDef *>(current))->getUsedClasses(),qualScopePart); } else if (current->definitionType()==Definition::TypeFile) { next = endOfPathIsUsedClass( - ((FileDef *)current)->getUsedClasses(),qualScopePart); + (dynamic_cast<const FileDef *>(current))->getUsedClasses(),qualScopePart); } current = next; if (current==0) break; @@ -968,13 +968,13 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi (item->definitionType()==Definition::TypeMember && // a member itemScope && itemScope->definitionType()==Definition::TypeClass && // of a class scope->definitionType()==Definition::TypeClass && // accessible - ((ClassDef*)scope)->isAccessibleMember((MemberDef *)item) // from scope + (dynamic_cast<const ClassDef*>(scope))->isAccessibleMember(dynamic_cast<const MemberDef *>(item)) // from scope ); bool nestedClassInsideBaseClass = (item->definitionType()==Definition::TypeClass && // a nested class itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base scope->definitionType()==Definition::TypeClass && // class of scope - ((ClassDef*)scope)->isBaseClass((ClassDef*)itemScope,TRUE) + (dynamic_cast<const ClassDef*>(scope))->isBaseClass(dynamic_cast<ClassDef*>(itemScope),TRUE) ); if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass) @@ -1009,7 +1009,7 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi // check if scope is a namespace, which is using other classes and namespaces if (scope->definitionType()==Definition::TypeNamespace) { - NamespaceDef *nscope = (NamespaceDef*)scope; + const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope); //printf(" %s is namespace with %d used classes\n",nscope->name().data(),nscope->getUsedClasses()); SDict<Definition> *cl = nscope->getUsedClasses(); if (accessibleViaUsingClass(cl,fileScope,item)) @@ -1089,7 +1089,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop else if (itemScope && newScope && itemScope->definitionType()==Definition::TypeClass && newScope->definitionType()==Definition::TypeClass && - ((ClassDef*)newScope)->isBaseClass((ClassDef*)itemScope,TRUE,0) + (dynamic_cast<const ClassDef*>(newScope))->isBaseClass(dynamic_cast<const ClassDef*>(itemScope),TRUE,0) ) { // inheritance is also ok. Example: looking for B::I, where @@ -1114,7 +1114,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop // A::B::C but is explicit referenced as A::C, where B is imported // in A via a using directive. //printf("newScope is a namespace: %s!\n",newScope->name().data()); - NamespaceDef *nscope = (NamespaceDef*)newScope; + const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(newScope); SDict<Definition> *cl = nscope->getUsedClasses(); if (cl) { @@ -1165,7 +1165,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop //printf(" failed to resolve: scope=%s\n",scope->name().data()); if (scope->definitionType()==Definition::TypeNamespace) { - NamespaceDef *nscope = (NamespaceDef*)scope; + const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope); NamespaceSDict *nl = nscope->getUsedNamespaces(); if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart)) { @@ -1227,7 +1227,7 @@ static void getResolvedSymbol(const Definition *scope, // only look at classes and members that are enums or typedefs if (d->definitionType()==Definition::TypeClass || (d->definitionType()==Definition::TypeMember && - (((MemberDef*)d)->isTypedef() || ((MemberDef*)d)->isEnumerate()) + ((dynamic_cast<MemberDef*>(d))->isTypedef() || (dynamic_cast<MemberDef*>(d))->isEnumerate()) ) ) { @@ -1240,7 +1240,7 @@ static void getResolvedSymbol(const Definition *scope, // see if we are dealing with a class or a typedef if (d->definitionType()==Definition::TypeClass) // d is a class { - ClassDef *cd = (ClassDef *)d; + ClassDef *cd = dynamic_cast<ClassDef *>(d); //printf("cd=%s\n",cd->name().data()); if (!cd->isTemplateArgument()) // skip classes that // are only there to @@ -1285,7 +1285,7 @@ static void getResolvedSymbol(const Definition *scope, } else if (d->definitionType()==Definition::TypeMember) { - MemberDef *md = (MemberDef *)d; + MemberDef *md = dynamic_cast<MemberDef *>(d); //printf(" member isTypedef()=%d\n",md->isTypedef()); if (md->isTypedef()) // d is a typedef { @@ -5002,7 +5002,7 @@ bool generateLink(OutputDocInterface &od,const char *clName, compound->definitionType()==Definition::TypeGroup /* is group */ ) { - linkText=((GroupDef *)compound)->groupTitle(); // use group's title as link + linkText=(dynamic_cast<GroupDef *>(compound))->groupTitle(); // use group's title as link } else if (compound->definitionType()==Definition::TypeFile) { @@ -5374,7 +5374,7 @@ static void initBaseClassHierarchy(BaseClassList *bcl) { initBaseClassHierarchy(cd->baseClasses()); } - cd->visited=FALSE; + cd->setVisited(FALSE); } } //---------------------------------------------------------------------------- @@ -5414,7 +5414,7 @@ void initClassHierarchy(ClassSDict *cl) ClassDef *cd; for ( ; (cd=cli.current()); ++cli) { - cd->visited=FALSE; + cd->setVisited(FALSE); initBaseClassHierarchy(cd->baseClasses()); } } @@ -6683,7 +6683,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle, baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length()); QCString title=ptitle.stripWhiteSpace(); - pd=new PageDef(fileName,startLine,baseName,doc,title); + pd=createPageDef(fileName,startLine,baseName,doc,title); pd->setRefItems(sli); pd->setLanguage(lang); @@ -7480,7 +7480,7 @@ MemberDef *getMemberFromSymbol(Definition *scope,FileDef *fileScope, if (distance!=-1 && distance<minDistance) { minDistance = distance; - bestMatch = (MemberDef *)d; + bestMatch = dynamic_cast<MemberDef *>(d); //printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance); } } @@ -7495,7 +7495,7 @@ MemberDef *getMemberFromSymbol(Definition *scope,FileDef *fileScope, if (distance!=-1 && distance<minDistance) { minDistance = distance; - bestMatch = (MemberDef *)d; + bestMatch = dynamic_cast<MemberDef *>(d); //printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance); } } diff --git a/src/vhdlcode.l b/src/vhdlcode.l index 18ae755..9e296cc 100644 --- a/src/vhdlcode.l +++ b/src/vhdlcode.l @@ -544,7 +544,7 @@ static void generateClassOrGlobalLink(CodeOutputInterface &ol,const char *clName Definition *d = cd->getOuterScope(); if (d && d->definitionType()==Definition::TypeClass) { - cd = (ClassDef*)d; + cd = dynamic_cast<ClassDef*>(d); } else { @@ -1582,7 +1582,7 @@ void parseVhdlCode(CodeOutputInterface &od,const char *className,const QCString if (exBlock && fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",exName); + g_sourceFileDef = createFileDef("",exName); cleanupSourceDef = TRUE; } if (g_sourceFileDef) diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp index 808b32b..e70f099 100644 --- a/src/vhdldocgen.cpp +++ b/src/vhdldocgen.cpp @@ -1798,7 +1798,7 @@ static void setGlobalType(MemberList *ml) /* writes a vhdl type documentation */ bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol) { - ClassDef *cd=(ClassDef*)d; + const ClassDef *cd=dynamic_cast<const ClassDef*>(d); bool hasParams = FALSE; if (cd==0) return hasParams; @@ -2984,7 +2984,7 @@ static void addInstance(ClassDef* classEntity, ClassDef* ar, ferr: QCString uu=cur->name; - MemberDef *md=new MemberDef( + MemberDef *md=createMemberDef( ar->getDefFileName(), cur->startLine,cur->startColumn, n1,uu,uu, 0, Public, Normal, cur->stat,Member, diff --git a/src/xmlcode.l b/src/xmlcode.l index c6e01e8..c9529d6 100644 --- a/src/xmlcode.l +++ b/src/xmlcode.l @@ -365,7 +365,7 @@ void parseXmlCode( if (exBlock && fd==0) { // create a dummy filedef for the example - g_sourceFileDef = new FileDef("",(exName?exName:"generated")); + g_sourceFileDef = createFileDef("",(exName?exName:"generated")); cleanupSourceDef = TRUE; } diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 01e0a6d..f85a16e 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -299,20 +299,21 @@ void XmlDocVisitor::visit(DocInclude *inc) { m_t << "<programlisting filename=\"" << inc->file() << "\">"; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci,inc->context(), inc->text(), langExt, inc->isExample(), inc->exampleFile(), - &fd, // fileDef, + fd, // fileDef, -1, // start line -1, // end line FALSE, // inline fragment 0, // memberDef TRUE // show line numbers ); + delete fd; m_t << "</programlisting>"; } break; @@ -373,7 +374,7 @@ void XmlDocVisitor::visit(DocInclude *inc) { m_t << "<programlisting filename=\"" << inc->file() << "\">"; QFileInfo cfi( inc->file() ); - FileDef fd( cfi.dirPath().utf8(), cfi.fileName().utf8() ); + FileDef *fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() ); Doxygen::parserManager->getParser(inc->extension()) ->parseCode(m_ci, inc->context(), @@ -381,13 +382,14 @@ void XmlDocVisitor::visit(DocInclude *inc) langExt, inc->isExample(), inc->exampleFile(), - &fd, + fd, lineBlock(inc->text(),inc->blockId()), -1, // endLine FALSE, // inlineFragment 0, // memberDef TRUE // show line number ); + delete fd; m_t << "</programlisting>"; } break; |