diff options
Diffstat (limited to 'src/memberdef.cpp')
-rw-r--r-- | src/memberdef.cpp | 141 |
1 files changed, 111 insertions, 30 deletions
diff --git a/src/memberdef.cpp b/src/memberdef.cpp index 7330b00..9b24ed9 100644 --- a/src/memberdef.cpp +++ b/src/memberdef.cpp @@ -102,6 +102,28 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, } if (!md->isDefine()) ol.docify(" "); + // simple argument list for tcl + if (md->getLanguage()==SrcLangExt_Tcl) + { + Argument *a=defArgList->first(); + ol.startParameterName(FALSE); + while (a) + { + if (a->defval.isEmpty()) + { + ol.docify(a->name+" "); + } + else + { + ol.docify("?"+a->name+"? "); + } + a=defArgList->next(); + } + ol.endParameterName(FALSE,FALSE,FALSE); + ol.endMemberDocName(); + return TRUE; + } + //printf("writeDefArgList(%d)\n",defArgList->count()); ol.pushGeneratorState(); //ol.disableAllBut(OutputGenerator::Html); @@ -111,6 +133,7 @@ static bool writeDefArgumentList(OutputList &ol,ClassDef *cd, // html and latex if (htmlOn) ol.enable(OutputGenerator::Html); if (latexOn) ol.enable(OutputGenerator::Latex); + ol.endMemberDocName(); ol.startParameterList(!md->isObjCMethod()); } @@ -995,21 +1018,22 @@ void MemberDef::setDefinitionTemplateParameterLists(QList<ArgumentList> *lists) void MemberDef::writeLink(OutputList &ol,ClassDef *,NamespaceDef *, FileDef *fd,GroupDef *gd,bool onlyText) { - static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); + //static bool optimizeOutputJava = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); static bool hideScopeNames = Config_getBool("HIDE_SCOPE_NAMES"); makeResident(); + SrcLangExt lang = getLanguage(); LockingPtr<MemberDef> lock(this,this); - QCString sep = optimizeOutputJava ? "." : "::"; + QCString sep = getLanguageSpecificSeparator(lang); QCString n = name(); if (!hideScopeNames) { if (m_impl->classDef && gd && !isRelated()) { - n.prepend(m_impl->classDef->name()+sep); + n.prepend(m_impl->classDef->displayName()+sep); } else if (m_impl->nspace && (gd || fd)) { - n.prepend(m_impl->nspace->name()+sep); + n.prepend(m_impl->nspace->displayName()+sep); } } @@ -1716,13 +1740,17 @@ bool MemberDef::isDetailedSectionLinkable() const bool MemberDef::isDetailedSectionVisible(bool inGroup,bool inFile) const { static bool separateMemPages = Config_getBool("SEPARATE_MEMBER_PAGES"); + static bool inlineSimpleStructs = Config_getBool("INLINE_SIMPLE_STRUCTS"); + static bool hideUndocMembers = Config_getBool("HIDE_UNDOC_MEMBERS"); bool groupFilter = getGroupDef()==0 || inGroup || separateMemPages; bool fileFilter = getNamespaceDef()==0 || !inFile; + bool simpleFilter = !hideUndocMembers && inlineSimpleStructs && + getClassDef()!=0 && getClassDef()->isSimple(); bool visible = isDetailedSectionLinkable() && groupFilter && fileFilter && !isReference(); //printf("MemberDef::isDetailedSectionVisible() %d\n",visible); - return visible; + return visible || simpleFilter; } /*! Writes the "detailed documentation" section of this member to @@ -1740,7 +1768,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, bool hasParameterList = FALSE; bool inFile = container->definitionType()==Definition::TypeFile; bool hasDocs = isDetailedSectionVisible(inGroup,inFile); - static bool optVhdl = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); + //printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d\n", // name().data(),hasDocs,container->definitionType(),inGroup); @@ -1748,6 +1776,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, if (isEnumValue() && !showEnumValues) return; makeResident(); + SrcLangExt lang = getLanguage(); + bool optVhdl = lang==SrcLangExt_VHDL; LockingPtr<MemberDef> lock(this,this); QCString scopeName = scName; @@ -1777,12 +1807,13 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, QCString doxyArgs=argsString(); QCString ldef = definition(); + QCString title = name(); //printf("member `%s' def=`%s'\n",name().data(),ldef.data()); if (isEnumerate()) { - if (name().at(0)=='@') + if (title.at(0)=='@') { - ldef = "anonymous enum"; + ldef = title = "anonymous enum"; } else { @@ -1828,10 +1859,14 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, //printf("Anonymous compound `%s'\n",cname.data()); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); ol.startMemberDoc(ciname,name(),memAnchor,name(),showInline); - // strip anonymous compound names from definition + // search for the last anonymous compound name in the definition int si=ldef.find(' '),pi,ei=i+l; if (si==-1) si=0; - while ((pi=r.match(ldef,i+l,&l))!=-1) ei=i=pi+l; + while ((pi=r.match(ldef,i+l,&l))!=-1) + { + i=pi; + ei=i+l; + } // first si characters of ldef contain compound type name ol.startMemberDocName(isObjCMethod()); ol.docify(ldef.left(si)); @@ -1845,7 +1880,7 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, else // not an enum value { ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); - ol.startMemberDoc(ciname,name(),memAnchor,name(),showInline); + ol.startMemberDoc(ciname,name(),memAnchor,title,showInline); ClassDef *cd=getClassDef(); if (!Config_getBool("HIDE_SCOPE_NAMES")) @@ -2478,6 +2513,23 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, } } +// strip scope and field name from the type +// example: "struct N::S.v.c" will become "struct S.v" +static QCString simplifyTypeForTable(const QCString &s) +{ + QCString ts=removeAnonymousScopes(s); + if (ts.right(2)=="::") ts = ts.left(ts.length()-2); + static QRegExp re("[A-Z_a-z0-9]+::"); + int i,l; + while ((i=re.match(ts,0,&l))!=-1) + { + ts=ts.left(i)+ts.mid(i+l); + } + i=ts.findRev('.'); + if (i!=-1) ts = ts.left(i); + return ts; +} + void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) { Definition *scope = getOuterScope(); @@ -2487,14 +2539,21 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) QCString cfname = getOutputFileBase(); QCString cname; if (scope) cname = scope->name(); + if (doxyName.at(0)=='@') + { + doxyName="__unnamed__"; + } ol.startInlineMemberType(); ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs); + + QCString ts = simplifyTypeForTable(m_impl->type); + linkifyText(TextGeneratorOLImpl(ol), // out scope, // scope getBodyDef(), // fileScope doxyName, // - m_impl->type, // text + ts, // text TRUE // autoBreak ); ol.endDoxyAnchor(cfname,memAnchor); @@ -2502,6 +2561,10 @@ void MemberDef::writeMemberDocSimple(OutputList &ol, Definition *container) ol.startInlineMemberName(); ol.docify(doxyName); + if (!m_impl->bitfields.isEmpty()) // add bitfields + { + linkifyText(TextGeneratorOLImpl(ol),getOuterScope(),getBodyDef(),name(),m_impl->bitfields.simplifyWhiteSpace()); + } ol.endInlineMemberName(); ol.startInlineMemberDoc(); @@ -2836,8 +2899,9 @@ void MemberDef::addListReference(Definition *) makeResident(); 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"); + //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; @@ -2845,7 +2909,7 @@ void MemberDef::addListReference(Definition *) { memLabel=theTranslator->trGlobal(TRUE,TRUE); } - else if (fortranOpt) + else if (lang==SrcLangExt_Fortran) { memLabel=theTranslator->trSubprogram(TRUE,TRUE); } @@ -2857,7 +2921,7 @@ void MemberDef::addListReference(Definition *) Definition *pd=getOuterScope(); QCString pdName = pd->definitionType()==Definition::TypeClass ? ((ClassDef*)pd)->displayName() : pd->name(); - QCString sep = optimizeOutputJava ? "." : "::"; + QCString sep = getLanguageSpecificSeparator(lang); QCString memArgs; if (!isRelated() /* && commented out as a result of bug 597016 @@ -2944,17 +3008,20 @@ void MemberDef::_computeIsConstructor() m_isConstructorCached = name()=="this" ? 2 : 1; return; } - else if (m_impl->fileDef && - getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_PHP) - { // for PHP + else if (getLanguage()==SrcLangExt_PHP) // for PHP + { m_isConstructorCached = name()=="__construct" ? 2 : 1; return; } - else if (name()=="__init__" && m_impl->fileDef && - getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_Python) - // for Python + else if (name()=="__init__" && + getLanguage()==SrcLangExt_Python) // for Python { - m_isConstructorCached=2; // TRUE + m_isConstructorCached = 2; // TRUE + return; + } + else if (getLanguage()==SrcLangExt_Tcl) // for Tcl + { + m_isConstructorCached = name()=="constructor" ? 2 : 1; return; } else // for other languages @@ -2994,14 +3061,16 @@ void MemberDef::_computeIsDestructor() { isDestructor = name()=="~this"; } - else if (m_impl->fileDef && - getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_PHP) - { // for PHP + else if (getLanguage()==SrcLangExt_PHP) // for PHP + { isDestructor = name()=="__destruct"; } - else if (name()=="__del__" && m_impl->fileDef && - getLanguageFromFileName(m_impl->fileDef->name())==SrcLangExt_Python) - // for Python + else if (getLanguage()==SrcLangExt_Tcl) // for Tcl + { + isDestructor = name()=="destructor"; + } + else if (name()=="__del__" && + getLanguage()==SrcLangExt_Python) // for Python { isDestructor=TRUE; } @@ -3023,7 +3092,6 @@ bool MemberDef::isDestructor() const } ASSERT(m_isDestructorCached>0); return m_isDestructorCached==2; - } void MemberDef::writeEnumDeclaration(OutputList &typeDecl, @@ -3183,6 +3251,12 @@ void MemberDef::setTypeConstraints(ArgumentList *al) } } +void MemberDef::setType(const char *t) +{ + makeResident(); + m_impl->type = t; +} + void MemberDef::findSectionsInDocumentation() { makeResident(); @@ -3461,6 +3535,12 @@ bool MemberDef::isFunction() const return m_impl->mtype==Function; } +bool MemberDef::isFunctionPtr() const +{ + makeResident(); + return m_impl->mtype==Variable && QCString(argsString()).find(")(")!=-1; +} + bool MemberDef::isDefine() const { makeResident(); @@ -4411,3 +4491,4 @@ void MemberDef::invalidateCachedArgumentTypes() invalidateCachedTypesInArgumentList(m_impl->declArgList); } + |