summaryrefslogtreecommitdiffstats
path: root/src/classdef.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2018-11-18 14:00:59 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2018-11-18 14:23:28 (GMT)
commitf0cc0f5da51faddd490c2cf358614b4ab70cc8ac (patch)
treed88c647365010677b4c4f6353e0e03e0daea6f33 /src/classdef.cpp
parent8ff99363c2f6b3226fe5b57f38ae1d4805dca22c (diff)
downloadDoxygen-f0cc0f5da51faddd490c2cf358614b4ab70cc8ac.zip
Doxygen-f0cc0f5da51faddd490c2cf358614b4ab70cc8ac.tar.gz
Doxygen-f0cc0f5da51faddd490c2cf358614b4ab70cc8ac.tar.bz2
Minor restructuring
Diffstat (limited to 'src/classdef.cpp')
-rw-r--r--src/classdef.cpp380
1 files changed, 184 insertions, 196 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp
index 944cd8c..77d9e05 100644
--- a/src/classdef.cpp
+++ b/src/classdef.cpp
@@ -1375,202 +1375,200 @@ QCString ClassDef::includeStatement() const
}
}
-void ClassDef::writeIncludeFiles(OutputList &ol)
+void ClassDef::writeIncludeFilesForSlice(OutputList &ol)
{
- if (m_impl->incInfo /*&& Config_getBool(SHOW_INCLUDE_FILES)*/)
+ if (m_impl->incInfo)
{
- SrcLangExt lang = getLanguage();
- if (lang==SrcLangExt_Slice)
+ QCString nm;
+ QStrList paths = Config_getList(STRIP_FROM_PATH);
+ if (!paths.isEmpty() && m_impl->incInfo->fileDef)
{
- QCString nm;
- QStrList paths = Config_getList(STRIP_FROM_PATH);
- if (!paths.isEmpty() && m_impl->incInfo->fileDef)
+ QCString abs = m_impl->incInfo->fileDef->absFilePath();
+ const char *s = paths.first();
+ QCString potential;
+ unsigned int length = 0;
+ while (s)
{
- QCString abs = m_impl->incInfo->fileDef->absFilePath();
- const char *s = paths.first();
- QCString potential;
- unsigned int length = 0;
- while (s)
+ QFileInfo info(s);
+ if (info.exists())
{
- QFileInfo info(s);
- if (info.exists())
+ QString prefix = info.absFilePath();
+ if (prefix.at(prefix.length() - 1) != '/')
{
- QString prefix = info.absFilePath();
- if (prefix.at(prefix.length() - 1) != '/')
- {
- prefix += '/';
- }
-
- if (prefix.length() > length &&
- qstricmp(abs.left(prefix.length()).data(), prefix.data()) == 0) // case insensitive compare
- {
- length = prefix.length();
- potential = abs.right(abs.length() - prefix.length());
- }
- s = paths.next();
+ prefix += '/';
}
- }
- if (length > 0)
- {
- nm = potential;
+ if (prefix.length() > length &&
+ qstricmp(abs.left(prefix.length()).data(), prefix.data()) == 0) // case insensitive compare
+ {
+ length = prefix.length();
+ potential = abs.right(abs.length() - prefix.length());
+ }
+ s = paths.next();
}
}
- if (nm.isEmpty())
+ if (length > 0)
{
- nm = m_impl->incInfo->includeName.data();
+ nm = potential;
}
+ }
- ol.startParagraph();
- ol.docify("Defined in ");
- ol.startTypewriter();
- ol.docify("<");
- if (m_impl->incInfo->fileDef)
- {
- ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm);
- }
- else
+ if (nm.isEmpty())
+ {
+ nm = m_impl->incInfo->includeName.data();
+ }
+
+ ol.startParagraph();
+ ol.docify(theTranslator->trDefinedIn()+" ");
+ ol.startTypewriter();
+ ol.docify("<");
+ if (m_impl->incInfo->fileDef)
+ {
+ ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm);
+ }
+ else
+ {
+ ol.docify(nm);
+ }
+ ol.docify(">");
+ ol.endTypewriter();
+ ol.endParagraph();
+ }
+
+ // Write a summary of the Slice definition including metadata.
+ ol.startParagraph();
+ ol.startTypewriter();
+ if (!m_impl->metaData.isEmpty())
+ {
+ ol.docify(m_impl->metaData);
+ ol.lineBreak();
+ }
+ if (m_impl->spec & Entry::Local)
+ {
+ ol.docify("local ");
+ }
+ if (m_impl->spec & Entry::Interface)
+ {
+ ol.docify("interface ");
+ }
+ else if (m_impl->spec & Entry::Struct)
+ {
+ ol.docify("struct ");
+ }
+ else if (m_impl->spec & Entry::Exception)
+ {
+ ol.docify("exception ");
+ }
+ else
+ {
+ ol.docify("class ");
+ }
+ ol.docify(stripScope(name()));
+ if (m_impl->inherits)
+ {
+ if (m_impl->spec & (Entry::Interface|Entry::Exception))
+ {
+ ol.docify(" extends ");
+ BaseClassListIterator it(*m_impl->inherits);
+ BaseClassDef *ibcd;
+ for (;(ibcd=it.current());++it)
{
- ol.docify(nm);
+ ClassDef *icd = ibcd->classDef;
+ ol.docify(icd->name());
+ if (!it.atLast())
+ {
+ ol.docify(", ");
+ }
}
- ol.docify(">");
- ol.endTypewriter();
- ol.endParagraph();
}
else
{
- QCString nm=m_impl->incInfo->includeName.isEmpty() ?
- (m_impl->incInfo->fileDef ?
- m_impl->incInfo->fileDef->docName().data() : ""
- ) :
- m_impl->incInfo->includeName.data();
- if (!nm.isEmpty())
+ // Must be a class.
+ bool implements = false;
+ BaseClassListIterator it(*m_impl->inherits);
+ BaseClassDef *ibcd;
+ for (;(ibcd=it.current());++it)
{
- ol.startParagraph();
- ol.startTypewriter();
- ol.docify(includeStatement());
- bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java;
- if (m_impl->incInfo->local || isIDLorJava)
- ol.docify("\"");
- else
- ol.docify("<");
- ol.pushGeneratorState();
- ol.disable(OutputGenerator::Html);
- ol.docify(nm);
- ol.disableAllBut(OutputGenerator::Html);
- ol.enable(OutputGenerator::Html);
- if (m_impl->incInfo->fileDef)
+ ClassDef *icd = ibcd->classDef;
+ if (icd->m_impl->spec & Entry::Interface)
{
- ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm);
+ implements = true;
}
else
{
- ol.docify(nm);
+ ol.docify(" extends ");
+ ol.docify(icd->name());
}
- ol.popGeneratorState();
- if (m_impl->incInfo->local || isIDLorJava)
- ol.docify("\"");
- else
- ol.docify(">");
- if (isIDLorJava)
- ol.docify(";");
- ol.endTypewriter();
- ol.endParagraph();
- }
- }
-
- // Write a summary of the Slice definition including metadata.
- if (lang == SrcLangExt_Slice)
- {
- ol.startParagraph();
- ol.startTypewriter();
- if (!m_impl->metaData.isEmpty())
- {
- ol.docify(m_impl->metaData);
- ol.lineBreak();
- }
- if (m_impl->spec & Entry::Local)
- {
- ol.docify("local ");
- }
- if (m_impl->spec & Entry::Interface)
- {
- ol.docify("interface ");
}
- else if (m_impl->spec & Entry::Struct)
+ if (implements)
{
- ol.docify("struct ");
- }
- else if (m_impl->spec & Entry::Exception)
- {
- ol.docify("exception ");
- }
- else
- {
- ol.docify("class ");
- }
- ol.docify(stripScope(name()));
- if (m_impl->inherits)
- {
- if (m_impl->spec & (Entry::Interface|Entry::Exception))
+ ol.docify(" implements ");
+ bool first = true;
+ for (ibcd=it.toFirst();(ibcd=it.current());++it)
{
- ol.docify(" extends ");
- BaseClassListIterator it(*m_impl->inherits);
- BaseClassDef *ibcd;
- for (;(ibcd=it.current());++it)
+ ClassDef *icd = ibcd->classDef;
+ if (icd->m_impl->spec & Entry::Interface)
{
- ClassDef *icd = ibcd->classDef;
- ol.docify(icd->name());
- if (!it.atLast())
+ if (!first)
{
ol.docify(", ");
}
- }
- }
- else
- {
- // Must be a class.
- bool implements = false;
- BaseClassListIterator it(*m_impl->inherits);
- BaseClassDef *ibcd;
- for (;(ibcd=it.current());++it)
- {
- ClassDef *icd = ibcd->classDef;
- if (icd->m_impl->spec & Entry::Interface)
- {
- implements = true;
- }
else
{
- ol.docify(" extends ");
- ol.docify(icd->name());
- }
- }
- if (implements)
- {
- ol.docify(" implements ");
- bool first = true;
- for (ibcd=it.toFirst();(ibcd=it.current());++it)
- {
- ClassDef *icd = ibcd->classDef;
- if (icd->m_impl->spec & Entry::Interface)
- {
- if (!first)
- {
- ol.docify(", ");
- }
- else
- {
- first = false;
- }
- ol.docify(icd->name());
- }
+ first = false;
}
+ ol.docify(icd->name());
}
}
}
- ol.docify(" { ... }");
+ }
+ }
+ ol.docify(" { ... }");
+ ol.endTypewriter();
+ ol.endParagraph();
+}
+
+void ClassDef::writeIncludeFiles(OutputList &ol)
+{
+ if (m_impl->incInfo /*&& Config_getBool(SHOW_INCLUDE_FILES)*/)
+ {
+ SrcLangExt lang = getLanguage();
+ QCString nm=m_impl->incInfo->includeName.isEmpty() ?
+ (m_impl->incInfo->fileDef ?
+ m_impl->incInfo->fileDef->docName().data() : ""
+ ) :
+ m_impl->incInfo->includeName.data();
+ if (!nm.isEmpty())
+ {
+ ol.startParagraph();
+ ol.startTypewriter();
+ ol.docify(includeStatement());
+ bool isIDLorJava = lang==SrcLangExt_IDL || lang==SrcLangExt_Java;
+ if (m_impl->incInfo->local || isIDLorJava)
+ ol.docify("\"");
+ else
+ ol.docify("<");
+ ol.pushGeneratorState();
+ ol.disable(OutputGenerator::Html);
+ ol.docify(nm);
+ ol.disableAllBut(OutputGenerator::Html);
+ ol.enable(OutputGenerator::Html);
+ if (m_impl->incInfo->fileDef)
+ {
+ ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm);
+ }
+ else
+ {
+ ol.docify(nm);
+ }
+ ol.popGeneratorState();
+ if (m_impl->incInfo->local || isIDLorJava)
+ ol.docify("\"");
+ else
+ ol.docify(">");
+ if (isIDLorJava)
+ ol.docify(";");
ol.endTypewriter();
ol.endParagraph();
}
@@ -2054,24 +2052,24 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade
{
if (sliceOpt)
{
- if (isInterface())
+ if (compoundType()==Interface)
{
ol.startMemberHeader("interfaces");
}
- else if (isStruct())
+ else if (compoundType()==Struct)
{
ol.startMemberHeader("structs");
}
- else if (isException())
+ else if (compoundType()==Exception)
{
ol.startMemberHeader("exceptions");
}
- else
+ else // compoundType==Class
{
ol.startMemberHeader("nested-classes");
}
}
- else
+ else // non-Slice optimization: single header for class/struct/..
{
ol.startMemberHeader("nested-classes");
}
@@ -2207,7 +2205,14 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page
writeBriefDescription(ol,exampleFlag);
break;
case LayoutDocEntry::ClassIncludes:
- writeIncludeFiles(ol);
+ if (lang==SrcLangExt_Slice)
+ {
+ writeIncludeFilesForSlice(ol);
+ }
+ else
+ {
+ writeIncludeFiles(ol);
+ }
break;
case LayoutDocEntry::ClassInheritanceGraph:
writeInheritanceGraph(ol);
@@ -2365,15 +2370,15 @@ void ClassDef::writeDocumentation(OutputList &ol)
HighlightedItem hli;
if (sliceOpt)
{
- if (isInterface())
+ if (compoundType()==Interface)
{
hli = HLI_InterfaceVisible;
}
- else if (isStruct())
+ else if (compoundType()==Struct)
{
hli = HLI_StructVisible;
}
- else if (isException())
+ else if (compoundType()==Exception)
{
hli = HLI_ExceptionVisible;
}
@@ -2524,15 +2529,15 @@ void ClassDef::writeMemberList(OutputList &ol)
HighlightedItem hli;
if (sliceOpt)
{
- if (isInterface())
+ if (compoundType()==Interface)
{
hli = HLI_InterfaceVisible;
}
- else if (isStruct())
+ else if (compoundType()==Struct)
{
hli = HLI_StructVisible;
}
- else if (isException())
+ else if (compoundType()==Exception)
{
hli = HLI_ExceptionVisible;
}
@@ -3802,21 +3807,19 @@ QCString ClassDef::compoundTypeString() const
}
else
{
- QCString type;
switch (m_impl->compType)
{
- case Class: type += isJavaEnum() ? "enum" : "class"; break;
- case Struct: type += "struct"; break;
- case Union: type += "union"; break;
- case Interface: type += getLanguage()==SrcLangExt_ObjC ? "class" : "interface"; break;
- case Protocol: type += "protocol"; break;
- case Category: type += "category"; break;
- case Exception: type += "exception"; break;
- case Service: type += "service"; break;
- case Singleton: type += "singleton"; break;
+ case Class: return isJavaEnum() ? "enum" : "class";
+ case Struct: return "struct";
+ case Union: return "union";
+ case Interface: return getLanguage()==SrcLangExt_ObjC ? "class" : "interface";
+ case Protocol: return "protocol";
+ case Category: return "category";
+ case Exception: return "exception";
+ case Service: return "service";
+ case Singleton: return "singleton";
default: return "unknown";
}
- return type;
}
}
@@ -5001,21 +5004,6 @@ bool ClassDef::subGrouping() const
return m_impl->subGrouping;
}
-bool ClassDef::isInterface() const
-{
- return m_impl->compType == Interface;
-}
-
-bool ClassDef::isStruct() const
-{
- return m_impl->compType == Struct;
-}
-
-bool ClassDef::isException() const
-{
- return m_impl->compType == Exception;
-}
-
bool ClassDef::isSliceLocal() const
{
return m_impl->spec&Entry::Local;