summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/clangparser.cpp2
-rw-r--r--src/classdef.cpp123
-rw-r--r--src/classdef.h16
-rw-r--r--src/classlist.cpp4
-rw-r--r--src/code.l40
-rw-r--r--src/context.cpp42
-rw-r--r--src/definition.cpp111
-rw-r--r--src/definition.h23
-rw-r--r--src/definitionimpl.h458
-rw-r--r--src/dirdef.cpp32
-rw-r--r--src/dirdef.h10
-rw-r--r--src/docparser.cpp20
-rw-r--r--src/docsets.cpp58
-rw-r--r--src/dotgfxhierarchytable.cpp2
-rw-r--r--src/doxygen.cpp235
-rw-r--r--src/filedef.cpp38
-rw-r--r--src/filedef.h11
-rw-r--r--src/fortrancode.l4
-rw-r--r--src/ftvhelp.cpp12
-rw-r--r--src/groupdef.cpp45
-rw-r--r--src/groupdef.h10
-rw-r--r--src/index.cpp2
-rw-r--r--src/memberdef.cpp125
-rw-r--r--src/memberdef.h21
-rw-r--r--src/membergroup.cpp4
-rw-r--r--src/memberlist.cpp35
-rw-r--r--src/namespacedef.cpp94
-rw-r--r--src/namespacedef.h22
-rw-r--r--src/pagedef.cpp43
-rw-r--r--src/pagedef.h9
-rw-r--r--src/pycode.l20
-rw-r--r--src/searchindex.cpp30
-rw-r--r--src/sqlite3gen.cpp2
-rw-r--r--src/symbolresolver.cpp28
-rw-r--r--src/symbolresolver.h2
-rw-r--r--src/tooltip.cpp2
-rw-r--r--src/util.cpp19
-rw-r--r--src/util.h4
-rw-r--r--src/vhdlcode.l2
-rw-r--r--src/vhdldocgen.cpp10
40 files changed, 1169 insertions, 601 deletions
diff --git a/src/clangparser.cpp b/src/clangparser.cpp
index 1f52fb4..7e97473 100644
--- a/src/clangparser.cpp
+++ b/src/clangparser.cpp
@@ -696,7 +696,7 @@ void ClangTUParser::linkIdentifier(CodeOutputInterface &ol,FileDef *fd,
p->currentMemberDef && d->definitionType()==Definition::TypeMember &&
(p->currentMemberDef!=d || p->currentLine<line)) // avoid self-reference
{
- addDocCrossReference(MemberDef::make_mutable(p->currentMemberDef),MemberDef::make_mutable(dynamic_cast<MemberDef *>(d)));
+ addDocCrossReference(toMemberDefMutable(p->currentMemberDef),toMemberDefMutable(d));
}
writeMultiLineCodeLink(ol,fd,line,column,d,text);
}
diff --git a/src/classdef.cpp b/src/classdef.cpp
index cb98622..45d57ed 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -56,7 +56,7 @@
/** Implementation of the ClassDef interface */
-class ClassDefImpl : public DefinitionImpl, public ClassDefMutable
+class ClassDefImpl : public DefinitionMixin<ClassDefMutable>
{
public:
ClassDefImpl(const char *fileName,int startLine,int startColumn,
@@ -283,14 +283,15 @@ ClassDefMutable *createClassDef(
}
//-----------------------------------------------------------------------------
-class ClassDefAliasImpl : public DefinitionAliasImpl, public ClassDef
+class ClassDefAliasImpl : public DefinitionAliasMixin<ClassDef>
{
public:
- ClassDefAliasImpl(const Definition *newScope,const ClassDef *cd) : DefinitionAliasImpl(newScope,cd) {}
+ ClassDefAliasImpl(const Definition *newScope,const ClassDef *cd)
+ : DefinitionAliasMixin(newScope,cd) {}
virtual ~ClassDefAliasImpl() {}
virtual DefType definitionType() const { return TypeClass; }
- const ClassDef *getCdAlias() const { return dynamic_cast<const ClassDef*>(getAlias()); }
+ const ClassDef *getCdAlias() const { return toClassDef(getAlias()); }
virtual ClassDef *resolveAlias() { return const_cast<ClassDef*>(getCdAlias()); }
virtual QCString getOutputFileBase() const
@@ -726,7 +727,7 @@ ClassDefImpl::ClassDefImpl(
const char *nm,CompoundType ct,
const char *lref,const char *fName,
bool isSymbol,bool isJavaEnum)
- : DefinitionImpl(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol)
+ : DefinitionMixin(defFileName,defLine,defColumn,removeRedundantWhiteSpace(nm),0,0,isSymbol)
{
m_visited=FALSE;
setReference(lref);
@@ -1217,7 +1218,7 @@ void ClassDefImpl::insertUsedFile(FileDef *fd)
ClassDef *cd;
for (qdi.toFirst();(cd=qdi.current());++qdi)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->insertUsedFile(fd);
@@ -1298,7 +1299,7 @@ static void searchTemplateSpecs(/*in*/ const Definition *d,
{
searchTemplateSpecs(d->getOuterScope(),result,name,lang);
}
- const ClassDef *cd=dynamic_cast<const ClassDef *>(d);
+ const ClassDef *cd=toClassDef(d);
if (!name.isEmpty()) name+="::";
QCString clName = d->localName();
if (/*clName.right(2)=="-g" ||*/ clName.right(2)=="-p")
@@ -2851,7 +2852,7 @@ void ClassDefImpl::writeDocumentationForInnerClasses(OutputList &ol) const
ClassDef *innerCd;
for (cli.toFirst();(innerCd=cli.current());++cli)
{
- ClassDefMutable *innerCdm = ClassDef::make_mutable(innerCd);
+ ClassDefMutable *innerCdm = toClassDefMutable(innerCd);
if (innerCdm)
{
if (
@@ -3398,7 +3399,7 @@ bool ClassDefImpl::isVisibleInHierarchy() const
bool ClassDefImpl::hasDocumentation() const
{
- return DefinitionImpl::hasDocumentation();
+ return DefinitionMixin::hasDocumentation();
}
//----------------------------------------------------------------------
@@ -3474,7 +3475,7 @@ void ClassDefImpl::mergeMembers()
static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
for (const auto &bcd : baseClasses())
{
- ClassDefMutable *bClass=ClassDef::make_mutable(bcd.classDef);
+ ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
if (bClass)
{
// merge the members in the base class of this inheritance branch first
@@ -3689,7 +3690,7 @@ void ClassDefImpl::mergeMembers()
*/
void ClassDefImpl::mergeCategory(ClassDef *cat)
{
- ClassDefMutable *category = ClassDef::make_mutable(cat);
+ ClassDefMutable *category = toClassDefMutable(cat);
if (category)
{
static bool extractLocalMethods = Config_getBool(EXTRACT_LOCAL_METHODS);
@@ -3737,8 +3738,8 @@ void ClassDefImpl::mergeCategory(ClassDef *cat)
auto &srcMi = srcMni->front();
if (srcMi && dstMi)
{
- MemberDefMutable *smdm = MemberDef::make_mutable(srcMi->memberDef());
- MemberDefMutable *dmdm = MemberDef::make_mutable(dstMi->memberDef());
+ MemberDefMutable *smdm = toMemberDefMutable(srcMi->memberDef());
+ MemberDefMutable *dmdm = toMemberDefMutable(dstMi->memberDef());
if (smdm && dmdm)
{
combineDeclarationAndDefinition(smdm,dmdm);
@@ -3760,7 +3761,7 @@ void ClassDefImpl::mergeCategory(ClassDef *cat)
//printf("Adding '%s'\n",mi->memberDef->name().data());
Protection prot = mi->prot();
//if (makePrivate) prot = Private;
- std::unique_ptr<MemberDefMutable> newMd { MemberDef::make_mutable(mi->memberDef()->deepCopy()) };
+ std::unique_ptr<MemberDefMutable> newMd { toMemberDefMutable(mi->memberDef()->deepCopy()) };
if (newMd)
{
//printf("Copying member %s\n",mi->memberDef->name().data());
@@ -3782,7 +3783,7 @@ void ClassDefImpl::mergeCategory(ClassDef *cat)
newMd->setCategory(category);
newMd->setCategoryRelation(mi->memberDef());
}
- MemberDefMutable *mdm = MemberDef::make_mutable(mi->memberDef());
+ MemberDefMutable *mdm = toMemberDefMutable(mi->memberDef());
if (mdm)
{
mdm->setCategoryRelation(newMd.get());
@@ -3955,7 +3956,7 @@ QCString ClassDefImpl::getSourceFileBase() const
}
else
{
- return DefinitionImpl::getSourceFileBase();
+ return DefinitionMixin::getSourceFileBase();
}
}
@@ -3967,12 +3968,12 @@ void ClassDefImpl::setGroupDefForAllMembers(GroupDef *gd,Grouping::GroupPri_t pr
{
for (auto &mi : *mni)
{
- MemberDefMutable *md = MemberDef::make_mutable(mi->memberDef());
+ MemberDefMutable *md = toMemberDefMutable(mi->memberDef());
if (md)
{
md->setGroupDef(gd,pri,fileName,startLine,hasDocs);
gd->insertMember(md,TRUE);
- ClassDefMutable *innerClass = ClassDef::make_mutable(md->getClassDefOfAnonymousType());
+ ClassDefMutable *innerClass = toClassDefMutable(md->getClassDefOfAnonymousType());
if (innerClass) innerClass->setGroupDefForAllMembers(gd,pri,fileName,startLine,hasDocs);
}
}
@@ -3989,7 +3990,7 @@ void ClassDefImpl::addInnerCompound(const Definition *d)
{
m_impl->innerClasses = new ClassSDict(17);
}
- m_impl->innerClasses->inSort(d->localName(),dynamic_cast<const ClassDef *>(d));
+ m_impl->innerClasses->inSort(d->localName(),toClassDef(d));
}
}
@@ -4012,7 +4013,7 @@ ClassDef *ClassDefImpl::insertTemplateInstance(const QCString &fileName,
{
m_impl->templateInstances = new QDict<ClassDef>(17);
}
- ClassDefMutable *templateClass=ClassDef::make_mutable(m_impl->templateInstances->find(templSpec));
+ ClassDefMutable *templateClass=toClassDefMutable(m_impl->templateInstances->find(templSpec));
if (templateClass==0)
{
Debug::print(Debug::Classes,0," New template instance class '%s''%s'\n",qPrint(name()),qPrint(templSpec));
@@ -4035,7 +4036,7 @@ ClassDef *ClassDefImpl::getVariableInstance(const char *templSpec) const
m_impl->variableInstances = new QDict<ClassDef>(17);
m_impl->variableInstances->setAutoDelete(TRUE);
}
- ClassDefMutable *templateClass=ClassDef::make_mutable(m_impl->variableInstances->find(templSpec));
+ ClassDefMutable *templateClass=toClassDefMutable(m_impl->variableInstances->find(templSpec));
if (templateClass==0)
{
Debug::print(Debug::Classes,0," New template variable instance class '%s' '%s'\n",qPrint(name()),qPrint(templSpec));
@@ -4112,7 +4113,7 @@ QCString ClassDefImpl::getReference() const
}
else
{
- return DefinitionImpl::getReference();
+ return DefinitionMixin::getReference();
}
}
@@ -4124,7 +4125,7 @@ bool ClassDefImpl::isReference() const
}
else
{
- return DefinitionImpl::isReference();
+ return DefinitionMixin::isReference();
}
}
@@ -4134,7 +4135,7 @@ ArgumentLists ClassDefImpl::getTemplateParameterLists() const
Definition *d=getOuterScope();
while (d && d->definitionType()==Definition::TypeClass)
{
- result.insert(result.begin(),dynamic_cast<ClassDef*>(d)->templateArguments());
+ result.insert(result.begin(),toClassDef(d)->templateArguments());
d = d->getOuterScope();
}
if (!templateArguments().empty())
@@ -4156,7 +4157,7 @@ QCString ClassDefImpl::qualifiedNameWithTemplateParameters(
{
if (d->definitionType()==Definition::TypeClass)
{
- ClassDef *cd=dynamic_cast<ClassDef *>(d);
+ ClassDef *cd=toClassDef(d);
scName = cd->qualifiedNameWithTemplateParameters(actualParams,actualParamIndex);
}
else if (!hideScopeNames)
@@ -4329,7 +4330,7 @@ void ClassDefImpl::addMemberToList(MemberListType lt,MemberDef *md,bool isBrief)
// for members in the declaration lists we set the section, needed for member grouping
if ((ml->listType()&MemberListType_detailedLists)==0)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->setSectionList(this,ml);
@@ -4456,7 +4457,7 @@ int ClassDefImpl::countInheritedDecMembers(MemberListType lt,
{
for (const auto &ibcd : m_impl->inherits)
{
- ClassDefMutable *icd=ClassDef::make_mutable(ibcd.classDef);
+ ClassDefMutable *icd=toClassDefMutable(ibcd.classDef);
int lt1,lt2;
if (icd && icd->isLinkable())
{
@@ -4592,7 +4593,7 @@ void ClassDefImpl::writeInheritedMemberDeclarations(OutputList &ol,
{
for (const auto &ibcd : m_impl->inherits)
{
- ClassDefMutable *icd=ClassDef::make_mutable(ibcd.classDef);
+ ClassDefMutable *icd=toClassDefMutable(ibcd.classDef);
if (icd && icd->isLinkable())
{
int lt1,lt3;
@@ -5104,7 +5105,7 @@ bool ClassDefImpl::isSliceLocal() const
void ClassDefImpl::setName(const char *name)
{
- DefinitionImpl::setName(name);
+ DefinitionMixin::setName(name);
}
void ClassDefImpl::setMetaData(const char *md)
@@ -5122,3 +5123,67 @@ QCString ClassDefImpl::inheritanceGraphFileName() const
return m_impl->inheritFileName;
}
+// --- Cast functions
+//
+ClassDef *toClassDef(Definition *d)
+{
+ if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
+ {
+ return static_cast<ClassDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+ClassDef *toClassDef(DefinitionMutable *md)
+{
+ Definition *d = toDefinition(md);
+ if (d && typeid(*d)==typeid(ClassDefImpl))
+ {
+ return static_cast<ClassDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const ClassDef *toClassDef(const Definition *d)
+{
+ if (d && (typeid(*d)==typeid(ClassDefImpl) || typeid(*d)==typeid(ClassDefAliasImpl)))
+ {
+ return static_cast<const ClassDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+ClassDefMutable *toClassDefMutable(Definition *d)
+{
+ if (d && typeid(*d)==typeid(ClassDefImpl))
+ {
+ return static_cast<ClassDefMutable*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+ClassDefMutable *toClassDefMutable(const Definition *d)
+{
+ if (d && typeid(*d)==typeid(ClassDefImpl))
+ {
+ return const_cast<ClassDefMutable*>(static_cast<const ClassDefMutable*>(d));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
diff --git a/src/classdef.h b/src/classdef.h
index 5dd35d3..e23bc19 100644
--- a/src/classdef.h
+++ b/src/classdef.h
@@ -91,7 +91,7 @@ using BaseClassList = std::vector<BaseClassDef>;
* A compound can be a class, struct, union, interface, service, singleton,
* or exception.
*/
-class ClassDef : virtual public Definition
+class ClassDef : public Definition
{
public:
/** The various compound types */
@@ -108,8 +108,6 @@ class ClassDef : virtual public Definition
virtual ~ClassDef() {}
- static ClassDefMutable *make_mutable(const ClassDef *);
-
//-----------------------------------------------------------------------------------
// --- getters
//-----------------------------------------------------------------------------------
@@ -386,7 +384,7 @@ class ClassDef : virtual public Definition
};
-class ClassDefMutable : virtual public DefinitionMutable, virtual public ClassDef
+class ClassDefMutable : public DefinitionMutable, public ClassDef
{
public:
//-----------------------------------------------------------------------------------
@@ -467,9 +465,6 @@ class ClassDefMutable : virtual public DefinitionMutable, virtual public ClassDe
};
-inline ClassDefMutable *ClassDef::make_mutable(const ClassDef *cd)
-{ return dynamic_cast<ClassDefMutable*>(const_cast<ClassDef*>(cd)); }
-
/** Factory method to create a new ClassDef object */
ClassDefMutable *createClassDef(
const char *fileName,int startLine,int startColumn,
@@ -479,6 +474,13 @@ ClassDefMutable *createClassDef(
ClassDef *createClassDefAlias(const Definition *newScope,const ClassDef *cd);
+// --- Cast functions
+
+ClassDef *toClassDef(Definition *d);
+ClassDef *toClassDef(DefinitionMutable *d);
+const ClassDef *toClassDef(const Definition *d);
+ClassDefMutable *toClassDefMutable(Definition *d);
+ClassDefMutable *toClassDefMutable(const Definition *d);
//------------------------------------------------------------------------
diff --git a/src/classlist.cpp b/src/classlist.cpp
index a50f9d5..eae216a 100644
--- a/src/classlist.cpp
+++ b/src/classlist.cpp
@@ -102,7 +102,7 @@ void ClassSDict::writeDeclaration(OutputList &ol,const ClassDef::CompoundType *f
bool found=FALSE;
for (sdi.toFirst();(cd=sdi.current());++sdi)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
//printf(" ClassSDict::writeDeclaration for %s\n",cd->name().data());
if (cdm &&
!cd->isAnonymous() &&
@@ -139,7 +139,7 @@ void ClassSDict::writeDocumentation(OutputList &ol,const Definition * container)
// cd->name().data(),cd->getOuterScope(),cd->isLinkableInProject(),cd->isEmbeddedInOuterScope(),
// container,cd->partOfGroups() ? cd->partOfGroups()->count() : 0);
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm &&
!cd->isAnonymous() &&
cd->isLinkableInProject() &&
diff --git a/src/code.l b/src/code.l
index 21d276a..d37b939 100644
--- a/src/code.l
+++ b/src/code.l
@@ -771,7 +771,7 @@ NUMBER {INTEGER_NUMBER}|{FLOAT_NUMBER}
auto it = yyextra->codeClassMap.find(s);
if (it!=yyextra->codeClassMap.end())
{
- bcd = dynamic_cast<const ClassDef*>(it->second.globalDef());
+ bcd = toClassDef(it->second.globalDef());
}
if (bcd==0) bcd=yyextra->symbolResolver.resolveClass(yyextra->currentDefinition,s);
if (bcd && bcd->name()!=yyextra->curClassName)
@@ -2451,7 +2451,7 @@ static void incrementFlowKeyWordCount(yyscan_t yyscanner)
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
- MemberDefMutable *md = MemberDef::make_mutable(yyextra->currentMemberDef);
+ MemberDefMutable *md = toMemberDefMutable(yyextra->currentMemberDef);
if (md)
{
md->incrementFlowKeyWordCount();
@@ -2699,7 +2699,7 @@ static void updateCallContextForSmartPointer(yyscan_t yyscanner)
const Definition *d = yyextra->theCallContext.getScope().globalDef();
//printf("updateCallContextForSmartPointer() cd=%s\n",cd ? d->name().data() : "<none>");
const MemberDef *md;
- if (d && d->definitionType()==Definition::TypeClass && (md=(dynamic_cast<const ClassDef*>(d))->isSmartPointer()))
+ if (d && d->definitionType()==Definition::TypeClass && (md=(toClassDef(d))->isSmartPointer()))
{
const ClassDef *ncd = stripClassName(yyscanner,md->typeString(),md->getOuterScope());
if (ncd)
@@ -2738,8 +2738,8 @@ static bool getLinkInScope(yyscan_t yyscanner,
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
// yyextra->exampleFile.data());
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
- if (mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
+ MemberDefMutable *mdm = toMemberDefMutable(md);
+ if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
ol.writeCodeAnchor(anchor);
yyextra->anchorCount++;
@@ -2759,7 +2759,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
//printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
@@ -2904,7 +2904,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
anchor.sprintf("_a%d",yyextra->anchorCount);
//printf("addExampleClass(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
// yyextra->exampleFile.data());
- ClassDefMutable *cdm = ClassDef::make_mutable(const_cast<ClassDef*>(cd));
+ ClassDefMutable *cdm = toClassDefMutable(const_cast<ClassDef*>(cd));
if (cdm && cdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
ol.writeCodeAnchor(anchor);
@@ -2923,7 +2923,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
yyextra->currentMemberDef && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
}
}
@@ -2961,7 +2961,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
return;
}
@@ -2994,7 +2994,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
anchor.sprintf("a%d",yyextra->anchorCount);
//printf("addExampleFile(%s,%s,%s)\n",anchor.data(),yyextra->exampleName.data(),
// yyextra->exampleFile.data());
- MemberDefMutable *mdm = MemberDef::make_mutable(xmd);
+ MemberDefMutable *mdm = toMemberDefMutable(xmd);
if (mdm && mdm->addExample(anchor,yyextra->exampleName,yyextra->exampleFile))
{
ol.writeCodeAnchor(anchor);
@@ -3023,7 +3023,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
/*xmd!=yyextra->currentMemberDef &&*/ yyextra->insideBody && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(xmd));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(xmd));
}
// write the actual link
@@ -3044,7 +3044,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (def && def->definitionType()==Definition::TypeClass)
{
- const ClassDef *cd = dynamic_cast<const ClassDef*>(def);
+ const ClassDef *cd = toClassDef(def);
MemberDef *xmd = cd->getMemberByName(memName);
//printf("generateClassMemberLink(class=%s,member=%s)=%p\n",def->name().data(),memName,xmd);
if (xmd)
@@ -3065,7 +3065,7 @@ static bool generateClassMemberLink(yyscan_t yyscanner,
}
else if (def && def->definitionType()==Definition::TypeNamespace)
{
- const NamespaceDef *nd = dynamic_cast<const NamespaceDef*>(def);
+ const NamespaceDef *nd = toNamespaceDef(def);
//printf("Looking for %s inside namespace %s\n",memName,nd->name().data());
const Definition *innerDef = nd->findInnerCompound(memName);
if (innerDef)
@@ -3358,7 +3358,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentDefinition &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
- ctx->objectType = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ ctx->objectType = toClassDef(yyextra->currentDefinition);
}
}
else
@@ -3379,7 +3379,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentDefinition &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
- ctx->objectVar = (dynamic_cast<const ClassDef *>(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName);
+ ctx->objectVar = (toClassDef(yyextra->currentDefinition))->getMemberByName(ctx->objectTypeOrName);
//printf(" ctx->objectVar=%p\n",ctx->objectVar);
if (ctx->objectVar)
{
@@ -3399,7 +3399,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
//printf(" object is local variable\n");
if (stv->globalDef() && !ctx->methodName.isEmpty())
{
- const ClassDef *cd = dynamic_cast<const ClassDef *>(stv->globalDef());
+ const ClassDef *cd = toClassDef(stv->globalDef());
if (cd)
{
ctx->method = cd->getMemberByName(ctx->methodName);
@@ -3439,7 +3439,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(ctx->method));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->method));
}
}
else
@@ -3468,7 +3468,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentDefinition &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
- ctx->objectType = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ ctx->objectType = toClassDef(yyextra->currentDefinition);
if (ctx->objectType->categoryOf())
{
ctx->objectType = ctx->objectType->categoryOf();
@@ -3487,7 +3487,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentDefinition &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
- const ClassDef *cd = dynamic_cast<const ClassDef *>(yyextra->currentDefinition);
+ const ClassDef *cd = toClassDef(yyextra->currentDefinition);
if (cd->categoryOf())
{
cd = cd->categoryOf();
@@ -3514,7 +3514,7 @@ static void writeObjCMethodCall(yyscan_t yyscanner,ObjCCallCtx *ctx)
if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
std::lock_guard<std::mutex> lock(g_docCrossReferenceMutex);
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(ctx->objectVar));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(ctx->objectVar));
}
}
else if (ctx->objectType &&
diff --git a/src/context.cpp b/src/context.cpp
index 2f281b8..6b62e8d 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -1585,9 +1585,9 @@ class DefinitionContext
{
fillPath(outerScope,list);
}
- else if (type==Definition::TypeFile && (dynamic_cast<const FileDef*>(def))->getDirDef())
+ else if (type==Definition::TypeFile && (toFileDef(def))->getDirDef())
{
- fillPath((dynamic_cast<const FileDef*>(def))->getDirDef(),list);
+ fillPath((toFileDef(def))->getDirDef(),list);
}
list->append(NavPathElemContext::alloc(def));
}
@@ -1601,9 +1601,9 @@ class DefinitionContext
{
fillPath(m_def->getOuterScope(),list);
}
- else if (m_def->definitionType()==Definition::TypeFile && (dynamic_cast<const FileDef *>(m_def))->getDirDef())
+ else if (m_def->definitionType()==Definition::TypeFile && (toFileDef(m_def))->getDirDef())
{
- fillPath((dynamic_cast<const FileDef *>(m_def))->getDirDef(),list);
+ fillPath((toFileDef(m_def))->getDirDef(),list);
}
cache.navPath.reset(list);
}
@@ -2372,7 +2372,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
{
addTemplateDecls(parent,tl);
}
- const ClassDef *cd=dynamic_cast<const ClassDef *>(d);
+ const ClassDef *cd=toClassDef(d);
if (!cd->templateArguments().empty())
{
ArgumentListContext *al = ArgumentListContext::alloc(cd->templateArguments(),cd,relPathAsString());
@@ -6262,7 +6262,7 @@ class NestingNodeContext::Private
{
if (!m_cache.classContext && m_def->definitionType()==Definition::TypeClass)
{
- m_cache.classContext.reset(ClassContext::alloc(dynamic_cast<const ClassDef*>(m_def)));
+ m_cache.classContext.reset(ClassContext::alloc(toClassDef(m_def)));
}
if (m_cache.classContext)
{
@@ -6277,7 +6277,7 @@ class NestingNodeContext::Private
{
if (!m_cache.namespaceContext && m_def->definitionType()==Definition::TypeNamespace)
{
- m_cache.namespaceContext.reset(NamespaceContext::alloc(dynamic_cast<const NamespaceDef*>(m_def)));
+ m_cache.namespaceContext.reset(NamespaceContext::alloc(toNamespaceDef(m_def)));
}
if (m_cache.namespaceContext)
{
@@ -6292,7 +6292,7 @@ class NestingNodeContext::Private
{
if (!m_cache.dirContext && m_def->definitionType()==Definition::TypeDir)
{
- m_cache.dirContext.reset(DirContext::alloc(dynamic_cast<const DirDef*>(m_def)));
+ m_cache.dirContext.reset(DirContext::alloc(toDirDef(m_def)));
}
if (m_cache.dirContext)
{
@@ -6307,7 +6307,7 @@ class NestingNodeContext::Private
{
if (!m_cache.fileContext && m_def->definitionType()==Definition::TypeFile)
{
- m_cache.fileContext.reset(FileContext::alloc(dynamic_cast<const FileDef*>(m_def)));
+ m_cache.fileContext.reset(FileContext::alloc(toFileDef(m_def)));
}
if (m_cache.fileContext)
{
@@ -6322,7 +6322,7 @@ class NestingNodeContext::Private
{
if (!m_cache.pageContext && m_def->definitionType()==Definition::TypePage)
{
- m_cache.pageContext.reset(PageContext::alloc(dynamic_cast<const PageDef*>(m_def),FALSE,FALSE));
+ m_cache.pageContext.reset(PageContext::alloc(toPageDef(m_def),FALSE,FALSE));
}
if (m_cache.pageContext)
{
@@ -6337,7 +6337,7 @@ class NestingNodeContext::Private
{
if (!m_cache.moduleContext && m_def->definitionType()==Definition::TypeGroup)
{
- m_cache.moduleContext.reset(ModuleContext::alloc(dynamic_cast<const GroupDef*>(m_def)));
+ m_cache.moduleContext.reset(ModuleContext::alloc(toGroupDef(m_def)));
}
if (m_cache.moduleContext)
{
@@ -6409,7 +6409,7 @@ class NestingNodeContext::Private
void addClasses(bool inherit, bool hideSuper)
{
- const ClassDef *cd = dynamic_cast<const ClassDef*>(m_def);
+ const ClassDef *cd = toClassDef(m_def);
if (cd && inherit)
{
bool hasChildren = !cd->isVisited() && !hideSuper && classHasVisibleChildren(cd);
@@ -6437,7 +6437,7 @@ class NestingNodeContext::Private
}
void addNamespaces(bool addClasses)
{
- const NamespaceDef *nd = dynamic_cast<const NamespaceDef*>(m_def);
+ const NamespaceDef *nd = toNamespaceDef(m_def);
if (nd && nd->getNamespaceSDict())
{
m_children->addNamespaces(*nd->getNamespaceSDict(),FALSE,addClasses);
@@ -6449,7 +6449,7 @@ class NestingNodeContext::Private
}
void addDirFiles()
{
- const DirDef *dd = dynamic_cast<const DirDef*>(m_def);
+ const DirDef *dd = toDirDef(m_def);
if (dd)
{
m_children->addDirs(dd->subDirs());
@@ -6461,7 +6461,7 @@ class NestingNodeContext::Private
}
void addPages()
{
- const PageDef *pd = dynamic_cast<const PageDef*>(m_def);
+ const PageDef *pd = toPageDef(m_def);
if (pd && pd->getSubPages())
{
m_children->addPages(*pd->getSubPages(),FALSE);
@@ -6469,7 +6469,7 @@ class NestingNodeContext::Private
}
void addModules()
{
- const GroupDef *gd = dynamic_cast<const GroupDef*>(m_def);
+ const GroupDef *gd = toGroupDef(m_def);
if (gd && gd->getSubGroups())
{
m_children->addModules(*gd->getSubGroups());
@@ -7776,11 +7776,11 @@ class NavPathElemContext::Private
QCString text = m_def->localName();
if (type==Definition::TypeGroup)
{
- text = (dynamic_cast<const GroupDef*>(m_def))->groupTitle();
+ text = (toGroupDef(m_def))->groupTitle();
}
- else if (type==Definition::TypePage && ((dynamic_cast<const PageDef*>(m_def))->hasTitle()))
+ else if (type==Definition::TypePage && ((toPageDef(m_def))->hasTitle()))
{
- text = (dynamic_cast<const PageDef*>(m_def))->title();
+ text = (toPageDef(m_def))->title();
}
else if (type==Definition::TypeClass)
{
@@ -9055,7 +9055,7 @@ class MemberListInfoContext::Private
m_def->definitionType()==Definition::TypeClass)
{
InheritedMemberInfoListContext *ctx = InheritedMemberInfoListContext::alloc();
- ctx->addMemberList(dynamic_cast<const ClassDef*>(m_def),m_memberList->listType(),m_title,FALSE);
+ ctx->addMemberList(toClassDef(m_def),m_memberList->listType(),m_title,FALSE);
m_cache.inherited.reset(ctx);
}
if (m_cache.inherited)
@@ -9557,7 +9557,7 @@ class SymbolContext::Private
const Definition *prev = m_prevDef;
const Definition *nextScope = next ? next->getOuterScope() : 0;
const Definition *prevScope = prev ? prev->getOuterScope() : 0;
- const MemberDef *md = dynamic_cast<const MemberDef*>(m_def);
+ const MemberDef *md = toMemberDef(m_def);
bool isFunctionLike = md && (md->isFunction() || md->isSlot() || md->isSignal());
bool overloadedFunction = isFunctionLike &&
((prevScope!=0 && scope==prevScope) || (scope && scope==nextScope));
diff --git a/src/definition.cpp b/src/definition.cpp
index 65bbd24..0d301c0 100644
--- a/src/definition.cpp
+++ b/src/definition.cpp
@@ -50,6 +50,7 @@
#include "bufstr.h"
#include "reflist.h"
+
//-----------------------------------------------------------------------------------------
/** Private data associated with a Symbol DefinitionImpl object. */
@@ -60,6 +61,8 @@ class DefinitionImpl::IMPL
void init(const char *df, const char *n);
void setDefFileName(const QCString &df);
+ Definition *def = 0;
+
SectionRefs sectionRefs;
std::unordered_map<std::string,const MemberDef *> sourceRefByDict;
@@ -98,7 +101,7 @@ class DefinitionImpl::IMPL
QCString symbolName;
int defLine;
int defColumn;
- Cookie *cookie;
+ Definition::Cookie *cookie;
};
@@ -235,17 +238,19 @@ static void removeFromMap(Definition *d)
Doxygen::symbolMap.remove(d->_symbolName(),d);
}
-DefinitionImpl::DefinitionImpl(const char *df,int dl,int dc,
+DefinitionImpl::DefinitionImpl(Definition *def,
+ const char *df,int dl,int dc,
const char *name,const char *b,
const char *d,bool isSymbol)
{
m_impl = new DefinitionImpl::IMPL;
setName(name);
+ m_impl->def = def;
m_impl->defLine = dl;
m_impl->defColumn = dc;
m_impl->init(df,name);
m_impl->isSymbol = isSymbol;
- if (isSymbol) addToMap(name,this);
+ if (isSymbol) addToMap(name,def);
_setBriefDescription(b,df,dl);
_setDocumentation(d,df,dl,TRUE,FALSE);
if (matchExcludedSymbols(name))
@@ -289,14 +294,14 @@ DefinitionImpl::DefinitionImpl(const DefinitionImpl &d)
m_impl->inbodyDocs = new DocInfo(*d.m_impl->inbodyDocs);
}
- if (m_impl->isSymbol) addToMap(m_impl->name,this);
+ if (m_impl->isSymbol) addToMap(m_impl->name,m_impl->def);
}
DefinitionImpl::~DefinitionImpl()
{
if (m_impl->isSymbol)
{
- removeFromMap(this);
+ removeFromMap(m_impl->def);
}
if (m_impl)
{
@@ -321,7 +326,7 @@ void DefinitionImpl::setId(const char *id)
if (Doxygen::clangUsrMap)
{
//printf("DefinitionImpl::setId '%s'->'%s'\n",id,m_impl->name.data());
- Doxygen::clangUsrMap->insert(id,this);
+ Doxygen::clangUsrMap->insert(id,m_impl->def);
}
}
@@ -347,7 +352,7 @@ void DefinitionImpl::addSectionsToDefinition(const std::vector<const SectionInfo
if (m_impl->sectionRefs.find(gsi->label())==0)
{
m_impl->sectionRefs.add(gsi);
- gsi->setDefinition(this);
+ gsi->setDefinition(m_impl->def);
}
}
}
@@ -403,7 +408,7 @@ void DefinitionImpl::addSectionsToIndex()
((int)((*it_next)->type()) > nextLevel) : FALSE;
Doxygen::indexList->addContentsItem(isDir,title,
getReference(),
- getOutputFileBase(),
+ m_impl->def->getOutputFileBase(),
si->label(),
FALSE,
TRUE);
@@ -427,7 +432,7 @@ void DefinitionImpl::writeDocAnchorsToTagFile(FTextStream &tagFile) const
if (!si->generated() && si->ref().isEmpty() && !si->label().startsWith("autotoc_md"))
{
//printf("write an entry!\n");
- if (definitionType()==TypeMember) tagFile << " ";
+ if (m_impl->def->definitionType()==Definition::TypeMember) tagFile << " ";
tagFile << " <docanchor file=\"" << addHtmlExtensionIfMissing(si->fileName()) << "\"";
if (!si->title().isEmpty())
{
@@ -900,7 +905,7 @@ bool readCodeFragment(const char *fileName,
QCString DefinitionImpl::getSourceFileBase() const
{
- ASSERT(definitionType()!=Definition::TypeFile); // file overloads this method
+ ASSERT(m_impl->def->definitionType()!=Definition::TypeFile); // file overloads this method
QCString fn;
static bool sourceBrowser = Config_getBool(SOURCE_BROWSER);
if (sourceBrowser &&
@@ -1162,7 +1167,10 @@ void DefinitionImpl::writeInlineCode(OutputList &ol,const char *scopeName) const
intf->resetCodeParserState();
//printf("Read:\n'%s'\n\n",codeFragment.data());
const MemberDef *thisMd = 0;
- if (definitionType()==TypeMember) thisMd = dynamic_cast <const MemberDef*>(this);
+ if (m_impl->def->definitionType()==Definition::TypeMember)
+ {
+ thisMd = toMemberDef(m_impl->def);
+ }
ol.startCodeFragment("DoxyCode");
intf->parseCode(ol, // codeOutIntf
@@ -1559,16 +1567,18 @@ QCString DefinitionImpl::pathFragment() const
{
result = m_impl->outerScope->pathFragment();
}
- if (isLinkable())
+ if (m_impl->def->isLinkable())
{
if (!result.isEmpty()) result+="/";
- if (definitionType()==Definition::TypeGroup && (dynamic_cast <const GroupDef*>(this))->groupTitle())
+ if (m_impl->def->definitionType()==Definition::TypeGroup &&
+ (toGroupDef(m_impl->def))->groupTitle())
{
- result+=(dynamic_cast <const GroupDef*>(this))->groupTitle();
+ result+=(toGroupDef(m_impl->def))->groupTitle();
}
- else if (definitionType()==Definition::TypePage && (dynamic_cast <const PageDef*>(this))->hasTitle())
+ else if (m_impl->def->definitionType()==Definition::TypePage &&
+ (toPageDef(m_impl->def))->hasTitle())
{
- result+=(dynamic_cast <const PageDef*>(this))->title();
+ result+=(toPageDef(m_impl->def))->title();
}
else
{
@@ -1597,37 +1607,37 @@ QCString DefinitionImpl::navigationPathAsString() const
{
result+=outerScope->navigationPathAsString();
}
- else if (definitionType()==Definition::TypeFile && (dynamic_cast<const FileDef*>(this))->getDirDef())
+ else if (m_impl->def->definitionType()==Definition::TypeFile && (toFileDef(m_impl->def))->getDirDef())
{
- result+=(dynamic_cast<const FileDef*>(this))->getDirDef()->navigationPathAsString();
+ result+=(toFileDef(m_impl->def))->getDirDef()->navigationPathAsString();
}
result+="<li class=\"navelem\">";
- if (isLinkable())
+ if (m_impl->def->isLinkable())
{
- if (definitionType()==Definition::TypeGroup && (dynamic_cast<const GroupDef*>(this))->groupTitle())
+ if (m_impl->def->definitionType()==Definition::TypeGroup && (toGroupDef(m_impl->def))->groupTitle())
{
- result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
- convertToHtml((dynamic_cast<const GroupDef*>(this))->groupTitle())+"</a>";
+ result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
+ convertToHtml((toGroupDef(m_impl->def))->groupTitle())+"</a>";
}
- else if (definitionType()==Definition::TypePage && (dynamic_cast<const PageDef*>(this))->hasTitle())
+ else if (m_impl->def->definitionType()==Definition::TypePage && (toPageDef(m_impl->def))->hasTitle())
{
- result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
- convertToHtml((dynamic_cast<const PageDef*>(this))->title())+"</a>";
+ result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
+ convertToHtml((toPageDef(m_impl->def))->title())+"</a>";
}
- else if (definitionType()==Definition::TypeClass)
+ else if (m_impl->def->definitionType()==Definition::TypeClass)
{
QCString name = locName;
if (name.right(2)=="-p" /*|| name.right(2)=="-g"*/)
{
name = name.left(name.length()-2);
}
- result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension;
- if (!anchor().isEmpty()) result+="#"+anchor();
+ result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension;
+ if (!m_impl->def->anchor().isEmpty()) result+="#"+m_impl->def->anchor();
result+="\">"+convertToHtml(name)+"</a>";
}
else
{
- result+="<a class=\"el\" href=\"$relpath^"+getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
+ result+="<a class=\"el\" href=\"$relpath^"+m_impl->def->getOutputFileBase()+Doxygen::htmlFileExtension+"\">"+
convertToHtml(locName)+"</a>";
}
}
@@ -1880,7 +1890,7 @@ QCString DefinitionImpl::briefDescription(bool abbr) const
{
//printf("%s::briefDescription(%d)='%s'\n",name().data(),abbr,m_impl->brief?m_impl->brief->doc.data():"<none>");
return m_impl->brief ?
- (abbr ? abbreviate(m_impl->brief->doc,displayName()) : m_impl->brief->doc) :
+ (abbr ? abbreviate(m_impl->brief->doc,m_impl->def->displayName()) : m_impl->brief->doc) :
QCString("");
}
@@ -1888,8 +1898,8 @@ void DefinitionImpl::computeTooltip()
{
if (m_impl->brief && m_impl->brief->tooltip.isEmpty() && !m_impl->brief->doc.isEmpty())
{
- const MemberDef *md = definitionType()==TypeMember ? dynamic_cast<const MemberDef*>(this) : 0;
- const Definition *scope = definitionType()==TypeMember ? getOuterScope() : this;
+ const MemberDef *md = m_impl->def->definitionType()==Definition::TypeMember ? toMemberDef(m_impl->def) : 0;
+ const Definition *scope = m_impl->def->definitionType()==Definition::TypeMember ? m_impl->def->getOuterScope() : m_impl->def;
m_impl->brief->tooltip = parseCommentAsText(scope,md,
m_impl->brief->doc, m_impl->brief->file, m_impl->brief->line);
}
@@ -1947,12 +1957,12 @@ bool DefinitionImpl::isHidden() const
bool DefinitionImpl::isVisibleInProject() const
{
- return isLinkableInProject() && !m_impl->hidden;
+ return m_impl->def->isLinkableInProject() && !m_impl->hidden;
}
bool DefinitionImpl::isVisible() const
{
- return isLinkable() && !m_impl->hidden;
+ return m_impl->def->isLinkable() && !m_impl->hidden;
}
bool DefinitionImpl::isArtificial() const
@@ -2027,7 +2037,7 @@ std::vector<const MemberDef*> DefinitionImpl::getReferencedByMembers() const
void DefinitionImpl::mergeReferences(const Definition *other)
{
- const DefinitionImpl *defImpl = dynamic_cast<const DefinitionImpl*>(other);
+ const DefinitionImpl *defImpl = other->toDefinitionImpl_();
if (defImpl)
{
for (const auto &kv : defImpl->m_impl->sourceRefsDict)
@@ -2043,7 +2053,7 @@ void DefinitionImpl::mergeReferences(const Definition *other)
void DefinitionImpl::mergeReferencedBy(const Definition *other)
{
- const DefinitionImpl *defImpl = dynamic_cast<const DefinitionImpl*>(other);
+ const DefinitionImpl *defImpl = other->toDefinitionImpl_();
if (defImpl)
{
for (const auto &kv : defImpl->m_impl->sourceRefByDict)
@@ -2147,7 +2157,7 @@ int DefinitionImpl::getDefColumn() const
return m_impl->defColumn;
}
-void DefinitionImpl::setCookie(Cookie *cookie) const
+void DefinitionImpl::setCookie(Definition::Cookie *cookie) const
{
delete m_impl->cookie;
m_impl->cookie = cookie;
@@ -2168,16 +2178,35 @@ void DefinitionImpl::writeSummaryLinks(OutputList &) const
//---------------------------------------------------------------------------------
-DefinitionAliasImpl::DefinitionAliasImpl(const Definition *scope,const Definition *alias)
- : m_scope(scope), m_def(alias), m_cookie(0)
+DefinitionAliasImpl::DefinitionAliasImpl(Definition *def,const Definition *alias)
+ : m_def(def)
{
//printf("%s::addToMap(%s)\n",qPrint(name()),qPrint(alias->name()));
- addToMap(alias->name(),this);
+ addToMap(alias->name(),m_def);
}
DefinitionAliasImpl::~DefinitionAliasImpl()
{
//printf("~DefinitionAliasImpl()\n");
- removeFromMap(this);
+ removeFromMap(m_def);
+}
+
+//---------------------------------------------------------------------------------
+
+Definition *toDefinition(DefinitionMutable *dm)
+{
+ if (dm==0) return 0;
+ return dm->toDefinition_();
+}
+
+DefinitionMutable *toDefinitionMutable(Definition *d)
+{
+ if (d==0) return 0;
+ return d->toDefinitionMutable_();
+}
+
+DefinitionMutable *toDefinitionMutable(const Definition *d)
+{
+ return toDefinitionMutable(const_cast<Definition*>(d));
}
diff --git a/src/definition.h b/src/definition.h
index 94c95b8..50a481d 100644
--- a/src/definition.h
+++ b/src/definition.h
@@ -41,6 +41,7 @@ class GroupList;
class SectionInfo;
class Definition;
class DefinitionMutable;
+class DefinitionImpl;
class FTextStream;
/** Data associated with a detailed description. */
@@ -95,7 +96,6 @@ class Definition
TypeDir = 7
};
- static DefinitionMutable *make_mutable(const Definition *);
//-----------------------------------------------------------------------------------
// ---- getters -----
@@ -300,11 +300,20 @@ class Definition
// ---------------------------------
virtual ~Definition() = default;
+
+ private:
+ friend class DefinitionImpl;
+ friend DefinitionMutable* toDefinitionMutable(Definition *);
+ friend DefinitionMutable* toDefinitionMutable(const Definition *);
+ virtual DefinitionMutable *toDefinitionMutable_() = 0;
+ virtual const DefinitionImpl *toDefinitionImpl_() const = 0;
};
-class DefinitionMutable : virtual public Definition
+class DefinitionMutable
{
public:
+
+
//-----------------------------------------------------------------------------------
// ---- setters -----
//-----------------------------------------------------------------------------------
@@ -380,11 +389,17 @@ class DefinitionMutable : virtual public Definition
virtual void writeDocAnchorsToTagFile(FTextStream &) const = 0;
virtual void writeToc(OutputList &ol, const LocalToc &lt) const = 0;
+ // ---------------------------------
+ virtual ~DefinitionMutable() = default;
+ private:
+ friend Definition* toDefinition(DefinitionMutable *);
+ virtual Definition *toDefinition_() = 0;
};
-inline DefinitionMutable *Definition::make_mutable(const Definition *def)
-{ return dynamic_cast<DefinitionMutable*>(const_cast<Definition*>(def)); }
+Definition *toDefinition(DefinitionMutable *dm);
+DefinitionMutable *toDefinitionMutable(Definition *d);
+DefinitionMutable *toDefinitionMutable(const Definition *d);
/** Reads a fragment from file \a fileName starting with line \a startLine
* and ending with line \a endLine. The result is returned as a string
diff --git a/src/definitionimpl.h b/src/definitionimpl.h
index 2cf1bf6..a5fc66d 100644
--- a/src/definitionimpl.h
+++ b/src/definitionimpl.h
@@ -23,110 +23,107 @@
#include "definition.h"
-class DefinitionImpl : virtual public DefinitionMutable
+class DefinitionImpl
{
public:
- /*! Create a new definition */
DefinitionImpl(
+ Definition *def,
const char *defFileName,int defLine,int defColumn,
const char *name,const char *b=0,const char *d=0,
bool isSymbol=TRUE);
virtual ~DefinitionImpl();
- virtual bool isAlias() const { return FALSE; }
- virtual const QCString &name() const;
- virtual bool isAnonymous() const;
- virtual QCString localName() const;
- virtual QCString qualifiedName() const;
- virtual QCString symbolName() const;
- virtual QCString getSourceFileBase() const;
- virtual QCString getSourceAnchor() const;
- virtual QCString documentation() const;
- virtual int docLine() const;
- virtual QCString docFile() const;
- virtual QCString briefDescription(bool abbreviate=FALSE) const;
- virtual QCString briefDescriptionAsTooltip() const;
- virtual int briefLine() const;
- virtual QCString inbodyDocumentation() const;
- virtual QCString inbodyFile() const;
- virtual int inbodyLine() const;
- virtual QCString briefFile() const;
- virtual QCString getDefFileName() const;
- virtual QCString getDefFileExtension() const;
- virtual int getDefLine() const;
- virtual int getDefColumn() const;
- virtual bool hasDocumentation() const;
- virtual bool hasUserDocumentation() const;
- virtual bool isVisibleInProject() const;
- virtual bool isVisible() const;
- virtual bool isHidden() const;
- virtual bool isArtificial() const;
- virtual QCString getReference() const;
- virtual bool isReference() const;
- virtual QCString externalReference(const QCString &relPath) const;
- virtual int getStartDefLine() const;
- virtual int getStartBodyLine() const;
- virtual int getEndBodyLine() const;
- virtual FileDef *getBodyDef() const;
- virtual SrcLangExt getLanguage() const;
- virtual GroupList *partOfGroups() const;
- virtual bool isLinkableViaGroup() const;
- virtual const RefItemVector &xrefListItems() const;
- virtual const Definition *findInnerCompound(const char *name) const;
- virtual Definition *getOuterScope() const;
- virtual std::vector<const MemberDef *> getReferencesMembers() const;
- virtual std::vector<const MemberDef *> getReferencedByMembers() const;
- virtual bool hasSections() const;
- virtual bool hasSources() const;
- virtual bool hasBriefDescription() const;
- virtual QCString id() const;
- virtual const SectionRefs &getSectionRefs() const;
- virtual void setName(const char *name);
- virtual void setId(const char *name);
- virtual void setDefFile(const QCString& df,int defLine,int defColumn);
- virtual void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE);
- virtual void setBriefDescription(const char *b,const char *briefFile,int briefLine);
- virtual void setInbodyDocumentation(const char *d,const char *docFile,int docLine);
- virtual void setReference(const char *r);
- virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList);
- virtual void setBodySegment(int defLine,int bls,int ble);
- virtual void setBodyDef(FileDef *fd);
- virtual void addSourceReferencedBy(const MemberDef *d);
- virtual void addSourceReferences(const MemberDef *d);
- virtual void setRefItems(const RefItemVector &sli);
- virtual void mergeRefItems(Definition *d);
- virtual void mergeReferences(const Definition *other);
- virtual void mergeReferencedBy(const Definition *other);
- virtual void addInnerCompound(const Definition *d);
- virtual void setOuterScope(Definition *d);
- virtual void setHidden(bool b);
- virtual void setArtificial(bool b);
- virtual void setLanguage(SrcLangExt lang);
- virtual void writeSourceDef(OutputList &ol,const char *scopeName) const;
- virtual void writeInlineCode(OutputList &ol,const char *scopeName) const;
- virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const;
- virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const;
- virtual void makePartOfGroup(GroupDef *gd);
- virtual void writeNavigationPath(OutputList &ol) const;
- virtual QCString navigationPathAsString() const;
- virtual void writeQuickMemberLinks(OutputList &,const MemberDef *) const;
- virtual void writeSummaryLinks(OutputList &) const;
- virtual QCString pathFragment() const;
- virtual void writeDocAnchorsToTagFile(FTextStream &) const;
- virtual void setLocalName(const QCString name);
- virtual void addSectionsToIndex();
- virtual void writeToc(OutputList &ol, const LocalToc &lt) const;
- virtual void setCookie(Cookie *cookie) const;
- virtual Cookie *cookie() const;
- virtual void computeTooltip();
-
- protected:
+ const QCString &name() const;
+ bool isAnonymous() const;
+ QCString localName() const;
+ QCString qualifiedName() const;
+ QCString symbolName() const;
+ QCString getSourceFileBase() const;
+ QCString getSourceAnchor() const;
+ QCString documentation() const;
+ int docLine() const;
+ QCString docFile() const;
+ QCString briefDescription(bool abbreviate=FALSE) const;
+ QCString briefDescriptionAsTooltip() const;
+ int briefLine() const;
+ QCString inbodyDocumentation() const;
+ QCString inbodyFile() const;
+ int inbodyLine() const;
+ QCString briefFile() const;
+ QCString getDefFileName() const;
+ QCString getDefFileExtension() const;
+ int getDefLine() const;
+ int getDefColumn() const;
+ bool hasDocumentation() const;
+ bool hasUserDocumentation() const;
+ bool isVisibleInProject() const;
+ bool isVisible() const;
+ bool isHidden() const;
+ bool isArtificial() const;
+ QCString getReference() const;
+ bool isReference() const;
+ QCString externalReference(const QCString &relPath) const;
+ int getStartDefLine() const;
+ int getStartBodyLine() const;
+ int getEndBodyLine() const;
+ FileDef *getBodyDef() const;
+ SrcLangExt getLanguage() const;
+ GroupList *partOfGroups() const;
+ bool isLinkableViaGroup() const;
+ const RefItemVector &xrefListItems() const;
+ const Definition *findInnerCompound(const char *name) const;
+ Definition *getOuterScope() const;
+ std::vector<const MemberDef *> getReferencesMembers() const;
+ std::vector<const MemberDef *> getReferencedByMembers() const;
+ bool hasSections() const;
+ bool hasSources() const;
+ bool hasBriefDescription() const;
+ QCString id() const;
+ const SectionRefs &getSectionRefs() const;
+ void setName(const char *name);
+ void setId(const char *name);
+ void setDefFile(const QCString& df,int defLine,int defColumn);
+ void setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace=TRUE);
+ void setBriefDescription(const char *b,const char *briefFile,int briefLine);
+ void setInbodyDocumentation(const char *d,const char *docFile,int docLine);
+ void setReference(const char *r);
+ void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList);
+ void setBodySegment(int defLine,int bls,int ble);
+ void setBodyDef(FileDef *fd);
+ void addSourceReferencedBy(const MemberDef *d);
+ void addSourceReferences(const MemberDef *d);
+ void setRefItems(const RefItemVector &sli);
+ void mergeRefItems(Definition *d);
+ void mergeReferences(const Definition *other);
+ void mergeReferencedBy(const Definition *other);
+ void addInnerCompound(const Definition *d);
+ void setOuterScope(Definition *d);
+ void setHidden(bool b);
+ void setArtificial(bool b);
+ void setLanguage(SrcLangExt lang);
+ void writeSourceDef(OutputList &ol,const char *scopeName) const;
+ void writeInlineCode(OutputList &ol,const char *scopeName) const;
+ void writeSourceRefs(OutputList &ol,const char *scopeName) const;
+ void writeSourceReffedBy(OutputList &ol,const char *scopeName) const;
+ void makePartOfGroup(GroupDef *gd);
+ void writeNavigationPath(OutputList &ol) const;
+ QCString navigationPathAsString() const;
+ void writeQuickMemberLinks(OutputList &,const MemberDef *) const;
+ void writeSummaryLinks(OutputList &) const;
+ QCString pathFragment() const;
+ void writeDocAnchorsToTagFile(FTextStream &) const;
+ void setLocalName(const QCString name);
+ void addSectionsToIndex();
+ void writeToc(OutputList &ol, const LocalToc &lt) const;
+ void setCookie(Definition::Cookie *cookie) const;
+ Definition::Cookie *cookie() const;
+ void computeTooltip();
+ void _setSymbolName(const QCString &name);
+ QCString _symbolName() const;
DefinitionImpl(const DefinitionImpl &d);
private:
- virtual void _setSymbolName(const QCString &name);
- virtual QCString _symbolName() const ;
int _getXRefListId(const char *listName) const;
void _writeSourceRefList(OutputList &ol,const char *scopeName,const QCString &text,
@@ -141,124 +138,291 @@ class DefinitionImpl : virtual public DefinitionMutable
IMPL *m_impl; // internal structure holding all private data
};
-class DefinitionAliasImpl : virtual public Definition
+template<class Base>
+class DefinitionMixin : public Base
+{
+ public:
+ /*! Create a new definition */
+ DefinitionMixin(
+ const char *defFileName,int defLine,int defColumn,
+ const char *name,const char *b=0,const char *d=0,
+ bool isSymbol=TRUE) : m_impl(this,defFileName,defLine,defColumn,name,b,d,isSymbol) {}
+ virtual ~DefinitionMixin() {}
+
+ virtual bool isAlias() const { return FALSE; }
+ virtual const QCString &name() const { return m_impl.name(); }
+ virtual bool isAnonymous() const { return m_impl.isAnonymous(); }
+ virtual QCString localName() const { return m_impl.localName(); }
+ virtual QCString qualifiedName() const { return m_impl.qualifiedName(); }
+ virtual QCString symbolName() const { return m_impl.symbolName(); }
+ virtual QCString getSourceFileBase() const { return m_impl.getSourceFileBase(); }
+ virtual QCString getSourceAnchor() const { return m_impl.getSourceAnchor(); }
+ virtual QCString documentation() const { return m_impl.documentation(); }
+ virtual int docLine() const { return m_impl.docLine(); }
+ virtual QCString docFile() const { return m_impl.docFile(); }
+ virtual QCString briefDescription(bool abbreviate=FALSE) const { return m_impl.briefDescription(abbreviate); }
+ virtual QCString briefDescriptionAsTooltip() const { return m_impl.briefDescriptionAsTooltip(); }
+ virtual int briefLine() const { return m_impl.briefLine(); }
+ virtual QCString inbodyDocumentation() const { return m_impl.inbodyDocumentation(); }
+ virtual QCString inbodyFile() const { return m_impl.inbodyFile(); }
+ virtual int inbodyLine() const { return m_impl.inbodyLine(); }
+ virtual QCString briefFile() const { return m_impl.briefFile(); }
+ virtual QCString getDefFileName() const { return m_impl.getDefFileName(); }
+ virtual QCString getDefFileExtension() const { return m_impl.getDefFileExtension(); }
+ virtual int getDefLine() const { return m_impl.getDefLine(); }
+ virtual int getDefColumn() const { return m_impl.getDefColumn(); }
+ virtual bool hasDocumentation() const { return m_impl.hasDocumentation(); }
+ virtual bool hasUserDocumentation() const { return m_impl.hasUserDocumentation(); }
+ virtual bool isVisibleInProject() const { return m_impl.isVisibleInProject(); }
+ virtual bool isVisible() const { return m_impl.isVisible(); }
+ virtual bool isHidden() const { return m_impl.isHidden(); }
+ virtual bool isArtificial() const { return m_impl.isArtificial(); }
+ virtual QCString getReference() const { return m_impl.getReference(); }
+ virtual bool isReference() const { return m_impl.isReference(); }
+ virtual QCString externalReference(const QCString &relPath) const { return m_impl.externalReference(relPath); }
+ virtual int getStartDefLine() const { return m_impl.getStartDefLine(); }
+ virtual int getStartBodyLine() const { return m_impl.getStartBodyLine(); }
+ virtual int getEndBodyLine() const { return m_impl.getEndBodyLine(); }
+ virtual FileDef *getBodyDef() const { return m_impl.getBodyDef(); }
+ virtual SrcLangExt getLanguage() const { return m_impl.getLanguage(); }
+ virtual GroupList *partOfGroups() const { return m_impl.partOfGroups(); }
+ virtual bool isLinkableViaGroup() const { return m_impl.isLinkableViaGroup(); }
+ virtual const RefItemVector &xrefListItems() const { return m_impl.xrefListItems(); }
+ virtual const Definition *findInnerCompound(const char *name) const { return m_impl.findInnerCompound(name); }
+ virtual Definition *getOuterScope() const { return m_impl.getOuterScope(); }
+ virtual std::vector<const MemberDef *> getReferencesMembers() const { return m_impl.getReferencesMembers(); }
+ virtual std::vector<const MemberDef *> getReferencedByMembers() const { return m_impl.getReferencedByMembers(); }
+ virtual bool hasSections() const { return m_impl.hasSections(); }
+ virtual bool hasSources() const { return m_impl.hasSources(); }
+ virtual bool hasBriefDescription() const { return m_impl.hasBriefDescription(); }
+ virtual QCString id() const { return m_impl.id(); }
+ virtual const SectionRefs &getSectionRefs() const { return m_impl.getSectionRefs(); }
+
+ virtual void setName(const char *name) { m_impl.setName(name); }
+ virtual void setId(const char *name) { m_impl.setId(name); }
+ virtual void setDefFile(const QCString& df,int defLine,int defColumn)
+ { m_impl.setDefFile(df,defLine,defColumn); }
+ virtual void setDocumentation(const char *doc,const char *docFile,int docLine,bool stripWhiteSpace=TRUE)
+ { m_impl.setDocumentation(doc,docFile,docLine,stripWhiteSpace); }
+ virtual void setBriefDescription(const char *brief,const char *briefFile,int briefLine)
+ { m_impl.setBriefDescription(brief,briefFile,briefLine); }
+ virtual void setInbodyDocumentation(const char *doc,const char *docFile,int docLine)
+ { m_impl.setInbodyDocumentation(doc,docFile,docLine); }
+ virtual void setReference(const char *r)
+ { m_impl.setReference(r); }
+ virtual void addSectionsToDefinition(const std::vector<const SectionInfo*> &anchorList)
+ { m_impl.addSectionsToDefinition(anchorList); }
+ virtual void setBodySegment(int defLine,int bls,int ble)
+ { m_impl.setBodySegment(defLine,bls,ble); }
+ virtual void setBodyDef(FileDef *fd)
+ { m_impl.setBodyDef(fd); }
+ virtual void addSourceReferencedBy(const MemberDef *md)
+ { m_impl.addSourceReferencedBy(md); }
+ virtual void addSourceReferences(const MemberDef *md)
+ { m_impl.addSourceReferences(md); }
+ virtual void setRefItems(const RefItemVector &sli)
+ { m_impl.setRefItems(sli); }
+ virtual void mergeRefItems(Definition *def)
+ { m_impl.mergeRefItems(def); }
+ virtual void mergeReferences(const Definition *other)
+ { m_impl.mergeReferences(other); }
+ virtual void mergeReferencedBy(const Definition *other)
+ { m_impl.mergeReferencedBy(other); }
+ virtual void addInnerCompound(const Definition *def)
+ { m_impl.addInnerCompound(def); }
+ virtual void setOuterScope(Definition *def)
+ { m_impl.setOuterScope(def); }
+ virtual void setHidden(bool b)
+ { m_impl.setHidden(b); }
+ virtual void setArtificial(bool b)
+ { m_impl.setArtificial(b); }
+ virtual void setLanguage(SrcLangExt lang)
+ { m_impl.setLanguage(lang); }
+ virtual void writeSourceDef(OutputList &ol,const char *scopeName) const
+ { m_impl.writeSourceDef(ol,scopeName); }
+ virtual void writeInlineCode(OutputList &ol,const char *scopeName) const
+ { m_impl.writeInlineCode(ol,scopeName); }
+ virtual void writeSourceRefs(OutputList &ol,const char *scopeName) const
+ { m_impl.writeSourceRefs(ol,scopeName); }
+ virtual void writeSourceReffedBy(OutputList &ol,const char *scopeName) const
+ { m_impl.writeSourceReffedBy(ol,scopeName); }
+ virtual void makePartOfGroup(GroupDef *gd)
+ { m_impl.makePartOfGroup(gd); }
+ virtual void writeNavigationPath(OutputList &ol) const
+ { m_impl.writeNavigationPath(ol); }
+ virtual QCString navigationPathAsString() const
+ { return m_impl.navigationPathAsString(); }
+ virtual void writeQuickMemberLinks(OutputList &ol,const MemberDef *md) const
+ { m_impl.writeQuickMemberLinks(ol,md); }
+ virtual void writeSummaryLinks(OutputList &ol) const
+ { m_impl.writeSummaryLinks(ol); }
+ virtual QCString pathFragment() const
+ { return m_impl.pathFragment(); }
+ virtual void writeDocAnchorsToTagFile(FTextStream &fs) const
+ { m_impl.writeDocAnchorsToTagFile(fs); }
+ virtual void setLocalName(const QCString name)
+ { m_impl.setLocalName(name); }
+ virtual void addSectionsToIndex()
+ { m_impl.addSectionsToIndex(); }
+ virtual void writeToc(OutputList &ol, const LocalToc &lt) const
+ { m_impl.writeToc(ol,lt); }
+ virtual void setCookie(Definition::Cookie *cookie) const
+ { m_impl.setCookie(cookie); }
+ virtual Definition::Cookie *cookie() const
+ { return m_impl.cookie(); }
+ virtual void computeTooltip()
+ { m_impl.computeTooltip(); }
+ virtual void _setSymbolName(const QCString &name)
+ { m_impl._setSymbolName(name); }
+ virtual QCString _symbolName() const
+ { return m_impl._symbolName(); }
+
+ protected:
+
+ DefinitionMixin(const DefinitionMixin &def) = default;
+
+ private:
+ virtual Definition *toDefinition_() { return this; }
+ virtual DefinitionMutable *toDefinitionMutable_() { return this; }
+ virtual const DefinitionImpl *toDefinitionImpl_() const { return &m_impl; }
+
+ DefinitionImpl m_impl;
+};
+
+class DefinitionAliasImpl
{
public:
- DefinitionAliasImpl(const Definition *scope,const Definition *alias);
+ DefinitionAliasImpl(Definition *def,const Definition *alias);
virtual ~DefinitionAliasImpl();
+ private:
+ Definition *m_def;
+};
+
+template<class Base>
+class DefinitionAliasMixin : public Base
+{
+ public:
+ DefinitionAliasMixin(const Definition *scope,const Definition *alias)
+ : m_impl(this,alias), m_scope(scope), m_alias(alias), m_cookie(0) {}
+ virtual ~DefinitionAliasMixin() = default;
virtual bool isAlias() const { return TRUE; }
virtual const QCString &name() const
- { return m_def->name(); }
+ { return m_alias->name(); }
virtual bool isAnonymous() const
- { return m_def->isAnonymous(); }
+ { return m_alias->isAnonymous(); }
virtual QCString localName() const
- { return m_def->localName(); }
+ { return m_alias->localName(); }
virtual QCString qualifiedName() const
- { return m_def->qualifiedName(); }
+ { return m_alias->qualifiedName(); }
virtual QCString symbolName() const
- { return m_def->symbolName(); }
+ { return m_alias->symbolName(); }
virtual QCString getSourceFileBase() const
- { return m_def->getSourceFileBase(); }
+ { return m_alias->getSourceFileBase(); }
virtual QCString getSourceAnchor() const
- { return m_def->getSourceAnchor(); }
+ { return m_alias->getSourceAnchor(); }
virtual QCString documentation() const
- { return m_def->documentation(); }
+ { return m_alias->documentation(); }
virtual int docLine() const
- { return m_def->docLine(); }
+ { return m_alias->docLine(); }
virtual QCString docFile() const
- { return m_def->docFile(); }
+ { return m_alias->docFile(); }
virtual QCString briefDescription(bool abbreviate=FALSE) const
- { return m_def->briefDescription(abbreviate); }
+ { return m_alias->briefDescription(abbreviate); }
virtual QCString briefDescriptionAsTooltip() const
- { return m_def->briefDescriptionAsTooltip(); }
+ { return m_alias->briefDescriptionAsTooltip(); }
virtual int briefLine() const
- { return m_def->briefLine(); }
+ { return m_alias->briefLine(); }
virtual QCString inbodyDocumentation() const
- { return m_def->inbodyDocumentation(); }
+ { return m_alias->inbodyDocumentation(); }
virtual QCString inbodyFile() const
- { return m_def->inbodyFile(); }
+ { return m_alias->inbodyFile(); }
virtual int inbodyLine() const
- { return m_def->inbodyLine(); }
+ { return m_alias->inbodyLine(); }
virtual QCString briefFile() const
- { return m_def->briefFile(); }
+ { return m_alias->briefFile(); }
virtual QCString getDefFileName() const
- { return m_def->getDefFileName(); }
+ { return m_alias->getDefFileName(); }
virtual QCString getDefFileExtension() const
- { return m_def->getDefFileExtension(); }
+ { return m_alias->getDefFileExtension(); }
virtual int getDefLine() const
- { return m_def->getDefLine(); }
+ { return m_alias->getDefLine(); }
virtual int getDefColumn() const
- { return m_def->getDefColumn(); }
+ { return m_alias->getDefColumn(); }
virtual bool hasDocumentation() const
- { return m_def->hasDocumentation(); }
+ { return m_alias->hasDocumentation(); }
virtual bool hasUserDocumentation() const
- { return m_def->hasUserDocumentation(); }
+ { return m_alias->hasUserDocumentation(); }
virtual bool isVisibleInProject() const
- { return m_def->isVisibleInProject(); }
+ { return m_alias->isVisibleInProject(); }
virtual bool isVisible() const
- { return m_def->isVisible(); }
+ { return m_alias->isVisible(); }
virtual bool isHidden() const
- { return m_def->isHidden(); }
+ { return m_alias->isHidden(); }
virtual bool isArtificial() const
- { return m_def->isArtificial(); }
+ { return m_alias->isArtificial(); }
virtual QCString getReference() const
- { return m_def->getReference(); }
+ { return m_alias->getReference(); }
virtual bool isReference() const
- { return m_def->isReference(); }
+ { return m_alias->isReference(); }
virtual QCString externalReference(const QCString &relPath) const
- { return m_def->externalReference(relPath); }
+ { return m_alias->externalReference(relPath); }
virtual int getStartDefLine() const
- { return m_def->getStartDefLine(); }
+ { return m_alias->getStartDefLine(); }
virtual int getStartBodyLine() const
- { return m_def->getStartBodyLine(); }
+ { return m_alias->getStartBodyLine(); }
virtual int getEndBodyLine() const
- { return m_def->getEndBodyLine(); }
+ { return m_alias->getEndBodyLine(); }
virtual FileDef *getBodyDef() const
- { return m_def->getBodyDef(); }
+ { return m_alias->getBodyDef(); }
virtual SrcLangExt getLanguage() const
- { return m_def->getLanguage(); }
+ { return m_alias->getLanguage(); }
virtual GroupList *partOfGroups() const
- { return m_def->partOfGroups(); }
+ { return m_alias->partOfGroups(); }
virtual bool isLinkableViaGroup() const
- { return m_def->isLinkableViaGroup(); }
+ { return m_alias->isLinkableViaGroup(); }
virtual const RefItemVector &xrefListItems() const
- { return m_def->xrefListItems(); }
+ { return m_alias->xrefListItems(); }
virtual const Definition *findInnerCompound(const char *name) const
- { return m_def->findInnerCompound(name); }
+ { return m_alias->findInnerCompound(name); }
virtual Definition *getOuterScope() const
{ return const_cast<Definition*>(m_scope); }
virtual std::vector<const MemberDef *> getReferencesMembers() const
- { return m_def->getReferencesMembers(); }
+ { return m_alias->getReferencesMembers(); }
virtual std::vector<const MemberDef *> getReferencedByMembers() const
- { return m_def->getReferencedByMembers(); }
+ { return m_alias->getReferencedByMembers(); }
virtual bool hasSections() const
- { return m_def->hasSections(); }
+ { return m_alias->hasSections(); }
virtual bool hasSources() const
- { return m_def->hasSources(); }
+ { return m_alias->hasSources(); }
virtual bool hasBriefDescription() const
- { return m_def->hasBriefDescription(); }
+ { return m_alias->hasBriefDescription(); }
virtual QCString id() const
- { return m_def->id(); }
+ { return m_alias->id(); }
virtual const SectionRefs &getSectionRefs() const
- { return m_def->getSectionRefs(); }
+ { return m_alias->getSectionRefs(); }
virtual QCString navigationPathAsString() const
- { return m_def->navigationPathAsString(); }
+ { return m_alias->navigationPathAsString(); }
virtual QCString pathFragment() const
- { return m_def->pathFragment(); }
+ { return m_alias->pathFragment(); }
protected:
- const Definition *getAlias() const { return m_def; }
+ const Definition *getAlias() const { return m_alias; }
const Definition *getScope() const { return m_scope; }
private:
- virtual void setCookie(Cookie *cookie) const { delete m_cookie; m_cookie = cookie; }
- virtual Cookie *cookie() const { return m_cookie; }
+ virtual Definition *toDefinition_() { return this; }
+ virtual DefinitionMutable *toDefinitionMutable_() { return 0; }
+ virtual const DefinitionImpl *toDefinitionImpl_() const { return 0; }
+
+ virtual void setCookie(Definition::Cookie *cookie) const { delete m_cookie; m_cookie = cookie; }
+ virtual Definition::Cookie *cookie() const { return m_cookie; }
virtual void _setSymbolName(const QCString &name) { m_symbolName = name; }
virtual QCString _symbolName() const { return m_symbolName; }
+ DefinitionAliasImpl m_impl;
const Definition *m_scope;
- const Definition *m_def;
- mutable Cookie *m_cookie;
+ const Definition *m_alias;
+ mutable Definition::Cookie *m_cookie;
QCString m_symbolName;
};
diff --git a/src/dirdef.cpp b/src/dirdef.cpp
index b058f86..14d978e 100644
--- a/src/dirdef.cpp
+++ b/src/dirdef.cpp
@@ -19,7 +19,7 @@
//----------------------------------------------------------------------
-class DirDefImpl : public DefinitionImpl, public DirDef
+class DirDefImpl : public DefinitionMixin<DirDef>
{
public:
DirDefImpl(const char *path);
@@ -93,7 +93,7 @@ DirDef *createDirDef(const char *path)
static int g_dirCount=0;
-DirDefImpl::DirDefImpl(const char *path) : DefinitionImpl(path,1,1,path)
+DirDefImpl::DirDefImpl(const char *path) : DefinitionMixin(path,1,1,path)
{
bool fullPathNames = Config_getBool(FULL_PATH_NAMES);
// get display name (stripping the paths mentioned in STRIP_FROM_PATH)
@@ -1101,3 +1101,31 @@ bool compareDirDefs(const DirDef *item1, const DirDef *item2)
return qstricmp(item1->shortName(),item2->shortName()) < 0;
}
+// --- Cast functions
+
+DirDef *toDirDef(Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(DirDefImpl))
+ {
+ return static_cast<DirDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const DirDef *toDirDef(const Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(DirDefImpl))
+ {
+ return static_cast<const DirDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
diff --git a/src/dirdef.h b/src/dirdef.h
index 9097c09..32fa442 100644
--- a/src/dirdef.h
+++ b/src/dirdef.h
@@ -39,7 +39,7 @@ typedef std::vector<DirDef*> DirList;
bool compareDirDefs(const DirDef *item1, const DirDef *item2);
/** A model of a directory symbol. */
-class DirDef : virtual public DefinitionMutable
+class DirDef : public DefinitionMutable, public Definition
{
public:
virtual ~DirDef() {}
@@ -79,6 +79,14 @@ class DirDef : virtual public DefinitionMutable
virtual void computeDependencies() = 0;
};
+// --- Cast functions
+
+DirDef *toDirDef(Definition *d);
+const DirDef *toDirDef(const Definition *d);
+
+// ------------------
+
+
/** Class representing a pair of FileDef objects */
class FilePair
{
diff --git a/src/docparser.cpp b/src/docparser.cpp
index b908005..8621cc7 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -1100,7 +1100,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor
}
else if (compound->definitionType()==Definition::TypeGroup)
{
- name=(dynamic_cast<const GroupDef*>(compound))->groupTitle();
+ name=(toGroupDef(compound))->groupTitle();
}
children.append(new
DocLinkedWord(parent,name,
@@ -1112,7 +1112,7 @@ static void handleLinkedWord(DocNode *parent,QList<DocNode> &children,bool ignor
);
}
else if (compound->definitionType()==Definition::TypeFile &&
- (dynamic_cast<const FileDef*>(compound))->generateSourceFile()
+ (toFileDef(compound))->generateSourceFile()
) // undocumented file that has source code we can link to
{
children.append(new
@@ -2464,16 +2464,16 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) :
{
if (anchor.isEmpty() && /* compound link */
compound->definitionType()==Definition::TypeGroup && /* is group */
- (dynamic_cast<const GroupDef *>(compound))->groupTitle() /* with title */
+ (toGroupDef(compound))->groupTitle() /* with title */
)
{
- m_text=(dynamic_cast<const GroupDef *>(compound))->groupTitle(); // use group's title as link
+ m_text=(toGroupDef(compound))->groupTitle(); // use group's title as link
}
else if (compound->definitionType()==Definition::TypeMember &&
- (dynamic_cast<const MemberDef*>(compound))->isObjCMethod())
+ (toMemberDef(compound))->isObjCMethod())
{
// Objective C Method
- const MemberDef *member = dynamic_cast<const MemberDef*>(compound);
+ const MemberDef *member = toMemberDef(compound);
bool localLink = g_memberDef ? member->getClassDef()==g_memberDef->getClassDef() : FALSE;
m_text = member->objCMethodName(localLink,g_inSeeBlock);
}
@@ -2485,7 +2485,7 @@ DocRef::DocRef(DocNode *parent,const QCString &target,const QCString &context) :
return;
}
else if (compound && compound->definitionType()==Definition::TypeFile &&
- (dynamic_cast<const FileDef*>(compound))->generateSourceFile()
+ (toFileDef(compound))->generateSourceFile()
) // undocumented file that has source code we can link to
{
m_file = compound->getSourceFileBase();
@@ -2626,7 +2626,7 @@ DocLink::DocLink(DocNode *parent,const QCString &target)
m_ref = compound->getReference();
}
else if (compound && compound->definitionType()==Definition::TypeFile &&
- (dynamic_cast<const FileDef*>(compound))->generateSourceFile()
+ (toFileDef(compound))->generateSourceFile()
) // undocumented file that has source code we can link to
{
m_file = compound->getSourceFileBase();
@@ -7590,12 +7590,12 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine,
}
else if (ctx && ctx->definitionType()==Definition::TypePage)
{
- const Definition *scope = (dynamic_cast<const PageDef*>(ctx))->getPageScope();
+ const Definition *scope = (toPageDef(ctx))->getPageScope();
if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
}
else if (ctx && ctx->definitionType()==Definition::TypeGroup)
{
- const Definition *scope = (dynamic_cast<const GroupDef*>(ctx))->getGroupScope();
+ const Definition *scope = (toGroupDef(ctx))->getGroupScope();
if (scope && scope!=Doxygen::globalScope) g_context = scope->name();
}
else
diff --git a/src/docsets.cpp b/src/docsets.cpp
index d92e4f3..c59ca76 100644
--- a/src/docsets.cpp
+++ b/src/docsets.cpp
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2015 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -66,7 +66,7 @@ void DocSets::initialize()
}
FTextStream ts(&makefile);
- ts << "DOCSET_NAME=" << bundleId << ".docset\n"
+ ts << "DOCSET_NAME=" << bundleId << ".docset\n"
"DOCSET_CONTENTS=$(DOCSET_NAME)/Contents\n"
"DOCSET_RESOURCES=$(DOCSET_CONTENTS)/Resources\n"
"DOCSET_DOCUMENTS=$(DOCSET_RESOURCES)/Documents\n"
@@ -116,25 +116,25 @@ void DocSets::initialize()
}
FTextStream ts(&plist);
- ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
- "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n"
- "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
- "<plist version=\"1.0\">\n"
- "<dict>\n"
- " <key>CFBundleName</key>\n"
- " <string>" << projectName << "</string>\n"
+ ts << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+ "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\"\n"
+ "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
+ "<plist version=\"1.0\">\n"
+ "<dict>\n"
+ " <key>CFBundleName</key>\n"
+ " <string>" << projectName << "</string>\n"
" <key>CFBundleIdentifier</key>\n"
- " <string>" << bundleId << "</string>\n"
+ " <string>" << bundleId << "</string>\n"
" <key>CFBundleVersion</key>\n"
" <string>" << projectNumber << "</string>\n"
- " <key>DocSetFeedName</key>\n"
+ " <key>DocSetFeedName</key>\n"
" <string>" << feedName << "</string>\n"
" <key>DocSetPublisherIdentifier</key>\n"
" <string>" << publisherId << "</string>\n"
" <key>DocSetPublisherName</key>\n"
" <string>" << publisherName << "</string>\n"
// markers for Dash
- " <key>DashDocSetFamily</key>\n"
+ " <key>DashDocSetFamily</key>\n"
" <string>doxy</string>\n"
" <key>DocSetPlatformFamily</key>\n"
" <string>doxygen</string>\n"
@@ -226,8 +226,8 @@ void DocSets::decContentsDepth()
}
void DocSets::addContentsItem(bool isDir,
- const char *name,
- const char *ref,
+ const char *name,
+ const char *ref,
const char *file,
const char *anchor,
bool /* separateIndex */,
@@ -247,7 +247,7 @@ void DocSets::addContentsItem(bool isDir,
m_nts << indent() << " <Name>" << convertToXML(name) << "</Name>" << endl;
if (file && file[0]=='^') // URL marker
{
- m_nts << indent() << " <URL>" << convertToXML(&file[1])
+ m_nts << indent() << " <URL>" << convertToXML(&file[1])
<< "</URL>" << endl;
}
else // relative file
@@ -294,11 +294,11 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
// determine language
QCString lang;
SrcLangExt langExt = SrcLangExt_Cpp;
- if (md)
+ if (md)
{
langExt = md->getLanguage();
}
- else if (context)
+ else if (context)
{
langExt = context->getLanguage();
}
@@ -309,7 +309,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
{
if (md && (md->isObjCMethod() || md->isObjCProperty()))
lang="occ"; // Objective C/C++
- else if (fd && fd->name().right(2).lower()==".c")
+ else if (fd && fd->name().right(2).lower()==".c")
lang="c"; // Plain C
else if (cd==0 && nd==0)
lang="c"; // Plain C symbol outside any class or namespace
@@ -386,9 +386,9 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
case MemberType_DCOP:
type="dcop"; break;
case MemberType_Property:
- if (cd && cd->compoundType()==ClassDef::Protocol)
+ if (cd && cd->compoundType()==ClassDef::Protocol)
type="intfp"; // interface property
- else
+ else
type="instp"; // instance property
break;
case MemberType_Event:
@@ -404,7 +404,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
}
cd = md->getClassDef();
nd = md->getNamespaceDef();
- if (cd)
+ if (cd)
{
scope = cd->qualifiedName();
}
@@ -427,28 +427,28 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
{
if (fd==0 && context->definitionType()==Definition::TypeFile)
{
- fd = dynamic_cast<const FileDef*>(context);
+ fd = toFileDef(context);
}
if (cd==0 && context->definitionType()==Definition::TypeClass)
{
- cd = dynamic_cast<const ClassDef*>(context);
+ cd = toClassDef(context);
}
if (nd==0 && context->definitionType()==Definition::TypeNamespace)
{
- nd = dynamic_cast<const NamespaceDef*>(context);
+ nd = toNamespaceDef(context);
}
if (fd)
{
type="file";
}
- else if (cd)
+ else if (cd)
{
scope = cd->qualifiedName();
if (cd->isTemplate())
{
type="tmplt";
}
- else if (cd->compoundType()==ClassDef::Protocol)
+ else if (cd->compoundType()==ClassDef::Protocol)
{
type="intf";
if (scope.right(2)=="-p") scope=scope.left(scope.length()-2);
@@ -461,7 +461,7 @@ void DocSets::addIndexItem(const Definition *context,const MemberDef *md,
{
type="cat";
}
- else
+ else
{
type = "cl";
}
@@ -510,7 +510,7 @@ void DocSets::writeToken(FTextStream &t,
t << " <Scope>" << convertToXML(scope) << "</Scope>" << endl;
}
t << " </TokenIdentifier>" << endl;
- t << " <Path>" << d->getOutputFileBase()
+ t << " <Path>" << d->getOutputFileBase()
<< Doxygen::htmlFileExtension << "</Path>" << endl;
if (anchor)
{
diff --git a/src/dotgfxhierarchytable.cpp b/src/dotgfxhierarchytable.cpp
index f9078cf..82f1580 100644
--- a/src/dotgfxhierarchytable.cpp
+++ b/src/dotgfxhierarchytable.cpp
@@ -109,7 +109,7 @@ void DotGfxHierarchyTable::addHierarchy(DotNode *n,const ClassDef *cd,bool hideS
//printf("addHierarchy '%s' baseClasses=%d\n",cd->name().data(),cd->baseClasses()->count());
for (const auto &bcd : cd->subClasses())
{
- ClassDefMutable *bClass=ClassDef::make_mutable(bcd.classDef);
+ ClassDefMutable *bClass=toClassDefMutable(bcd.classDef);
//printf(" Trying sub class='%s' usedNodes=%d\n",bClass->name().data(),m_usedNodes->count());
if (bClass && bClass->isVisibleInHierarchy() && hasVisibleRoot(bClass->baseClasses()))
{
diff --git a/src/doxygen.cpp b/src/doxygen.cpp
index 8d34955..ef0828f 100644
--- a/src/doxygen.cpp
+++ b/src/doxygen.cpp
@@ -324,7 +324,7 @@ static void addPageToContext(PageDef *pd,Entry *root)
DefinitionMutable *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo());
if (d)
{
- pd->setPageScope(d);
+ pd->setPageScope(toDefinition(d));
}
}
}
@@ -453,7 +453,7 @@ static void findGroupScope(const Entry *root)
}
scope = stripAnonymousNamespaceScope(scope);
scope+="::"+gd->name();
- Definition *d = findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo());
+ Definition *d = toDefinition(findScopeFromQualifiedName(Doxygen::globalScope,scope,0,root->tagInfo()));
if (d)
{
gd->setGroupScope(d);
@@ -732,7 +732,7 @@ static DefinitionMutable *buildScopeFromQualifiedName(const QCString name,
if (nsName.isEmpty()) return prevScope;
if (!fullScope.isEmpty()) fullScope+="::";
fullScope+=nsName;
- NamespaceDefMutable *nd=NamespaceDef::make_mutable(Doxygen::namespaceSDict->find(fullScope));
+ NamespaceDefMutable *nd=toNamespaceDefMutable(Doxygen::namespaceSDict->find(fullScope));
DefinitionMutable *innerScope = nd;
ClassDefMutable *cd=0;
if (nd==0) cd = getClassMutable(fullScope);
@@ -760,8 +760,8 @@ static DefinitionMutable *buildScopeFromQualifiedName(const QCString name,
if (innerScope)
{
// make the parent/child scope relation
- prevScope->addInnerCompound(innerScope);
- innerScope->setOuterScope(prevScope);
+ prevScope->addInnerCompound(toDefinition(innerScope));
+ innerScope->setOuterScope(toDefinition(prevScope));
}
else // current scope is a class, so return only the namespace part...
{
@@ -793,9 +793,9 @@ static DefinitionMutable *findScopeFromQualifiedName(NamespaceDefMutable *startS
while ((i2=getScopeFragment(scope,p,&l2))!=-1)
{
QCString nestedNameSpecifier = scope.mid(i1,l1);
- Definition *orgScope = resultScope;
+ Definition *orgScope = toDefinition(resultScope);
//printf(" nestedNameSpecifier=%s\n",nestedNameSpecifier.data());
- resultScope = Definition::make_mutable(resultScope->findInnerCompound(nestedNameSpecifier));
+ resultScope = toDefinitionMutable(toDefinition(resultScope)->findInnerCompound(nestedNameSpecifier));
//printf(" resultScope=%p\n",resultScope);
if (resultScope==0)
{
@@ -804,7 +804,7 @@ static DefinitionMutable *findScopeFromQualifiedName(NamespaceDefMutable *startS
{
for (const auto &nd : fileScope->getUsedNamespaces())
{
- resultScope = findScopeFromQualifiedName(NamespaceDef::make_mutable(nd),n,fileScope,tagInfo);
+ resultScope = findScopeFromQualifiedName(toNamespaceDefMutable(nd),n,fileScope,tagInfo);
if (resultScope!=0) break;
}
if (resultScope)
@@ -813,7 +813,7 @@ static DefinitionMutable *findScopeFromQualifiedName(NamespaceDefMutable *startS
// N::A::I while looking for A, so we should compare
// resultScope->name() against scope.left(i2+l2)
//printf(" -> result=%s scope=%s\n",resultScope->name().data(),scope.data());
- if (rightScopeMatch(resultScope->name(),scope.left(i2+l2)))
+ if (rightScopeMatch(toDefinition(resultScope)->name(),scope.left(i2+l2)))
{
break;
}
@@ -1151,7 +1151,7 @@ static void resolveClassNestingRelations()
ClassSDict::Iterator cli(*Doxygen::classSDict);
for (cli.toFirst();cli.current();++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cdm = toClassDefMutable(cli.current());
if (cdm)
{
cdm->setVisited(FALSE);
@@ -1167,7 +1167,7 @@ static void resolveClassNestingRelations()
ClassDef *icd=0;
for (cli.toFirst();(icd=cli.current());++cli)
{
- ClassDefMutable *cd = ClassDef::make_mutable(icd);
+ ClassDefMutable *cd = toClassDefMutable(icd);
if (cd && !cd->isVisited())
{
QCString name = stripAnonymousNamespaceScope(cd->name());
@@ -1179,21 +1179,21 @@ static void resolveClassNestingRelations()
{
//printf("****** adding %s to scope %s in iteration %d\n",cd->name().data(),d->name().data(),iteration);
d->addInnerCompound(cd);
- cd->setOuterScope(d);
+ cd->setOuterScope(toDefinition(d));
// for inline namespace add an alias of the class to the outer scope
- while (d->definitionType()==Definition::TypeNamespace)
+ while (toDefinition(d)->definitionType()==Definition::TypeNamespace)
{
- NamespaceDef *nd = dynamic_cast<NamespaceDef*>(d);
+ NamespaceDef *nd = toNamespaceDef(d);
//printf("d->isInline()=%d\n",nd->isInline());
if (nd && nd->isInline())
{
- d = Definition::make_mutable(d->getOuterScope());
+ d = toDefinitionMutable(toDefinition(d)->getOuterScope());
if (d)
{
- ClassDef *aliasCd = createClassDefAlias(d,cd);
+ ClassDef *aliasCd = createClassDefAlias(toDefinition(d),cd);
d->addInnerCompound(aliasCd);
- QCString aliasFullName = d->qualifiedName()+"::"+aliasCd->localName();
+ QCString aliasFullName = toDefinition(d)->qualifiedName()+"::"+aliasCd->localName();
Doxygen::classSDict->append(aliasFullName,aliasCd);
//printf("adding %s to %s as %s\n",qPrint(aliasCd->name()),qPrint(d->name()),qPrint(aliasFullName));
//aliasCd->setVisited(TRUE); // not needed anymore, as aliasCd is not mutable
@@ -1220,7 +1220,7 @@ static void resolveClassNestingRelations()
ClassDef *icd=0;
for (cli.toFirst();(icd=cli.current());++cli)
{
- ClassDefMutable *cd = ClassDef::make_mutable(icd);
+ ClassDefMutable *cd = toClassDefMutable(icd);
if (cd && !cd->isVisited())
{
QCString name = stripAnonymousNamespaceScope(cd->name());
@@ -1228,13 +1228,13 @@ static void resolveClassNestingRelations()
/// create the scope artificially
// anyway, so we can at least relate scopes properly.
DefinitionMutable *d = buildScopeFromQualifiedName(name,name.contains("::"),cd->getLanguage(),0);
- if (d!=cd && !cd->getDefFileName().isEmpty())
+ if (d && d!=cd && !cd->getDefFileName().isEmpty())
// avoid recursion in case of redundant scopes, i.e: namespace N { class N::C {}; }
// for this case doxygen assumes the existence of a namespace N::N in which C is to be found!
// also avoid warning for stuff imported via a tagfile.
{
d->addInnerCompound(cd);
- cd->setOuterScope(d);
+ cd->setOuterScope(toDefinition(d));
warn(cd->getDefFileName(),cd->getDefLine(),
"Internal inconsistency: scope for class %s not "
"found!",name.data()
@@ -1253,7 +1253,7 @@ void distributeClassGroupRelations()
ClassSDict::Iterator cli(*Doxygen::classSDict);
for (cli.toFirst();cli.current();++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cdm = toClassDefMutable(cli.current());
if (cdm)
{
cdm->setVisited(FALSE);
@@ -1263,7 +1263,7 @@ void distributeClassGroupRelations()
ClassDef *icd;
for (cli.toFirst();(icd=cli.current());++cli)
{
- ClassDefMutable *cd = ClassDef::make_mutable(icd);
+ ClassDefMutable *cd = toClassDefMutable(icd);
//printf("Checking %s\n",cd->name().data());
// distribute the group to nested classes as well
if (cd && !cd->isVisited() && cd->partOfGroups()!=0 && cd->getClassSDict())
@@ -1274,7 +1274,7 @@ void distributeClassGroupRelations()
GroupDef *gd = cd->partOfGroups()->at(0);
for (ncli.toFirst();(ncd=ncli.current());++ncli)
{
- ClassDefMutable *ncdm = ClassDef::make_mutable(ncd);
+ ClassDefMutable *ncdm = toClassDefMutable(ncd);
if (ncdm && ncdm->partOfGroups()==0)
{
//printf(" Adding %s to group '%s'\n",ncd->name().data(),
@@ -1309,7 +1309,7 @@ static ClassDefMutable *createTagLessInstance(ClassDef *rootCd,ClassDef *templ,c
cd->setOuterScope(rootCd->getOuterScope());
if (rootCd->getOuterScope()!=Doxygen::globalScope)
{
- DefinitionMutable *outerScope = Definition::make_mutable(rootCd->getOuterScope());
+ DefinitionMutable *outerScope = toDefinitionMutable(rootCd->getOuterScope());
if (outerScope)
{
outerScope->addInnerCompound(cd);
@@ -1425,7 +1425,7 @@ static void processTagLessClasses(ClassDef *rootCd,
MemberDef *pmd;
for (pli.toFirst();(pmd=pli.current());++pli)
{
- MemberDefMutable *pmdm = MemberDef::make_mutable(pmd);
+ MemberDefMutable *pmdm = toMemberDefMutable(pmd);
if (pmdm && pmd->name()==md->name())
{
pmdm->setAccessorType(ncd,substitute(pmd->typeString(),icd->name(),ncd->name()));
@@ -1456,7 +1456,7 @@ static void findTagLessClasses(ClassDef *cd)
}
}
- processTagLessClasses(cd,cd,ClassDef::make_mutable(cd),"",0); // process tag less inner struct/classes (if any)
+ processTagLessClasses(cd,cd,toClassDefMutable(cd),"",0); // process tag less inner struct/classes (if any)
}
static void findTagLessClasses()
@@ -1501,7 +1501,7 @@ static void buildNamespaceList(const Entry *root)
//printf("Found namespace %s in %s at line %d\n",root->name.data(),
// root->fileName.data(), root->startLine);
NamespaceDefMutable *nd;
- if ((nd=NamespaceDef::make_mutable(Doxygen::namespaceSDict->find(fullName)))) // existing namespace
+ if ((nd=toNamespaceDefMutable(Doxygen::namespaceSDict->find(fullName)))) // existing namespace
{
nd->setDocumentation(root->doc,root->docFile,root->docLine);
nd->setName(fullName); // change name to match docs
@@ -1576,24 +1576,24 @@ static void buildNamespaceList(const Entry *root)
{
d = buildScopeFromQualifiedName(fullName,fullName.contains("::"),nd->getLanguage(),tagInfo);
d->addInnerCompound(nd);
- nd->setOuterScope(d);
+ nd->setOuterScope(toDefinition(d));
// TODO: Due to the order in which the tag file is written
// a nested class can be found before its parent!
}
else
{
d->addInnerCompound(nd);
- nd->setOuterScope(d);
+ nd->setOuterScope(toDefinition(d));
// in case of d is an inline namespace, alias insert nd in the part scope of d.
- while (d->definitionType()==Definition::TypeNamespace)
+ while (toDefinition(d)->definitionType()==Definition::TypeNamespace)
{
- NamespaceDef *pnd = dynamic_cast<NamespaceDef*>(d);
+ NamespaceDef *pnd = toNamespaceDef(d);
if (pnd && pnd->isInline())
{
- d = Definition::make_mutable(d->getOuterScope());
+ d = toDefinitionMutable(toDefinition(d)->getOuterScope());
if (d)
{
- NamespaceDef *aliasNd = createNamespaceDefAlias(d,nd);
+ NamespaceDef *aliasNd = createNamespaceDefAlias(toDefinition(d),nd);
//printf("adding %s to %s\n",qPrint(aliasNd->name()),qPrint(d->name()));
d->addInnerCompound(aliasNd);
}
@@ -1684,13 +1684,13 @@ static void findUsingDirectives(const Entry *root)
while (pnd && usingNd==0)
{
// also try with one of the used namespaces found earlier
- usingNd = NamespaceDef::make_mutable(findUsedNamespace(pnd->getUsedNamespaces(),name));
+ usingNd = toNamespaceDefMutable(findUsedNamespace(pnd->getUsedNamespaces(),name));
// goto the parent
const Definition *s = pnd->getOuterScope();
if (s && s->definitionType()==Definition::TypeNamespace)
{
- pnd = NamespaceDef::make_mutable(dynamic_cast<const NamespaceDef*>(s));
+ pnd = toNamespaceDefMutable(toNamespaceDef(s));
}
else
{
@@ -1832,7 +1832,7 @@ static void findUsingDeclarations(const Entry *root)
}
if (usingCd==0)
{
- usingCd = ClassDef::make_mutable(Doxygen::hiddenClasses->find(name)); // check if it is already hidden
+ usingCd = toClassDefMutable(Doxygen::hiddenClasses->find(name)); // check if it is already hidden
}
//printf("%s -> %p\n",root->name.data(),usingCd);
@@ -2075,7 +2075,7 @@ static MemberDef *addVariableToClass(
{
//printf("md->getClassDef()=%p cd=%p type=[%s] md->typeString()=[%s]\n",
// md->getClassDef(),cd,type.data(),md->typeString());
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md &&
md->getClassDef()==cd &&
removeRedundantWhiteSpace(type)==md->typeString())
@@ -2286,7 +2286,7 @@ static MemberDef *addVariableToFile(
}
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md &&
((nd==0 && md->getNamespaceDef()==0 && md->getFileDef() &&
root->fileName==md->getFileDef()->absFilePath()
@@ -3387,7 +3387,7 @@ static void buildFunctionList(const Entry *root)
Debug::print(Debug::Functions,0," --> function %s already found!\n",qPrint(rname));
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
const NamespaceDef *mnd = md->getNamespaceDef();
@@ -3587,15 +3587,16 @@ static void findFriends()
// for each function with that name
for (const auto &ifmd : *fn)
{
- MemberDefMutable *fmd = MemberDef::make_mutable(ifmd.get());
+ MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
// for each member with that name
for (const auto &immd : *mn)
{
- MemberDefMutable *mmd = MemberDef::make_mutable(immd.get());
+ MemberDefMutable *mmd = toMemberDefMutable(immd.get());
//printf("Checking for matching arguments
// mmd->isRelated()=%d mmd->isFriend()=%d mmd->isFunction()=%d\n",
// mmd->isRelated(),mmd->isFriend(),mmd->isFunction());
- if ((mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) &&
+ if (fmd && mmd &&
+ (mmd->isFriend() || (mmd->isRelated() && mmd->isFunction())) &&
matchArguments2(mmd->getOuterScope(), mmd->getFileDef(), &mmd->argumentList(),
fmd->getOuterScope(), fmd->getFileDef(), &fmd->argumentList(),
TRUE
@@ -3675,7 +3676,7 @@ static void transferFunctionDocumentation()
/* find a matching function declaration and definition for this function */
for (const auto &imdec : *mn)
{
- MemberDefMutable *mdec = MemberDef::make_mutable(imdec.get());
+ MemberDefMutable *mdec = toMemberDefMutable(imdec.get());
if (mdec &&
(mdec->isPrototype() ||
(mdec->isVariable() && mdec->isExternal())
@@ -3683,7 +3684,7 @@ static void transferFunctionDocumentation()
{
for (const auto &imdef : *mn)
{
- MemberDefMutable *mdef = MemberDef::make_mutable(imdef.get());
+ MemberDefMutable *mdef = toMemberDefMutable(imdef.get());
if (mdef && mdec!=mdef &&
mdec->getNamespaceDef()==mdef->getNamespaceDef())
{
@@ -3705,7 +3706,7 @@ static void transferFunctionReferences()
/* find a matching function declaration and definition for this function */
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
if (md->isPrototype())
@@ -3753,7 +3754,7 @@ static void transferRelatedFunctionDocumentation()
// for each global function
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
//printf(" Function '%s'\n",md->name().data());
@@ -3764,7 +3765,7 @@ static void transferRelatedFunctionDocumentation()
// for each member with the same name
for (const auto &irmd : *rmn)
{
- MemberDefMutable *rmd = MemberDef::make_mutable(irmd.get());
+ MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
//printf(" Member found: related='%d'\n",rmd->isRelated());
if (rmd &&
(rmd->isRelated() || rmd->isForeign()) && // related function
@@ -3935,7 +3936,7 @@ static void findUsedClassesForClass(const Entry *root,
found=TRUE;
Debug::print(Debug::Classes,0," New used class '%s'\n", qPrint(usedName));
- ClassDefMutable *usedCd = ClassDef::make_mutable(Doxygen::hiddenClasses->find(usedName));
+ ClassDefMutable *usedCd = toClassDefMutable(Doxygen::hiddenClasses->find(usedName));
if (usedCd==0)
{
usedCd = createClassDef(
@@ -3958,7 +3959,7 @@ static void findUsedClassesForClass(const Entry *root,
if (!found)
{
- ClassDefMutable *usedCd=ClassDef::make_mutable(findClassWithinClassContext(context,masterCd,usedName));
+ ClassDefMutable *usedCd=toClassDefMutable(findClassWithinClassContext(context,masterCd,usedName));
//printf("Looking for used class %s: result=%s master=%s\n",
// usedName.data(),usedCd?usedCd->name().data():"<none>",masterCd?masterCd->name().data():"<none>");
@@ -3978,7 +3979,7 @@ static void findUsedClassesForClass(const Entry *root,
}
if (!found && !type.isEmpty()) // used class is not documented in any scope
{
- ClassDefMutable *usedCd = ClassDef::make_mutable(Doxygen::hiddenClasses->find(type));
+ ClassDefMutable *usedCd = toClassDefMutable(Doxygen::hiddenClasses->find(type));
if (usedCd==0 && !Config_getBool(HIDE_UNDOC_RELATIONS))
{
if (type.right(2)=="(*" || type.right(2)=="(^") // type is a function pointer
@@ -4092,7 +4093,7 @@ static bool findTemplateInstanceRelation(const Entry *root,
if (existingClass) return TRUE;
bool freshInstance=FALSE;
- ClassDefMutable *instanceClass = ClassDef::make_mutable(
+ ClassDefMutable *instanceClass = toClassDefMutable(
templateClass->insertTemplateInstance(
root->fileName,root->startLine,root->startColumn,templSpec,freshInstance));
if (isArtificial) instanceClass->setArtificial(TRUE);
@@ -4323,7 +4324,7 @@ static bool findClassRelation(
if (baseClass==0 && (root->lang==SrcLangExt_CSharp || root->lang==SrcLangExt_Java))
{
// for Java/C# strip the template part before looking for matching
- baseClass = ClassDef::make_mutable(Doxygen::genericsDict->find(baseClassName.left(i)));
+ baseClass = toClassDefMutable(Doxygen::genericsDict->find(baseClassName.left(i)));
//printf("looking for '%s' result=%p\n",baseClassName.data(),baseClass);
}
if (baseClass==0 && i!=-1)
@@ -4391,7 +4392,7 @@ static bool findClassRelation(
if (!found)
{
- baseClass=ClassDef::make_mutable(findClassWithinClassContext(context,cd,baseClassName));
+ baseClass=toClassDefMutable(findClassWithinClassContext(context,cd,baseClassName));
//printf("findClassWithinClassContext(%s,%s)=%p\n",
// cd->name().data(),baseClassName.data(),baseClass);
found = baseClass!=0 && baseClass!=cd;
@@ -4477,7 +4478,7 @@ static bool findClassRelation(
baseClass=0;
if (isATemplateArgument)
{
- baseClass=ClassDef::make_mutable(Doxygen::hiddenClasses->find(baseClassName));
+ baseClass=toClassDefMutable(Doxygen::hiddenClasses->find(baseClassName));
if (baseClass==0)
{
baseClass=createClassDef(root->fileName,root->startLine,root->startColumn,
@@ -4490,7 +4491,7 @@ static bool findClassRelation(
}
else
{
- baseClass=ClassDef::make_mutable(Doxygen::classSDict->find(baseClassName));
+ baseClass=toClassDefMutable(Doxygen::classSDict->find(baseClassName));
//printf("*** classDDict->find(%s)=%p biName=%s templSpec=%s\n",
// baseClassName.data(),baseClass,biName.data(),templSpec.data());
if (baseClass==0)
@@ -4504,7 +4505,7 @@ static bool findClassRelation(
si = baseClassName.findRev("::");
if (si!=-1) // class is nested
{
- Definition *sd = findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo());
+ Definition *sd = toDefinition(findScopeFromQualifiedName(Doxygen::globalScope,baseClassName.left(si),0,root->tagInfo()));
if (sd==0 || sd==Doxygen::globalScope) // outer scope not found
{
baseClass->setArtificial(TRUE); // see bug678139
@@ -4632,7 +4633,7 @@ static void findInheritedTemplateInstances()
ClassSDict::Iterator cli(*Doxygen::classSDict);
for (cli.toFirst();cli.current();++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cdm = toClassDefMutable(cli.current());
if (cdm)
{
cdm->setVisited(FALSE);
@@ -4646,7 +4647,7 @@ static void findInheritedTemplateInstances()
Debug::print(Debug::Classes,0," Inheritance: Class %s : \n",qPrint(bName));
if ((cd=getClass(bName)))
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
//printf("Class %s %d\n",cd->name().data(),root->extends->count());
@@ -4661,7 +4662,7 @@ static void findUsedTemplateInstances()
ClassSDict::Iterator cli(*Doxygen::classSDict);
for (cli.toFirst();cli.current();++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cdm = toClassDefMutable(cli.current());
if (cdm)
{
cdm->setVisited(FALSE);
@@ -4675,7 +4676,7 @@ static void findUsedTemplateInstances()
Debug::print(Debug::Classes,0," Usage: Class %s : \n",qPrint(bName));
if ((cd=getClass(bName)))
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
findUsedClassesForClass(root,cd,cdm,cdm,TRUE);
@@ -4690,7 +4691,7 @@ static void computeClassRelations()
ClassSDict::Iterator cli(*Doxygen::classSDict);
for (cli.toFirst();cli.current();++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cdm = toClassDefMutable(cli.current());
if (cdm)
{
cdm->setVisited(FALSE);
@@ -4743,7 +4744,7 @@ static void computeTemplateClassRelations()
ClassDef *itcd;
for (tdi.toFirst();(itcd=tdi.current());++tdi) // for each template instance
{
- ClassDefMutable *tcd=ClassDef::make_mutable(itcd);
+ ClassDefMutable *tcd=toClassDefMutable(itcd);
if (tcd)
{
Debug::print(Debug::Classes,0," Template instance %s : \n",qPrint(tcd->name()));
@@ -4809,7 +4810,7 @@ static void computeMemberReferences()
ClassDef *cd=0;
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->computeAnchors();
@@ -4826,7 +4827,7 @@ static void computeMemberReferences()
NamespaceDef *nd=0;
for (nli.toFirst();(nd=nli.current());++nli)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->computeAnchors();
@@ -4848,7 +4849,7 @@ static void addListReferences()
ClassDef *cd=0;
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->addListReferences();
@@ -4867,7 +4868,7 @@ static void addListReferences()
NamespaceDef *nd=0;
for (nli.toFirst();(nd=nli.current());++nli)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->addListReferences();
@@ -5121,7 +5122,7 @@ static bool findGlobalMember(const Entry *root,
if (md->isAlias() && md->getOuterScope() &&
md->getOuterScope()->definitionType()==Definition::TypeNamespace)
{
- nd = dynamic_cast<const NamespaceDef *>(md->getOuterScope());
+ nd = toNamespaceDef(md->getOuterScope());
}
else
{
@@ -5203,7 +5204,7 @@ static bool findGlobalMember(const Entry *root,
if (matching) // add docs to the member
{
Debug::print(Debug::FindMembers,0,"5. Match found\n");
- addMemberDocs(root,MemberDef::make_mutable(md->resolveAlias()),decl,&root->argList,FALSE,root->spec);
+ addMemberDocs(root,toMemberDefMutable(md->resolveAlias()),decl,&root->argList,FALSE,root->spec);
found=TRUE;
break;
}
@@ -5268,7 +5269,7 @@ static bool scopeIsTemplate(const Definition *d)
bool result=FALSE;
if (d && d->definitionType()==Definition::TypeClass)
{
- result = !(dynamic_cast<const ClassDef*>(d))->templateArguments().empty() ||
+ result = !(toClassDef(d))->templateArguments().empty() ||
scopeIsTemplate(d->getOuterScope());
}
return result;
@@ -5473,7 +5474,7 @@ static void addMemberFunction(const Entry *root,
bool memFound=FALSE;
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md==0) continue;
ClassDefMutable *cd=md->getClassDefMutable();
Debug::print(Debug::FindMembers,0,
@@ -5691,7 +5692,7 @@ static void addMemberFunction(const Entry *root,
{
// we didn't find an actual match on argument lists, but there is only 1 member with this
// name in the same scope, so that has to be the one.
- addMemberDocs(root,MemberDef::make_mutable(umd),funcDecl,0,overloaded,spec);
+ addMemberDocs(root,toMemberDefMutable(umd),funcDecl,0,overloaded,spec);
return;
}
else if (candidates>1 && ecd && emd)
@@ -5699,7 +5700,7 @@ static void addMemberFunction(const Entry *root,
// we didn't find a unique match using type resolution,
// but one of the matches has the exact same signature so
// we take that one.
- addMemberDocs(root,MemberDef::make_mutable(emd),funcDecl,0,overloaded,spec);
+ addMemberDocs(root,toMemberDefMutable(emd),funcDecl,0,overloaded,spec);
return;
}
}
@@ -6276,7 +6277,7 @@ static void findMember(const Entry *root,
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->isDefine())
{
mdDefine = md;
@@ -6298,7 +6299,7 @@ static void findMember(const Entry *root,
MemberDefMutable *rmd_found = 0;
for (const auto &irmd : *mn)
{
- MemberDefMutable *rmd = MemberDef::make_mutable(irmd.get());
+ MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
if (rmd)
{
const ArgumentList &rmdAl = rmd->argumentList();
@@ -6398,7 +6399,7 @@ static void findMember(const Entry *root,
const MemberDefMutable *rmd_found=0;
for (const auto &irmd : *rmn)
{
- MemberDefMutable *rmd = MemberDef::make_mutable(irmd.get());
+ MemberDefMutable *rmd = toMemberDefMutable(irmd.get());
if (rmd)
{
const ArgumentList &rmdAl = rmd->argumentList();
@@ -6977,7 +6978,7 @@ static void addEnumValuesToEnums(const Entry *root)
// for each enum in this list
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
// use raw pointer in this loop, since we modify mn and can then invalidate mdp.
if (md && md->isEnumerate() && !root->children().empty())
{
@@ -7047,7 +7048,7 @@ static void addEnumValuesToEnums(const Entry *root)
{
for (const auto &ifmd : *fmn)
{
- MemberDefMutable *fmd = MemberDef::make_mutable(ifmd.get());
+ MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
if (fmd && fmd->isEnumValue() && fmd->getOuterScope()==md->getOuterScope()) // in same scope
{
//printf("found enum value with same name %s in scope %s\n",
@@ -7160,7 +7161,7 @@ static void findEnumDocumentation(const Entry *root)
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && (cd=md->getClassDef()) && cd->name()==className && md->isEnumerate())
{
// documentation outside a compound overrides the documentation inside it
@@ -7218,7 +7219,7 @@ static void findEnumDocumentation(const Entry *root)
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->isEnumerate())
{
md->setDocumentation(root->doc,root->docFile,root->docLine);
@@ -7262,7 +7263,7 @@ static void findDEV(const MemberNameLinkedMap &mnsd)
// for each member definition
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->isEnumerate()) // member is an enum
{
const MemberList *fmdl = md->enumFieldList();
@@ -7311,7 +7312,7 @@ static void addMembersToIndex()
// for each member definition
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
if (md->getNamespaceDef())
@@ -7337,7 +7338,7 @@ static void vhdlCorrectMemberProperties()
// for each member definition
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
VhdlDocGen::correctMemberProperties(md);
@@ -7350,7 +7351,7 @@ static void vhdlCorrectMemberProperties()
// for each member definition
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
VhdlDocGen::correctMemberProperties(md);
@@ -7372,13 +7373,13 @@ static void computeMemberRelations()
// for each member with a specific name
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
// for each other member with the same name
for ( const auto &ibmd : *mn)
{
- MemberDefMutable *bmd = MemberDef::make_mutable(ibmd.get());
+ MemberDefMutable *bmd = toMemberDefMutable(ibmd.get());
if (bmd && md!=bmd)
{
const ClassDef *mcd = md->getClassDef();
@@ -7468,7 +7469,7 @@ static void createTemplateInstanceMembers()
// for each instance of the template
for (qdi.toFirst();(tcd=qdi.current());++qdi)
{
- ClassDefMutable *tcdm = ClassDef::make_mutable(tcd);
+ ClassDefMutable *tcdm = toClassDefMutable(tcd);
if (tcdm)
{
tcdm->addMembersToTemplateInstance(cd,qdi.currentKey());
@@ -7491,7 +7492,7 @@ static void mergeCategories()
if (i!=-1) // it is an Objective-C category
{
QCString baseName=cd->name().left(i);
- ClassDefMutable *baseClass=ClassDef::make_mutable(Doxygen::classSDict->find(baseName));
+ ClassDefMutable *baseClass=toClassDefMutable(Doxygen::classSDict->find(baseName));
if (baseClass)
{
//printf("*** merging members of category %s into %s\n",
@@ -7515,7 +7516,7 @@ static void buildCompleteMemberLists()
cd->subClasses().empty() && // is a root of the hierarchy
!cd->baseClasses().empty()) // and has at least one base class
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
//printf("*** merging members for %s\n",cd->name().data());
@@ -7526,7 +7527,7 @@ static void buildCompleteMemberLists()
// now sort the member list of all members for all classes.
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->sortAllMembersList();
@@ -7875,7 +7876,7 @@ static void sortMemberLists()
ClassDef *cd=0;
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->sortMemberLists();
@@ -7887,7 +7888,7 @@ static void sortMemberLists()
NamespaceDef *nd=0;
for (nli.toFirst();(nd=nli.current());++nli)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->sortMemberLists();
@@ -7925,8 +7926,8 @@ static void computeTooltipTexts()
{
for (const auto &kv : Doxygen::symbolMap)
{
- DefinitionMutable *dm = Definition::make_mutable(kv.second);
- if (!isSymbolHidden(dm) && dm->isLinkableInProject())
+ DefinitionMutable *dm = toDefinitionMutable(kv.second);
+ if (dm && !isSymbolHidden(toDefinition(dm)) && toDefinition(dm)->isLinkableInProject())
{
dm->computeTooltip();
}
@@ -7941,7 +7942,7 @@ static void setAnonymousEnumType()
ClassDef *cd=0;
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->setAnonymousEnumType();
@@ -7957,7 +7958,7 @@ static void countMembers()
ClassDef *cd=0;
for (cli.toFirst();(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->countMembers();
@@ -7968,7 +7969,7 @@ static void countMembers()
NamespaceDef *nd=0;
for (nli.toFirst();(nd=nli.current());++nli)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->countMembers();
@@ -8000,7 +8001,7 @@ static void generateClassList(ClassSDict &classSDict)
ClassSDict::Iterator cli(classSDict);
for ( ; cli.current() ; ++cli )
{
- ClassDefMutable *cd=ClassDef::make_mutable(cli.current());
+ ClassDefMutable *cd=toClassDefMutable(cli.current());
//printf("cd=%s getOuterScope=%p global=%p\n",cd->name().data(),cd->getOuterScope(),Doxygen::globalScope);
if (cd &&
@@ -8038,7 +8039,7 @@ static void inheritDocumentation()
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
//static int count=0;
//printf("%04d Member '%s'\n",count++,md->qualifiedName().data());
if (md && md->documentation().isEmpty() && md->briefDescription().isEmpty())
@@ -8094,7 +8095,7 @@ static void combineUsingRelations()
}
for (nli.toFirst() ; (nd=nli.current()) ; ++nli )
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->combineUsingRelations();
@@ -8111,7 +8112,7 @@ static void addMembersToMemberGroup()
ClassDef *cd;
for ( ; (cd=cli.current()) ; ++cli )
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->addMembersToMemberGroup();
@@ -8130,7 +8131,7 @@ static void addMembersToMemberGroup()
NamespaceDef *nd;
for ( ; (nd=nli.current()) ; ++nli )
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->addMembersToMemberGroup();
@@ -8154,7 +8155,7 @@ static void distributeMemberGroupDocumentation()
ClassDef *cd;
for ( ; (cd=cli.current()) ; ++cli )
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->distributeMemberGroupDocumentation();
@@ -8173,7 +8174,7 @@ static void distributeMemberGroupDocumentation()
NamespaceDef *nd;
for ( ; (nd=nli.current()) ; ++nli )
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->distributeMemberGroupDocumentation();
@@ -8197,7 +8198,7 @@ static void findSectionsInDocumentation()
ClassDef *cd;
for ( ; (cd=cli.current()) ; ++cli )
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->findSectionsInDocumentation();
@@ -8216,7 +8217,7 @@ static void findSectionsInDocumentation()
NamespaceDef *nd;
for ( ; (nd=nli.current()) ; ++nli )
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->findSectionsInDocumentation();
@@ -8267,7 +8268,7 @@ static void flushCachedTemplateRelations()
// for each function with that name
for (const auto &ifmd : *fn)
{
- MemberDefMutable *fmd = MemberDef::make_mutable(ifmd.get());
+ MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
if (fmd && fmd->isTypedefValCached())
{
const ClassDef *cd = fmd->getCachedTypedefVal();
@@ -8281,7 +8282,7 @@ static void flushCachedTemplateRelations()
// for each function with that name
for (const auto &imd : *nm)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->isTypedefValCached())
{
const ClassDef *cd = md->getCachedTypedefVal();
@@ -8325,7 +8326,7 @@ static void flushUnresolvedRelations()
// for each function with that name
for (const auto &ifmd : *fn)
{
- MemberDefMutable *fmd = MemberDef::make_mutable(ifmd.get());
+ MemberDefMutable *fmd = toMemberDefMutable(ifmd.get());
if (fmd)
{
fmd->invalidateCachedArgumentTypes();
@@ -8338,7 +8339,7 @@ static void flushUnresolvedRelations()
// for each function with that name
for (const auto &imd : *nm)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md)
{
md->invalidateCachedArgumentTypes();
@@ -8385,7 +8386,7 @@ static void findDefineDocumentation(Entry *root)
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->memberType()==MemberType_Define)
{
md->setDocumentation(root->doc,root->docFile,root->docLine);
@@ -8416,7 +8417,7 @@ static void findDefineDocumentation(Entry *root)
{
for (const auto &imd : *mn)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd.get());
+ MemberDefMutable *md = toMemberDefMutable(imd.get());
if (md && md->memberType()==MemberType_Define)
{
const FileDef *fd=md->getFileDef();
@@ -8731,7 +8732,7 @@ static void resolveUserReferences()
const GroupDef *gd=0;
if (si->definition()->definitionType()==Definition::TypeMember)
{
- gd = (dynamic_cast<MemberDef *>(si->definition()))->getGroupDef();
+ gd = (toMemberDef(si->definition()))->getGroupDef();
}
if (gd)
@@ -8908,7 +8909,7 @@ static void generateNamespaceClassDocs(ClassSDict *d)
ClassDef *cd;
for ( ; (cd=cli.current()) ; ++cli )
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
if ( ( cd->isLinkableInProject() &&
@@ -8942,7 +8943,7 @@ static void generateNamespaceDocs()
if (nd->isLinkableInProject())
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
msg("Generating docs for namespace %s\n",nd->name().data());
@@ -9923,7 +9924,7 @@ static void dumpSymbol(FTextStream &t,Definition *d)
QCString anchor;
if (d->definitionType()==Definition::TypeMember)
{
- MemberDef *md = dynamic_cast<MemberDef *>(d);
+ MemberDef *md = toMemberDef(d);
anchor=":"+md->anchor();
}
QCString scope;
@@ -10697,7 +10698,7 @@ static void writeTagFile()
ClassDef *cd;
for ( ; (cd=cli.current()) ; ++cli )
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm && cdm->isLinkableInProject())
{
cdm->writeTagFile(tagFile);
@@ -10708,7 +10709,7 @@ static void writeTagFile()
NamespaceDef *nd;
for ( ; (nd=nli.current()) ; ++nli )
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm && nd->isLinkableInProject())
{
ndm->writeTagFile(tagFile);
diff --git a/src/filedef.cpp b/src/filedef.cpp
index aa6d598..01b5bfd 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -48,7 +48,7 @@
//---------------------------------------------------------------------------
-class FileDefImpl : public DefinitionImpl, public FileDef
+class FileDefImpl : public DefinitionMixin<FileDef>
{
public:
FileDefImpl(const char *p,const char *n,const char *ref=0,const char *dn=0);
@@ -222,7 +222,7 @@ class DevNullCodeDocInterface : public CodeOutputInterface
*/
FileDefImpl::FileDefImpl(const char *p,const char *nm,
const char *lref,const char *dn)
- : DefinitionImpl((QCString)p+nm,1,1,nm)
+ : DefinitionMixin((QCString)p+nm,1,1,nm)
{
m_path=p;
m_filePath=m_path+nm;
@@ -1444,7 +1444,7 @@ const QCString &FileDefImpl::name() const
if (Config_getBool(FULL_PATH_NAMES))
return m_fileName;
else
- return DefinitionImpl::name();
+ return DefinitionMixin::name();
}
void FileDefImpl::addSourceRef(int line,Definition *d,MemberDef *md)
@@ -1895,7 +1895,7 @@ void FileDefImpl::combineUsingRelations()
LinkedRefMap<const NamespaceDef> usingDirList = m_usingDirList;
for (auto &nd : usingDirList)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->combineUsingRelations();
@@ -2016,7 +2016,7 @@ void FileDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
}
if (ml->listType()&MemberListType_declarationLists)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->setSectionList(this,ml);
@@ -2170,3 +2170,31 @@ int FileDefImpl::numDecMembers() const
return ml ? ml->numDecMembers() : 0;
}
+// --- Cast functions
+
+FileDef *toFileDef(Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(FileDefImpl))
+ {
+ return static_cast<FileDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const FileDef *toFileDef(const Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(FileDefImpl))
+ {
+ return static_cast<const FileDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
diff --git a/src/filedef.h b/src/filedef.h
index 900399d..e3333dc 100644
--- a/src/filedef.h
+++ b/src/filedef.h
@@ -63,7 +63,7 @@ struct IncludeInfo
* The member writeDocumentation() can be used to generate the page of
* documentation to HTML and LaTeX.
*/
-class FileDef : virtual public DefinitionMutable
+class FileDef : public DefinitionMutable, public Definition
{
public:
~FileDef() {}
@@ -188,6 +188,15 @@ class FileDef : virtual public DefinitionMutable
FileDef *createFileDef(const char *p,const char *n,const char *ref=0,const char *dn=0);
+
+
+// --- Cast functions
+
+FileDef *toFileDef(Definition *d);
+const FileDef *toFileDef(const Definition *d);
+
+// ------------------
+
/** Class representing a list of FileDef objects. */
class FileList : public QList<FileDef>
{
diff --git a/src/fortrancode.l b/src/fortrancode.l
index 39dc721..0de7b84 100644
--- a/src/fortrancode.l
+++ b/src/fortrancode.l
@@ -297,7 +297,7 @@ LANGUAGE_BIND_SPEC BIND{BS}"("{BS}C{BS}(,{BS}NAME{BS}"="{BS}"\""(.*)"\""{BS})?")
}
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
- MemberDefMutable *mdm = MemberDef::make_mutable(yyextra->currentMemberDef);
+ MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
mdm->incrementFlowKeyWordCount();
@@ -1237,7 +1237,7 @@ static bool getLink(yyscan_t yyscanner,UseSDict *usedict, // dictionary with use
if (yyextra->currentDefinition && yyextra->currentMemberDef &&
md!=yyextra->currentMemberDef && yyextra->insideBody && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
writeMultiLineCodeLink(yyscanner,ol,md,text ? text : memberText);
addToSearchIndex(yyscanner, text ? text : memberText);
diff --git a/src/ftvhelp.cpp b/src/ftvhelp.cpp
index b34f644..c8edeb2 100644
--- a/src/ftvhelp.cpp
+++ b/src/ftvhelp.cpp
@@ -249,7 +249,7 @@ static QCString node2URL(const FTVNode *n,bool overruleFile=FALSE,bool srcLink=F
{
if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile)
{
- const FileDef *fd = dynamic_cast<const FileDef*>(n->def);
+ const FileDef *fd = toFileDef(n->def);
if (srcLink)
{
url = fd->getSourceFileBase();
@@ -419,7 +419,7 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in
}
else if (n->def && n->def->definitionType()==Definition::TypeClass)
{
- char icon=compoundIcon(dynamic_cast<const ClassDef*>(n->def));
+ char icon=compoundIcon(toClassDef(n->def));
t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>";
}
else
@@ -444,9 +444,9 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in
{
const FileDef *srcRef=0;
if (n->def && n->def->definitionType()==Definition::TypeFile &&
- (dynamic_cast<const FileDef*>(n->def))->generateSourceFile())
+ (toFileDef(n->def))->generateSourceFile())
{
- srcRef = dynamic_cast<const FileDef*>(n->def);
+ srcRef = toFileDef(n->def);
}
if (srcRef)
{
@@ -475,7 +475,7 @@ void FTVHelp::generateTree(FTextStream &t, const QList<FTVNode> &nl,int level,in
}
else if (n->def && n->def->definitionType()==Definition::TypeClass)
{
- char icon=compoundIcon(dynamic_cast<const ClassDef*>(n->def));
+ char icon=compoundIcon(toClassDef(n->def));
t << "<span class=\"icona\"><span class=\"icon\">" << icon << "</span></span>";
}
else if (n->def && n->def->definitionType()==Definition::TypeDir)
@@ -591,7 +591,7 @@ static bool generateJSTree(NavIndexEntryList &navIndex,FTextStream &t,
{
if (n->def && n->def->definitionType()==Definition::TypeFile)
{
- const FileDef *fd = dynamic_cast<const FileDef*>(n->def);
+ const FileDef *fd = toFileDef(n->def);
bool doc,src;
doc = fileVisibleInIndex(fd,src);
if (doc)
diff --git a/src/groupdef.cpp b/src/groupdef.cpp
index 4574b37..2e01d64 100644
--- a/src/groupdef.cpp
+++ b/src/groupdef.cpp
@@ -45,7 +45,7 @@
//---------------------------------------------------------------------------
-class GroupDefImpl : public DefinitionImpl, public GroupDef
+class GroupDefImpl : public DefinitionMixin<GroupDef>
{
public:
GroupDefImpl(const char *fileName,int line,const char *name,const char *title,const char *refFileName=0);
@@ -54,7 +54,7 @@ class GroupDefImpl : public DefinitionImpl, public GroupDef
virtual DefType definitionType() const { return TypeGroup; }
virtual QCString getOutputFileBase() const;
virtual QCString anchor() const { return QCString(); }
- virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionImpl::name(); }
+ virtual QCString displayName(bool=TRUE) const { return hasGroupTitle() ? m_title : DefinitionMixin::name(); }
virtual const char *groupTitle() const { return m_title; }
virtual void setGroupTitle( const char *newtitle );
virtual bool hasGroupTitle( ) const { return m_titleSet; }
@@ -161,7 +161,7 @@ GroupDef *createGroupDef(const char *fileName,int line,const char *name,
//---------------------------------------------------------------------------
GroupDefImpl::GroupDefImpl(const char *df,int dl,const char *na,const char *t,
- const char *refFileName) : DefinitionImpl(df,dl,1,na)
+ const char *refFileName) : DefinitionMixin(df,dl,1,na)
{
m_fileList = new FileList;
m_classSDict = new ClassSDict(17);
@@ -396,7 +396,7 @@ bool GroupDefImpl::insertMember(MemberDef *md,bool docOnly)
sameScope // both are found in the same scope
)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm && srcMd->getGroupAlias()==0)
{
mdm->setGroupAlias(srcMd);
@@ -1438,7 +1438,7 @@ void addClassToGroups(const Entry *root,ClassDef *cd)
GroupDef *gd=0;
if (!g.groupname.isEmpty() && (gd=Doxygen::groupSDict->find(g.groupname)))
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm && gd->addClass(cdm))
{
cdm->makePartOfGroup(gd);
@@ -1459,7 +1459,7 @@ void addNamespaceToGroups(const Entry *root,NamespaceDef *nd)
{
if (gd->addNamespace(nd))
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->makePartOfGroup(gd);
@@ -1604,13 +1604,13 @@ void addMemberToGroups(const Entry *root,MemberDef *md)
bool success = fgd->insertMember(md);
if (success)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
//printf("insertMember successful\n");
mdm->setGroupDef(fgd,pri,root->fileName,root->startLine,!root->doc.isEmpty());
}
- ClassDefMutable *cdm = ClassDef::make_mutable(mdm->getClassDefOfAnonymousType());
+ ClassDefMutable *cdm = toClassDefMutable(mdm->getClassDefOfAnonymousType());
if (cdm)
{
cdm->setGroupDefForAllMembers(fgd,pri,root->fileName,root->startLine,root->doc.length() != 0);
@@ -1787,3 +1787,32 @@ bool GroupDefImpl::hasDetailedDescription() const
!documentation().isEmpty());
}
+// --- Cast functions
+
+GroupDef *toGroupDef(Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(GroupDefImpl))
+ {
+ return static_cast<GroupDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const GroupDef *toGroupDef(const Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(GroupDefImpl))
+ {
+ return static_cast<const GroupDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
diff --git a/src/groupdef.h b/src/groupdef.h
index b9e0740..0df5344 100644
--- a/src/groupdef.h
+++ b/src/groupdef.h
@@ -43,7 +43,7 @@ class MemberDef;
class FTextStream;
/** A model of a group of symbols. */
-class GroupDef : virtual public DefinitionMutable
+class GroupDef : public DefinitionMutable, public Definition
{
public:
~GroupDef() {}
@@ -108,6 +108,14 @@ class GroupDef : virtual public DefinitionMutable
GroupDef *createGroupDef(const char *fileName,int line,const char *name,
const char *title,const char *refFileName=0);
+// --- Cast functions
+
+GroupDef *toGroupDef(Definition *d);
+const GroupDef *toGroupDef(const Definition *d);
+
+// ------------------
+
+
/** A sorted dictionary of GroupDef objects. */
class GroupSDict : public SDict<GroupDef>
{
diff --git a/src/index.cpp b/src/index.cpp
index 7dacc14..3b3c520 100644
--- a/src/index.cpp
+++ b/src/index.cpp
@@ -1576,7 +1576,7 @@ static void writeClassTree(ClassSDict *clDict,FTVHelp *ftv,bool addToIndex,bool
ClassDef *cd;
for (;(cd=cli.current());++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm && cd->getLanguage()==SrcLangExt_VHDL)
{
if ((VhdlDocGen::VhdlClasses)cd->protection()==VhdlDocGen::PACKAGECLASS ||
diff --git a/src/memberdef.cpp b/src/memberdef.cpp
index fe7b1bd..95c6613 100644
--- a/src/memberdef.cpp
+++ b/src/memberdef.cpp
@@ -47,7 +47,7 @@
//-----------------------------------------------------------------------------
-class MemberDefImpl : public DefinitionImpl, public MemberDefMutable
+class MemberDefImpl : public DefinitionMixin<MemberDefMutable>
{
public:
MemberDefImpl(const char *defFileName,int defLine,int defColumn,
@@ -372,15 +372,15 @@ MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defCol
//-----------------------------------------------------------------------------
-class MemberDefAliasImpl : public DefinitionAliasImpl, public MemberDef
+class MemberDefAliasImpl : public DefinitionAliasMixin<MemberDef>
{
public:
MemberDefAliasImpl(const Definition *newScope,const MemberDef *md)
- : DefinitionAliasImpl(newScope,md), m_memberGroup(0) {}
+ : DefinitionAliasMixin(newScope,md), m_memberGroup(0) {}
virtual ~MemberDefAliasImpl() {}
virtual DefType definitionType() const { return TypeMember; }
- const MemberDef *getMdAlias() const { return dynamic_cast<const MemberDef*>(getAlias()); }
+ const MemberDef *getMdAlias() const { return toMemberDef(getAlias()); }
virtual MemberDef *resolveAlias() { return const_cast<MemberDef*>(getMdAlias()); }
virtual const MemberDef *resolveAlias() const { return getMdAlias(); }
@@ -888,7 +888,7 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me
}
else if (scope->definitionType()==Definition::TypeClass)
{
- cName=tempArgListToString((dynamic_cast<const ClassDef*>(scope))->templateArguments(),
+ cName=tempArgListToString((toClassDef(scope))->templateArguments(),
scope->getLanguage());
//printf("2. cName=%s\n",cName.data());
}
@@ -1432,7 +1432,7 @@ MemberDefImpl::MemberDefImpl(const char *df,int dl,int dc,
const char *t,const char *na,const char *a,const char *e,
Protection p,Specifier v,bool s,Relationship r,MemberType mt,
const ArgumentList &tal,const ArgumentList &al,const char *meta
- ) : DefinitionImpl(df,dl,dc,removeRedundantWhiteSpace(na))
+ ) : DefinitionMixin(df,dl,dc,removeRedundantWhiteSpace(na))
{
//printf("MemberDefImpl::MemberDef(%s)\n",na);
m_impl = new MemberDefImpl::IMPL;
@@ -1442,7 +1442,7 @@ MemberDefImpl::MemberDefImpl(const char *df,int dl,int dc,
m_isDestructorCached = 0;
}
-MemberDefImpl::MemberDefImpl(const MemberDefImpl &md) : DefinitionImpl(md)
+MemberDefImpl::MemberDefImpl(const MemberDefImpl &md) : DefinitionMixin(md)
{
m_impl = new MemberDefImpl::IMPL;
m_isLinkableCached = 0;
@@ -1512,15 +1512,15 @@ void MemberDefImpl::moveTo(Definition *scope)
setOuterScope(scope);
if (scope->definitionType()==Definition::TypeClass)
{
- m_impl->classDef = dynamic_cast<ClassDef*>(scope);
+ m_impl->classDef = toClassDef(scope);
}
else if (scope->definitionType()==Definition::TypeFile)
{
- m_impl->fileDef = dynamic_cast<FileDef*>(scope);
+ m_impl->fileDef = toFileDef(scope);
}
else if (scope->definitionType()==Definition::TypeNamespace)
{
- m_impl->nspace = dynamic_cast<NamespaceDef*>(scope);
+ m_impl->nspace = toNamespaceDef(scope);
}
m_isLinkableCached = 0;
m_isConstructorCached = 0;
@@ -1544,7 +1544,7 @@ void MemberDefImpl::insertReimplementedBy(MemberDef *md)
{
if (m_impl->templateMaster)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(m_impl->templateMaster);
+ MemberDefMutable *mdm = toMemberDefMutable(m_impl->templateMaster);
if (mdm)
{
mdm->insertReimplementedBy(md);
@@ -1686,7 +1686,7 @@ QCString MemberDefImpl::getOutputFileBase() const
QCString MemberDefImpl::getReference() const
{
- QCString ref = DefinitionImpl::getReference();
+ QCString ref = DefinitionMixin::getReference();
if (!ref.isEmpty())
{
return ref;
@@ -1821,25 +1821,25 @@ void MemberDefImpl::_computeLinkableInProject()
void MemberDefImpl::setDocumentation(const char *d,const char *docFile,int docLine,bool stripWhiteSpace)
{
- DefinitionImpl::setDocumentation(d,docFile,docLine,stripWhiteSpace);
+ DefinitionMixin::setDocumentation(d,docFile,docLine,stripWhiteSpace);
m_isLinkableCached = 0;
}
void MemberDefImpl::setBriefDescription(const char *b,const char *briefFile,int briefLine)
{
- DefinitionImpl::setBriefDescription(b,briefFile,briefLine);
+ DefinitionMixin::setBriefDescription(b,briefFile,briefLine);
m_isLinkableCached = 0;
}
void MemberDefImpl::setInbodyDocumentation(const char *d,const char *inbodyFile,int inbodyLine)
{
- DefinitionImpl::setInbodyDocumentation(d,inbodyFile,inbodyLine);
+ DefinitionMixin::setInbodyDocumentation(d,inbodyFile,inbodyLine);
m_isLinkableCached = 0;
}
void MemberDefImpl::setHidden(bool b)
{
- DefinitionImpl::setHidden(b);
+ DefinitionMixin::setHidden(b);
m_isLinkableCached = 0;
}
@@ -2134,7 +2134,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol,
QCString cfname = getOutputFileBase();
// search for the last anonymous scope in the member type
- ClassDefMutable *annoClassDef=ClassDef::make_mutable(getClassDefOfAnonymousType());
+ ClassDefMutable *annoClassDef=toClassDefMutable(getClassDefOfAnonymousType());
ol.startMemberDeclaration();
@@ -2312,7 +2312,7 @@ void MemberDefImpl::writeDeclaration(OutputList &ol,
static bool extractPrivate = Config_getBool(EXTRACT_PRIVATE);
static bool extractPrivateVirtual = Config_getBool(EXTRACT_PRIV_VIRTUAL);
static bool extractStatic = Config_getBool(EXTRACT_STATIC);
- MemberDefMutable *annMemb = MemberDef::make_mutable(m_impl->annMemb);
+ MemberDefMutable *annMemb = toMemberDefMutable(m_impl->annMemb);
//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 valid
(hasDocumentation() || isReference()) && // has docs
@@ -3242,7 +3242,7 @@ void MemberDefImpl::writeDocumentation(const MemberList *ml,
if (getClassDef()) { scopeName=getClassDef()->displayName(); scopedContainer=getClassDef(); }
else if (getNamespaceDef()) { scopeName=getNamespaceDef()->displayName(); scopedContainer=getNamespaceDef(); }
else if (getFileDef()) { scopeName=getFileDef()->displayName(); scopedContainer=getFileDef(); }
- ciname = (dynamic_cast<const GroupDef *>(container))->groupTitle();
+ ciname = (toGroupDef(container))->groupTitle();
}
else if (container->definitionType()==TypeFile && getNamespaceDef() && getNamespaceDef()->isLinkable())
{ // member is in a namespace, but is written as part of the file documentation
@@ -3811,7 +3811,7 @@ void MemberDefImpl::writeMemberDocSimple(OutputList &ol, const Definition *conta
//printf("===> %s::anonymous: %s\n",name().data(),cd?cd->name().data():"<none>");
if (container && container->definitionType()==Definition::TypeClass &&
- !(dynamic_cast<const ClassDef*>(container))->isJavaEnum())
+ !(toClassDef(container))->isJavaEnum())
{
ol.startInlineMemberType();
ol.startDoxyAnchor(cfname,cname,memAnchor,doxyName,doxyArgs);
@@ -4115,7 +4115,7 @@ bool MemberDefImpl::isDeleted() const
bool MemberDefImpl::hasDocumentation() const
{
- return DefinitionImpl::hasDocumentation() ||
+ return DefinitionMixin::hasDocumentation() ||
(m_impl->mtype==MemberType_Enumeration && m_impl->docEnumValues) || // has enum values
(m_impl->defArgList.hasDocumentation()); // has doc arguments
}
@@ -4123,7 +4123,7 @@ bool MemberDefImpl::hasDocumentation() const
#if 0
bool MemberDefImpl::hasUserDocumentation() const
{
- bool hasDocs = DefinitionImpl::hasUserDocumentation();
+ bool hasDocs = DefinitionMixin::hasUserDocumentation();
return hasDocs;
}
#endif
@@ -4340,7 +4340,7 @@ void MemberDefImpl::addListReference(Definition *)
QCString memName = name();
Definition *pd=getOuterScope();
QCString pdName = pd->definitionType()==Definition::TypeClass ?
- (dynamic_cast<ClassDef*>(pd))->displayName() : pd->name();
+ (toClassDef(pd))->displayName() : pd->name();
QCString sep = getLanguageSpecificSeparator(lang,TRUE);
QCString memArgs;
if (!isRelated()
@@ -4635,7 +4635,7 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
if (fmdl)
{
MemberListIterator mli(*fmdl);
- MemberDefMutable *fmd=MemberDef::make_mutable(mli.current());
+ MemberDefMutable *fmd=toMemberDefMutable(mli.current());
bool fmdVisible = fmd ? fmd->isBriefSectionVisible() : TRUE;
while (fmd)
{
@@ -4679,7 +4679,7 @@ void MemberDefImpl::writeEnumDeclaration(OutputList &typeDecl,
bool prevVisible = fmdVisible;
++mli;
- fmd=MemberDef::make_mutable(mli.current());
+ fmd=toMemberDefMutable(mli.current());
if (fmd && (fmdVisible=fmd->isBriefSectionVisible()))
{
typeDecl.writeString(", ");
@@ -4818,7 +4818,7 @@ QCString MemberDefImpl::qualifiedName() const
}
else
{
- return DefinitionImpl::qualifiedName();
+ return DefinitionMixin::qualifiedName();
}
}
@@ -5835,7 +5835,7 @@ int MemberDefImpl::numberOfFlowKeyWords() const
QCString MemberDefImpl::displayName(bool) const
{
- return DefinitionImpl::name();
+ return DefinitionMixin::name();
}
void MemberDefImpl::addToSearchIndex() const
@@ -6037,7 +6037,7 @@ QCString MemberDefImpl::briefDescription(bool abbr) const
}
else
{
- return DefinitionImpl::briefDescription(abbr);
+ return DefinitionMixin::briefDescription(abbr);
}
}
@@ -6049,7 +6049,7 @@ QCString MemberDefImpl::documentation() const
}
else
{
- return DefinitionImpl::documentation();
+ return DefinitionMixin::documentation();
}
}
@@ -6093,7 +6093,72 @@ bool MemberDefImpl::isRelatedOrFriend() const
bool MemberDefImpl::isReference() const
{
- return DefinitionImpl::isReference() ||
+ return DefinitionMixin::isReference() ||
(m_impl->templateMaster && m_impl->templateMaster->isReference());
}
+// --- Cast functions
+//
+MemberDef *toMemberDef(Definition *d)
+{
+ if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl)))
+ {
+ return static_cast<MemberDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+MemberDef *toMemberDef(DefinitionMutable *md)
+{
+ Definition *d = toDefinition(md);
+ if (d && typeid(*d)==typeid(MemberDefImpl))
+ {
+ return static_cast<MemberDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const MemberDef *toMemberDef(const Definition *d)
+{
+ if (d && (typeid(*d)==typeid(MemberDefImpl) || typeid(*d)==typeid(MemberDefAliasImpl)))
+ {
+ return static_cast<const MemberDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+MemberDefMutable *toMemberDefMutable(Definition *d)
+{
+ if (d && typeid(*d)==typeid(MemberDefImpl))
+ {
+ return static_cast<MemberDefMutable*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+MemberDefMutable *toMemberDefMutable(const Definition *d)
+{
+ if (d && typeid(*d)==typeid(MemberDefImpl))
+ {
+ return const_cast<MemberDefMutable*>(static_cast<const MemberDefMutable*>(d));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+
diff --git a/src/memberdef.h b/src/memberdef.h
index 13b62a4..d2dd699 100644
--- a/src/memberdef.h
+++ b/src/memberdef.h
@@ -43,7 +43,7 @@ struct TagInfo;
class MemberDefMutable;
/** A model of a class/file/namespace member symbol. */
-class MemberDef : virtual public Definition
+class MemberDef : public Definition
{
public:
virtual ~MemberDef() {}
@@ -55,7 +55,6 @@ class MemberDef : virtual public Definition
virtual MemberDef *resolveAlias() = 0;
virtual const MemberDef *resolveAlias() const = 0;
- static MemberDefMutable *make_mutable(const MemberDef *);
ClassDefMutable *getClassDefMutable() const;
//-----------------------------------------------------------------------------------
@@ -289,7 +288,7 @@ class MemberDef : virtual public Definition
virtual void setMemberGroup(MemberGroup *grp) = 0;
};
-class MemberDefMutable : virtual public DefinitionMutable, virtual public MemberDef
+class MemberDefMutable : public DefinitionMutable, public MemberDef
{
public:
@@ -423,14 +422,22 @@ class MemberDefMutable : virtual public DefinitionMutable, virtual public Member
};
-inline MemberDefMutable *MemberDef::make_mutable(const MemberDef *md)
-{ return dynamic_cast<MemberDefMutable*>(const_cast<MemberDef*>(md)); }
-
inline ClassDefMutable *MemberDef::getClassDefMutable() const
{
- return ClassDef::make_mutable(getClassDef());
+ return toClassDefMutable(getClassDef());
}
+// --- Cast functions
+
+MemberDef *toMemberDef(Definition *d);
+MemberDef *toMemberDef(DefinitionMutable *d);
+const MemberDef *toMemberDef(const Definition *d);
+MemberDefMutable *toMemberDefMutable(Definition *d);
+MemberDefMutable *toMemberDefMutable(const Definition *d);
+
+//------------------------------------------------------------------------
+
+
/** Factory method to create a new instance of a MemberDef */
MemberDefMutable *createMemberDef(const char *defFileName,int defLine,int defColumn,
const char *type,const char *name,const char *args,
diff --git a/src/membergroup.cpp b/src/membergroup.cpp
index b47fe71..d8d6193 100644
--- a/src/membergroup.cpp
+++ b/src/membergroup.cpp
@@ -71,7 +71,7 @@ void MemberGroup::insertMember(MemberDef *md)
GroupDef *gd;
if (firstMd && !firstMd->isAlias() && (gd=const_cast<GroupDef*>(firstMd->getGroupDef())))
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->setGroupDef(gd, firstMd->getGroupPri(),
@@ -224,7 +224,7 @@ void MemberGroup::distributeMemberGroupDocumentation()
MemberDef *iomd;
for (li.toFirst();(iomd=li.current());++li)
{
- MemberDefMutable *omd = MemberDef::make_mutable(iomd);
+ MemberDefMutable *omd = toMemberDefMutable(iomd);
if (omd && md!=omd && omd->documentation().isEmpty() &&
omd->briefDescription().isEmpty() &&
omd->inbodyDocumentation().isEmpty()
diff --git a/src/memberlist.cpp b/src/memberlist.cpp
index 589aa7e..11b6c9f 100644
--- a/src/memberlist.cpp
+++ b/src/memberlist.cpp
@@ -334,7 +334,7 @@ void MemberList::setAnonymousEnumType()
MemberDef *vmd;
for ( ; (vmd=vmli.current()) ; ++vmli)
{
- MemberDefMutable *vmdm = MemberDef::make_mutable(vmd);
+ MemberDefMutable *vmdm = toMemberDefMutable(vmd);
if (vmdm)
{
QCString vtype=vmd->typeString();
@@ -580,7 +580,7 @@ void MemberList::writePlainDeclarations(OutputList &ol,
{
if (md->fromAnonymousScope() && !md->anonymousDeclShown())
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm) mdm->setFromAnonymousScope(FALSE);
//printf("anonymous compound members\n");
if (md->isBriefSectionVisible())
@@ -752,7 +752,7 @@ void MemberList::writeDeclarations(OutputList &ol,
}
if (inheritedFrom && cd)
{
- const ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ const ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
// also add members that of this list type, that are grouped together
@@ -821,7 +821,7 @@ void MemberList::writeDocumentation(OutputList &ol,
{
uint overloadCount = *overloadTotalDict.find(md->name());
uint *pCount = overloadCountDict.find(md->name());
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container,
@@ -853,14 +853,14 @@ void MemberList::writeSimpleDocumentation(OutputList &ol,
const ClassDef *cd = 0;
if (container && container->definitionType()==Definition::TypeClass)
{
- cd = dynamic_cast<const ClassDef*>(container);
+ cd = toClassDef(container);
}
ol.startMemberDocSimple(cd && cd->isJavaEnum());
MemberListIterator mli(*this);
const MemberDef *md;
for ( ; (md=mli.current()) ; ++mli)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->writeMemberDocSimple(ol,container);
@@ -884,7 +884,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
const MemberDef *imd;
for (mli.toFirst() ; (imd=mli.current()) ; ++mli)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
+ MemberDefMutable *md = toMemberDefMutable(imd);
if (md->isDetailedSectionLinkable())
{
@@ -903,7 +903,8 @@ void MemberList::writeDocumentationPage(OutputList &ol,
for ( mli.toFirst() ; (imd=mli.current()) ; ++mli)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
+ Definition *container_d = toDefinition(const_cast<DefinitionMutable*>(container));
+ MemberDefMutable *md = toMemberDefMutable(imd);
if (md->isDetailedSectionLinkable())
{
uint overloadCount = *overloadTotalDict.find(md->name());
@@ -920,11 +921,11 @@ void MemberList::writeDocumentationPage(OutputList &ol,
if (generateTreeView)
{
- md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container,m_inGroup);
+ md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container_d,m_inGroup);
(*pCount)++;
ol.endContents();
- endFileWithNavPath(container,ol);
+ endFileWithNavPath(container_d,ol);
}
else
{
@@ -937,7 +938,7 @@ void MemberList::writeDocumentationPage(OutputList &ol,
ol.writeString(" </td>\n");
ol.writeString(" <td valign=\"top\" class=\"mempage\">\n");
- md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container,m_inGroup);
+ md->writeDocumentation(this,*pCount,overloadCount,ol,scopeName,container_d,m_inGroup);
(*pCount)++;
ol.writeString(" </td>\n");
@@ -976,8 +977,8 @@ void MemberList::addListReferences(Definition *def)
MemberDef *imd;
for ( ; (imd=mli.current()) ; ++mli)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
- if (!md->isAlias() && (md->getGroupDef()==0 || def->definitionType()==Definition::TypeGroup))
+ MemberDefMutable *md = toMemberDefMutable(imd);
+ if (md && !md->isAlias() && (md->getGroupDef()==0 || def->definitionType()==Definition::TypeGroup))
{
md->addListReference(def);
const MemberList *enumFields = md->enumFieldList();
@@ -988,7 +989,7 @@ void MemberList::addListReferences(Definition *def)
MemberDef *vmd;
for ( ; (vmd=vmli.current()) ; ++vmli)
{
- MemberDefMutable *vmdm = MemberDef::make_mutable(vmd);
+ MemberDefMutable *vmdm = toMemberDefMutable(vmd);
if (vmdm)
{
//printf(" adding %s\n",vmd->name().data());
@@ -1015,7 +1016,7 @@ void MemberList::findSectionsInDocumentation(const Definition *d)
MemberDef *imd;
for ( ; (imd=mli.current()) ; ++mli)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
+ MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
{
md->findSectionsInDocumentation();
@@ -1101,7 +1102,7 @@ void MemberList::writeTagFile(FTextStream &tagFile)
MemberDef *imd;
for ( ; (imd=mli.current()) ; ++mli)
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
+ MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
{
if (md->getLanguage()!=SrcLangExt_VHDL)
@@ -1113,7 +1114,7 @@ void MemberList::writeTagFile(FTextStream &tagFile)
MemberDef *ivmd;
for ( ; (ivmd=vmli.current()) ; ++vmli)
{
- MemberDefMutable *vmd = MemberDef::make_mutable(ivmd);
+ MemberDefMutable *vmd = toMemberDefMutable(ivmd);
if (vmd)
{
vmd->writeTagFile(tagFile);
diff --git a/src/namespacedef.cpp b/src/namespacedef.cpp
index 6e2cdf8..1671362 100644
--- a/src/namespacedef.cpp
+++ b/src/namespacedef.cpp
@@ -35,7 +35,7 @@
//------------------------------------------------------------------
-class NamespaceDefImpl : public DefinitionImpl, public NamespaceDefMutable
+class NamespaceDefImpl : public DefinitionMixin<NamespaceDefMutable>
{
public:
NamespaceDefImpl(const char *defFileName,int defLine,int defColumn,
@@ -153,14 +153,15 @@ NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int
//------------------------------------------------------------------
-class NamespaceDefAliasImpl : public DefinitionAliasImpl, public NamespaceDef
+class NamespaceDefAliasImpl : public DefinitionAliasMixin<NamespaceDef>
{
public:
- NamespaceDefAliasImpl(const Definition *newScope,const NamespaceDef *nd) : DefinitionAliasImpl(newScope,nd) {}
+ NamespaceDefAliasImpl(const Definition *newScope,const NamespaceDef *nd)
+ : DefinitionAliasMixin(newScope,nd) {}
virtual ~NamespaceDefAliasImpl() {}
virtual DefType definitionType() const { return TypeNamespace; }
- const NamespaceDef *getNSAlias() const { return dynamic_cast<const NamespaceDef*>(getAlias()); }
+ const NamespaceDef *getNSAlias() const { return toNamespaceDef(getAlias()); }
// ---- getters
virtual QCString getOutputFileBase() const
@@ -236,7 +237,7 @@ NamespaceDefImpl::NamespaceDefImpl(const char *df,int dl,int dc,
const char *name,const char *lref,
const char *fName, const char*type,
bool isPublished) :
- DefinitionImpl(df,dl,dc,name)
+ DefinitionMixin(df,dl,dc,name)
,m_isPublished(isPublished)
{
if (fName)
@@ -357,11 +358,11 @@ void NamespaceDefImpl::addInnerCompound(const Definition *d)
m_innerCompounds->append(d->localName(),d);
if (d->definitionType()==Definition::TypeNamespace)
{
- insertNamespace(dynamic_cast<const NamespaceDef *>(d));
+ insertNamespace(toNamespaceDef(d));
}
else if (d->definitionType()==Definition::TypeClass)
{
- insertClass(dynamic_cast<const ClassDef *>(d));
+ insertClass(toClassDef(d));
}
}
@@ -443,7 +444,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
//printf("%s::insertMember(%s) isInline=%d hasDocs=%d\n",qPrint(name()),qPrint(md->name()),
// isInline(),hasDocumentation());
if (md->isHidden()) return;
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
// if this is an inline namespace that is not documented, then insert the
// member in the parent scope instead
@@ -454,7 +455,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
{
if (outerScope->definitionType()==Definition::TypeNamespace)
{
- NamespaceDefMutable *nd = NamespaceDef::make_mutable(dynamic_cast<NamespaceDef*>(outerScope));
+ NamespaceDefMutable *nd = toNamespaceDefMutable(outerScope);
if (nd)
{
nd->insertMember(md);
@@ -466,7 +467,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
}
else if (outerScope->definitionType()==Definition::TypeFile)
{
- FileDef *fd = dynamic_cast<FileDef*>(outerScope);
+ FileDef *fd = toFileDef(outerScope);
fd->insertMember(md);
if (mdm)
{
@@ -542,7 +543,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
if (outerScope->definitionType()==Definition::TypeNamespace)
{
aliasMd.reset(createMemberDefAlias(outerScope,md));
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(dynamic_cast<NamespaceDef*>(outerScope));
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(outerScope);
if (ndm)
{
ndm->insertMember(aliasMd.get());
@@ -551,7 +552,7 @@ void NamespaceDefImpl::insertMember(MemberDef *md)
else if (outerScope->definitionType()==Definition::TypeFile)
{
aliasMd.reset(createMemberDefAlias(outerScope,md));
- dynamic_cast<FileDef*>(outerScope)->insertMember(aliasMd.get());
+ toFileDef(outerScope)->insertMember(aliasMd.get());
}
if (aliasMd)
{
@@ -1290,7 +1291,7 @@ void NamespaceDefImpl::combineUsingRelations()
LinkedRefMap<const NamespaceDef> usingDirList = m_usingDirList;
for (auto &nd : usingDirList)
{
- NamespaceDefMutable *ndm = NamespaceDef::make_mutable(nd);
+ NamespaceDefMutable *ndm = toNamespaceDefMutable(nd);
if (ndm)
{
ndm->combineUsingRelations();
@@ -1439,7 +1440,7 @@ void NamespaceDefImpl::addMemberToList(MemberListType lt,MemberDef *md)
if (ml->listType()&MemberListType_declarationLists)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->setSectionList(this,ml);
@@ -1604,3 +1605,68 @@ void NamespaceDefImpl::setMetaData(const QCString &m)
{
metaData = m;
}
+
+// --- Cast functions
+//
+NamespaceDef *toNamespaceDef(Definition *d)
+{
+ if (d && (typeid(*d)==typeid(NamespaceDefImpl) || typeid(*d)==typeid(NamespaceDefAliasImpl)))
+ {
+ return static_cast<NamespaceDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+NamespaceDef *toNamespaceDef(DefinitionMutable *md)
+{
+ Definition *d = toDefinition(md);
+ if (d && typeid(*d)==typeid(NamespaceDefImpl))
+ {
+ return static_cast<NamespaceDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+
+const NamespaceDef *toNamespaceDef(const Definition *d)
+{
+ if (d && (typeid(*d)==typeid(NamespaceDefImpl) || typeid(*d)==typeid(NamespaceDefAliasImpl)))
+ {
+ return static_cast<const NamespaceDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+NamespaceDefMutable *toNamespaceDefMutable(Definition *d)
+{
+ if (d && typeid(*d)==typeid(NamespaceDefImpl))
+ {
+ return static_cast<NamespaceDefMutable*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+NamespaceDefMutable *toNamespaceDefMutable(const Definition *d)
+{
+ if (d && typeid(*d)==typeid(NamespaceDefImpl))
+ {
+ return const_cast<NamespaceDefMutable*>(static_cast<const NamespaceDefMutable*>(d));
+ }
+ else
+ {
+ return 0;
+ }
+}
+
diff --git a/src/namespacedef.h b/src/namespacedef.h
index 8ce0ef1..b81480e 100644
--- a/src/namespacedef.h
+++ b/src/namespacedef.h
@@ -34,14 +34,12 @@ class FTextStream;
class NamespaceDefMutable;
/** An abstract interface of a namespace symbol. */
-class NamespaceDef : virtual public Definition
+class NamespaceDef : public Definition
{
public:
virtual ~NamespaceDef() {}
virtual DefType definitionType() const = 0;
- static NamespaceDefMutable *make_mutable(const NamespaceDef *);
-
// ---- getters
virtual QCString getOutputFileBase() const = 0;
virtual QCString anchor() const = 0;
@@ -89,7 +87,7 @@ class NamespaceDef : virtual public Definition
virtual bool isVisited() const = 0;
};
-class NamespaceDefMutable : virtual public DefinitionMutable, virtual public NamespaceDef
+class NamespaceDefMutable : public DefinitionMutable, public NamespaceDef
{
public:
@@ -118,9 +116,6 @@ class NamespaceDefMutable : virtual public DefinitionMutable, virtual public Nam
virtual void setInline(bool isInline) = 0;
};
-inline NamespaceDefMutable *NamespaceDef::make_mutable(const NamespaceDef *nd)
-{ return dynamic_cast<NamespaceDefMutable*>(const_cast<NamespaceDef*>(nd)); }
-
/** Factory method to create new NamespaceDef instance */
NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int defColumn,
const char *name,const char *ref=0,
@@ -130,6 +125,19 @@ NamespaceDefMutable *createNamespaceDef(const char *defFileName,int defLine,int
/** Factory method to create an alias of an existing namespace. Used for inline namespaces. */
NamespaceDef *createNamespaceDefAlias(const Definition *newScope, const NamespaceDef *nd);
+
+// --- Cast functions
+
+NamespaceDef *toNamespaceDef(Definition *d);
+NamespaceDef *toNamespaceDef(DefinitionMutable *d);
+const NamespaceDef *toNamespaceDef(const Definition *d);
+NamespaceDefMutable *toNamespaceDefMutable(Definition *d);
+NamespaceDefMutable *toNamespaceDefMutable(const Definition *d);
+
+//------------------------------------------------------------------------
+
+
+
/** A list of NamespaceDef objects. */
class NamespaceList : public QList<NamespaceDef>
{
diff --git a/src/pagedef.cpp b/src/pagedef.cpp
index 15f4932..b0d375e 100644
--- a/src/pagedef.cpp
+++ b/src/pagedef.cpp
@@ -29,7 +29,7 @@
//------------------------------------------------------------------------------------------
-class PageDefImpl : public DefinitionImpl, public PageDef
+class PageDefImpl : public DefinitionMixin<PageDef>
{
public:
PageDefImpl(const char *f,int l,const char *n,const char *d,const char *t);
@@ -56,7 +56,7 @@ class PageDefImpl : public DefinitionImpl, public PageDef
virtual LocalToc localToc() const { return m_localToc; }
virtual void setPageScope(Definition *d){ m_pageScope = d; }
virtual Definition *getPageScope() const { return m_pageScope; }
- virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionImpl::name(); }
+ virtual QCString displayName(bool=TRUE) const { return hasTitle() ? m_title : DefinitionMixin::name(); }
virtual bool showLineNo() const;
virtual void writeDocumentation(OutputList &ol);
virtual void writeTagFile(FTextStream &);
@@ -82,7 +82,7 @@ PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const cha
PageDefImpl::PageDefImpl(const char *f,int l,const char *n,
const char *d,const char *t)
- : DefinitionImpl(f,l,1,n), m_title(t)
+ : DefinitionMixin(f,l,1,n), m_title(t)
{
setDocumentation(d,f,l);
m_subPageDict = new PageSDict(7);
@@ -122,12 +122,11 @@ void PageDefImpl::setFileName(const char *name)
m_fileName = name;
}
-void PageDefImpl::addInnerCompound(const Definition *const_def)
+void PageDefImpl::addInnerCompound(const Definition *def)
{
- if (const_def->definitionType()==Definition::TypePage)
+ if (def->definitionType()==Definition::TypePage)
{
- Definition *def = const_cast<Definition*>(const_def); // uck: fix me
- PageDef *pd = dynamic_cast<PageDef*>(def);
+ PageDef *pd = const_cast<PageDef*>(toPageDef(def));
if (pd)
{
m_subPageDict->append(pd->name(),pd);
@@ -212,7 +211,7 @@ void PageDefImpl::writeDocumentation(OutputList &ol)
{
if (getOuterScope()!=Doxygen::globalScope && !Config_getBool(DISABLE_INDEX))
{
- DefinitionMutable *outerScope = Definition::make_mutable(getOuterScope());
+ DefinitionMutable *outerScope = toDefinitionMutable(getOuterScope());
if (outerScope)
{
outerScope->writeNavigationPath(ol);
@@ -406,3 +405,31 @@ bool PageDefImpl::hasTitle() const
return !m_title.isEmpty() && m_title.lower()!="notitle";
}
+// --- Cast functions
+
+PageDef *toPageDef(Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(PageDefImpl))
+ {
+ return static_cast<PageDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+const PageDef *toPageDef(const Definition *d)
+{
+ if (d==0) return 0;
+ if (d && typeid(*d)==typeid(PageDefImpl))
+ {
+ return static_cast<const PageDef*>(d);
+ }
+ else
+ {
+ return 0;
+ }
+}
+
diff --git a/src/pagedef.h b/src/pagedef.h
index dbd1ef1..03cc5a8 100644
--- a/src/pagedef.h
+++ b/src/pagedef.h
@@ -24,7 +24,7 @@ class OutputList;
class FTextStream;
/** @brief A model of a page symbol. */
-class PageDef : virtual public DefinitionMutable
+class PageDef : public DefinitionMutable, public Definition
{
public:
virtual ~PageDef() {}
@@ -65,6 +65,13 @@ class PageDef : virtual public DefinitionMutable
PageDef *createPageDef(const char *f,int l,const char *n,const char *d,const char *t);
+// --- Cast functions
+
+PageDef *toPageDef(Definition *d);
+const PageDef *toPageDef(const Definition *d);
+
+// ------------------
+
class PageSDict : public SDict<PageDef>
{
public:
diff --git a/src/pycode.l b/src/pycode.l
index 70a0a51..e136e91 100644
--- a/src/pycode.l
+++ b/src/pycode.l
@@ -404,7 +404,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
auto it = yyextra->codeClassMap.find(s);
if (it != yyextra->codeClassMap.end())
{
- baseDefToAdd = dynamic_cast<const ClassDef*>(it->second.globalDef());
+ baseDefToAdd = toClassDef(it->second.globalDef());
}
// Try to find class in global scope
if (baseDefToAdd==0)
@@ -488,7 +488,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
{FLOWKW} {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
- MemberDefMutable *mdm = MemberDef::make_mutable(yyextra->currentMemberDef);
+ MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
mdm->incrementFlowKeyWordCount();
@@ -533,7 +533,7 @@ TARGET ({IDENTIFIER}|"("{TARGET_LIST}")"|"["{TARGET_LIST}"]"|{ATTRIBU
{FLOWKW} {
if (yyextra->currentMemberDef && yyextra->currentMemberDef->isFunction())
{
- MemberDefMutable *mdm = MemberDef::make_mutable(yyextra->currentMemberDef);
+ MemberDefMutable *mdm = toMemberDefMutable(yyextra->currentMemberDef);
if (mdm)
{
mdm->incrementFlowKeyWordCount();
@@ -1225,7 +1225,7 @@ static bool getLinkInScope(yyscan_t yyscanner,
if (yyextra->currentDefinition && yyextra->currentMemberDef &&
md!=yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
//printf("d->getReference()='%s' d->getOutputBase()='%s' name='%s' member name='%s'\n",d->getReference().data(),d->getOutputFileBase().data(),d->name().data(),md->name().data());
@@ -1335,7 +1335,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && md->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(md));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(md));
}
}
}
@@ -1362,7 +1362,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && mmd->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(mmd));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));
}
return;
}
@@ -1385,7 +1385,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,
if (d && d->isLinkable() && mmd->isLinkable() &&
yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(mmd));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(mmd));
}
return;
}
@@ -1465,13 +1465,13 @@ static bool findMemberLink(yyscan_t yyscanner,
sym->getOuterScope()->definitionType()==Definition::TypeClass &&
yyextra->currentDefinition->definitionType()==Definition::TypeClass)
{
- ClassDef *cd = dynamic_cast<ClassDef*>(sym->getOuterScope());
- ClassDef *thisCd = dynamic_cast<ClassDef *>(yyextra->currentDefinition);
+ ClassDef *cd = toClassDef(sym->getOuterScope());
+ ClassDef *thisCd = toClassDef(yyextra->currentDefinition);
if (sym->definitionType()==Definition::TypeMember)
{
if (yyextra->currentMemberDef && yyextra->collectXRefs)
{
- addDocCrossReference(MemberDef::make_mutable(yyextra->currentMemberDef),MemberDef::make_mutable(dynamic_cast<MemberDef*>(sym)));
+ addDocCrossReference(toMemberDefMutable(yyextra->currentMemberDef),toMemberDefMutable(toMemberDef(sym)));
}
}
DBG_CTX((stderr,"cd=%s thisCd=%s\n",cd?cd->name().data():"<none>",thisCd?thisCd->name().data():"<none>"));
diff --git a/src/searchindex.cpp b/src/searchindex.cpp
index 3045385..b0f6abb 100644
--- a/src/searchindex.cpp
+++ b/src/searchindex.cpp
@@ -85,7 +85,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is
if (ctx==0) return;
assert(!isSourceFile || ctx->definitionType()==Definition::TypeFile);
//printf("SearchIndex::setCurrentDoc(%s,%s,%s)\n",name,baseName,anchor);
- QCString url=isSourceFile ? (dynamic_cast<const FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase();
+ QCString url=isSourceFile ? (toFileDef(ctx))->getSourceFileBase() : ctx->getOutputFileBase();
url+=Config_getString(HTML_FILE_EXTENSION);
QCString baseUrl = url;
if (anchor) url+=QCString("#")+anchor;
@@ -93,7 +93,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is
QCString name=ctx->qualifiedName();
if (ctx->definitionType()==Definition::TypeMember)
{
- const MemberDef *md = dynamic_cast<const MemberDef *>(ctx);
+ const MemberDef *md = toMemberDef(ctx);
name.prepend((md->getLanguage()==SrcLangExt_Fortran ?
theTranslator->trSubprogram(TRUE,TRUE) :
theTranslator->trMember(TRUE,TRUE))+" ");
@@ -110,7 +110,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is
{
case Definition::TypePage:
{
- const PageDef *pd = dynamic_cast<const PageDef *>(ctx);
+ const PageDef *pd = toPageDef(ctx);
if (pd->hasTitle())
{
name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title();
@@ -123,7 +123,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is
break;
case Definition::TypeClass:
{
- const ClassDef *cd = dynamic_cast<const ClassDef *>(ctx);
+ const ClassDef *cd = toClassDef(ctx);
name.prepend(cd->compoundTypeString()+" ");
}
break;
@@ -145,7 +145,7 @@ void SearchIndex::setCurrentDoc(const Definition *ctx,const char *anchor,bool is
break;
case Definition::TypeGroup:
{
- const GroupDef *gd = dynamic_cast<const GroupDef *>(ctx);
+ const GroupDef *gd = toGroupDef(ctx);
if (gd->groupTitle())
{
name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle();
@@ -409,7 +409,7 @@ static QCString definitionToName(const Definition *ctx)
{
if (ctx && ctx->definitionType()==Definition::TypeMember)
{
- const MemberDef *md = dynamic_cast<const MemberDef*>(ctx);
+ const MemberDef *md = toMemberDef(ctx);
if (md->isFunction())
return "function";
else if (md->isSlot())
@@ -440,7 +440,7 @@ static QCString definitionToName(const Definition *ctx)
switch(ctx->definitionType())
{
case Definition::TypeClass:
- return (dynamic_cast<const ClassDef*>(ctx))->compoundTypeString();
+ return (toClassDef(ctx))->compoundTypeString();
case Definition::TypeFile:
return "file";
case Definition::TypeNamespace:
@@ -463,7 +463,7 @@ static QCString definitionToName(const Definition *ctx)
void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const char *anchor,bool isSourceFile)
{
static QCString extId = stripPath(Config_getString(EXTERNAL_SEARCH_ID));
- QCString baseName = isSourceFile ? (dynamic_cast<const FileDef*>(ctx))->getSourceFileBase() : ctx->getOutputFileBase();
+ QCString baseName = isSourceFile ? (toFileDef(ctx))->getSourceFileBase() : ctx->getOutputFileBase();
QCString url = baseName + Doxygen::htmlFileExtension;
if (anchor) url+=QCString("#")+anchor;
QCString key = extId+";"+url;
@@ -476,7 +476,7 @@ void SearchIndexExternal::setCurrentDoc(const Definition *ctx,const char *anchor
e.name = ctx->qualifiedName();
if (ctx->definitionType()==Definition::TypeMember)
{
- e.args = (dynamic_cast<const MemberDef*>(ctx))->argsString();
+ e.args = (toMemberDef(ctx))->argsString();
}
e.extId = extId;
e.url = url;
@@ -995,7 +995,7 @@ void writeJavaScriptSearchIndex()
if (dl->count()==1) // item with a unique name
{
- const MemberDef *md = dynamic_cast<const MemberDef*>(d);
+ const MemberDef *md = toMemberDef(d);
QCString anchor = d->anchor();
ti << "'" << externalRef("../",d->getReference(),TRUE)
@@ -1047,7 +1047,7 @@ void writeJavaScriptSearchIndex()
const Definition *scope = d->getOuterScope();
const Definition *next = di.current();
const Definition *nextScope = 0;
- const MemberDef *md = dynamic_cast<const MemberDef*>(d);
+ const MemberDef *md = toMemberDef(d);
if (next) nextScope = next->getOuterScope();
QCString anchor = d->anchor();
@@ -1091,12 +1091,12 @@ void writeJavaScriptSearchIndex()
QCString name;
if (d->definitionType()==Definition::TypeClass)
{
- name = convertToXML((dynamic_cast<const ClassDef*>(d))->displayName());
+ name = convertToXML((toClassDef(d))->displayName());
found = TRUE;
}
else if (d->definitionType()==Definition::TypeNamespace)
{
- name = convertToXML((dynamic_cast<const NamespaceDef*>(d))->displayName());
+ name = convertToXML((toNamespaceDef(d))->displayName());
found = TRUE;
}
else if (scope==0 || scope==Doxygen::globalScope) // in global scope
@@ -1271,11 +1271,11 @@ void SearchIndexList::append(const Definition *d)
{
if (d->definitionType()==Definition::TypeGroup)
{
- dispName = (dynamic_cast<const GroupDef*>(d))->groupTitle();
+ dispName = (toGroupDef(d))->groupTitle();
}
else if (d->definitionType()==Definition::TypePage)
{
- dispName = (dynamic_cast<const PageDef*>(d))->title();
+ dispName = (toPageDef(d))->title();
}
l=new SearchDefinitionList(searchId(dispName),dispName);
SDict< SearchDefinitionList >::append(dispName,l);
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp
index 76ac77d..bfbe25e 100644
--- a/src/sqlite3gen.cpp
+++ b/src/sqlite3gen.cpp
@@ -1421,7 +1421,7 @@ QCString getSQLDocBlock(const Definition *scope,
fileName,
lineNr,
const_cast<Definition*>(scope),
- dynamic_cast<const MemberDef*>(def),
+ toMemberDef(def),
doc,
FALSE,
FALSE,
diff --git a/src/symbolresolver.cpp b/src/symbolresolver.cpp
index 7cd6115..9f80c15 100644
--- a/src/symbolresolver.cpp
+++ b/src/symbolresolver.cpp
@@ -343,8 +343,8 @@ void SymbolResolver::Private::getResolvedSymbol(
// only look at classes and members that are enums or typedefs
if (d->definitionType()==Definition::TypeClass ||
(d->definitionType()==Definition::TypeMember &&
- ((dynamic_cast<const MemberDef*>(d))->isTypedef() ||
- (dynamic_cast<const MemberDef*>(d))->isEnumerate())
+ ((toMemberDef(d))->isTypedef() ||
+ (toMemberDef(d))->isEnumerate())
)
)
{
@@ -358,7 +358,7 @@ void SymbolResolver::Private::getResolvedSymbol(
// see if we are dealing with a class or a typedef
if (d->definitionType()==Definition::TypeClass) // d is a class
{
- const ClassDef *cd = dynamic_cast<const ClassDef *>(d);
+ const ClassDef *cd = toClassDef(d);
//printf("cd=%s\n",cd->name().data());
if (!cd->isTemplateArgument()) // skip classes that
// are only there to
@@ -403,7 +403,7 @@ void SymbolResolver::Private::getResolvedSymbol(
}
else if (d->definitionType()==Definition::TypeMember)
{
- const MemberDef *md = dynamic_cast<const MemberDef *>(d);
+ const MemberDef *md = toMemberDef(d);
//fprintf(stderr," member isTypedef()=%d\n",md->isTypedef());
if (md->isTypedef()) // d is a typedef
{
@@ -607,7 +607,7 @@ done:
//printf("setting cached typedef %p in result %p\n",md,result);
//printf("==> %s (%s,%d)\n",result->name().data(),result->getDefFileName().data(),result->getDefLine());
//printf("*pResolvedType=%s\n",pResolvedType?pResolvedType->data():"<none>");
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm)
{
mdm->cacheTypedefVal(result,
@@ -663,7 +663,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope(
else if (itemScope && newScope &&
itemScope->definitionType()==Definition::TypeClass &&
newScope->definitionType()==Definition::TypeClass &&
- (dynamic_cast<const ClassDef*>(newScope))->isBaseClass(dynamic_cast<const ClassDef*>(itemScope),TRUE,0)
+ (toClassDef(newScope))->isBaseClass(toClassDef(itemScope),TRUE,0)
)
{
// inheritance is also ok. Example: looking for B::I, where
@@ -688,7 +688,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope(
// A::B::C but is explicit referenced as A::C, where B is imported
// in A via a using directive.
//printf("newScope is a namespace: %s!\n",newScope->name().data());
- const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(newScope);
+ const NamespaceDef *nscope = toNamespaceDef(newScope);
for (const auto &cd : nscope->getUsedClasses())
{
//printf("Trying for class %s\n",cd->name().data());
@@ -725,7 +725,7 @@ int SymbolResolver::Private::isAccessibleFromWithExpScope(
//printf(" failed to resolve: scope=%s\n",scope->name().data());
if (scope->definitionType()==Definition::TypeNamespace)
{
- const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope);
+ const NamespaceDef *nscope = toNamespaceDef(scope);
StringUnorderedSet visited;
if (accessibleViaUsingNamespace(visited,nscope->getUsedNamespaces(),item,explicitScopePart))
{
@@ -795,12 +795,12 @@ const Definition *SymbolResolver::Private::followPath(const Definition *start,co
if (current->definitionType()==Definition::TypeNamespace)
{
next = endOfPathIsUsedClass(
- (dynamic_cast<const NamespaceDef *>(current))->getUsedClasses(),qualScopePart);
+ (toNamespaceDef(current))->getUsedClasses(),qualScopePart);
}
else if (current->definitionType()==Definition::TypeFile)
{
next = endOfPathIsUsedClass(
- (dynamic_cast<const FileDef *>(current))->getUsedClasses(),qualScopePart);
+ (toFileDef(current))->getUsedClasses(),qualScopePart);
}
current = next;
if (current==0) break;
@@ -901,13 +901,13 @@ int SymbolResolver::Private::isAccessibleFrom(AccessStack &accessStack,
(item->definitionType()==Definition::TypeMember && // a member
itemScope && itemScope->definitionType()==Definition::TypeClass && // of a class
scope->definitionType()==Definition::TypeClass && // accessible
- (dynamic_cast<const ClassDef*>(scope))->isAccessibleMember(dynamic_cast<const MemberDef *>(item)) // from scope
+ (toClassDef(scope))->isAccessibleMember(toMemberDef(item)) // from scope
);
bool nestedClassInsideBaseClass =
(item->definitionType()==Definition::TypeClass && // a nested class
itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base
scope->definitionType()==Definition::TypeClass && // class of scope
- (dynamic_cast<const ClassDef*>(scope))->isBaseClass(dynamic_cast<ClassDef*>(itemScope),TRUE)
+ (toClassDef(scope))->isBaseClass(toClassDef(itemScope),TRUE)
);
if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass)
@@ -941,7 +941,7 @@ int SymbolResolver::Private::isAccessibleFrom(AccessStack &accessStack,
// check if scope is a namespace, which is using other classes and namespaces
if (scope->definitionType()==Definition::TypeNamespace)
{
- const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope);
+ const NamespaceDef *nscope = toNamespaceDef(scope);
//printf(" %s is namespace with %d used classes\n",nscope->name().data(),nscope->getUsedClasses());
if (accessibleViaUsingClass(nscope->getUsedClasses(),item))
{
@@ -986,7 +986,7 @@ QCString SymbolResolver::Private::substTypedef(
if (d->definitionType()==Definition::TypeMember)
{
// that are also typedefs
- MemberDef *md = dynamic_cast<MemberDef *>(d);
+ MemberDef *md = toMemberDef(d);
if (md->isTypedef()) // d is a typedef
{
VisitedNamespaces visitedNamespaces;
diff --git a/src/symbolresolver.h b/src/symbolresolver.h
index edbf6fd..5536c1e 100644
--- a/src/symbolresolver.h
+++ b/src/symbolresolver.h
@@ -56,7 +56,7 @@ class SymbolResolver
bool mayBeUnlinkable=false,
bool mayBeHidden=false)
{
- return ClassDef::make_mutable(resolveClass(scope,name,mayBeUnlinkable,mayBeHidden));
+ return toClassDefMutable(resolveClass(scope,name,mayBeUnlinkable,mayBeHidden));
}
/** Checks if symbol \a item is accessible from within \a scope.
diff --git a/src/tooltip.cpp b/src/tooltip.cpp
index 32b43fa..3c2f0e1 100644
--- a/src/tooltip.cpp
+++ b/src/tooltip.cpp
@@ -92,7 +92,7 @@ void TooltipManager::writeTooltips(CodeOutputInterface &ol)
QCString decl;
if (d->definitionType()==Definition::TypeMember)
{
- const MemberDef *md = dynamic_cast<const MemberDef*>(d);
+ const MemberDef *md = toMemberDef(d);
if (!md->isAnonymous())
{
decl = md->declaration();
diff --git a/src/util.cpp b/src/util.cpp
index 39bdc94..c9b20cc 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1237,7 +1237,7 @@ void setAnchors(MemberList *ml)
MemberDef *md;
for (;(md=mli.current());++mli)
{
- MemberDefMutable *mdm = MemberDef::make_mutable(md);
+ MemberDefMutable *mdm = toMemberDefMutable(md);
if (mdm && !md->isReference())
{
mdm->setAnchor();
@@ -3309,7 +3309,7 @@ bool generateLink(OutputDocInterface &od,const char *clName,
compound->definitionType()==Definition::TypeGroup /* is group */
)
{
- linkText=(dynamic_cast<const GroupDef *>(compound))->groupTitle(); // use group's title as link
+ linkText=(toGroupDef(compound))->groupTitle(); // use group's title as link
}
else if (compound->definitionType()==Definition::TypeFile)
{
@@ -3552,7 +3552,7 @@ static void initBaseClassHierarchy(const BaseClassList &bcl)
{
for (const auto &bcd : bcl)
{
- ClassDefMutable *cd = ClassDef::make_mutable(bcd.classDef);
+ ClassDefMutable *cd = toClassDefMutable(bcd.classDef);
if (cd)
{
if (cd->baseClasses().empty()) // no base classes => new root
@@ -3599,7 +3599,7 @@ void initClassHierarchy(ClassSDict *cl)
ClassDef *cd;
for ( ; (cd=cli.current()); ++cli)
{
- ClassDefMutable *cdm = ClassDef::make_mutable(cd);
+ ClassDefMutable *cdm = toClassDefMutable(cd);
if (cdm)
{
cdm->setVisited(FALSE);
@@ -5753,7 +5753,7 @@ static MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fil
if (distance!=-1 && distance<minDistance)
{
minDistance = distance;
- bestMatch = dynamic_cast<MemberDef *>(d);
+ bestMatch = toMemberDef(d);
//printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance);
}
}
@@ -6870,6 +6870,7 @@ bool fileVisibleInIndex(const FileDef *fd,bool &genSourceFile)
void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst)
{
+ if (src==0 || dst==0) return;
//printf("--> addDocCrossReference src=%s,dst=%s\n",src->name().data(),dst->name().data());
if (dst->isTypedef() || dst->isEnumerate()) return; // don't add types
if ((dst->hasReferencedByRelation() || dst->hasCallerGraph()) &&
@@ -6877,12 +6878,12 @@ void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst)
)
{
dst->addSourceReferencedBy(src);
- MemberDefMutable *mdDef = MemberDef::make_mutable(dst->memberDefinition());
+ MemberDefMutable *mdDef = toMemberDefMutable(dst->memberDefinition());
if (mdDef)
{
mdDef->addSourceReferencedBy(src);
}
- MemberDefMutable *mdDecl = MemberDef::make_mutable(dst->memberDeclaration());
+ MemberDefMutable *mdDecl = toMemberDefMutable(dst->memberDeclaration());
if (mdDecl)
{
mdDecl->addSourceReferencedBy(src);
@@ -6893,12 +6894,12 @@ void addDocCrossReference(MemberDefMutable *src,MemberDefMutable *dst)
)
{
src->addSourceReferences(dst);
- MemberDefMutable *mdDef = MemberDef::make_mutable(src->memberDefinition());
+ MemberDefMutable *mdDef = toMemberDefMutable(src->memberDefinition());
if (mdDef)
{
mdDef->addSourceReferences(dst);
}
- MemberDefMutable *mdDecl = MemberDef::make_mutable(src->memberDeclaration());
+ MemberDefMutable *mdDecl = toMemberDefMutable(src->memberDeclaration());
if (mdDecl)
{
mdDecl->addSourceReferences(dst);
diff --git a/src/util.h b/src/util.h
index 1d14ea9..9867d9f 100644
--- a/src/util.h
+++ b/src/util.h
@@ -207,13 +207,13 @@ QCString resolveDefines(const char *n);
ClassDef *getClass(const char *key);
inline ClassDefMutable *getClassMutable(const char *key)
{
- return ClassDef::make_mutable(getClass(key));
+ return toClassDefMutable(getClass(key));
}
NamespaceDef *getResolvedNamespace(const char *key);
inline NamespaceDefMutable *getResolvedNamespaceMutable(const char *key)
{
- return NamespaceDef::make_mutable(getResolvedNamespace(key));
+ return toNamespaceDefMutable(getResolvedNamespace(key));
}
FileDef *findFileDef(const FileNameLinkedMap *fnMap,const char *n,
diff --git a/src/vhdlcode.l b/src/vhdlcode.l
index 746be45..dfabe5b 100644
--- a/src/vhdlcode.l
+++ b/src/vhdlcode.l
@@ -1352,7 +1352,7 @@ static void generateClassOrGlobalLink(yyscan_t yyscanner,CodeOutputInterface &ol
Definition *d = cd->getOuterScope();
if (d && d->definitionType()==Definition::TypeClass)
{
- cd = dynamic_cast<ClassDef*>(d);
+ cd = toClassDef(d);
}
else
{
diff --git a/src/vhdldocgen.cpp b/src/vhdldocgen.cpp
index b7b3de8..d4af49e 100644
--- a/src/vhdldocgen.cpp
+++ b/src/vhdldocgen.cpp
@@ -1762,7 +1762,7 @@ void VhdlDocGen::correctMemberProperties(MemberDefMutable *md)
/* writes a vhdl type documentation */
bool VhdlDocGen::writeVHDLTypeDocumentation(const MemberDef* mdef, const Definition *d, OutputList &ol)
{
- const ClassDef *cd=dynamic_cast<const ClassDef*>(d);
+ const ClassDef *cd=toClassDef(d);
bool hasParams = FALSE;
if (cd==0) return hasParams;
@@ -2202,7 +2202,7 @@ void VhdlDocGen::writePlainVHDLDeclarations(
MemberListIterator mli(*mlist);
for ( ; (imd=mli.current()); ++mli )
{
- MemberDefMutable *md = MemberDef::make_mutable(imd);
+ MemberDefMutable *md = toMemberDefMutable(imd);
if (md)
{
int mems=md->getMemberSpecifiers();
@@ -2683,10 +2683,10 @@ void VhdlDocGen::computeVhdlComponentRelations()
entity=cur->type;
}
- ClassDefMutable *classEntity= ClassDef::make_mutable(VhdlDocGen::findVhdlClass(entity.data()));
+ ClassDefMutable *classEntity= toClassDefMutable(VhdlDocGen::findVhdlClass(entity.data()));
inst=VhdlDocGen::getIndexWord(cur->args.data(),0);
- ClassDefMutable *cd=ClassDef::make_mutable(Doxygen::classSDict->find(inst));
- ClassDefMutable *ar=ClassDef::make_mutable(Doxygen::classSDict->find(cur->args));
+ ClassDefMutable *cd=toClassDefMutable(Doxygen::classSDict->find(inst));
+ ClassDefMutable *ar=toClassDefMutable(Doxygen::classSDict->find(cur->args));
if (cd==0)
{