Commit c5ec90d1 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Template and context enhancements

parent e47f3d06
...@@ -337,7 +337,14 @@ QCString ClassDef::displayName(bool includeScope) const ...@@ -337,7 +337,14 @@ QCString ClassDef::displayName(bool includeScope) const
// n = n.left(n.length()-2); // n = n.left(n.length()-2);
//} //}
//printf("ClassDef::displayName()=%s\n",n.data()); //printf("ClassDef::displayName()=%s\n",n.data());
return n; if (n.find('@')!=-1)
{
return removeAnonymousScopes(n);
}
else
{
return n;
}
} }
// inserts a base/super class in the inheritance list // inserts a base/super class in the inheritance list
...@@ -1542,7 +1549,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol) ...@@ -1542,7 +1549,7 @@ void ClassDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type); MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible()) if (ml && ml->declVisible())
{ {
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first); ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE; first=FALSE;
} }
} }
...@@ -2526,23 +2533,14 @@ bool ClassDef::hasNonReferenceSuperClass() ...@@ -2526,23 +2533,14 @@ bool ClassDef::hasNonReferenceSuperClass()
void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup, void ClassDef::writeDeclaration(OutputList &ol,MemberDef *md,bool inGroup,
ClassDef *inheritedFrom,const char *inheritId) ClassDef *inheritedFrom,const char *inheritId)
{ {
//ol.insertMemberAlign();
//printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup); //printf("ClassName=`%s' inGroup=%d\n",name().data(),inGroup);
//if (inGroup && md && md->getClassDef()==this) return;
ol.docify(compoundTypeString()); ol.docify(compoundTypeString());
int ri=name().findRev("::"); QCString cn = displayName(FALSE);
if (ri==-1) ri=name().length(); if (!cn.isEmpty())
QCString cn=name().right(name().length()-ri-2);
if (!cn.isEmpty() && cn.at(0)!='@' && md)
{ {
if (cn.right(2)=="-p" /*|| cn.right(2)=="-g"*/)
{
cn = cn.left(cn.length()-2);
}
ol.docify(" "); ol.docify(" ");
if (isLinkable()) if (md && isLinkable())
{ {
ol.writeObjectLink(0,0,md->anchor(),cn); ol.writeObjectLink(0,0,md->anchor(),cn);
} }
...@@ -3929,196 +3927,6 @@ void ClassDef::sortMemberLists() ...@@ -3929,196 +3927,6 @@ void ClassDef::sortMemberLists()
} }
} }
/** Computes for a given list type \a inListType, which are the
* the corresponding list type(s) in the base class that are to be
* added to this list.
*
* So for public inheritance, the mapping is 1-1, so outListType1=inListType
* Private members are to be hidden completely.
*
* For protected inheritance, both protected and public members of the
* base class should be joined in the protected member section.
*
* For private inheritance, both protected and public members of the
* base class should be joined in the private member section.
*/
static void convertProtectionLevel(
MemberListType inListType,
Protection inProt,
int *outListType1,
int *outListType2
)
{
static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
// default representing 1-1 mapping
*outListType1=inListType;
*outListType2=-1;
if (inProt==Public)
{
switch (inListType) // in the private section of the derived class,
// the private section of the base class should not
// be visible
{
case MemberListType_priMethods:
case MemberListType_priStaticMethods:
case MemberListType_priSlots:
case MemberListType_priAttribs:
case MemberListType_priStaticAttribs:
case MemberListType_priTypes:
*outListType1=-1;
*outListType2=-1;
break;
default:
break;
}
}
else if (inProt==Protected) // Protected inheritance
{
switch (inListType) // in the protected section of the derived class,
// both the public and protected members are shown
// as protected
{
case MemberListType_pubMethods:
case MemberListType_pubStaticMethods:
case MemberListType_pubSlots:
case MemberListType_pubAttribs:
case MemberListType_pubStaticAttribs:
case MemberListType_pubTypes:
case MemberListType_priMethods:
case MemberListType_priStaticMethods:
case MemberListType_priSlots:
case MemberListType_priAttribs:
case MemberListType_priStaticAttribs:
case MemberListType_priTypes:
*outListType1=-1;
*outListType2=-1;
break;
case MemberListType_proMethods:
*outListType2=MemberListType_pubMethods;
break;
case MemberListType_proStaticMethods:
*outListType2=MemberListType_pubStaticMethods;
break;
case MemberListType_proSlots:
*outListType2=MemberListType_pubSlots;
break;
case MemberListType_proAttribs:
*outListType2=MemberListType_pubAttribs;
break;
case MemberListType_proStaticAttribs:
*outListType2=MemberListType_pubStaticAttribs;
break;
case MemberListType_proTypes:
*outListType2=MemberListType_pubTypes;
break;
default:
break;
}
}
else if (inProt==Private)
{
switch (inListType) // in the private section of the derived class,
// both the public and protected members are shown
// as private
{
case MemberListType_pubMethods:
case MemberListType_pubStaticMethods:
case MemberListType_pubSlots:
case MemberListType_pubAttribs:
case MemberListType_pubStaticAttribs:
case MemberListType_pubTypes:
case MemberListType_proMethods:
case MemberListType_proStaticMethods:
case MemberListType_proSlots:
case MemberListType_proAttribs:
case MemberListType_proStaticAttribs:
case MemberListType_proTypes:
*outListType1=-1;
*outListType2=-1;
break;
case MemberListType_priMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubMethods;
*outListType2=MemberListType_proMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticMethods;
*outListType2=MemberListType_proStaticMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priSlots:
if (extractPrivate)
{
*outListType1=MemberListType_pubSlots;
*outListType1=MemberListType_proSlots;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubAttribs;
*outListType2=MemberListType_proAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticAttribs;
*outListType2=MemberListType_proStaticAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priTypes:
if (extractPrivate)
{
*outListType1=MemberListType_pubTypes;
*outListType2=MemberListType_proTypes;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
default:
break;
}
}
//printf("convertProtectionLevel(type=%d prot=%d): %d,%d\n",
// inListType,inProt,*outListType1,*outListType2);
}
int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom, int ClassDef::countMemberDeclarations(MemberListType lt,ClassDef *inheritedFrom,
int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses) int lt2,bool invert,bool showAlways,QPtrDict<void> *visitedClasses)
{ {
...@@ -4157,7 +3965,7 @@ int ClassDef::countInheritedDecMembers(MemberListType lt, ...@@ -4157,7 +3965,7 @@ int ClassDef::countInheritedDecMembers(MemberListType lt,
QPtrDict<void> *visitedClasses) QPtrDict<void> *visitedClasses)
{ {
int inhCount = 0; int inhCount = 0;
int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE)>0; int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE);
bool process = count>0; bool process = count>0;
//printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n", //printf("%s: countInheritedDecMembers: lt=%d process=%d count=%d invert=%d\n",
// name().data(),lt,process,count,invert); // name().data(),lt,process,count,invert);
...@@ -4297,7 +4105,7 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol, ...@@ -4297,7 +4105,7 @@ void ClassDef::writeInheritedMemberDeclarations(OutputList &ol,
{ {
ol.pushGeneratorState(); ol.pushGeneratorState();
ol.disableAllBut(OutputGenerator::Html); ol.disableAllBut(OutputGenerator::Html);
int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE)>0; int count = countMembersIncludingGrouped(lt,inheritedFrom,FALSE);
bool process = count>0; bool process = count>0;
//printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n", //printf("%s: writeInheritedMemberDec: lt=%d process=%d invert=%d always=%d\n",
// name().data(),lt,process,invert,showAlways); // name().data(),lt,process,invert,showAlways);
......
...@@ -22,6 +22,10 @@ ...@@ -22,6 +22,10 @@
#include "example.h" #include "example.h"
#include "membername.h" #include "membername.h"
#include "parserintf.h" #include "parserintf.h"
#include "portable.h"
// TODO: pass the current file to Dot*::writeGraph, so the user can put dot graphs in other
// files as well
struct ContextGlobals struct ContextGlobals
{ {
...@@ -61,7 +65,7 @@ template<class T> class ScopedPtr ...@@ -61,7 +65,7 @@ template<class T> class ScopedPtr
void reset(T *p=0) { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } } void reset(T *p=0) { if (p!=m_ptr) { delete m_ptr; m_ptr = p; } }
}; };
// iterator support /** @brief Template List iterator support */
template<class T> template<class T>
class GenericConstIterator : public TemplateListIntf::ConstIterator class GenericConstIterator : public TemplateListIntf::ConstIterator
{ {
...@@ -104,7 +108,7 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator ...@@ -104,7 +108,7 @@ class GenericConstIterator : public TemplateListIntf::ConstIterator
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// standard list implementation /** @brief standard template list implementation */
template<class T> template<class T>
class GenericNodeListContext : public TemplateListIntf class GenericNodeListContext : public TemplateListIntf
{ {
...@@ -337,7 +341,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -337,7 +341,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.generateAt should take two parameters, got %d!\n",args.count()); err("tr.generateAt should take two arguments, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -349,7 +353,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -349,7 +353,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.inheritanceDiagramFor should take one parameter, got %d!\n",args.count()); err("tr.inheritanceDiagramFor should take one argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -361,7 +365,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -361,7 +365,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.collaborationDiagramFor should take one parameter, got %d!\n",args.count()); err("tr.collaborationDiagramFor should take one argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -373,7 +377,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -373,7 +377,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.inheritsList should take one integer parameter, got %d!\n",args.count()); err("tr.inheritsList should take one integer argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -385,7 +389,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -385,7 +389,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.inheritedByList should take one integer parameter, got %d!\n",args.count()); err("tr.inheritedByList should take one integer argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -397,7 +401,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -397,7 +401,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.*List should take one integer parameter, got %d!\n",args.count()); err("tr.*List should take one integer argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -409,7 +413,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -409,7 +413,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.implementedBy should take one integer parameter, got %d!\n",args.count()); err("tr.implementedBy should take one integer argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -421,7 +425,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -421,7 +425,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.reimplementedBy should take one integer parameter, got %d!\n",args.count()); err("tr.reimplementedBy should take one integer argument, got %d!\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -433,7 +437,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -433,7 +437,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.sourceRefs should take one integer parameter, got %d\n",args.count()); err("tr.sourceRefs should take one integer argument, got %d\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -445,7 +449,7 @@ class TranslateContext::Private : public PropertyMapper ...@@ -445,7 +449,7 @@ class TranslateContext::Private : public PropertyMapper
} }
else else
{ {
err("tr.sourceRefBys should take one integer parameter, got %d\n",args.count()); err("tr.sourceRefBys should take one integer argument, got %d\n",args.count());
} }
return TemplateVariant(); return TemplateVariant();
} }
...@@ -657,6 +661,14 @@ class TranslateContext::Private : public PropertyMapper ...@@ -657,6 +661,14 @@ class TranslateContext::Private : public PropertyMapper
{ {
return theTranslator->trCallerGraph(); return theTranslator->trCallerGraph();
} }
TemplateVariant inheritedFrom() const
{
return theTranslator->trInheritedFrom("@0","@1");
}
TemplateVariant additionalInheritedMembers() const
{
return theTranslator->trAdditionalInheritedMembers();
}
Private() Private()
{ {
//%% string generatedBy //%% string generatedBy
...@@ -745,6 +757,10 @@ class TranslateContext::Private : public PropertyMapper ...@@ -745,6 +757,10 @@ class TranslateContext::Private : public PropertyMapper
addProperty("callGraph", this,&Private::callGraph); addProperty("callGraph", this,&Private::callGraph);
//%% string callerGraph //%% string callerGraph
addProperty("callerGraph", this,&Private::callerGraph); addProperty("callerGraph", this,&Private::callerGraph);
//%% markerstring inheritedFrom
addProperty("inheritedFrom", this,&Private::inheritedFrom);
//%% string addtionalInheritedMembers
addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers);
m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
...@@ -845,6 +861,8 @@ class DefinitionContext : public PropertyMapper ...@@ -845,6 +861,8 @@ class DefinitionContext : public PropertyMapper
addProperty("language",this,&DefinitionContext::language); addProperty("language",this,&DefinitionContext::language);
//%% string sourceDef: A link to the source definition //%% string sourceDef: A link to the source definition
addProperty("sourceDef",this,&DefinitionContext::sourceDef); addProperty("sourceDef",this,&DefinitionContext::sourceDef);
//%% list[Definition] navigationPath: Breadcrumb navigation path to this item
addProperty("navigationPath",this,&DefinitionContext::navigationPath);
if (m_def && !m_def->getSourceFileBase().isEmpty()) if (m_def && !m_def->getSourceFileBase().isEmpty())
{ {
...@@ -988,14 +1006,43 @@ class DefinitionContext : public PropertyMapper ...@@ -988,14 +1006,43 @@ class DefinitionContext : public PropertyMapper
return FALSE; return FALSE;
} }
} }
void fillPath(Definition *def,TemplateList *list) const
{
Definition *outerScope = def->getOuterScope();
Definition::DefType type = def->definitionType();
if (outerScope && outerScope!=Doxygen::globalScope)
{
fillPath(outerScope,list);
}
else if (type==Definition::TypeFile && ((const FileDef*)def)->getDirDef())
{
fillPath(((const FileDef*)def)->getDirDef(),list);
}
NavPathElemContext *elem = new NavPathElemContext(def);
list->append(elem);
m_cache.navPathElems.append(elem);
}
TemplateVariant navigationPath() const
{
if (!m_cache.navPath)
{
TemplateList *list = new TemplateList;
fillPath(m_def,list);
m_cache.navPath.reset(list);
}
return m_cache.navPath.get();
}
private: private:
Definition *m_def; Definition *m_def;
struct Cachable struct Cachable
{ {
Cachable() { navPathElems.setAutoDelete(TRUE); }
ScopedPtr<TemplateVariant> details; ScopedPtr<TemplateVariant> details;
ScopedPtr<TemplateVariant> brief; ScopedPtr<TemplateVariant> brief;
ScopedPtr<TemplateVariant> inbodyDocs; ScopedPtr<TemplateVariant> inbodyDocs;
ScopedPtr<TemplateList> navPath;
QList<NavPathElemContext> navPathElems;
}; };
mutable Cachable m_cache; mutable Cachable m_cache;
TemplateList m_sourceDef; TemplateList m_sourceDef;
...@@ -1140,9 +1187,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1140,9 +1187,11 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
addProperty("templateDecls", this,&Private::templateDecls); addProperty("templateDecls", this,&Private::templateDecls);
addProperty("typeConstraints", this,&Private::typeConstraints); addProperty("typeConstraints", this,&Private::typeConstraints);
addProperty("examples", this,&Private::examples); addProperty("examples", this,&Private::examples);
addProperty("members", this,&Private::members);
addProperty("allMembersList", this,&Private::allMembersList); addProperty("allMembersList", this,&Private::allMembersList);
addProperty("allMembersFileName", this,&Private::allMembersFileName); addProperty("allMembersFileName", this,&Private::allMembersFileName);
addProperty("memberGroups", this,&Private::memberGroups); addProperty("memberGroups", this,&Private::memberGroups);
addProperty("additionalInheritedMembers",this,&Private::additionalInheritedMembers);
} }
TemplateVariant title() const TemplateVariant title() const
{ {
...@@ -1213,7 +1262,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1213,7 +1262,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
FTextStream t(&result); FTextStream t(&result);
cg->writeGraph(t,BITMAP, cg->writeGraph(t,BITMAP,
g_globals.outputDir, g_globals.outputDir,
m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension,
relPathAsString(),TRUE,TRUE,g_globals.dynSectionId relPathAsString(),TRUE,TRUE,g_globals.dynSectionId
); );
} }
...@@ -1258,7 +1307,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1258,7 +1307,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
FTextStream t(&result); FTextStream t(&result);
cg->writeGraph(t,BITMAP, cg->writeGraph(t,BITMAP,
g_globals.outputDir, g_globals.outputDir,
m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension, g_globals.outputDir+portable_pathSeparator()+m_classDef->getOutputFileBase()+Doxygen::htmlFileExtension,
relPathAsString(),TRUE,TRUE,g_globals.dynSectionId relPathAsString(),TRUE,TRUE,g_globals.dynSectionId
); );
} }
...@@ -1298,14 +1347,14 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1298,14 +1347,14 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
return m_cache.inheritedByList.get(); return m_cache.inheritedByList.get();
} }
TemplateVariant getMemberList(ScopedPtr<MemberListInfoContext> &list, TemplateVariant getMemberList(ScopedPtr<MemberListInfoContext> &list,
MemberListType type,const char *title) const MemberListType type,const char *title,bool detailed=FALSE) const
{ {
if (!list) if (!list)
{ {
MemberList *ml = m_classDef->getMemberList(type); MemberList *ml = m_classDef->getMemberList(type);
if (ml) if (ml)
{ {
list.reset(new MemberListInfoContext(m_classDef,relPathAsString(),ml,title)); list.reset(new MemberListInfoContext(m_classDef,relPathAsString(),ml,title,detailed));
} }
} }
if (list) if (list)
...@@ -1443,43 +1492,43 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1443,43 +1492,43 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
} }
TemplateVariant detailedTypedefs() const TemplateVariant detailedTypedefs() const
{ {
return getMemberList(m_cache.detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation()); return getMemberList(m_cache.detailedTypedefs,MemberListType_typedefMembers,theTranslator->trMemberTypedefDocumentation(),TRUE);
} }
TemplateVariant detailedEnums() const TemplateVariant detailedEnums() const
{ {
return getMemberList(m_cache.detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation()); return getMemberList(m_cache.detailedEnums,MemberListType_enumMembers,theTranslator->trMemberEnumerationDocumentation(),TRUE);
} }
TemplateVariant detailedServices() const TemplateVariant detailedServices() const
{ {
return getMemberList(m_cache.detailedServices,MemberListType_serviceMembers,theTranslator->trServices()); return getMemberList(m_cache.detailedServices,MemberListType_serviceMembers,theTranslator->trServices(),TRUE);
} }
TemplateVariant detailedInterfaces() const TemplateVariant detailedInterfaces() const
{ {
return getMemberList(m_cache.detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces()); return getMemberList(m_cache.detailedInterfaces,MemberListType_interfaceMembers,theTranslator->trInterfaces(),TRUE);
} }
TemplateVariant detailedConstructors() const TemplateVariant detailedConstructors() const
{ {
return getMemberList(m_cache.detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation()); return getMemberList(m_cache.detailedConstructors,MemberListType_constructors,theTranslator->trConstructorDocumentation(),TRUE);
} }
TemplateVariant detailedMethods() const TemplateVariant detailedMethods() const
{ {
return getMemberList(m_cache.detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation()); return getMemberList(m_cache.detailedMethods,MemberListType_functionMembers,theTranslator->trMemberFunctionDocumentation(),TRUE);
} }
TemplateVariant detailedRelated() const TemplateVariant detailedRelated() const
{ {
return getMemberList(m_cache.detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation()); return getMemberList(m_cache.detailedRelated,MemberListType_relatedMembers,theTranslator->trRelatedFunctionDocumentation(),TRUE);
} }
TemplateVariant detailedVariables() const TemplateVariant detailedVariables() const
{ {
return getMemberList(m_cache.detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation()); return getMemberList(m_cache.detailedVariables,MemberListType_variableMembers,theTranslator->trMemberDataDocumentation(),TRUE);
} }
TemplateVariant detailedProperties() const TemplateVariant detailedProperties() const
{ {
return getMemberList(m_cache.detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation()); return getMemberList(m_cache.detailedProperties,MemberListType_propertyMembers,theTranslator->trPropertyDocumentation(),TRUE);
} }
TemplateVariant detailedEvents() const TemplateVariant detailedEvents() const
{ {
return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation()); return getMemberList(m_cache.detailedEvents,MemberListType_eventMembers,theTranslator->trEventDocumentation(),TRUE);
} }
TemplateVariant nestedClasses() const TemplateVariant nestedClasses() const
{ {
...@@ -1584,6 +1633,59 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1584,6 +1633,59 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
} }
return m_cache.examples.get(); return m_cache.examples.get();
} }
void addMembers(ClassDef *cd,MemberListType lt) const
{
MemberList *ml = cd->getMemberList(lt);
if (ml)
{
MemberListIterator li(*ml);
const MemberDef *md;
for (li.toFirst();(md=li.current());++li)
{
if (md->isBriefSectionVisible())
{
m_cache.allMembers.append(md);
}
}
}
}
TemplateVariant members() const
{
if (!m_cache.members)
{
addMembers(m_classDef,MemberListType_pubTypes);
addMembers(m_classDef,MemberListType_services);
addMembers(m_classDef,MemberListType_interfaces);
addMembers(m_classDef,MemberListType_pubSlots);
addMembers(m_classDef,MemberListType_signals);
addMembers(m_classDef,MemberListType_pubMethods);
addMembers(m_classDef,MemberListType_pubStaticMethods);
addMembers(m_classDef,MemberListType_pubAttribs);
addMembers(m_classDef,MemberListType_pubStaticAttribs);
addMembers(m_classDef,MemberListType_proTypes);
addMembers(m_classDef,MemberListType_proSlots);
addMembers(m_classDef,MemberListType_proMethods);
addMembers(m_classDef,MemberListType_proStaticMethods);
addMembers(m_classDef,MemberListType_proAttribs);
addMembers(m_classDef,MemberListType_proStaticAttribs);
addMembers(m_classDef,MemberListType_pacTypes);
addMembers(m_classDef,MemberListType_pacMethods);
addMembers(m_classDef,MemberListType_pacStaticMethods);
addMembers(m_classDef,MemberListType_pacAttribs);
addMembers(m_classDef,MemberListType_pacStaticAttribs);
addMembers(m_classDef,MemberListType_properties);
addMembers(m_classDef,MemberListType_events);
addMembers(m_classDef,MemberListType_priTypes);
addMembers(m_classDef,MemberListType_priSlots);
addMembers(m_classDef,MemberListType_priMethods);
addMembers(m_classDef,MemberListType_priStaticMethods);
addMembers(m_classDef,MemberListType_priAttribs);
addMembers(m_classDef,MemberListType_priStaticAttribs);
addMembers(m_classDef,MemberListType_related);
m_cache.members.reset(new MemberListContext(&m_cache.allMembers));
}
return m_cache.members.get();
}
TemplateVariant allMembersList() const TemplateVariant allMembersList() const
{ {
if (!m_cache.allMembersList && m_classDef->memberNameInfoSDict()) if (!m_cache.allMembersList && m_classDef->memberNameInfoSDict())
...@@ -1616,6 +1718,48 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1616,6 +1718,48 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
} }
return m_cache.memberGroups.get(); return m_cache.memberGroups.get();
} }
TemplateVariant additionalInheritedMembers() const
{
if (!m_cache.additionalInheritedMembers)
{
InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext;
ctx->addMemberList(m_classDef,MemberListType_pubTypes,theTranslator->trPublicTypes());
ctx->addMemberList(m_classDef,MemberListType_services,theTranslator->trServices());
ctx->addMemberList(m_classDef,MemberListType_interfaces,theTranslator->trInterfaces());
ctx->addMemberList(m_classDef,MemberListType_pubSlots,theTranslator->trPublicSlots());
ctx->addMemberList(m_classDef,MemberListType_signals,theTranslator->trSignals());
ctx->addMemberList(m_classDef,MemberListType_pubMethods,
m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trInstanceMethods()
: theTranslator->trPublicMembers());
ctx->addMemberList(m_classDef,MemberListType_pubStaticMethods,
m_classDef->getLanguage()==SrcLangExt_ObjC ? theTranslator->trClassMethods()
: theTranslator->trStaticPublicMembers());
ctx->addMemberList(m_classDef,MemberListType_pubAttribs,theTranslator->trPublicAttribs());
ctx->addMemberList(m_classDef,MemberListType_pubStaticAttribs,theTranslator->trStaticPublicAttribs());
ctx->addMemberList(m_classDef,MemberListType_proTypes,theTranslator->trProtectedTypes());
ctx->addMemberList(m_classDef,MemberListType_proSlots,theTranslator->trProtectedSlots());
ctx->addMemberList(m_classDef,MemberListType_proMethods,theTranslator->trProtectedMembers());
ctx->addMemberList(m_classDef,MemberListType_proStaticMethods,theTranslator->trStaticProtectedMembers());
ctx->addMemberList(m_classDef,MemberListType_proAttribs,theTranslator->trProtectedAttribs());
ctx->addMemberList(m_classDef,MemberListType_proStaticAttribs,theTranslator->trStaticProtectedAttribs());
ctx->addMemberList(m_classDef,MemberListType_pacTypes,theTranslator->trPackageTypes());
ctx->addMemberList(m_classDef,MemberListType_pacMethods,theTranslator->trPackageMembers());
ctx->addMemberList(m_classDef,MemberListType_pacStaticMethods,theTranslator->trStaticPackageMembers());
ctx->addMemberList(m_classDef,MemberListType_pacAttribs,theTranslator->trPackageAttribs());
ctx->addMemberList(m_classDef,MemberListType_pacStaticAttribs,theTranslator->trStaticPackageAttribs());
ctx->addMemberList(m_classDef,MemberListType_properties,theTranslator->trProperties());
ctx->addMemberList(m_classDef,MemberListType_events,theTranslator->trEvents());
ctx->addMemberList(m_classDef,MemberListType_priTypes,theTranslator->trPrivateTypes());
ctx->addMemberList(m_classDef,MemberListType_priSlots,theTranslator->trPrivateSlots());
ctx->addMemberList(m_classDef,MemberListType_priMethods,theTranslator->trPrivateMembers());
ctx->addMemberList(m_classDef,MemberListType_priStaticMethods,theTranslator->trStaticPrivateMembers());
ctx->addMemberList(m_classDef,MemberListType_priAttribs,theTranslator->trPrivateAttribs());
ctx->addMemberList(m_classDef,MemberListType_priStaticAttribs,theTranslator->trStaticPrivateAttribs());
ctx->addMemberList(m_classDef,MemberListType_related,theTranslator->trRelatedFunctions());
m_cache.additionalInheritedMembers.reset(ctx);
}
return m_cache.additionalInheritedMembers.get();
}
private: private:
ClassDef *m_classDef; ClassDef *m_classDef;
...@@ -1627,11 +1771,12 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1627,11 +1771,12 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{ {
templateArgList.setAutoDelete(TRUE); templateArgList.setAutoDelete(TRUE);
exampleList.setAutoDelete(TRUE); exampleList.setAutoDelete(TRUE);
allMembers.setAutoDelete(TRUE);
} }
ScopedPtr<InheritanceListContext> inheritsList; ScopedPtr<InheritanceListContext> inheritsList;
ScopedPtr<InheritanceListContext> inheritedByList; ScopedPtr<InheritanceListContext> inheritedByList;
ScopedPtr<DotClassGraph> classGraph; ScopedPtr<DotClassGraph> classGraph;
ScopedPtr<DotClassGraph> collaborationGraph; ScopedPtr<DotClassGraph> collaborationGraph;
ScopedPtr<NestedClassListContext> nestedClasses; ScopedPtr<NestedClassListContext> nestedClasses;
ScopedPtr<MemberListInfoContext> publicTypes; ScopedPtr<MemberListInfoContext> publicTypes;
ScopedPtr<MemberListInfoContext> publicMethods; ScopedPtr<MemberListInfoContext> publicMethods;
...@@ -1678,9 +1823,12 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private> ...@@ -1678,9 +1823,12 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
ScopedPtr<ArgumentListContext> typeConstraints; ScopedPtr<ArgumentListContext> typeConstraints;
ScopedPtr<TemplateList> examples; ScopedPtr<TemplateList> examples;
ScopedPtr<TemplateList> templateDecls; ScopedPtr<TemplateList> templateDecls;
QList<ArgumentListContext> templateArgList; ScopedPtr<InheritedMemberInfoListContext> additionalInheritedMembers;
int inheritanceNodes; ScopedPtr<MemberListContext> members;
QList<TemplateStruct> exampleList; QList<ArgumentListContext> templateArgList;
int inheritanceNodes;
QList<TemplateStruct> exampleList;
MemberList allMembers;
}; };
mutable Cachable m_cache; mutable Cachable m_cache;
}; };
...@@ -2024,6 +2172,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2024,6 +2172,8 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
addProperty("isEnumeration", this,&Private::isEnumeration); addProperty("isEnumeration", this,&Private::isEnumeration);
addProperty("isEnumValue", this,&Private::isEnumValue); addProperty("isEnumValue", this,&Private::isEnumValue);
addProperty("isAnonymous", this,&Private::isAnonymous); addProperty("isAnonymous", this,&Private::isAnonymous);
addProperty("anonymousType", this,&Private::anonymousType);
addProperty("anonymousMember", this,&Private::anonymousMember);
addProperty("isRelated", this,&Private::isRelated); addProperty("isRelated", this,&Private::isRelated);
addProperty("hasDetails", this,&Private::hasDetails); addProperty("hasDetails", this,&Private::hasDetails);
addProperty("exception", this,&Private::exception); addProperty("exception", this,&Private::exception);
...@@ -2161,6 +2311,44 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2161,6 +2311,44 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
QCString name = m_memberDef->name(); QCString name = m_memberDef->name();
return !name.isEmpty() && name.at(0)=='@'; return !name.isEmpty() && name.at(0)=='@';
} }
TemplateVariant anonymousType() const
{
if (!m_cache.anonymousType)
{
ClassDef *cd = m_memberDef->getClassDefOfAnonymousType();
if (cd)
{
m_cache.anonymousType.reset(new ClassContext(cd));
}
}
if (m_cache.anonymousType)
{
return m_cache.anonymousType.get();
}
else
{
return FALSE;
}
}
TemplateVariant anonymousMember() const
{
if (!m_cache.anonymousMember)
{
MemberDef *md = m_memberDef->fromAnonymousMember();
if (md)
{
m_cache.anonymousMember.reset(new MemberContext(md));
}
}
if (m_cache.anonymousMember)
{
return m_cache.anonymousMember.get();
}
else
{
return FALSE;
}
}
TemplateVariant isRelated() const TemplateVariant isRelated() const
{ {
return m_memberDef->isRelated(); return m_memberDef->isRelated();
...@@ -2617,7 +2805,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2617,7 +2805,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
FTextStream t(&result); FTextStream t(&result);
cg->writeGraph(t,BITMAP, cg->writeGraph(t,BITMAP,
g_globals.outputDir, g_globals.outputDir,
m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension,
relPathAsString(),TRUE,g_globals.dynSectionId relPathAsString(),TRUE,g_globals.dynSectionId
); );
g_globals.dynSectionId++; g_globals.dynSectionId++;
...@@ -2657,7 +2845,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2657,7 +2845,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
FTextStream t(&result); FTextStream t(&result);
cg->writeGraph(t,BITMAP, cg->writeGraph(t,BITMAP,
g_globals.outputDir, g_globals.outputDir,
m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension, g_globals.outputDir+portable_pathSeparator()+m_memberDef->getOutputFileBase()+Doxygen::htmlFileExtension,
relPathAsString(),TRUE,g_globals.dynSectionId relPathAsString(),TRUE,g_globals.dynSectionId
); );
g_globals.dynSectionId++; g_globals.dynSectionId++;
...@@ -2683,6 +2871,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2683,6 +2871,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
ScopedPtr<ArgumentListContext> arguments; ScopedPtr<ArgumentListContext> arguments;
ScopedPtr<MemberListContext> enumValues; ScopedPtr<MemberListContext> enumValues;
ScopedPtr<ClassContext> classDef; ScopedPtr<ClassContext> classDef;
ScopedPtr<ClassContext> anonymousType;
ScopedPtr<TemplateList> templateDecls; ScopedPtr<TemplateList> templateDecls;
ScopedPtr<TemplateVariant> paramDocs; ScopedPtr<TemplateVariant> paramDocs;
ScopedPtr<TemplateList> implements; ScopedPtr<TemplateList> implements;
...@@ -2694,6 +2883,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private> ...@@ -2694,6 +2883,7 @@ class MemberContext::Private : public DefinitionContext<MemberContext::Private>
ScopedPtr<MemberListContext> sourceRefBys; ScopedPtr<MemberListContext> sourceRefBys;
ScopedPtr<DotCallGraph> callGraph; ScopedPtr<DotCallGraph> callGraph;
ScopedPtr<DotCallGraph> callerGraph; ScopedPtr<DotCallGraph> callerGraph;
ScopedPtr<MemberContext> anonymousMember;
QList<MemberContext> implementedByMembers; QList<MemberContext> implementedByMembers;
ScopedPtr<TemplateList> reimplementedBy; ScopedPtr<TemplateList> reimplementedBy;
QList<MemberContext> reimplementedByMembers; QList<MemberContext> reimplementedByMembers;
...@@ -4328,6 +4518,74 @@ TemplateVariant ModuleTreeContext::get(const char *name) const ...@@ -4328,6 +4518,74 @@ TemplateVariant ModuleTreeContext::get(const char *name) const
return p->get(name); return p->get(name);
} }
//------------------------------------------------------------------------
//%% struct NavPathElem: list of examples page
//%% {
class NavPathElemContext::Private : public PropertyMapper
{
public:
Private(Definition *def) : m_def(def)
{
addProperty("isLinkable",this,&Private::isLinkable);
addProperty("fileName",this,&Private::fileName);
addProperty("anchor",this,&Private::anchor);
addProperty("text",this,&Private::text);
}
TemplateVariant isLinkable() const
{
return m_def->isLinkable();
}
TemplateVariant anchor() const
{
return m_def->anchor();
}
TemplateVariant fileName() const
{
return m_def->getOutputFileBase();
}
TemplateVariant text() const
{
Definition::DefType type = m_def->definitionType();
QCString text = m_def->localName();
if (type==Definition::TypeGroup)
{
text = ((const GroupDef*)m_def)->groupTitle();
}
else if (type==Definition::TypePage && !(((const PageDef*)this)->title().isEmpty()))
{
text = ((const PageDef*)m_def)->title();
}
else if (type==Definition::TypeClass)
{
if (text.right(2)=="-p")
{
text = text.left(text.length()-2);
}
}
return text;
}
private:
Definition *m_def;
};
//%% }
NavPathElemContext::NavPathElemContext(Definition *def)
{
p = new Private(def);
}
NavPathElemContext::~NavPathElemContext()
{
delete p;
}
TemplateVariant NavPathElemContext::get(const char *name) const
{
return p->get(name);
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
//%% struct ExampleList: list of examples page //%% struct ExampleList: list of examples page
...@@ -4518,11 +4776,14 @@ MemberListContext::MemberListContext(const MemberList *list) ...@@ -4518,11 +4776,14 @@ MemberListContext::MemberListContext(const MemberList *list)
p = new Private; p = new Private;
if (list) if (list)
{ {
bool details = list->listType()&MemberListType_detailedLists;
MemberListIterator mli(*list); MemberListIterator mli(*list);
MemberDef *md; MemberDef *md;
for (mli.toFirst();(md=mli.current());++mli) for (mli.toFirst();(md=mli.current());++mli)
{ {
if (md->isBriefSectionVisible()) if ((md->isBriefSectionVisible() && !details) ||
(md->isDetailedSectionLinkable() && details)
)
{ {
p->addMember(md); p->addMember(md);
} }
...@@ -4596,6 +4857,7 @@ class MemberInfoContext::Private : public PropertyMapper ...@@ -4596,6 +4857,7 @@ class MemberInfoContext::Private : public PropertyMapper
case ::Private: return "private"; case ::Private: return "private";
case ::Package: return "package"; case ::Package: return "package";
} }
return "";
} }
TemplateVariant virtualness() const TemplateVariant virtualness() const
{ {
...@@ -4605,6 +4867,7 @@ class MemberInfoContext::Private : public PropertyMapper ...@@ -4605,6 +4867,7 @@ class MemberInfoContext::Private : public PropertyMapper
case ::Virtual: return "virtual"; case ::Virtual: return "virtual";
case ::Pure: return "pure"; case ::Pure: return "pure";
} }
return "";
} }
TemplateVariant ambiguityScope() const TemplateVariant ambiguityScope() const
{ {
...@@ -4735,6 +4998,7 @@ class MemberGroupInfoContext::Private : public PropertyMapper ...@@ -4735,6 +4998,7 @@ class MemberGroupInfoContext::Private : public PropertyMapper
addProperty("anchor", this,&Private::groupAnchor); addProperty("anchor", this,&Private::groupAnchor);
addProperty("memberGroups", this,&Private::memberGroups); addProperty("memberGroups", this,&Private::memberGroups);
addProperty("docs", this,&Private::docs); addProperty("docs", this,&Private::docs);
addProperty("inherited", this,&Private::inherited);
} }
TemplateVariant members() const TemplateVariant members() const
{ {
...@@ -4775,6 +5039,10 @@ class MemberGroupInfoContext::Private : public PropertyMapper ...@@ -4775,6 +5039,10 @@ class MemberGroupInfoContext::Private : public PropertyMapper
} }
return *m_docs; return *m_docs;
} }
TemplateVariant inherited() const
{
return FALSE;
}
private: private:
Definition *m_def; Definition *m_def;
QCString m_relPath; QCString m_relPath;
...@@ -4879,6 +5147,7 @@ class MemberListInfoContext::Private : public PropertyMapper ...@@ -4879,6 +5147,7 @@ class MemberListInfoContext::Private : public PropertyMapper
{ {
public: public:
Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) : Private(Definition *def,const QCString &relPath,const MemberList *ml,const QCString &title,const QCString &subtitle) :
m_def(def),
m_memberListContext(ml), m_memberListContext(ml),
m_memberGroups(def,relPath,ml ? ml->getMemberGroupList() : 0), m_memberGroups(def,relPath,ml ? ml->getMemberGroupList() : 0),
m_memberList(ml), m_memberList(ml),
...@@ -4890,6 +5159,7 @@ class MemberListInfoContext::Private : public PropertyMapper ...@@ -4890,6 +5159,7 @@ class MemberListInfoContext::Private : public PropertyMapper
addProperty("subtitle", this,&Private::subtitle); addProperty("subtitle", this,&Private::subtitle);
addProperty("anchor", this,&Private::anchor); addProperty("anchor", this,&Private::anchor);
addProperty("memberGroups", this,&Private::memberGroups); addProperty("memberGroups", this,&Private::memberGroups);
addProperty("inherited", this,&Private::inherited);
} }
TemplateVariant members() const TemplateVariant members() const
{ {
...@@ -4905,18 +5175,38 @@ class MemberListInfoContext::Private : public PropertyMapper ...@@ -4905,18 +5175,38 @@ class MemberListInfoContext::Private : public PropertyMapper
} }
TemplateVariant anchor() const TemplateVariant anchor() const
{ {
return m_memberList->listTypeAsString(m_memberList->listType()); return MemberList::listTypeAsString(m_memberList->listType());
} }
TemplateVariant memberGroups() const TemplateVariant memberGroups() const
{ {
return &m_memberGroups; return &m_memberGroups;
} }
TemplateVariant inherited() const
{
if (!m_inherited && (m_memberList->listType()&MemberListType_detailedLists)==0 &&
m_def->definitionType()==Definition::TypeClass)
{
InheritedMemberInfoListContext *ctx = new InheritedMemberInfoListContext;
ctx->addMemberList((ClassDef*)m_def,m_memberList->listType(),m_title,FALSE);
m_inherited.reset(ctx);
}
if (m_inherited)
{
return m_inherited.get();
}
else
{
return TemplateVariant(FALSE);
}
}
private: private:
Definition *m_def;
MemberListContext m_memberListContext; MemberListContext m_memberListContext;
MemberGroupListContext m_memberGroups; MemberGroupListContext m_memberGroups;
const MemberList *m_memberList; const MemberList *m_memberList;
QCString m_title; QCString m_title;
QCString m_subtitle; QCString m_subtitle;
mutable ScopedPtr<InheritedMemberInfoListContext> m_inherited;
}; };
//%% } //%% }
...@@ -4939,6 +5229,243 @@ TemplateVariant MemberListInfoContext::get(const char *name) const ...@@ -4939,6 +5229,243 @@ TemplateVariant MemberListInfoContext::get(const char *name) const
//------------------------------------------------------------------------ //------------------------------------------------------------------------
//%% struct InheritedMemberInfo: inherited member information
//%% {
class InheritedMemberInfoContext::Private : public PropertyMapper
{
public:
Private(ClassDef *cd,MemberList *ml,const QCString &title)
: m_class(cd), m_memberList(ml), m_title(title)
{
addProperty("class", this,&Private::getClass);
addProperty("title", this,&Private::title);
addProperty("members", this,&Private::members);
addProperty("id", this,&Private::id);
addProperty("inheritedFrom", this,&Private::inheritedFrom);
}
~Private()
{
delete m_memberList;
}
TemplateVariant getClass() const
{
if (!m_classCtx)
{
m_classCtx.reset(new ClassContext(m_class));
}
return m_classCtx.get();
}
TemplateVariant title() const
{
return m_title;
}
TemplateVariant members() const
{
if (!m_memberListCtx)
{
m_memberListCtx.reset(new MemberListContext(m_memberList));
}
return m_memberListCtx.get();
}
TemplateVariant id() const
{
return substitute(MemberList::listTypeAsString(m_memberList->listType()),"-","_")+"_"+
stripPath(m_class->getOutputFileBase());
}
TemplateVariant inheritedFrom() const
{
if (m_inheritedFrom.count()==0)
{
m_inheritedFrom.append(title());
m_inheritedFrom.append(getClass());
}
return &m_inheritedFrom;
}
private:
ClassDef * m_class;
MemberList *m_memberList;
QCString m_title;
mutable ScopedPtr<ClassContext> m_classCtx;
mutable ScopedPtr<MemberListContext> m_memberListCtx;
mutable TemplateList m_inheritedFrom;
};
//%% }
InheritedMemberInfoContext::InheritedMemberInfoContext(ClassDef *cd,MemberList *ml,
const QCString &title)
{
p = new Private(cd,ml,title);
}
InheritedMemberInfoContext::~InheritedMemberInfoContext()
{
delete p;
}
TemplateVariant InheritedMemberInfoContext::get(const char *name) const
{
return p->get(name);
}
//------------------------------------------------------------------------
//%% list InheritedMemberList[InheritedMemberInfo] : list of inherited classes
class InheritedMemberInfoListContext::Private : public GenericNodeListContext<InheritedMemberInfoContext>
{
public:
void addMemberList(ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList)
{
if (ml)
{
MemberListIterator li(*ml);
MemberDef *md;
for (li.toFirst();(md=li.current());++li)
{
if (md->isBriefSectionVisible() && !md->isReimplementedBy(inheritedFrom))
{
combinedList->append(md);
}
}
}
}
void addMemberListIncludingGrouped(ClassDef *inheritedFrom,MemberList *ml,MemberList *combinedList)
{
if (ml)
{
addMemberList(inheritedFrom,ml,combinedList);
if (ml->getMemberGroupList())
{
MemberGroupListIterator mgli(*ml->getMemberGroupList());
MemberGroup *mg;
for (mgli.toFirst();(mg=mgli.current());++mgli)
{
addMemberList(inheritedFrom,mg->members(),combinedList);
}
}
}
}
void addMemberGroupsOfClass(ClassDef *inheritedFrom,
ClassDef *cd,MemberListType lt,MemberList *combinedList)
{
if (cd->getMemberGroupSDict())
{
MemberGroupSDict::Iterator mgli(*cd->getMemberGroupSDict());
MemberGroup *mg;
for (;(mg=mgli.current());++mgli)
{
if (mg->members() && (!mg->allMembersInSameSection() || !cd->subGrouping())) // group is in its own section
{
MemberListIterator li(*mg->members());
MemberDef *md;
for (li.toFirst();(md=li.current());++li)
{
if (lt==md->getSectionList(mg->parent())->listType() &&
!md->isReimplementedBy(inheritedFrom) &&
md->isBriefSectionVisible())
{
combinedList->append(md);
}
}
}
}
}
}
void addInheritedMembers(ClassDef *inheritedFrom,ClassDef *cd,MemberListType lt,
MemberListType lt1,int lt2,const QCString &title,bool additionalList)
{
int count = cd->countMembersIncludingGrouped(lt1,inheritedFrom,additionalList);
if (lt2!=-1) count += cd->countMembersIncludingGrouped((MemberListType)lt2,inheritedFrom,additionalList);
if (count>0)
{
MemberList *ml = cd->getMemberList(lt1);
MemberList *ml2 = lt2!=-1 ? cd->getMemberList((MemberListType)lt2) : 0;
MemberList *combinedList = new MemberList(lt);
addMemberListIncludingGrouped(inheritedFrom,ml,combinedList);
addMemberListIncludingGrouped(inheritedFrom,ml2,combinedList);
addMemberGroupsOfClass(inheritedFrom,cd,lt,combinedList);
if (lt2!=-1) addMemberGroupsOfClass(inheritedFrom,cd,(MemberListType)lt2,combinedList);
append(new InheritedMemberInfoContext(cd,combinedList,title));
}
}
void findInheritedMembers(ClassDef *inheritedFrom,ClassDef *cd,MemberListType lt,
int lt2, const QCString &title,bool additionalList,
QPtrDict<void> *visitedClasses)
{
if (cd->baseClasses())
{
BaseClassListIterator it(*cd->baseClasses());
BaseClassDef *ibcd;
for (it.toFirst();(ibcd=it.current());++it)
{
ClassDef *icd=ibcd->classDef;
if (icd->isLinkable())
{
int lt1,lt3;
convertProtectionLevel(lt,ibcd->prot,&lt1,&lt3);
if (lt2==-1 && lt3!=-1)
{
lt2=lt3;
}
if (visitedClasses->find(icd)==0)
{
visitedClasses->insert(icd,icd); // guard for multiple virtual inheritance
if (lt1!=-1)
{
// add member info for members of cd with list type lt
addInheritedMembers(inheritedFrom,icd,lt,(MemberListType)lt1,lt2,title,additionalList);
// recurse down the inheritance tree
findInheritedMembers(inheritedFrom,icd,(MemberListType)lt1,lt2,title,additionalList,visitedClasses);
}
}
}
}
}
}
};
InheritedMemberInfoListContext::InheritedMemberInfoListContext()
{
p = new Private;
}
void InheritedMemberInfoListContext::addMemberList(
ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList)
{
QPtrDict<void> visited(17);
bool memberInSection = cd->countMembersIncludingGrouped(lt,cd,FALSE);
bool show = (additionalList && !memberInSection) || // inherited member to show in the additional inherited members list
(!additionalList && memberInSection); // inherited member to show in a member list of the class
//printf("%s:%s show=%d\n",cd->name().data(),MemberList::listTypeAsString(lt).data(),show);
if (show)
{
p->findInheritedMembers(cd,cd,lt,-1,title,additionalList,&visited);
}
}
InheritedMemberInfoListContext::~InheritedMemberInfoListContext()
{
delete p;
}
// TemplateListIntf
int InheritedMemberInfoListContext::count() const
{
return p->count();
}
TemplateVariant InheritedMemberInfoListContext::at(int index) const
{
return p->at(index);
}
TemplateListIntf::ConstIterator *InheritedMemberInfoListContext::createIterator() const
{
return p->createIterator();
}
//------------------------------------------------------------------------
//%% struct Argument: parameter information //%% struct Argument: parameter information
//%% { //%% {
class ArgumentContext::Private : public PropertyMapper class ArgumentContext::Private : public PropertyMapper
......
...@@ -614,6 +614,23 @@ class ExampleListContext : public TemplateStructIntf ...@@ -614,6 +614,23 @@ class ExampleListContext : public TemplateStructIntf
Private *p; Private *p;
}; };
//----------------------------------------------------
class NavPathElemContext : public TemplateStructIntf
{
public:
NavPathElemContext(Definition *def);
~NavPathElemContext();
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
private:
class Private;
Private *p;
};
//---------------------------------------------------- //----------------------------------------------------
class InheritanceNodeContext : public TemplateStructIntf class InheritanceNodeContext : public TemplateStructIntf
...@@ -741,6 +758,41 @@ class MemberInfoContext : public TemplateStructIntf ...@@ -741,6 +758,41 @@ class MemberInfoContext : public TemplateStructIntf
//---------------------------------------------------- //----------------------------------------------------
class InheritedMemberInfoContext : public TemplateStructIntf
{
public:
InheritedMemberInfoContext(ClassDef *cd,MemberList *ml,const QCString &title);
~InheritedMemberInfoContext();
// TemplateStructIntf methods
virtual TemplateVariant get(const char *name) const;
private:
class Private;
Private *p;
};
//----------------------------------------------------
class InheritedMemberInfoListContext : public TemplateListIntf
{
public:
InheritedMemberInfoListContext();
void addMemberList(ClassDef *cd,MemberListType lt,const QCString &title,bool additionalList=TRUE);
~InheritedMemberInfoListContext();
// TemplateListIntf
virtual int count() const;
virtual TemplateVariant at(int index) const;
virtual TemplateListIntf::ConstIterator *createIterator() const;
private:
class Private;
Private *p;
};
//----------------------------------------------------
class AllMembersListContext : public TemplateListIntf class AllMembersListContext : public TemplateListIntf
{ {
public: public:
......
...@@ -11427,6 +11427,8 @@ void generateOutput() ...@@ -11427,6 +11427,8 @@ void generateOutput()
g_s.end(); g_s.end();
} }
if (g_useOutputTemplate) generateOutputViaTemplate();
if (generateRtf) if (generateRtf)
{ {
g_s.begin("Combining RTF output...\n"); g_s.begin("Combining RTF output...\n");
...@@ -11506,7 +11508,6 @@ void generateOutput() ...@@ -11506,7 +11508,6 @@ void generateOutput()
msg("finished...\n"); msg("finished...\n");
} }
if (g_useOutputTemplate) generateOutputViaTemplate();
/************************************************************************** /**************************************************************************
* Start cleaning up * * Start cleaning up *
......
...@@ -514,7 +514,7 @@ void FileDef::writeSummaryLinks(OutputList &ol) ...@@ -514,7 +514,7 @@ void FileDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type); MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible()) if (ml && ml->declVisible())
{ {
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first); ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE; first=FALSE;
} }
} }
......
...@@ -913,7 +913,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol) ...@@ -913,7 +913,7 @@ void GroupDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type); MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible()) if (ml && ml->declVisible())
{ {
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first); ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE; first=FALSE;
} }
} }
......
...@@ -1409,9 +1409,6 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -1409,9 +1409,6 @@ void MemberDef::writeDeclaration(OutputList &ol,
// are explicitly grouped. // are explicitly grouped.
if (!inGroup && m_impl->mtype==MemberType_EnumValue) return; if (!inGroup && m_impl->mtype==MemberType_EnumValue) return;
// hide members whose brief section should not be visible
//if (!isBriefSectionVisible()) return;
Definition *d=0; Definition *d=0;
ASSERT (cd!=0 || nd!=0 || fd!=0 || gd!=0); // member should belong to something ASSERT (cd!=0 || nd!=0 || fd!=0 || gd!=0); // member should belong to something
if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd; if (cd) d=cd; else if (nd) d=nd; else if (fd) d=fd; else d=gd;
...@@ -1421,14 +1418,6 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -1421,14 +1418,6 @@ void MemberDef::writeDeclaration(OutputList &ol,
QCString cname = d->name(); QCString cname = d->name();
QCString cdname = d->displayName(); QCString cdname = d->displayName();
QCString cfname = getOutputFileBase(); QCString cfname = getOutputFileBase();
//QCString osname = cname;
// in case of class members that are put in a group the name of the outerscope
// differs from the cname.
//if (getOuterScope()) osname=getOuterScope()->name();
//HtmlHelp *htmlHelp=0;
//bool hasHtmlHelp = Config_getBool("GENERATE_HTML") && Config_getBool("GENERATE_HTMLHELP");
//if (hasHtmlHelp) htmlHelp = HtmlHelp::getInstance();
// search for the last anonymous scope in the member type // search for the last anonymous scope in the member type
ClassDef *annoClassDef=getClassDefOfAnonymousType(); ClassDef *annoClassDef=getClassDefOfAnonymousType();
...@@ -1445,15 +1434,27 @@ void MemberDef::writeDeclaration(OutputList &ol, ...@@ -1445,15 +1434,27 @@ void MemberDef::writeDeclaration(OutputList &ol,
// If there is no detailed description we need to write the anchor here. // If there is no detailed description we need to write the anchor here.
bool detailsVisible = isDetailedSectionLinkable(); bool detailsVisible = isDetailedSectionLinkable();
if (!detailsVisible && !m_impl->annMemb) if (!detailsVisible)
{ {
QCString doxyName=name().copy(); QCString doxyArgs=argsString();
if (!cname.isEmpty()) if (m_impl->annMemb)
{ {
doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage())); QCString doxyName=m_impl->annMemb->name();
if (!cname.isEmpty())
{
doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage()));
}
ol.startDoxyAnchor(cfname,cname,m_impl->annMemb->anchor(),doxyName,doxyArgs);
}
else
{
QCString doxyName=name();
if (!cname.isEmpty())
{
doxyName.prepend(cdname+getLanguageSpecificSeparator(getLanguage()));
}
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName,doxyArgs);
} }
QCString doxyArgs=argsString();
ol.startDoxyAnchor(cfname,cname,anchor(),doxyName,doxyArgs);
ol.pushGeneratorState(); ol.pushGeneratorState();
ol.disable(OutputGenerator::Man); ol.disable(OutputGenerator::Man);
...@@ -2388,6 +2389,21 @@ QCString MemberDef::displayDefinition() const ...@@ -2388,6 +2389,21 @@ QCString MemberDef::displayDefinition() const
ldef=ldef.mid(2); ldef=ldef.mid(2);
} }
} }
static QRegExp r("@[0-9]+");
int l,i=r.match(ldef,0,&l);
if (i!=-1) // replace anonymous parts with { ... }
{
int si=ldef.find(' '),pi,ei=i+l;
if (si==-1) si=0;
while ((pi=r.match(ldef,i+l,&l))!=-1)
{
i=pi;
ei=i+l;
}
int ni=ldef.find("::",si);
if (ni>=ei) ei=ni+2;
ldef = ldef.left(si) + " { ... } " + ldef.right(ldef.length()-ei);
}
ClassDef *cd=getClassDef(); ClassDef *cd=getClassDef();
if (cd && cd->isObjectiveC()) if (cd && cd->isObjectiveC())
{ {
...@@ -2407,9 +2423,9 @@ QCString MemberDef::displayDefinition() const ...@@ -2407,9 +2423,9 @@ QCString MemberDef::displayDefinition() const
{ {
ldef=ldef.left(dp+1); ldef=ldef.left(dp+1);
} }
int l=ldef.length(); l=ldef.length();
//printf("start >%s<\n",ldef.data()); //printf("start >%s<\n",ldef.data());
int i=l-1; i=l-1;
while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--; while (i>=0 && (isId(ldef.at(i)) || ldef.at(i)==':')) i--;
while (i>=0 && isspace((uchar)ldef.at(i))) i--; while (i>=0 && isspace((uchar)ldef.at(i))) i--;
if (i>0) if (i>0)
...@@ -2483,8 +2499,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol, ...@@ -2483,8 +2499,8 @@ void MemberDef::writeDocumentation(MemberList *ml,OutputList &ol,
bool inFile = container->definitionType()==Definition::TypeFile; bool inFile = container->definitionType()==Definition::TypeFile;
bool hasDocs = isDetailedSectionVisible(inGroup,inFile); bool hasDocs = isDetailedSectionVisible(inGroup,inFile);
//printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d\n", //printf("MemberDef::writeDocumentation(): name=`%s' hasDocs=`%d' containerType=%d inGroup=%d sectionLinkable=%d\n",
// name().data(),hasDocs,container->definitionType(),inGroup); // name().data(),hasDocs,container->definitionType(),inGroup,isDetailedSectionLinkable());
if ( !hasDocs ) return; if ( !hasDocs ) return;
if (isEnumValue() && !showEnumValues) return; if (isEnumValue() && !showEnumValues) return;
...@@ -4656,6 +4672,11 @@ void MemberDef::setFromAnonymousMember(MemberDef *m) ...@@ -4656,6 +4672,11 @@ void MemberDef::setFromAnonymousMember(MemberDef *m)
m_impl->annMemb=m; m_impl->annMemb=m;
} }
MemberDef *MemberDef::fromAnonymousMember() const
{
return m_impl->annMemb;
}
void MemberDef::setTemplateMaster(MemberDef *mt) void MemberDef::setTemplateMaster(MemberDef *mt)
{ {
m_impl->templateMaster=mt; m_impl->templateMaster=mt;
......
...@@ -217,6 +217,7 @@ class MemberDef : public Definition ...@@ -217,6 +217,7 @@ class MemberDef : public Definition
bool fromAnonymousScope() const; bool fromAnonymousScope() const;
bool anonymousDeclShown() const; bool anonymousDeclShown() const;
MemberDef *fromAnonymousMember() const;
// callgraph related members // callgraph related members
bool hasCallGraph() const; bool hasCallGraph() const;
......
...@@ -878,7 +878,7 @@ void MemberList::setNeedsSorting(bool b) ...@@ -878,7 +878,7 @@ void MemberList::setNeedsSorting(bool b)
m_needsSorting = b; m_needsSorting = b;
} }
QCString MemberList::listTypeAsString(MemberListType type) const QCString MemberList::listTypeAsString(MemberListType type)
{ {
switch(type) switch(type)
{ {
......
...@@ -36,7 +36,7 @@ class MemberList : public QList<MemberDef> ...@@ -36,7 +36,7 @@ class MemberList : public QList<MemberDef>
MemberList(MemberListType lt); MemberList(MemberListType lt);
~MemberList(); ~MemberList();
MemberListType listType() const { return m_listType; } MemberListType listType() const { return m_listType; }
QCString listTypeAsString(MemberListType type) const; static QCString listTypeAsString(MemberListType type);
bool insert(uint index,const MemberDef *md); bool insert(uint index,const MemberDef *md);
void inSort(const MemberDef *md); void inSort(const MemberDef *md);
void append(const MemberDef *md); void append(const MemberDef *md);
......
...@@ -430,7 +430,7 @@ void NamespaceDef::writeSummaryLinks(OutputList &ol) ...@@ -430,7 +430,7 @@ void NamespaceDef::writeSummaryLinks(OutputList &ol)
MemberList * ml = getMemberList(lmd->type); MemberList * ml = getMemberList(lmd->type);
if (ml && ml->declVisible()) if (ml && ml->declVisible())
{ {
ol.writeSummaryLink(0,ml->listTypeAsString(ml->listType()),lmd->title(lang),first); ol.writeSummaryLink(0,MemberList::listTypeAsString(ml->listType()),lmd->title(lang),first);
first=FALSE; first=FALSE;
} }
} }
......
...@@ -1558,6 +1558,7 @@ class TemplateImpl : public TemplateNode, public Template ...@@ -1558,6 +1558,7 @@ class TemplateImpl : public TemplateNode, public Template
{ {
public: public:
TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data); TemplateImpl(TemplateEngine *e,const QCString &name,const QCString &data);
~TemplateImpl() {}
void render(FTextStream &ts, TemplateContext *c); void render(FTextStream &ts, TemplateContext *c);
TemplateEngine *engine() const { return m_engine; } TemplateEngine *engine() const { return m_engine; }
...@@ -1867,6 +1868,58 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf> ...@@ -1867,6 +1868,58 @@ class TemplateNodeIf : public TemplateNodeCreator<TemplateNodeIf>
TemplateNodeList m_falseNodes; TemplateNodeList m_falseNodes;
}; };
//----------------------------------------------------------
/** @brief Class representing a 'for' tag in a template */
class TemplateNodeRepeat : public TemplateNodeCreator<TemplateNodeRepeat>
{
public:
TemplateNodeRepeat(TemplateParser *parser,TemplateNode *parent,int line,const QCString &data)
: TemplateNodeCreator<TemplateNodeRepeat>(parser,parent,line)
{
TRACE(("{TemplateNodeRepeat(%s)\n",data.data()));
ExpressionParser expParser(parser->templateName(),line);
m_expr = expParser.parseVariable(data);
QStrList stopAt;
stopAt.append("endrepeat");
parser->parse(this,line,stopAt,m_repeatNodes);
parser->removeNextToken(); // skip over endrepeat
TRACE(("}TemplateNodeRepeat(%s)\n",data.data()));
}
~TemplateNodeRepeat()
{
delete m_expr;
}
void render(FTextStream &ts, TemplateContext *c)
{
dynamic_cast<TemplateContextImpl*>(c)->setLocation(m_templateName,m_line);
TemplateVariant v;
if (m_expr && (v=m_expr->resolve(c)).type()==TemplateVariant::Integer)
{
int i, n = v.toInt();
for (i=0;i<n;i++)
{
TemplateStruct s;
s.set("counter0", (int)i);
s.set("counter", (int)(i+1));
s.set("revcounter", (int)(n-i));
s.set("revcounter0", (int)(n-i-1));
s.set("first",i==0);
s.set("last", i==n-1);
c->set("repeatloop",&s);
// render all items for this iteration of the loop
m_repeatNodes.render(ts,c);
}
}
else // simple type...
{
warn(m_templateName,m_line,"for requires a variable of list type!");
}
}
private:
TemplateNodeList m_repeatNodes;
ExprAst *m_expr;
};
//---------------------------------------------------------- //----------------------------------------------------------
/** @brief Class representing a 'for' tag in a template */ /** @brief Class representing a 'for' tag in a template */
...@@ -2165,7 +2218,8 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> ...@@ -2165,7 +2218,8 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend>
TemplateImpl *t = getTemplate(); TemplateImpl *t = getTemplate();
if (t) if (t)
{ {
TemplateImpl *baseTemplate = dynamic_cast<TemplateImpl*>(t->engine()->loadByName(extendFile)); Template *bt = t->engine()->loadByName(extendFile);
TemplateImpl *baseTemplate = bt ? dynamic_cast<TemplateImpl*>(bt) : 0;
if (baseTemplate) if (baseTemplate)
{ {
// fill block context // fill block context
...@@ -2194,7 +2248,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend> ...@@ -2194,7 +2248,7 @@ class TemplateNodeExtend : public TemplateNodeCreator<TemplateNodeExtend>
// clean up // clean up
bc->clear(); bc->clear();
delete baseTemplate; //delete baseTemplate;
} }
else else
{ {
...@@ -2242,7 +2296,8 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude> ...@@ -2242,7 +2296,8 @@ class TemplateNodeInclude : public TemplateNodeCreator<TemplateNodeInclude>
TemplateImpl *t = getTemplate(); TemplateImpl *t = getTemplate();
if (t) if (t)
{ {
TemplateImpl *incTemplate = dynamic_cast<TemplateImpl*>(t->engine()->loadByName(includeFile)); Template *it = t->engine()->loadByName(includeFile);
TemplateImpl *incTemplate = it ? dynamic_cast<TemplateImpl*>(it) : 0;
if (incTemplate) if (incTemplate)
{ {
incTemplate->render(ts,c); incTemplate->render(ts,c);
...@@ -2324,7 +2379,8 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> ...@@ -2324,7 +2379,8 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate>
TemplateImpl *t = getTemplate(); TemplateImpl *t = getTemplate();
if (t) if (t)
{ {
TemplateImpl *createTemplate = dynamic_cast<TemplateImpl*>(t->engine()->loadByName(templateFile)); Template *ct = t->engine()->loadByName(templateFile);
TemplateImpl *createTemplate = ct ? dynamic_cast<TemplateImpl*>(ct) : 0;
if (createTemplate) if (createTemplate)
{ {
if (!ci->outputDirectory().isEmpty()) if (!ci->outputDirectory().isEmpty())
...@@ -2336,7 +2392,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate> ...@@ -2336,7 +2392,7 @@ class TemplateNodeCreate : public TemplateNodeCreator<TemplateNodeCreate>
{ {
FTextStream ts(&f); FTextStream ts(&f);
createTemplate->render(ts,c); createTemplate->render(ts,c);
delete createTemplate; //delete createTemplate;
} }
else else
{ {
...@@ -2729,6 +2785,9 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers> ...@@ -2729,6 +2785,9 @@ class TemplateNodeMarkers : public TemplateNodeCreator<TemplateNodeMarkers>
for (it->toFirst(); (it->current(var)) && i<entryIndex; it->toNext(),i++) {} for (it->toFirst(); (it->current(var)) && i<entryIndex; it->toNext(),i++) {}
if (ok && i==entryIndex) // found element if (ok && i==entryIndex) // found element
{ {
TemplateStruct s;
s.set("id",(int)i);
c->set("markers",&s);
c->set(m_var,var); // define local variable to hold element of list type c->set(m_var,var); // define local variable to hold element of list type
bool wasSpaceless = ci->spacelessEnabled(); bool wasSpaceless = ci->spacelessEnabled();
ci->enableSpaceless(TRUE); ci->enableSpaceless(TRUE);
...@@ -2824,6 +2883,7 @@ static TemplateNodeFactory::AutoRegister<TemplateNodeBlock> autoRefBlock("bl ...@@ -2824,6 +2883,7 @@ static TemplateNodeFactory::AutoRegister<TemplateNodeBlock> autoRefBlock("bl
static TemplateNodeFactory::AutoRegister<TemplateNodeCycle> autoRefCycle("cycle"); static TemplateNodeFactory::AutoRegister<TemplateNodeCycle> autoRefCycle("cycle");
static TemplateNodeFactory::AutoRegister<TemplateNodeExtend> autoRefExtend("extend"); static TemplateNodeFactory::AutoRegister<TemplateNodeExtend> autoRefExtend("extend");
static TemplateNodeFactory::AutoRegister<TemplateNodeCreate> autoRefCreate("create"); static TemplateNodeFactory::AutoRegister<TemplateNodeCreate> autoRefCreate("create");
static TemplateNodeFactory::AutoRegister<TemplateNodeRepeat> autoRefRepeat("repeat");
static TemplateNodeFactory::AutoRegister<TemplateNodeInclude> autoRefInclude("include"); static TemplateNodeFactory::AutoRegister<TemplateNodeInclude> autoRefInclude("include");
static TemplateNodeFactory::AutoRegister<TemplateNodeMarkers> autoRefMarkers("markers"); static TemplateNodeFactory::AutoRegister<TemplateNodeMarkers> autoRefMarkers("markers");
static TemplateNodeFactory::AutoRegister<TemplateNodeSpaceless> autoRefSpaceless("spaceless"); static TemplateNodeFactory::AutoRegister<TemplateNodeSpaceless> autoRefSpaceless("spaceless");
...@@ -3186,7 +3246,8 @@ void TemplateParser::parse( ...@@ -3186,7 +3246,8 @@ void TemplateParser::parse(
command=="endif" || command=="endfor" || command=="endif" || command=="endfor" ||
command=="endblock" || command=="endwith" || command=="endblock" || command=="endwith" ||
command=="endrecursetree" || command=="endspaceless" || command=="endrecursetree" || command=="endspaceless" ||
command=="endmarkers" || command=="endmsg") command=="endmarkers" || command=="endmsg" ||
command=="endrepeat")
{ {
warn(m_templateName,tok->line,"Found tag '%s' without matching start tag",command.data()); warn(m_templateName,tok->line,"Found tag '%s' without matching start tag",command.data());
} }
...@@ -3288,13 +3349,45 @@ void TemplateImpl::render(FTextStream &ts, TemplateContext *c) ...@@ -3288,13 +3349,45 @@ void TemplateImpl::render(FTextStream &ts, TemplateContext *c)
class TemplateEngine::Private class TemplateEngine::Private
{ {
public: public:
Private() { templates.setAutoDelete(TRUE); } Private(TemplateEngine *engine) : m_templateCache(17), m_engine(engine)
QList<Template> templates; { m_templateCache.setAutoDelete(TRUE); }
Template *loadByName(const QCString &fileName) const
{
Template *templ = m_templateCache.find(fileName);
if (templ==0)
{
QFile f(fileName);
if (f.open(IO_ReadOnly))
{
uint size=f.size();
char *data = new char[size+1];
if (data)
{
data[size]=0;
if (f.readBlock(data,f.size()))
{
templ = new TemplateImpl(m_engine,fileName,data);
m_templateCache.insert(fileName,templ);
}
delete[] data;
}
}
else
{
err("Cound not open template file %s\n",fileName.data());
}
}
return templ;
}
private:
mutable QDict<Template> m_templateCache;
TemplateEngine *m_engine;
}; };
TemplateEngine::TemplateEngine() TemplateEngine::TemplateEngine()
{ {
p = new Private; p = new Private(this);
} }
TemplateEngine::~TemplateEngine() TemplateEngine::~TemplateEngine()
...@@ -3307,32 +3400,8 @@ TemplateContext *TemplateEngine::createContext() const ...@@ -3307,32 +3400,8 @@ TemplateContext *TemplateEngine::createContext() const
return new TemplateContextImpl; return new TemplateContextImpl;
} }
Template *TemplateEngine::newTemplate(const QCString &name,const QCString &data)
{
Template *t = new TemplateImpl(this,name,data);
p->templates.append(t);
return t;
}
Template *TemplateEngine::loadByName(const QCString &fileName) Template *TemplateEngine::loadByName(const QCString &fileName)
{ {
Template *t=0; return p->loadByName(fileName);
QFile f(fileName);
if (f.open(IO_ReadOnly))
{
uint size=f.size();
char *data = new char[size+1];
if (data)
{
data[size]=0;
if (f.readBlock(data,f.size()))
{
t = new TemplateImpl(this,fileName,data);
}
delete[] data;
}
}
return t;
} }
...@@ -443,13 +443,6 @@ class TemplateEngine ...@@ -443,13 +443,6 @@ class TemplateEngine
*/ */
TemplateContext *createContext() const; TemplateContext *createContext() const;
/** Creates a new template whose contents are given by a string.
* @param[in] name The name of the template.
* @param[in] data The contents of the template.
* @return the new template, the caller will be the owner.
*/
Template *newTemplate(const QCString &name,const QCString &data);
/** Creates a new template whole contents are in a file. /** Creates a new template whole contents are in a file.
* @param[in] fileName The name of the file containing the * @param[in] fileName The name of the file containing the
* template data * template data
......
...@@ -8080,3 +8080,193 @@ QCString extractDirection(QCString &docs) ...@@ -8080,3 +8080,193 @@ QCString extractDirection(QCString &docs)
return QCString(); return QCString();
} }
//-----------------------------------------------------------
/** Computes for a given list type \a inListType, which are the
* the corresponding list type(s) in the base class that are to be
* added to this list.
*
* So for public inheritance, the mapping is 1-1, so outListType1=inListType
* Private members are to be hidden completely.
*
* For protected inheritance, both protected and public members of the
* base class should be joined in the protected member section.
*
* For private inheritance, both protected and public members of the
* base class should be joined in the private member section.
*/
void convertProtectionLevel(
MemberListType inListType,
Protection inProt,
int *outListType1,
int *outListType2
)
{
static bool extractPrivate = Config_getBool("EXTRACT_PRIVATE");
// default representing 1-1 mapping
*outListType1=inListType;
*outListType2=-1;
if (inProt==Public)
{
switch (inListType) // in the private section of the derived class,
// the private section of the base class should not
// be visible
{
case MemberListType_priMethods:
case MemberListType_priStaticMethods:
case MemberListType_priSlots:
case MemberListType_priAttribs:
case MemberListType_priStaticAttribs:
case MemberListType_priTypes:
*outListType1=-1;
*outListType2=-1;
break;
default:
break;
}
}
else if (inProt==Protected) // Protected inheritance
{
switch (inListType) // in the protected section of the derived class,
// both the public and protected members are shown
// as protected
{
case MemberListType_pubMethods:
case MemberListType_pubStaticMethods:
case MemberListType_pubSlots:
case MemberListType_pubAttribs:
case MemberListType_pubStaticAttribs:
case MemberListType_pubTypes:
case MemberListType_priMethods:
case MemberListType_priStaticMethods:
case MemberListType_priSlots:
case MemberListType_priAttribs:
case MemberListType_priStaticAttribs:
case MemberListType_priTypes:
*outListType1=-1;
*outListType2=-1;
break;
case MemberListType_proMethods:
*outListType2=MemberListType_pubMethods;
break;
case MemberListType_proStaticMethods:
*outListType2=MemberListType_pubStaticMethods;
break;
case MemberListType_proSlots:
*outListType2=MemberListType_pubSlots;
break;
case MemberListType_proAttribs:
*outListType2=MemberListType_pubAttribs;
break;
case MemberListType_proStaticAttribs:
*outListType2=MemberListType_pubStaticAttribs;
break;
case MemberListType_proTypes:
*outListType2=MemberListType_pubTypes;
break;
default:
break;
}
}
else if (inProt==Private)
{
switch (inListType) // in the private section of the derived class,
// both the public and protected members are shown
// as private
{
case MemberListType_pubMethods:
case MemberListType_pubStaticMethods:
case MemberListType_pubSlots:
case MemberListType_pubAttribs:
case MemberListType_pubStaticAttribs:
case MemberListType_pubTypes:
case MemberListType_proMethods:
case MemberListType_proStaticMethods:
case MemberListType_proSlots:
case MemberListType_proAttribs:
case MemberListType_proStaticAttribs:
case MemberListType_proTypes:
*outListType1=-1;
*outListType2=-1;
break;
case MemberListType_priMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubMethods;
*outListType2=MemberListType_proMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticMethods:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticMethods;
*outListType2=MemberListType_proStaticMethods;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priSlots:
if (extractPrivate)
{
*outListType1=MemberListType_pubSlots;
*outListType1=MemberListType_proSlots;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubAttribs;
*outListType2=MemberListType_proAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priStaticAttribs:
if (extractPrivate)
{
*outListType1=MemberListType_pubStaticAttribs;
*outListType2=MemberListType_proStaticAttribs;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
case MemberListType_priTypes:
if (extractPrivate)
{
*outListType1=MemberListType_pubTypes;
*outListType2=MemberListType_proTypes;
}
else
{
*outListType1=-1;
*outListType2=-1;
}
break;
default:
break;
}
}
//printf("convertProtectionLevel(type=%d prot=%d): %d,%d\n",
// inListType,inProt,*outListType1,*outListType2);
}
...@@ -448,5 +448,12 @@ uint getUtf8CodeToUpper( const QCString& s, int idx ); ...@@ -448,5 +448,12 @@ uint getUtf8CodeToUpper( const QCString& s, int idx );
QCString extractDirection(QCString &docs); QCString extractDirection(QCString &docs);
void convertProtectionLevel(
MemberListType inListType,
Protection inProt,
int *outListType1,
int *outListType2
);
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment