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(); }
/** In order to create stable, but unique directory names, * we compute the common part of the path shared by all directories. */ static void computeCommonDirPrefix() { QCString path; DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); if (Doxygen::directories->count()>0) // we have at least one dir { // start will full path of first dir sdi.toFirst(); dir=sdi.current(); path=dir->name(); int i=path.findRev('/',path.length()-2); path=path.left(i+1); bool done=FALSE; if (i==-1) { path=""; } else { while (!done) { int l = path.length(); int count=0; for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString dirName = dir->name(); if (dirName.length()>path.length()) { if (qstrncmp(dirName,path,l)!=0) // dirName does not start with path { int i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); break; } } } else // dir is shorter than path -> take path of dir as new start { path=dir->name(); l=path.length(); int i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); } break; } count++; } if (count==Doxygen::directories->count()) // path matches for all directories -> found the common prefix { done=TRUE; } } } } for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString diskName = dir->name().right(dir->name().length()-path.length()); dir->setDiskName(diskName); //printf("set disk name: %s -> %s\n",dir->name().data(),diskName.data()); } }
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); }