summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-08-26 14:15:46 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-08-26 14:15:46 (GMT)
commitc822eb3d9ce727dd69954661edcabcad479c1481 (patch)
tree9acee8d8d8b91289eb8173fd93a8f16891fc2a92 /src/util.cpp
parent2f7902073680b977b74f3faeada95119ec767eb3 (diff)
downloadDoxygen-c822eb3d9ce727dd69954661edcabcad479c1481.zip
Doxygen-c822eb3d9ce727dd69954661edcabcad479c1481.tar.gz
Doxygen-c822eb3d9ce727dd69954661edcabcad479c1481.tar.bz2
Release-1.2.10
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp84
1 files changed, 73 insertions, 11 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 24cfa66..95193f7 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -243,9 +243,11 @@ QCString replaceAnonymousScopes(const QCString &s)
// strip annonymous left hand side part of the scope
QCString stripAnonymousNamespaceScope(const QCString &s)
{
+#if 0
int oi=0,i=0,p=0;
- if (s.isEmpty()) return s;
- while (s.at(p)=='@' && (i=s.find("::",p))!=-1 &&
+ p=s.find('@');
+ if (p==-1) return s;
+ while (s.at(p)=='@' && (i=s.find("::@",p))!=-1 &&
Doxygen::namespaceDict[s.left(i)]!=0) { oi=i; p=i+2; }
if (oi==0)
{
@@ -257,6 +259,32 @@ QCString stripAnonymousNamespaceScope(const QCString &s)
//printf("stripAnonymousNamespaceScope(`%s')=`%s'\n",s.data(),s.right(s.length()-oi-2).data());
return s.right(s.length()-oi-2);
}
+#endif
+
+ int i,p=0,l;
+ QCString newScope;
+ while ((i=getScopeFragment(s,p,&l))!=-1)
+ {
+ //printf("Scope fragment %s\n",s.mid(i,l).data());
+ if (Doxygen::namespaceDict[s.left(i+l)]!=0)
+ {
+ if (s.at(i)!='@')
+ {
+ if (!newScope.isEmpty()) newScope+="::";
+ newScope+=s.mid(i,l);
+ }
+ }
+ else
+ {
+ if (!newScope.isEmpty()) newScope+="::";
+ newScope+=s.right(s.length()-i);
+ goto done;
+ }
+ p=i+l;
+ }
+done:
+ //printf("stripAnonymousNamespaceScope(`%s')=`%s'\n",s.data(),newScope.data());
+ return newScope;
}
void writePageRef(OutputDocInterface &od,const char *cn,const char *mn)
@@ -1134,7 +1162,7 @@ void trimBaseClassScope(BaseClassList *bcl,QCString &s,int level=0)
* scope. If neither or both have a namespace scope, t1 and t2 remain
* unchanged.
*/
-static void trimNamespaceScope(QCString &t1,QCString &t2)
+static void trimNamespaceScope(QCString &t1,QCString &t2,const QCString &nsName)
{
int p1=t1.length();
int p2=t2.length();
@@ -1149,20 +1177,54 @@ static void trimNamespaceScope(QCString &t1,QCString &t2)
if (i1!=-1 && i2==-1) // only t1 has a scope
{
QCString scope=t1.left(i1);
- if (!scope.isEmpty() && Doxygen::namespaceDict[scope]!=0) // scope is a namespace
+
+ int so=nsName.length();
+ do
{
- t1 = t1.right(t1.length()-i1-2);
- return;
+ QCString fullScope=nsName.left(so);
+ if (!fullScope.isEmpty() && !scope.isEmpty()) fullScope+="::";
+ fullScope+=scope;
+ if (!fullScope.isEmpty() && Doxygen::namespaceDict[fullScope]!=0) // scope is a namespace
+ {
+ t1 = t1.right(t1.length()-i1-2);
+ return;
+ }
+ if (so==0)
+ {
+ so=-1;
+ }
+ else if ((so=nsName.findRev("::",so-1))==-1)
+ {
+ so=0;
+ }
}
+ while (so>=0);
}
else if (i1==-1 && i2!=-1) // only t2 has a scope
{
QCString scope=t2.left(i2);
- if (!scope.isEmpty() && Doxygen::namespaceDict[scope]!=0) // scope is a namespace
+
+ int so=nsName.length();
+ do
{
- t2 = t2.right(t2.length()-i2-2);
- return;
+ QCString fullScope=nsName.left(so);
+ if (!fullScope.isEmpty() && !scope.isEmpty()) fullScope+="::";
+ fullScope+=scope;
+ if (!fullScope.isEmpty() && Doxygen::namespaceDict[fullScope]!=0) // scope is a namespace
+ {
+ t2 = t2.right(t2.length()-i2-2);
+ return;
+ }
+ if (so==0)
+ {
+ so=-1;
+ }
+ else if ((so=nsName.findRev("::",so-1))==-1)
+ {
+ so=0;
+ }
}
+ while (so>=0);
}
p1 = QMAX(i1-2,0);
p2 = QMAX(i2-2,0);
@@ -1297,7 +1359,7 @@ static bool matchArgument(const Argument *srcA,const Argument *dstA,
// remove a namespace scope that is only in one type
// (assuming a using statement was used)
- trimNamespaceScope(srcAType,dstAType);
+ trimNamespaceScope(srcAType,dstAType,namespaceName);
//QCString srcScope;
//QCString dstScope;
@@ -1521,7 +1583,7 @@ static void mergeArgument(Argument *srcA,Argument *dstA,
// remove a namespace scope that is only in one type
// (assuming a using statement was used)
- trimNamespaceScope(srcAType,dstAType);
+ trimNamespaceScope(srcAType,dstAType,namespaceName);
//QCString srcScope;