diff options
author | Mark Spruiell <mes@zeroc.com> | 2017-12-27 19:12:07 (GMT) |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2018-10-22 19:21:42 (GMT) |
commit | 3a97099d5e6afd298486f219694a7fb5eff67fea (patch) | |
tree | 979abad6dd502a4d28dac1f29a1bce9e4bb3b336 /src/classdef.cpp | |
parent | d94c10574f44c10ff0df9ce24c09cb6fcaac37c0 (diff) | |
download | Doxygen-3a97099d5e6afd298486f219694a7fb5eff67fea.zip Doxygen-3a97099d5e6afd298486f219694a7fb5eff67fea.tar.gz Doxygen-3a97099d5e6afd298486f219694a7fb5eff67fea.tar.bz2 |
Added *.ice files as a recognized file type.
Added a Slice-optimized output mode.
Diffstat (limited to 'src/classdef.cpp')
-rw-r--r-- | src/classdef.cpp | 325 |
1 files changed, 289 insertions, 36 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 787cd5e..abe7a52 100644 --- a/src/classdef.cpp +++ b/src/classdef.cpp @@ -17,6 +17,7 @@ #include <stdio.h> #include <qfile.h> +#include <qfileinfo.h> #include <qregexp.h> #include "classdef.h" #include "classlist.h" @@ -201,6 +202,8 @@ class ClassDefImpl bool isAnonymous; uint64 spec; + + QCString metaData; }; void ClassDefImpl::init(const char *defFileName, const char *name, @@ -1372,27 +1375,53 @@ void ClassDef::writeIncludeFiles(OutputList &ol) { if (m_impl->incInfo /*&& Config_getBool(SHOW_INCLUDE_FILES)*/) { - 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()) + SrcLangExt lang = getLanguage(); + if (lang==SrcLangExt_Slice) { + 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) + { + QFileInfo info(s); + if (info.exists()) + { + 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(); + } + } + + if (length > 0) + { + nm = potential; + } + } + + if (nm.isEmpty()) + { + nm = m_impl->incInfo->includeName.data(); + } + ol.startParagraph(); + ol.docify("Defined in "); ol.startTypewriter(); - ol.docify(includeStatement()); - SrcLangExt lang = getLanguage(); - 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); + ol.docify("<"); if (m_impl->incInfo->fileDef) { ol.writeObjectLink(0,m_impl->incInfo->fileDef->includeName(),0,nm); @@ -1401,13 +1430,143 @@ void ClassDef::writeIncludeFiles(OutputList &ol) { ol.docify(nm); } - ol.popGeneratorState(); - if (m_impl->incInfo->local || isIDLorJava) - 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()) + { + 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(); + } + } + + // 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) + { + ol.docify("struct "); + } + else if (m_impl->spec & Entry::Exception) + { + ol.docify("exception "); + } else - ol.docify(">"); - if (isIDLorJava) - ol.docify(";"); + { + 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) + { + ClassDef *icd = ibcd->classDef; + ol.docify(icd->name()); + if (!it.atLast()) + { + 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()); + } + } + } + } + } + ol.docify(" { ... }"); ol.endTypewriter(); ol.endParagraph(); } @@ -1914,6 +2073,10 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade if (lang!=SrcLangExt_VHDL) // for VHDL we swap the name and the type { + if (isSliceLocal()) + { + ol.writeString("local "); + } ol.writeString(ctype); ol.writeString(" "); ol.insertMemberAlign(); @@ -2079,8 +2242,14 @@ void ClassDef::writeDocumentationContents(OutputList &ol,const QCString & /*page case LayoutDocEntry::NamespaceNestedNamespaces: case LayoutDocEntry::NamespaceNestedConstantGroups: case LayoutDocEntry::NamespaceClasses: + case LayoutDocEntry::NamespaceInterfaces: + case LayoutDocEntry::NamespaceStructs: + case LayoutDocEntry::NamespaceExceptions: case LayoutDocEntry::NamespaceInlineClasses: case LayoutDocEntry::FileClasses: + case LayoutDocEntry::FileInterfaces: + case LayoutDocEntry::FileStructs: + case LayoutDocEntry::FileExceptions: case LayoutDocEntry::FileNamespaces: case LayoutDocEntry::FileConstantGroups: case LayoutDocEntry::FileIncludes: @@ -2119,6 +2288,12 @@ QCString ClassDef::title() const m_impl->compType, m_impl->tempArgs != 0); } + else if (lang==SrcLangExt_Slice) + { + pageTitle = theTranslator->trCompoundReferenceSlice(displayName(), + m_impl->compType, + isSliceLocal()); + } else if (lang==SrcLangExt_VHDL) { pageTitle = theTranslator->trCustomReference(VhdlDocGen::getClassTitle(this)); @@ -2157,9 +2332,35 @@ void ClassDef::writeDocumentation(OutputList &ol) static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); QCString pageTitle = title(); - startFile(ol,getOutputFileBase(),name(),pageTitle,HLI_ClassVisible,!generateTreeView); + HighlightedItem hli; + if (sliceOpt) + { + if (isInterface()) + { + hli = HLI_InterfaceVisible; + } + else if (isStruct()) + { + hli = HLI_StructVisible; + } + else if (isException()) + { + hli = HLI_ExceptionVisible; + } + else + { + hli = HLI_ClassVisible; + } + } + else + { + hli = HLI_ClassVisible; + } + + startFile(ol,getOutputFileBase(),name(),pageTitle,hli,!generateTreeView); if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) @@ -2286,15 +2487,40 @@ void ClassDef::writeMemberList(OutputList &ol) { static bool cOpt = Config_getBool(OPTIMIZE_OUTPUT_FOR_C); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); static bool generateTreeView = Config_getBool(GENERATE_TREEVIEW); if (m_impl->allMemberNameInfoSDict==0 || cOpt) return; // only for HTML ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); + HighlightedItem hli; + if (sliceOpt) + { + if (isInterface()) + { + hli = HLI_InterfaceVisible; + } + else if (isStruct()) + { + hli = HLI_StructVisible; + } + else if (isException()) + { + hli = HLI_ExceptionVisible; + } + else + { + hli = HLI_ClassVisible; + } + } + else + { + hli = HLI_ClassVisible; + } + QCString memListFile = getMemberListFileName(); - startFile(ol,memListFile,memListFile,theTranslator->trMemberList(), - HLI_ClassVisible,!generateTreeView,getOutputFileBase()); + startFile(ol,memListFile,memListFile,theTranslator->trMemberList(),hli,!generateTreeView,getOutputFileBase()); if (!generateTreeView) { if (getOuterScope()!=Doxygen::globalScope) @@ -3549,19 +3775,21 @@ QCString ClassDef::compoundTypeString() const } else { + QCString type; switch (m_impl->compType) { - 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"; + 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; default: return "unknown"; } + return type; } } @@ -4746,12 +4974,37 @@ 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; +} + void ClassDef::setName(const char *name) { m_impl->isAnonymous = QCString(name).find('@')!=-1; Definition::setName(name); } +void ClassDef::setMetaData(const char *md) +{ + m_impl->metaData = md; +} + bool ClassDef::isAnonymous() const { return m_impl->isAnonymous; |