diff options
Diffstat (limited to 'src/classdef.cpp')
-rw-r--r-- | src/classdef.cpp | 350 |
1 files changed, 313 insertions, 37 deletions
diff --git a/src/classdef.cpp b/src/classdef.cpp index 28308db..944cd8c 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, @@ -1376,27 +1379,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); @@ -1405,13 +1434,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(); } @@ -1887,12 +2046,35 @@ void ClassDef::writeDeclarationLink(OutputList &ol,bool &found,const char *heade { //static bool fortranOpt = Config_getBool(OPTIMIZE_FOR_FORTRAN); //static bool vhdlOpt = Config_getBool(OPTIMIZE_OUTPUT_VHDL); + static bool sliceOpt = Config_getBool(OPTIMIZE_OUTPUT_SLICE); SrcLangExt lang = getLanguage(); if (visibleInParentsDeclList()) { if (!found) // first class { - ol.startMemberHeader("nested-classes"); + if (sliceOpt) + { + if (isInterface()) + { + ol.startMemberHeader("interfaces"); + } + else if (isStruct()) + { + ol.startMemberHeader("structs"); + } + else if (isException()) + { + ol.startMemberHeader("exceptions"); + } + else + { + ol.startMemberHeader("nested-classes"); + } + } + else + { + ol.startMemberHeader("nested-classes"); + } if (header) { ol.parseText(header); @@ -1918,6 +2100,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(); @@ -2083,8 +2269,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: @@ -2123,6 +2315,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)); @@ -2161,9 +2359,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) @@ -2290,15 +2514,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) @@ -3553,19 +3802,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; } } @@ -4750,12 +5001,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; |