summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/util.cpp b/src/util.cpp
index b99753e..f92df68 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -689,7 +689,7 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co
if (d->definitionType()==Definition::TypeMember)
{
// that are also typedefs
- MemberDef *md = (MemberDef *)d;
+ MemberDef *md = dynamic_cast<MemberDef *>(d);
if (md->isTypedef()) // d is a typedef
{
// test accessibility of typedef within scope.
@@ -708,7 +708,7 @@ static QCString substTypedef(const Definition *scope,const FileDef *fileScope,co
{
Definition *d = (Definition*)di;
// that are also typedefs
- MemberDef *md = (MemberDef *)di;
+ MemberDef *md = dynamic_cast<MemberDef *>(di);
if (md->isTypedef()) // d is a typedef
{
// test accessibility of typedef within scope.
@@ -786,12 +786,12 @@ static const Definition *followPath(const Definition *start,const FileDef *fileS
if (current->definitionType()==Definition::TypeNamespace)
{
next = endOfPathIsUsedClass(
- ((NamespaceDef *)current)->getUsedClasses(),qualScopePart);
+ (dynamic_cast<const NamespaceDef *>(current))->getUsedClasses(),qualScopePart);
}
else if (current->definitionType()==Definition::TypeFile)
{
next = endOfPathIsUsedClass(
- ((FileDef *)current)->getUsedClasses(),qualScopePart);
+ (dynamic_cast<const FileDef *>(current))->getUsedClasses(),qualScopePart);
}
current = next;
if (current==0) break;
@@ -968,13 +968,13 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi
(item->definitionType()==Definition::TypeMember && // a member
itemScope && itemScope->definitionType()==Definition::TypeClass && // of a class
scope->definitionType()==Definition::TypeClass && // accessible
- ((ClassDef*)scope)->isAccessibleMember((MemberDef *)item) // from scope
+ (dynamic_cast<const ClassDef*>(scope))->isAccessibleMember(dynamic_cast<const MemberDef *>(item)) // from scope
);
bool nestedClassInsideBaseClass =
(item->definitionType()==Definition::TypeClass && // a nested class
itemScope && itemScope->definitionType()==Definition::TypeClass && // inside a base
scope->definitionType()==Definition::TypeClass && // class of scope
- ((ClassDef*)scope)->isBaseClass((ClassDef*)itemScope,TRUE)
+ (dynamic_cast<const ClassDef*>(scope))->isBaseClass(dynamic_cast<ClassDef*>(itemScope),TRUE)
);
if (itemScope==scope || memberAccessibleFromScope || nestedClassInsideBaseClass)
@@ -1009,7 +1009,7 @@ int isAccessibleFrom(const Definition *scope,const FileDef *fileScope,const Defi
// check if scope is a namespace, which is using other classes and namespaces
if (scope->definitionType()==Definition::TypeNamespace)
{
- NamespaceDef *nscope = (NamespaceDef*)scope;
+ const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope);
//printf(" %s is namespace with %d used classes\n",nscope->name().data(),nscope->getUsedClasses());
SDict<Definition> *cl = nscope->getUsedClasses();
if (accessibleViaUsingClass(cl,fileScope,item))
@@ -1089,7 +1089,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop
else if (itemScope && newScope &&
itemScope->definitionType()==Definition::TypeClass &&
newScope->definitionType()==Definition::TypeClass &&
- ((ClassDef*)newScope)->isBaseClass((ClassDef*)itemScope,TRUE,0)
+ (dynamic_cast<const ClassDef*>(newScope))->isBaseClass(dynamic_cast<const ClassDef*>(itemScope),TRUE,0)
)
{
// inheritance is also ok. Example: looking for B::I, where
@@ -1114,7 +1114,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop
// A::B::C but is explicit referenced as A::C, where B is imported
// in A via a using directive.
//printf("newScope is a namespace: %s!\n",newScope->name().data());
- NamespaceDef *nscope = (NamespaceDef*)newScope;
+ const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(newScope);
SDict<Definition> *cl = nscope->getUsedClasses();
if (cl)
{
@@ -1165,7 +1165,7 @@ int isAccessibleFromWithExpScope(const Definition *scope,const FileDef *fileScop
//printf(" failed to resolve: scope=%s\n",scope->name().data());
if (scope->definitionType()==Definition::TypeNamespace)
{
- NamespaceDef *nscope = (NamespaceDef*)scope;
+ const NamespaceDef *nscope = dynamic_cast<const NamespaceDef*>(scope);
NamespaceSDict *nl = nscope->getUsedNamespaces();
if (accessibleViaUsingNamespace(nl,fileScope,item,explicitScopePart))
{
@@ -1227,7 +1227,7 @@ static void getResolvedSymbol(const Definition *scope,
// only look at classes and members that are enums or typedefs
if (d->definitionType()==Definition::TypeClass ||
(d->definitionType()==Definition::TypeMember &&
- (((MemberDef*)d)->isTypedef() || ((MemberDef*)d)->isEnumerate())
+ ((dynamic_cast<MemberDef*>(d))->isTypedef() || (dynamic_cast<MemberDef*>(d))->isEnumerate())
)
)
{
@@ -1240,7 +1240,7 @@ static void getResolvedSymbol(const Definition *scope,
// see if we are dealing with a class or a typedef
if (d->definitionType()==Definition::TypeClass) // d is a class
{
- ClassDef *cd = (ClassDef *)d;
+ ClassDef *cd = dynamic_cast<ClassDef *>(d);
//printf("cd=%s\n",cd->name().data());
if (!cd->isTemplateArgument()) // skip classes that
// are only there to
@@ -1285,7 +1285,7 @@ static void getResolvedSymbol(const Definition *scope,
}
else if (d->definitionType()==Definition::TypeMember)
{
- MemberDef *md = (MemberDef *)d;
+ MemberDef *md = dynamic_cast<MemberDef *>(d);
//printf(" member isTypedef()=%d\n",md->isTypedef());
if (md->isTypedef()) // d is a typedef
{
@@ -1707,7 +1707,7 @@ QCString removeRedundantWhiteSpace(const QCString &s)
// improve the performance of this function
static char *growBuf = 0;
static int growBufLen = 0;
- if (s.length()*3>growBufLen) // For input character we produce at most 3 output characters,
+ if ((int)s.length()*3>growBufLen) // For input character we produce at most 3 output characters,
{
growBufLen = s.length()*3;
growBuf = (char *)realloc(growBuf,growBufLen+1); // add 1 for 0-terminator
@@ -5002,7 +5002,7 @@ bool generateLink(OutputDocInterface &od,const char *clName,
compound->definitionType()==Definition::TypeGroup /* is group */
)
{
- linkText=((GroupDef *)compound)->groupTitle(); // use group's title as link
+ linkText=(dynamic_cast<GroupDef *>(compound))->groupTitle(); // use group's title as link
}
else if (compound->definitionType()==Definition::TypeFile)
{
@@ -5374,7 +5374,7 @@ static void initBaseClassHierarchy(BaseClassList *bcl)
{
initBaseClassHierarchy(cd->baseClasses());
}
- cd->visited=FALSE;
+ cd->setVisited(FALSE);
}
}
//----------------------------------------------------------------------------
@@ -5414,7 +5414,7 @@ void initClassHierarchy(ClassSDict *cl)
ClassDef *cd;
for ( ; (cd=cli.current()); ++cli)
{
- cd->visited=FALSE;
+ cd->setVisited(FALSE);
initBaseClassHierarchy(cd->baseClasses());
}
}
@@ -6683,7 +6683,7 @@ PageDef *addRelatedPage(const char *name,const QCString &ptitle,
baseName=baseName.left(baseName.length()-Doxygen::htmlFileExtension.length());
QCString title=ptitle.stripWhiteSpace();
- pd=new PageDef(fileName,startLine,baseName,doc,title);
+ pd=createPageDef(fileName,startLine,baseName,doc,title);
pd->setRefItems(sli);
pd->setLanguage(lang);
@@ -6856,6 +6856,7 @@ void filterLatexString(FTextStream &t,const char *str,
case '%': t << "\\%"; break;
case '#': t << "\\#"; break;
case '$': t << "\\$"; break;
+ case '-': t << "-\\/"; break;
case '^': (usedTableLevels()>0) ? t << "\\string^" : t << (char)c; break;
case '~': (usedTableLevels()>0) ? t << "\\string~" : t << (char)c; break;
case ' ': if (keepSpaces) t << "~"; else t << ' ';
@@ -7480,7 +7481,7 @@ MemberDef *getMemberFromSymbol(Definition *scope,FileDef *fileScope,
if (distance!=-1 && distance<minDistance)
{
minDistance = distance;
- bestMatch = (MemberDef *)d;
+ bestMatch = dynamic_cast<MemberDef *>(d);
//printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance);
}
}
@@ -7495,7 +7496,7 @@ MemberDef *getMemberFromSymbol(Definition *scope,FileDef *fileScope,
if (distance!=-1 && distance<minDistance)
{
minDistance = distance;
- bestMatch = (MemberDef *)d;
+ bestMatch = dynamic_cast<MemberDef *>(d);
//printf("new best match %s distance=%d\n",bestMatch->qualifiedName().data(),distance);
}
}