static void lookupSymbol(Definition *d) { if (d!=Doxygen::globalScope && // skip the global namespace symbol d->name().at(0)!='@' // skip anonymous stuff ) { printf("Symbol info\n"); printf("-----------\n"); printf("Name: %s\n",d->name().data()); printf("File: %s\n",d->getDefFileName().data()); printf("Line: %d\n",d->getDefLine()); // depending on the definition type we can case to the appropriate // derived to get additional information switch (d->definitionType()) { case Definition::TypeClass: { ClassDef *cd = (ClassDef *)d; printf("Kind: %s\n",cd->compoundTypeString().data()); } break; case Definition::TypeFile: { FileDef *fd = (FileDef *)d; printf("Kind: File: #includes %d other files\n", fd->includeFileList() ? fd->includeFileList()->count() : 0); } break; case Definition::TypeNamespace: { NamespaceDef *nd = (NamespaceDef *)d; printf("Kind: Namespace: contains %d classes and %d namespaces\n", nd->getClassSDict() ? nd->getClassSDict()->count() : 0, nd->getNamespaceSDict() ? nd->getNamespaceSDict()->count() : 0); } break; case Definition::TypeMember: { MemberDef *md = (MemberDef *)d; printf("Kind: %s\n",md->memberTypeName().data()); } break; default: // ignore groups/pages/packages/dirs for now break; } } }
void NamespaceDef::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"namespace\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; QCString idStr = id(); if (!idStr.isEmpty()) { tagFile << " <clangid>" << convertToXML(idStr) << "</clangid>" << endl; } QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Namespace)); LayoutDocEntry *lde; for (eli.toFirst(); (lde=eli.current()); ++eli) { switch (lde->kind()) { case LayoutDocEntry::NamespaceNestedNamespaces: { if (namespaceSDict) { SDict<NamespaceDef>::Iterator ni(*namespaceSDict); NamespaceDef *nd; for (ni.toFirst(); (nd=ni.current()); ++ni) { if (nd->isLinkableInProject()) { tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl; } } } } break; case LayoutDocEntry::NamespaceClasses: { if (classSDict) { SDict<ClassDef>::Iterator ci(*classSDict); ClassDef *cd; for (ci.toFirst(); (cd=ci.current()); ++ci) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() << "\">" << convertToXML(cd->name()) << "</class>" << endl; } } } } case LayoutDocEntry::MemberDecl: { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; MemberList * ml = getMemberList(lmd->type); if (ml) { ml->writeTagFile(tagFile); } } break; case LayoutDocEntry::MemberGroups: { if (memberGroupSDict) { MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; for (; (mg=mgli.current()); ++mgli) { mg->writeTagFile(tagFile); } } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>" << endl; }
void SearchIndex::setCurrentDoc(Definition *ctx,const char *anchor,bool isSourceFile) { if (ctx==0) return; assert(!isSourceFile || ctx->definitionType()==Definition::TypeFile); //printf("SearchIndex::setCurrentDoc(%s,%s,%s)\n",name,baseName,anchor); QCString url=isSourceFile ? ((FileDef*)ctx)->getSourceFileBase() : ctx->getOutputFileBase(); url+=Config_getString("HTML_FILE_EXTENSION"); if (anchor) url+=QCString("#")+anchor; QCString name=ctx->qualifiedName(); if (ctx->definitionType()==Definition::TypeMember) { MemberDef *md = (MemberDef *)ctx; name.prepend((md->getLanguage()==SrcLangExt_Fortran ? theTranslator->trSubprogram(TRUE,TRUE) : theTranslator->trMember(TRUE,TRUE))+" "); } else // compound type { SrcLangExt lang = ctx->getLanguage(); QCString sep = getLanguageSpecificSeparator(lang); if (sep!="::") { name = substitute(name,"::",sep); } switch (ctx->definitionType()) { case Definition::TypePage: { PageDef *pd = (PageDef *)ctx; if (!pd->title().isEmpty()) { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->title(); } else { name = theTranslator->trPage(TRUE,TRUE)+" "+pd->name(); } } break; case Definition::TypeClass: { ClassDef *cd = (ClassDef *)ctx; name.prepend(cd->compoundTypeString()+" "); } break; case Definition::TypeNamespace: { if (lang==SrcLangExt_Java || lang==SrcLangExt_CSharp) { name = theTranslator->trPackage(name); } else if (lang==SrcLangExt_Fortran) { name.prepend(theTranslator->trModule(TRUE,TRUE)+" "); } else { name.prepend(theTranslator->trNamespace(TRUE,TRUE)+" "); } } break; case Definition::TypeGroup: { GroupDef *gd = (GroupDef *)ctx; if (gd->groupTitle()) { name = theTranslator->trGroup(TRUE,TRUE)+" "+gd->groupTitle(); } else { name.prepend(theTranslator->trGroup(TRUE,TRUE)+" "); } } break; default: break; } } int *pIndex = m_url2IdMap.find(url); if (pIndex==0) { ++m_urlIndex; m_url2IdMap.insert(url,new int(m_urlIndex)); m_urls.insert(m_urlIndex,new URL(name,url)); } else { m_urls.insert(*pIndex,new URL(name,url)); } }
void GroupDef::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"group\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; tagFile << " <title>" << convertToXML(title) << "</title>" << endl; tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Group)); LayoutDocEntry *lde; for (eli.toFirst();(lde=eli.current());++eli) { switch (lde->kind()) { case LayoutDocEntry::GroupClasses: { if (classSDict) { SDict<ClassDef>::Iterator ci(*classSDict); ClassDef *cd; for (ci.toFirst();(cd=ci.current());++ci) { if (cd->isLinkableInProject()) { tagFile << " <class kind=\"" << cd->compoundTypeString() << "\">" << convertToXML(cd->name()) << "</class>" << endl; } } } } break; case LayoutDocEntry::GroupNamespaces: { if (namespaceSDict) { SDict<NamespaceDef>::Iterator ni(*namespaceSDict); NamespaceDef *nd; for (ni.toFirst();(nd=ni.current());++ni) { if (nd->isLinkableInProject()) { tagFile << " <namespace>" << convertToXML(nd->name()) << "</namespace>" << endl; } } } } break; case LayoutDocEntry::GroupFiles: { if (fileList) { QListIterator<FileDef> it(*fileList); FileDef *fd; for (;(fd=it.current());++it) { if (fd->isLinkableInProject()) { tagFile << " <file>" << convertToXML(fd->name()) << "</file>" << endl; } } } } break; case LayoutDocEntry::GroupPageDocs: { if (pageDict) { PageSDict::Iterator pdi(*pageDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { QCString pageName = pd->getOutputFileBase(); if (pd->isLinkableInProject()) { tagFile << " <page>" << convertToXML(pageName) << "</page>" << endl; } } } } break; case LayoutDocEntry::GroupDirs: { if (dirList) { QListIterator<DirDef> it(*dirList); DirDef *dd; for (;(dd=it.current());++it) { if (dd->isLinkableInProject()) { tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>" << endl; } } } } break; case LayoutDocEntry::GroupNestedGroups: { if (groupList) { QListIterator<GroupDef> it(*groupList); GroupDef *gd; for (;(gd=it.current());++it) { if (gd->isVisible()) { tagFile << " <subgroup>" << convertToXML(gd->name()) << "</subgroup>" << endl; } } } } break; case LayoutDocEntry::MemberDecl: { LayoutDocEntryMemberDecl *lmd = (LayoutDocEntryMemberDecl*)lde; MemberList * ml = getMemberList(lmd->type); if (ml) { ml->writeTagFile(tagFile); } } break; case LayoutDocEntry::MemberGroups: { if (memberGroupSDict) { MemberGroupSDict::Iterator mgli(*memberGroupSDict); MemberGroup *mg; for (;(mg=mgli.current());++mgli) { mg->writeTagFile(tagFile); } } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>" << endl; }