static QCString node2URL(FTVNode *n,bool overruleFile=FALSE,bool srcLink=FALSE) { QCString url = n->file; if (!url.isEmpty() && url.at(0)=='!') // relative URL { // remove leading ! url = url.mid(1); } else if (!url.isEmpty() && url.at(0)=='^') // absolute URL { // skip, keep ^ in the output } else // local file (with optional anchor) { if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile) { FileDef *fd = (FileDef*)n->def; if (srcLink) { url = fd->getSourceFileBase(); } else { url = fd->getOutputFileBase(); } } url+=Doxygen::htmlFileExtension; if (!n->anchor.isEmpty()) url+="#"+n->anchor; } return url; }
void XmlDocVisitor::visitPre(DocImage *img) { if (m_hide) return; QCString baseName=img->name(); int i; if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1) { baseName=baseName.right(baseName.length()-i-1); } visitPreStart(m_t, "image", FALSE, this, img->children(), baseName, TRUE, img->type(), img->width(), img->height()); // copy the image to the output dir FileDef *fd; bool ambig; if ((fd=findFileDef(Doxygen::imageNameDict,img->name(),ambig))) { QFile inImage(fd->absFilePath()); QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data()); if (inImage.open(IO_ReadOnly)) { if (outImage.open(IO_WriteOnly)) { char *buffer = new char[inImage.size()]; inImage.readBlock(buffer,inImage.size()); outImage.writeBlock(buffer,inImage.size()); outImage.flush(); delete[] buffer; } } } }
void GroupDef::writeFiles(OutputList &ol,const QCString &title) { // write list of files if (fileList->count()>0) { ol.startMemberHeader("files"); ol.parseText(title); ol.endMemberHeader(); ol.startMemberList(); QListIterator<FileDef> it(*fileList); FileDef *fd; for (;(fd=it.current());++it) { if (!fd->hasDocumentation()) continue; ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.insertMemberAlign(); ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name()); ol.endMemberItem(); if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(fd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE,0,TRUE,FALSE); ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); } ol.endMemberList(); } }
void buildDirectories() { // for each input file FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { FileNameIterator fni(*fn); FileDef *fd; for (;(fd=fni.current());++fni) { //printf("buildDirectories %s\n",fd->name().data()); if (fd->getReference().isEmpty()) { DirDef *dir; if ((dir=Doxygen::directories->find(fd->getPath()))==0) // new directory { dir = DirDef::mergeDirectoryInTree(fd->getPath()); } if (dir && !fd->isDocumentationFile()) dir->addFile(fd); } else { // do something for file imported via tag files. } } } //DirDef *root = new DirDef("root:"); // compute relations between directories => introduce container dirs. DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString name = dir->name(); int i=name.findRev('/',name.length()-2); if (i>0) { DirDef *parent = Doxygen::directories->find(name.left(i+1)); //if (parent==0) parent=root; if (parent) { parent->addSubDir(dir); //printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n", // dir->displayName().data(), parent->displayName().data()); } } } for (sdi.toFirst();(dir=sdi.current());++sdi) { dir->sort(); } Doxygen::directories->sort(); computeCommonDirPrefix(); }
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 DirDef::writeTagFile(FTextStream &tagFile) { tagFile << " <compound kind=\"dir\">" << endl; tagFile << " <name>" << convertToXML(displayName()) << "</name>" << endl; tagFile << " <path>" << convertToXML(name()) << "</path>" << endl; tagFile << " <filename>" << convertToXML(getOutputFileBase()) << Doxygen::htmlFileExtension << "</filename>" << endl; QListIterator<LayoutDocEntry> eli( LayoutDocManager::instance().docEntries(LayoutDocManager::Directory)); LayoutDocEntry *lde; for (eli.toFirst();(lde=eli.current());++eli) { switch (lde->kind()) { case LayoutDocEntry::DirSubDirs: { if (m_subdirs.count()>0) { DirDef *dd; QListIterator<DirDef> it(m_subdirs); for (;(dd=it.current());++it) { tagFile << " <dir>" << convertToXML(dd->displayName()) << "</dir>" << endl; } } } break; case LayoutDocEntry::DirFiles: { if (m_fileList->count()>0) { QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { tagFile << " <file>" << convertToXML(fd->name()) << "</file>" << endl; } } } break; default: break; } } writeDocAnchorsToTagFile(tagFile); tagFile << " </compound>" << endl; }
void TagFileParser::addIncludes() { TagFileInfo *tfi = m_tagFileFiles.first(); while (tfi) { //printf("tag file tagName=%s path=%s name=%s\n",m_tagName.data(),tfi->path.data(),tfi->name.data()); FileName *fn = Doxygen::inputNameDict->find(tfi->name); if (fn) { //printf("found\n"); FileNameIterator fni(*fn); FileDef *fd; for (;(fd=fni.current());++fni) { //printf("input file path=%s name=%s\n",fd->getPath().data(),fd->name().data()); if (fd->getPath()==QCString(m_tagName+":"+tfi->path)) { //printf("found\n"); QListIterator<TagIncludeInfo> mii(tfi->includes); TagIncludeInfo *ii; for (;(ii=mii.current());++mii) { //printf("ii->name=`%s'\n",ii->name.data()); FileName *ifn = Doxygen::inputNameDict->find(ii->name); ASSERT(ifn!=0); if (ifn) { FileNameIterator ifni(*ifn); FileDef *ifd; for (;(ifd=ifni.current());++ifni) { //printf("ifd->getOutputFileBase()=%s ii->id=%s\n", // ifd->getOutputFileBase().data(),ii->id.data()); if (ifd->getOutputFileBase()==QCString(ii->id)) { fd->addIncludeDependency(ifd,ii->text,ii->isLocal,ii->isImported,FALSE); } } } } } } } tfi = m_tagFileFiles.next(); } }
/** Computes the dependencies between directories */ void DirDef::computeDependencies() { FileList *fl = m_fileList; if (fl) { QListIterator<FileDef> fli(*fl); FileDef *fd; for (fli.toFirst();(fd=fli.current());++fli) // foreach file in dir dd { //printf(" File %s\n",fd->name().data()); //printf("** dir=%s file=%s\n",shortName().data(),fd->name().data()); QList<IncludeInfo> *ifl = fd->includeFileList(); if (ifl) { QListIterator<IncludeInfo> ifli(*ifl); IncludeInfo *ii; for (ifli.toFirst();(ii=ifli.current());++ifli) // foreach include file { //printf(" > %s\n",ii->includeName.data()); //printf(" #include %s\n",ii->includeName.data()); if (ii->fileDef && ii->fileDef->isLinkable()) // linkable file { DirDef *usedDir = ii->fileDef->getDirDef(); if (usedDir) { // add dependency: thisDir->usedDir //static int count=0; //printf(" %d: add dependency %s->%s\n",count++,name().data(),usedDir->name().data()); addUsesDependency(usedDir,fd,ii->fileDef,FALSE); } } } } } } if (m_usedDirs) { QDictIterator<UsedDir> udi(*m_usedDirs); UsedDir *udir; for (udi.toFirst();(udir=udi.current());++udi) { udir->sort(); } } }
void computeDirDependencies() { DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); // compute nesting level for each directory for (sdi.toFirst();(dir=sdi.current());++sdi) { dir->setLevel(); } // compute uses dependencies between directories for (sdi.toFirst();(dir=sdi.current());++sdi) { //printf("computeDependencies for %s: #dirs=%d\n",dir->name().data(),Doxygen::directories.count()); dir->computeDependencies(); } #if 0 printf("-------------------------------------------------------------\n"); // print dependencies (for debugging) for (sdi.toFirst();(dir=sdi.current());++sdi) { if (dir->usedDirs()) { QDictIterator<UsedDir> udi(*dir->usedDirs()); UsedDir *usedDir; for (udi.toFirst();(usedDir=udi.current());++udi) { printf("%s depends on %s due to ", dir->shortName().data(),usedDir->dir()->shortName().data()); QDictIterator<FileDef> fdi(usedDir->files()); FileDef *fd; for (fdi.toFirst();(fd=fdi.current());++fdi) { printf("%s ",fd->name().data()); } printf("\n"); } } } printf("^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^\n"); #endif }
void DirDef::writeFileList(OutputList &ol) { int numFiles = 0; QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (it.toFirst();(fd=it.current());++it) { if (fd->hasDocumentation()) { numFiles++; } } // write file list if (numFiles>0) { ol.startMemberHeader("files"); ol.parseText(theTranslator->trFile(TRUE,FALSE)); ol.endMemberHeader(); ol.startMemberList(); QListIterator<FileDef> it(*m_fileList); FileDef *fd; for (;(fd=it.current());++it) { if (fd->hasDocumentation()) { ol.startMemberDeclaration(); ol.startMemberItem(fd->getOutputFileBase(),0); ol.docify(theTranslator->trFile(FALSE,TRUE)+" "); ol.insertMemberAlign(); if (fd->isLinkable()) { ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name()); } else { ol.startBold(); ol.docify(fd->name()); ol.endBold(); } if (fd->generateSourceFile()) { ol.pushGeneratorState(); ol.disableAllBut(OutputGenerator::Html); ol.docify(" "); ol.startTextLink(fd->includeName(),0); ol.docify("["); ol.parseText(theTranslator->trCode()); ol.docify("]"); ol.endTextLink(); ol.popGeneratorState(); } ol.endMemberItem(); if (!fd->briefDescription().isEmpty() && Config_getBool(BRIEF_MEMBER_DESC)) { ol.startMemberDescription(fd->getOutputFileBase()); ol.generateDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(), FALSE, // indexWords FALSE, // isExample 0, // exampleName TRUE, // single line TRUE // link from index ); ol.endMemberDescription(); } ol.endMemberDeclaration(0,0); } } ol.endMemberList(); } }
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; }
void generateSqlite3() { // + classes // + namespaces // + files // + groups // + related pages // + examples // + main page QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QDir sqlite3Dir(outputDirectory); sqlite3 *db; sqlite3_initialize(); int rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (rc != SQLITE_OK) { sqlite3_close(db); msg("database open failed: %s\n", "doxygen_sqlite3.db"); return; } beginTransaction(db); pragmaTuning(db); if (-1==initializeSchema(db)) return; if ( -1 == prepareStatements(db) ) { err("sqlite generator: prepareStatements failed!"); return; } // + classes ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { msg("Generating Sqlite3 output for class %s\n",cd->name().data()); generateSqlite3ForClass(db,cd); } // + namespaces NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { msg("Generating Sqlite3 output for namespace %s\n",nd->name().data()); generateSqlite3ForNamespace(db,nd); } // + files FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { FileNameIterator fni(*fn); FileDef *fd; for (;(fd=fni.current());++fni) { msg("Generating Sqlite3 output for file %s\n",fd->name().data()); generateSqlite3ForFile(db,fd); } } // + groups GroupSDict::Iterator gli(*Doxygen::groupSDict); GroupDef *gd; for (;(gd=gli.current());++gli) { msg("Generating Sqlite3 output for group %s\n",gd->name().data()); generateSqlite3ForGroup(db,gd); } // + page { PageSDict::Iterator pdi(*Doxygen::pageSDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { msg("Generating Sqlite3 output for page %s\n",pd->name().data()); generateSqlite3ForPage(db,pd,FALSE); } } // + dirs { DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { msg("Generating Sqlite3 output for dir %s\n",dir->name().data()); generateSqlite3ForDir(db,dir); } } // + examples { PageSDict::Iterator pdi(*Doxygen::exampleSDict); PageDef *pd=0; for (pdi.toFirst();(pd=pdi.current());++pdi) { msg("Generating Sqlite3 output for example %s\n",pd->name().data()); generateSqlite3ForPage(db,pd,TRUE); } } // + main page if (Doxygen::mainPage) { msg("Generating Sqlite3 output for the main page\n"); generateSqlite3ForPage(db,Doxygen::mainPage,FALSE); } endTransaction(db); }
void DocSets::addIndexItem(Definition *context,MemberDef *md, const char *,const char *) { if (md==0 && context==0) return; FileDef *fd = 0; ClassDef *cd = 0; NamespaceDef *nd = 0; if (md) { fd = md->getFileDef(); cd = md->getClassDef(); nd = md->getNamespaceDef(); if (!md->isLinkable()) return; // internal symbol } QCString scope; QCString type; QCString decl; // determine language QCString lang; SrcLangExt langExt = SrcLangExt_Cpp; if (md) { langExt = md->getLanguage(); } else if (context) { langExt = context->getLanguage(); } switch (langExt) { case SrcLangExt_Cpp: case SrcLangExt_ObjC: { if (md && (md->isObjCMethod() || md->isObjCProperty())) lang="occ"; // Objective C/C++ else if (fd && fd->name().right(2).lower()==".c") lang="c"; // Plain C else if (cd==0 && nd==0) lang="c"; // Plain C symbol outside any class or namespace else lang="cpp"; // C++ } break; case SrcLangExt_IDL: lang="idl"; break; // IDL case SrcLangExt_CSharp: lang="csharp"; break; // C# case SrcLangExt_PHP: lang="php"; break; // PHP4/5 case SrcLangExt_D: lang="d"; break; // D case SrcLangExt_Java: lang="java"; break; // Java case SrcLangExt_JS: lang="javascript"; break; // Javascript case SrcLangExt_Python: lang="python"; break; // Python case SrcLangExt_Fortran: lang="fortran"; break; // Fortran case SrcLangExt_VHDL: lang="vhdl"; break; // VHDL case SrcLangExt_XML: lang="xml"; break; // DBUS XML case SrcLangExt_Tcl: lang="tcl"; break; // Tcl case SrcLangExt_Markdown:lang="markdown"; break; // Markdown case SrcLangExt_Unknown: lang="unknown"; break; // should not happen! } if (md) { if (context==0) { if (md->getGroupDef()) context = md->getGroupDef(); else if (md->getFileDef()) context = md->getFileDef(); } if (context==0) return; // should not happen switch (md->memberType()) { case MemberType_Define: type="macro"; break; case MemberType_Function: if (cd && (cd->compoundType()==ClassDef::Interface || cd->compoundType()==ClassDef::Class)) { if (md->isStatic()) type="clm"; // class member else type="instm"; // instance member } else if (cd && cd->compoundType()==ClassDef::Protocol) { if (md->isStatic()) type="intfcm"; // interface class member else type="intfm"; // interface member } else type="func"; break; case MemberType_Variable: type="data"; break; case MemberType_Typedef: type="tdef"; break; case MemberType_Enumeration: type="enum"; break; case MemberType_EnumValue: type="econst"; break; //case MemberDef::Prototype: // type="prototype"; break; case MemberType_Signal: type="signal"; break; case MemberType_Slot: type="slot"; break; case MemberType_Friend: type="ffunc"; break; case MemberType_DCOP: type="dcop"; break; case MemberType_Property: if (cd && cd->compoundType()==ClassDef::Protocol) type="intfp"; // interface property else type="instp"; // instance property break; case MemberType_Event: type="event"; break; case MemberType_Interface: type="ifc"; break; case MemberType_Service: type="svc"; break; } cd = md->getClassDef(); nd = md->getNamespaceDef(); if (cd) { scope = cd->qualifiedName(); } else if (nd) { scope = nd->name(); } MemberDef *declMd = md->memberDeclaration(); if (declMd==0) declMd = md; { fd = md->getFileDef(); if (fd) { decl = fd->name(); } } writeToken(m_tts,md,type,lang,scope,md->anchor(),decl); } else if (context && context->isLinkable()) { if (fd==0 && context->definitionType()==Definition::TypeFile) { fd = (FileDef*)context; } if (cd==0 && context->definitionType()==Definition::TypeClass) { cd = (ClassDef*)context; } if (nd==0 && context->definitionType()==Definition::TypeNamespace) { nd = (NamespaceDef*)context; } if (fd) { type="file"; } else if (cd) { scope = cd->qualifiedName(); if (cd->isTemplate()) { type="tmplt"; } else if (cd->compoundType()==ClassDef::Protocol) { type="intf"; if (scope.right(2)=="-p") scope=scope.left(scope.length()-2); } else if (cd->compoundType()==ClassDef::Interface) { type="cl"; } else if (cd->compoundType()==ClassDef::Category) { type="cat"; } else { type = "cl"; } IncludeInfo *ii = cd->includeInfo(); if (ii) { decl=ii->includeName; } } else if (nd) { scope = nd->name(); type = "ns"; } if (m_scopes.find(context->getOutputFileBase())==0) { writeToken(m_tts,context,type,lang,scope,0,decl); m_scopes.append(context->getOutputFileBase(),(void*)0x8); } } }
void FileName::generateDiskNames() { //QCString commonPrefix; QListIterator<FileDef> it(*this); FileDef *fd; int count=0; for (;(fd=it.current());++it) { if (!fd->isReference()) count++; } if (count==1) { // skip references for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } if (fd) { // name if unique, so diskname is simply the name //printf("!!!!!!!! Unique disk name=%s for fd=%s\n",name.data(),fd->diskname.data()); fd->m_diskName=name; } } else if (count>1) // multiple occurrences of the same file name { //printf("Multiple occurrences of %s\n",name.data()); int i=0,j=0; bool found=FALSE; while (!found) // search for the common prefix of all paths { for (it.toFirst();(fd=it.current()) && fd->isReference();++it) { } if (fd) { char c=fd->m_path.at(i); if (c=='/') j=i; // remember last position of dirname ++it; while ((fd=it.current()) && !found) { if (!fd->isReference()) { //printf("i=%d j=%d fd->path=`%s' fd->name=`%s'\n",i,j,fd->path.left(i).data(),fd->name().data()); if (i==(int)fd->m_path.length()) { //warning("Input file %s found multiple times!\n" // " The generated documentation for this file may not be correct!\n",fd->absFilePath().data()); found=TRUE; } else if (fd->m_path[i]!=c) { found=TRUE; } } ++it; } i++; } } for (it.toFirst();(fd=it.current());++it) { //printf("fd->setName(%s)\n",(fd->path.right(fd->path.length()-j-1)+name).data()); if (!fd->isReference()) { QCString prefix = fd->m_path.right(fd->m_path.length()-j-1); fd->setName(prefix+name); //printf("!!!!!!!! non unique disk name=%s for fd=%s\n",(prefix+name).data(),fd->diskname.data()); fd->m_diskName=prefix+name; } } } }
FileDef *findFileDef(const FileNameDict *fnDict,const char *n,bool &ambig) { ambig=FALSE; if (n==0) return 0; const int maxAddrSize = 20; char addr[maxAddrSize]; qsnprintf(addr,maxAddrSize,"%p:",fnDict); QCString key = addr; key+=n; g_findFileDefCache.setAutoDelete(TRUE); FindFileCacheElem *cachedResult = g_findFileDefCache.find(key); //printf("key=%s cachedResult=%p\n",key.data(),cachedResult); if (cachedResult) { ambig = cachedResult->isAmbig; //printf("cached: fileDef=%p\n",cachedResult->fileDef); return cachedResult->fileDef; } else { cachedResult = new FindFileCacheElem(0,FALSE); } QCString name=QDir::cleanDirPath(n).utf8(); QCString path; int slashPos; FileName *fn; if (name.isEmpty()) goto exit; slashPos=QMAX(name.findRev('/'),name.findRev('\\')); if (slashPos!=-1) { path=name.left(slashPos+1); name=name.right(name.length()-slashPos-1); //printf("path=%s name=%s\n",path.data(),name.data()); } if (name.isEmpty()) goto exit; if ((fn=(*fnDict)[name])) { //printf("fn->count()=%d\n",fn->count()); if (fn->count()==1) { FileDef *fd = fn->getFirst(); #if defined(_WIN32) || defined(__MACOSX__) // Windows or MacOSX bool isSamePath = fd->getPath().right(path.length()).lower()==path.lower(); #else // Unix bool isSamePath = fd->getPath().right(path.length())==path; #endif if (path.isEmpty() || isSamePath) { cachedResult->fileDef = fd; g_findFileDefCache.insert(key,cachedResult); //printf("=1 ===> add to cache %p\n",fd); return fd; } } else // file name alone is ambiguous { int count=0; FileNameIterator fni(*fn); FileDef *fd; FileDef *lastMatch=0; QCString pathStripped = path; for (fni.toFirst();(fd=fni.current());++fni) { QCString fdStripPath = fd->getPath(); if (path.isEmpty() || fdStripPath.right(pathStripped.length())==pathStripped) { count++; lastMatch=fd; } } //printf(">1 ===> add to cache %p\n",fd); ambig=(count>1); cachedResult->isAmbig = ambig; cachedResult->fileDef = lastMatch; g_findFileDefCache.insert(key,cachedResult); return lastMatch; } } else { //printf("not found!\n"); } exit: //printf("0 ===> add to cache %p: %s\n",cachedResult,n); g_findFileDefCache.insert(key,cachedResult); //delete cachedResult; return 0; }
void generateSqlite3() { // + classes // + namespaces // + files // - groups // - related pages // - examples //QCString outputDirectory = Config_getString("SQLITE3_OUTPUT"); QCString outputDirectory = Config_getString("OUTPUT_DIRECTORY"); QDir sqlite3Dir(outputDirectory); sqlite3 *db; sqlite3_initialize(); int rc = sqlite3_open_v2(outputDirectory+"/doxygen_sqlite3.db", &db, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); if (rc != SQLITE_OK) { sqlite3_close(db); msg("database open failed: %s\n", "doxygen_sqlite3.db"); exit(-1); } beginTransaction(db); pragmaTuning(db); initializeSchema(db); if ( -1 == prepareStatements(db) ) { err("sqlite generator: prepareStatements failed!"); return; } // + classes ClassSDict::Iterator cli(*Doxygen::classSDict); ClassDef *cd; for (cli.toFirst();(cd=cli.current());++cli) { msg("Generating Sqlite3 output for class %s\n",cd->name().data()); generateSqlite3ForClass(db,cd); } // + namespaces NamespaceSDict::Iterator nli(*Doxygen::namespaceSDict); NamespaceDef *nd; for (nli.toFirst();(nd=nli.current());++nli) { msg("Generating Sqlite3 output for namespace %s\n",nd->name().data()); generateSqlite3ForNamespace(db,nd); } // + files FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (;(fn=fnli.current());++fnli) { FileNameIterator fni(*fn); FileDef *fd; for (;(fd=fni.current());++fni) { msg("Generating Sqlite3 output for file %s\n",fd->name().data()); generateSqlite3ForFile(db,fd); } } endTransaction(db); }
void DocSets::addIndexItem(const char *, const char *, const char *, const char *, const char *,const MemberDef *md) { if (!md->isLinkable()) return; // internal symbol ClassDef *cd = md->getClassDef(); NamespaceDef *nd = md->getNamespaceDef(); FileDef *fd = md->getFileDef(); // determine language QCString lang; SrcLangExt langExt = SrcLangExt_Cpp; if (fd) langExt = getLanguageFromFileName(fd->name()); switch (langExt) { case SrcLangExt_Cpp: { if (md->isObjCMethod()) lang="occ"; // Objective C/C++ else if (fd && fd->name().right(2).lower()==".c") lang="c"; // Plain C else lang="cpp"; // C++ } break; case SrcLangExt_ObjC: lang="occ"; break; // Objective C++ case SrcLangExt_IDL: lang="idl"; break; // IDL case SrcLangExt_CSharp: lang="csharp"; break; // C# case SrcLangExt_PHP: lang="php"; break; // PHP4/5 case SrcLangExt_D: lang="d"; break; // D case SrcLangExt_Java: lang="java"; break; // Java case SrcLangExt_JS: lang="javascript"; break; // Javascript case SrcLangExt_Python: lang="python"; break; // Python case SrcLangExt_F90: lang="fortran"; break; // Fortran case SrcLangExt_VHDL: lang="vhdl"; break; // VHDL } // determine scope QCString scope; QCString type; QCString decl; Definition *d = 0; if (fd && fd->isLinkable() && m_scopes.find(fd->getOutputFileBase())==0) { writeToken(m_tts,fd,"file",lang,0,0,0); m_scopes.append(fd->getOutputFileBase(),(void*)0x8); } if (cd) { scope = cd->qualifiedName(); if (cd->isTemplate()) type="tmplt"; else if (cd->compoundType()==ClassDef::Protocol) type="intf"; else if (cd->compoundType()==ClassDef::Interface) type="cl"; else if (cd->compoundType()==ClassDef::Category) type="cat"; else type = "cl"; d = cd; IncludeInfo *ii = cd->includeInfo(); if (ii) { decl=ii->includeName; if (decl.isEmpty()) { decl=ii->local; } } } else if (nd) { scope = nd->name(); type = "ns"; d = cd; } if (d && d->isLinkable() && m_scopes.find(d->getOutputFileBase())==0) { writeToken(m_tts,d,type,lang,0,0,decl); m_scopes.append(d->getOutputFileBase(),(void*)0x8); } switch (md->memberType()) { case MemberDef::Define: type="macro"; break; case MemberDef::Function: if (cd && cd->compoundType()==ClassDef::Interface) type="intfm"; else if (cd && cd->compoundType()==ClassDef::Class) type="clm"; else type="func"; break; case MemberDef::Variable: type="data"; break; case MemberDef::Typedef: type="tdef"; break; case MemberDef::Enumeration: type="enum"; break; case MemberDef::EnumValue: type="econst"; break; //case MemberDef::Prototype: // type="prototype"; break; case MemberDef::Signal: type="signal"; break; case MemberDef::Slot: type="slot"; break; case MemberDef::Friend: type="ffunc"; break; case MemberDef::DCOP: type="dcop"; break; case MemberDef::Property: type="property"; break; case MemberDef::Event: type="event"; break; } writeToken(m_tts,md,type,lang,scope,md->anchor()); }