diff options
Diffstat (limited to 'src/memberdef.cpp')
-rw-r--r-- | src/memberdef.cpp | 205 |
1 files changed, 103 insertions, 102 deletions
diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 28c0abb..e03d1df 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -262,7 +262,7 @@ class MemberDefImpl : public DefinitionImpl, public MemberDef virtual void makeRelated(); virtual void makeForeign(); virtual void setInheritsDocsFrom(MemberDef *md); - virtual void setTagInfo(TagInfo *i); + virtual void setTagInfo(const TagInfo *i); virtual void setArgsString(const char *as); virtual void setReimplements(MemberDef *md); virtual void insertReimplementedBy(MemberDef *md); @@ -774,7 +774,7 @@ class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef virtual void makeRelated() {} virtual void makeForeign() {} virtual void setInheritsDocsFrom(MemberDef *md) {} - virtual void setTagInfo(TagInfo *i) {} + virtual void setTagInfo(const TagInfo *i) {} virtual void setArgsString(const char *as) {} virtual void setReimplements(MemberDef *md) {} virtual void insertReimplementedBy(MemberDef *md) {} @@ -1300,32 +1300,32 @@ class MemberDefImpl::IMPL const ArgumentList &al,const char *meta ); - ClassDef *classDef; // member of or related to - FileDef *fileDef; // member of file definition - NamespaceDef *nspace; // the namespace this member is in. + ClassDef *classDef = 0; // member of or related to + FileDef *fileDef = 0; // member of file definition + NamespaceDef *nspace = 0; // the namespace this member is in. - MemberDef *enumScope; // the enclosing scope, if this is an enum field - bool livesInsideEnum; - const MemberDef *annEnumType; // the anonymous enum that is the type of this member - MemberList *enumFields; // enumeration fields + MemberDef *enumScope = 0; // the enclosing scope, if this is an enum field + bool livesInsideEnum = false; + const MemberDef *annEnumType = 0; // the anonymous enum that is the type of this member + MemberList *enumFields = 0; // enumeration fields - MemberDef *redefines; // the members that this member redefines - MemberList *redefinedBy; // the list of members that redefine this one + MemberDef *redefines = 0; // the members that this member redefines + MemberList *redefinedBy = 0; // the list of members that redefine this one - MemberDef *memDef; // member definition for this declaration - MemberDef *memDec; // member declaration for this definition - ClassDef *relatedAlso; // points to class marked by relatedAlso + MemberDef *memDef = 0; // member definition for this declaration + MemberDef *memDec = 0; // member declaration for this definition + ClassDef *relatedAlso = 0; // points to class marked by relatedAlso - ExampleSDict *exampleSDict; // a dictionary of all examples for quick access + ExampleSDict *exampleSDict = 0; // a dictionary of all examples for quick access QCString type; // return actual type QCString accessorType; // return type that tell how to get to this member - ClassDef *accessorClass; // class that this member accesses (for anonymous types) + ClassDef *accessorClass = 0; // class that this member accesses (for anonymous types) QCString args; // function arguments/variable array specifiers QCString def; // member definition in code (fully qualified name) QCString anc; // HTML anchor name - Specifier virt; // normal/virtual/pure virtual - Protection prot; // protection type [Public/Protected/Private] + Specifier virt = Normal; // normal/virtual/pure virtual + Protection prot = Public; // protection type [Public/Protected/Private] QCString decl; // member declaration in class QCString bitfields; // struct member bitfields @@ -1335,13 +1335,13 @@ class MemberDefImpl::IMPL QCString initializer; // initializer QCString extraTypeChars; // extra type info found after the argument list QCString enumBaseType; // base type of the enum (C++11) - int initLines; // number of lines in the initializer + int initLines = 0; // number of lines in the initializer - uint64 memSpec; // The specifiers present for this member - MemberType mtype; // returns the kind of member - int maxInitLines; // when the initializer will be displayed - int userInitLines; // result of explicit \hideinitializer or \showinitializer - MemberDef *annMemb; + uint64 memSpec = 0; // The specifiers present for this member + MemberType mtype = MemberType_Define; // returns the kind of member + int maxInitLines = 0; // when the initializer will be displayed + int userInitLines = 0; // result of explicit \hideinitializer or \showinitializer + MemberDef *annMemb = 0; ArgumentList defArgList; // argument list of this member definition ArgumentList declArgList; // argument list of this member declaration @@ -1358,19 +1358,19 @@ class MemberDefImpl::IMPL // as its type then this is computed by // getClassDefOfAnonymousType() and // cached here. - SDict<MemberList> *classSectionSDict; // not accessible + SDict<MemberList> *classSectionSDict = 0; // not accessible - const MemberDef *groupAlias; // Member containing the definition - int grpId; // group id - MemberGroup *memberGroup; // group's member definition - GroupDef *group; // group in which this member is in + const MemberDef *groupAlias = 0; // Member containing the definition + int grpId = 0; // group id + MemberGroup *memberGroup = 0; // group's member definition + GroupDef *group = 0; // group in which this member is in Grouping::GroupPri_t grouppri; // priority of this definition QCString groupFileName; // file where this grouping was defined - int groupStartLine; // line " " " " " - MemberDef *groupMember; + int groupStartLine = 0; // line " " " " " + MemberDef *groupMember = 0; - bool isTypedefValCached; - const ClassDef *cachedTypedefValue; + bool isTypedefValCached = false; + const ClassDef *cachedTypedefValue = 0; QCString cachedTypedefTemplSpec; QCString cachedResolvedType; @@ -1380,41 +1380,41 @@ class MemberDefImpl::IMPL //QCString inbodyDocs; // documentation inheritance - MemberDef *docProvider; + MemberDef *docProvider = 0; // to store the output file base from tag files QCString explicitOutputFileBase; // objective-c - bool implOnly; // function found in implementation but not - // in the interface - mutable bool hasDocumentedParams; - mutable bool hasDocumentedReturnType; - bool isDMember; - Relationship related; // relationship of this to the class - bool stat; // is it a static function? - bool proto; // is it a prototype; - bool docEnumValues; // is an enum with documented enum values. - - mutable bool annScope; // member is part of an anonymous scope - mutable bool annUsed; // ugly: needs to be mutable to allow setAnonymousUsed to act as a - // const member. - bool hasCallGraph; - bool hasCallerGraph; - bool hasReferencedByRelation; - bool hasReferencesRelation; - bool explExt; // member was explicitly declared external - bool tspec; // member is a template specialization - bool groupHasDocs; // true if the entry that caused the grouping was documented - bool docsForDefinition; // TRUE => documentation block is put before - // definition. - // FALSE => block is put before declaration. - ClassDef *category; - MemberDef *categoryRelation; + bool implOnly = false; // function found in implementation but not + // in the interface + mutable bool hasDocumentedParams = false; + mutable bool hasDocumentedReturnType = false; + bool isDMember = false; + Relationship related = Member; // relationship of this to the class + bool stat = false; // is it a static function? + bool proto = false; // is it a prototype? + bool docEnumValues = false; // is an enum with documented enum values. + + mutable bool annScope = false; // member is part of an anonymous scope + mutable bool annUsed = false; // ugly: needs to be mutable to allow setAnonymousUsed to act as a + // const member. + bool hasCallGraph = false; + bool hasCallerGraph = false; + bool hasReferencedByRelation = false; + bool hasReferencesRelation = false; + bool explExt = false; // member was explicitly declared external + bool tspec = false; // member is a template specialization + bool groupHasDocs = false; // true if the entry that caused the grouping was documented + bool docsForDefinition = false; // TRUE => documentation block is put before + // definition. + // FALSE => block is put before declaration. + ClassDef *category = 0; + MemberDef *categoryRelation = 0; QCString declFileName; - int declLine; - int declColumn; - int numberOfFlowKW; + int declLine = 0; + int declColumn = 0; + int numberOfFlowKW = 0; }; MemberDefImpl::IMPL::IMPL() : @@ -1503,7 +1503,7 @@ void MemberDefImpl::IMPL::init(Definition *def, // convert function declaration arguments (if any) if (!args.isEmpty()) { - stringToArgumentList(args,declArgList,&extraTypeChars); + stringToArgumentList(def->getLanguage(),args,declArgList,&extraTypeChars); //printf("setDeclArgList %s to %s const=%d\n",args.data(), // argListToString(declArgList).data(),declArgList->constSpecifier); } @@ -1771,7 +1771,7 @@ QCString MemberDefImpl::getOutputFileBase() const return baseName; } } - else if (nspace && nspace->isLinkableInProject()) + else if (nspace) { baseName=nspace->getOutputFileBase(); } @@ -1877,7 +1877,7 @@ void MemberDefImpl::_computeLinkableInProject() m_isLinkableCached = templateMaster()->isLinkableInProject() ? 2 : 1; return; } - if (name().isEmpty() || name().at(0)=='@') + if (isAnonymous()) { //printf("name invalid\n"); m_isLinkableCached = 1; // not a valid or a dummy name @@ -2145,11 +2145,11 @@ bool MemberDefImpl::isBriefSectionVisible() const // Hide friend (class|struct|union) declarations if HIDE_FRIEND_COMPOUNDS is true bool visibleIfFriendCompound = !(hideFriendCompounds && - isFriend() && + isFriend() /*&& (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union" - ) + )*/ ); // only include members that are non-private unless EXTRACT_PRIVATE is @@ -2181,7 +2181,7 @@ bool MemberDefImpl::isBriefSectionVisible() const //printf("visibleIfStatic=%d visibleIfDocumented=%d visibleIfEnabled=%d " - // "visibleIfPrivate=%d visibltIfNotDefaultCDTor=%d " + // "visibleIfPrivate=%d visibleIfNotDefaultCDTor=%d " // "visibleIfFriendCompound=%d !annScope=%d\n", // visibleIfStatic,visibleIfDocumented, // visibleIfEnabled,visibleIfPrivate,visibleIfNotDefaultCDTor, @@ -2257,10 +2257,10 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, ol.startMemberDeclaration(); // start a new member declaration - bool isAnonymous = annoClassDef || m_impl->annMemb || m_impl->annEnumType; + bool isAnonType = annoClassDef || m_impl->annMemb || m_impl->annEnumType; ///printf("startMemberItem for %s\n",name().data()); ol.startMemberItem(anchor(), - isAnonymous ? 1 : !m_impl->tArgList.empty() ? 3 : 0, + isAnonType ? 1 : !m_impl->tArgList.empty() ? 3 : 0, inheritId ); @@ -2301,9 +2301,9 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, // *** write template lists if (m_impl->tArgList.hasParameters() && getLanguage()==SrcLangExt_Cpp) { - if (!isAnonymous) ol.startMemberTemplateParams(); + if (!isAnonType) ol.startMemberTemplateParams(); writeTemplatePrefix(ol,m_impl->tArgList); - if (!isAnonymous) ol.endMemberTemplateParams(anchor(),inheritId); + if (!isAnonType) ol.endMemberTemplateParams(anchor(),inheritId); } // *** write type @@ -2343,7 +2343,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, QCString varName=ltype.right(ltype.length()-ir).stripWhiteSpace(); //printf(">>>>>> ltype='%s' varName='%s'\n",ltype.data(),varName.data()); ol.docify("}"); - if (varName.isEmpty() && (name().isEmpty() || name().at(0)=='@')) + if (varName.isEmpty() && isAnonymous()) { ol.docify(";"); } @@ -2425,13 +2425,13 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } // *** write name - if (!name().isEmpty() && name().at(0)!='@') // hide anonymous stuff + if (!isAnonymous()) // hide anonymous stuff { static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE); static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL); static bool extractStatic = Config_getBool(EXTRACT_STATIC); //printf("Member name=`%s gd=%p md->groupDef=%p inGroup=%d isLinkable()=%d hasDocumentation=%d\n",name().data(),gd,getGroupDef(),inGroup,isLinkable(),hasDocumentation()); - if (!(name().isEmpty() || name().at(0)=='@') && // name valid + if (!name().isEmpty() && // name valid (hasDocumentation() || isReference()) && // has docs !(m_impl->prot==Private && !extractPrivate && (m_impl->virt==Normal || !extractPrivateVirtual) && m_impl->mtype!=MemberType_Friend) && // hidden due to protection !(isStatic() && getClassDef()==0 && !extractStatic) // hidden due to static-ness @@ -2479,7 +2479,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol, } // add to index - if (isEnumerate() && name().at(0)=='@') + if (isEnumerate() && isAnonymous()) { // don't add to index } @@ -2719,11 +2719,11 @@ bool MemberDefImpl::isDetailedSectionLinkable() const // hide friend (class|struct|union) member if HIDE_FRIEND_COMPOUNDS // is true bool friendCompoundFilter = !(Config_getBool(HIDE_FRIEND_COMPOUNDS) && - isFriend() && + isFriend() /*&& (m_impl->type=="friend class" || m_impl->type=="friend struct" || m_impl->type=="friend union" - ) + )*/ ); @@ -2744,7 +2744,7 @@ bool MemberDefImpl::isDetailedSectionVisible(bool inGroup,bool inFile) const bool visible = isDetailedSectionLinkable() && groupFilter && fileFilter && !isReference(); bool result = visible || simpleFilter; - //printf("%s::isDetailedSectionVisble: %d groupFilter=%d fileFilter=%d\n", + //printf("%s::isDetailedSectionVisible: %d groupFilter=%d fileFilter=%d\n", // name().data(),result,groupFilter,fileFilter); return result; } @@ -2877,7 +2877,8 @@ void MemberDefImpl::_writeCallGraph(OutputList &ol) const DotCallGraph callGraph(this,FALSE); if (callGraph.isTooBig()) { - warn_uncond("Call graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Call graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callGraph.isTrivial()) { @@ -2900,7 +2901,8 @@ void MemberDefImpl::_writeCallerGraph(OutputList &ol) const DotCallGraph callerGraph(this, TRUE); if (callerGraph.isTooBig()) { - warn_uncond("Caller graph for '%s' not generated, too many nodes. Consider increasing DOT_GRAPH_MAX_NODES.\n",qPrint(qualifiedName())); + warn_uncond("Caller graph for '%s' not generated, too many nodes (%d), threshold is %d. Consider increasing DOT_GRAPH_MAX_NODES.\n", + qPrint(qualifiedName()), callerGraph.numNodes(), Config_getInt(DOT_GRAPH_MAX_NODES)); } else if (!callerGraph.isTrivial()) { @@ -3202,7 +3204,7 @@ QCString MemberDefImpl::displayDefinition() const QCString title = name(); if (isEnumerate()) { - if (title.at(0)=='@') + if (isAnonymous()) { ldef = title = "anonymous enum"; if (!m_impl->enumBaseType.isEmpty()) @@ -3221,7 +3223,7 @@ QCString MemberDefImpl::displayDefinition() const } else if (isEnumValue()) { - if (ldef.at(0)=='@') + if (isAnonymous()) { ldef=ldef.mid(2); } @@ -3705,10 +3707,10 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml, else ol.parseText(theTranslator->trInitialValue()); ol.endBold(); - ParserInterface *pIntf = Doxygen::parserManager->getParser(getDefFileExtension()); - pIntf->resetCodeParserState(); + CodeParserInterface &intf = Doxygen::parserManager->getCodeParser(getDefFileExtension()); + intf.resetCodeParserState(); ol.startCodeFragment(); - pIntf->parseCode(ol,scopeName,m_impl->initializer,lang,FALSE,0,const_cast<FileDef*>(getFileDef()), + intf.parseCode(ol,scopeName,m_impl->initializer,lang,FALSE,0,const_cast<FileDef*>(getFileDef()), -1,-1,TRUE,this,FALSE,this); ol.endCodeFragment(); } @@ -4168,6 +4170,7 @@ void MemberDefImpl::warnIfUndocumentedParams() const !isReference() && !Doxygen::suppressDocWarnings) { + QCString returnType = typeString(); if (!m_impl->hasDocumentedParams) { warn_doc_error(getDefFileName(),getDefLine(), @@ -4175,7 +4178,7 @@ void MemberDefImpl::warnIfUndocumentedParams() const qPrint(qualifiedName())); } if (!m_impl->hasDocumentedReturnType && - isFunction() && hasDocumentation()) + isFunction() && hasDocumentation() && !returnType.isEmpty()) { warn_doc_error(getDefFileName(),getDefLine(), "return type of member %s is not documented", @@ -4184,13 +4187,6 @@ void MemberDefImpl::warnIfUndocumentedParams() const } } -bool MemberDefImpl::isFriendClass() const -{ - return (isFriend() && - (m_impl->type=="friend class" || m_impl->type=="friend struct" || - m_impl->type=="friend union")); -} - bool MemberDefImpl::isDocumentedFriendClass() const { ClassDef *fcd=0; @@ -4460,14 +4456,11 @@ void MemberDefImpl::addListReference(Definition *) memArgs = argsString(); } } - QList<ListItemInfo> *xrefItems = xrefListItems(); - if (xrefItems) - { - addRefItem(xrefItems, + const std::vector<ListItemInfo> &xrefItems = xrefListItems(); + addRefItem(xrefItems, qualifiedName()+argsString(), // argsString is needed for overloaded functions (see bug 609624) memLabel, getOutputFileBase()+"#"+anchor(),memName,memArgs,pd); - } } const MemberList *MemberDefImpl::getSectionList() const @@ -4928,7 +4921,7 @@ QCString MemberDefImpl::qualifiedName() const } } -void MemberDefImpl::setTagInfo(TagInfo *ti) +void MemberDefImpl::setTagInfo(const TagInfo *ti) { if (ti) { @@ -6010,7 +6003,7 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) if (mdefAl.hasParameters()) { ArgumentList mdefAlComb; - stringToArgumentList(mdef->argsString(),mdefAlComb); + stringToArgumentList(mdef->getLanguage(),mdef->argsString(),mdefAlComb); transferArgumentDocumentation(mdefAl,mdefAlComb); mdec->setArgumentList(mdefAlComb); } @@ -6023,7 +6016,7 @@ void combineDeclarationAndDefinition(MemberDef *mdec,MemberDef *mdef) if (mdecAl.hasParameters()) { ArgumentList mdecAlComb; - stringToArgumentList(mdec->argsString(),mdecAlComb); + stringToArgumentList(mdec->getLanguage(),mdec->argsString(),mdecAlComb); transferArgumentDocumentation(mdecAl,mdecAlComb); mdef->setDeclArgumentList(mdecAlComb); } @@ -6135,6 +6128,14 @@ bool MemberDefImpl::isFriendToHide() const return isFriendToHide; } +bool MemberDefImpl::isFriendClass() const +{ + return (isFriend() && + (m_impl->type=="friend class" || m_impl->type=="friend struct" || + m_impl->type=="friend union")); +} + + bool MemberDefImpl::isNotFriend() const { return !(isFriend() && isFriendToHide()); |