diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-16 18:06:29 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2021-01-22 20:45:20 (GMT) |
commit | b07a48868ad3846564c4a792ed94aef91b3825ce (patch) | |
tree | bfef632216d2471667a631d647e6716aec977981 | |
parent | b97b3b47d3d71c5ac121df27863c8d3bc27273ea (diff) | |
download | Doxygen-b07a48868ad3846564c4a792ed94aef91b3825ce.zip Doxygen-b07a48868ad3846564c4a792ed94aef91b3825ce.tar.gz Doxygen-b07a48868ad3846564c4a792ed94aef91b3825ce.tar.bz2 |
Refactoring: remove unused function generateFileTree()
-rw-r--r-- | src/doxygen.cpp | 1 | ||||
-rw-r--r-- | src/filedef.cpp | 238 | ||||
-rw-r--r-- | src/filedef.h | 49 |
3 files changed, 0 insertions, 288 deletions
diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 6a35a0d..e7cb5d7 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -11224,7 +11224,6 @@ void parseInput() g_s.begin("Building file list...\n"); buildFileList(root.get()); g_s.end(); - //generateFileTree(); g_s.begin("Building class list...\n"); buildClassList(root.get()); diff --git a/src/filedef.cpp b/src/filedef.cpp index a512c40..7adb1a1 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -1494,244 +1494,6 @@ void FileDefImpl::addListReferences() //------------------------------------------------------------------- -static int findMatchingPart(const QCString &path,const QCString dir) -{ - int si1; - int pos1=0,pos2=0; - while ((si1=path.find('/',pos1))!=-1) - { - int si2=dir.find('/',pos2); - //printf(" found slash at pos %d in path %d: %s<->%s\n",si1,si2, - // path.mid(pos1,si1-pos2).data(),dir.mid(pos2).data()); - if (si2==-1 && path.mid(pos1,si1-pos2)==dir.mid(pos2)) // match at end - { - return dir.length(); - } - if (si1!=si2 || path.mid(pos1,si1-pos2)!=dir.mid(pos2,si2-pos2)) // no match in middle - { - return QMAX(pos1-1,0); - } - pos1=si1+1; - pos2=si2+1; - } - return 0; -} - -static Directory *findDirNode(Directory *root,const QCString &name) -{ - QListIterator<DirEntry> dli(root->children()); - DirEntry *de; - for (dli.toFirst();(de=dli.current());++dli) - { - if (de->kind()==DirEntry::Dir) - { - Directory *dir = (Directory *)de; - QCString dirName=dir->name(); - int sp=findMatchingPart(name,dirName); - //printf("findMatchingPart(%s,%s)=%d\n",name.data(),dirName.data(),sp); - if (sp>0) // match found - { - if ((uint)sp==dirName.length()) // whole directory matches - { - // recurse into the directory - return findDirNode(dir,name.mid(dirName.length()+1)); - } - else // partial match => we need to split the path into three parts - { - QCString baseName =dirName.left(sp); - QCString oldBranchName=dirName.mid(sp+1); - QCString newBranchName=name.mid(sp+1); - // strip file name from path - int newIndex=newBranchName.findRev('/'); - if (newIndex>0) newBranchName=newBranchName.left(newIndex); - - //printf("Splitting off part in new branch \n" - // "base=%s old=%s new=%s\n", - // baseName.data(), - // oldBranchName.data(), - // newBranchName.data() - // ); - Directory *base = new Directory(root,baseName); - Directory *newBranch = new Directory(base,newBranchName); - dir->reParent(base); - dir->rename(oldBranchName); - base->addChild(dir); - base->addChild(newBranch); - dir->setLast(FALSE); - // remove DirEntry container from list (without deleting it) - root->children().setAutoDelete(FALSE); - root->children().removeRef(dir); - root->children().setAutoDelete(TRUE); - // add new branch to the root - if (!root->children().isEmpty()) - { - root->children().getLast()->setLast(FALSE); - } - root->addChild(base); - return newBranch; - } - } - } - } - int si=name.findRev('/'); - if (si==-1) // no subdir - { - return root; // put the file under the root node. - } - else // need to create a subdir - { - QCString baseName = name.left(si); - //printf("new subdir %s\n",baseName.data()); - Directory *newBranch = new Directory(root,baseName); - if (!root->children().isEmpty()) - { - root->children().getLast()->setLast(FALSE); - } - root->addChild(newBranch); - return newBranch; - } -} - -static void mergeFileDef(Directory *root,FileDef *fd) -{ - QCString filePath = fd->absFilePath(); - //printf("merging %s\n",filePath.data()); - Directory *dirNode = findDirNode(root,filePath); - if (!dirNode->children().isEmpty()) - { - dirNode->children().getLast()->setLast(FALSE); - } - DirEntry *e=new DirEntry(dirNode,fd); - dirNode->addChild(e); -} - -#if 0 -static void generateIndent(QTextStream &t,DirEntry *de,int level) -{ - if (de->parent()) - { - generateIndent(t,de->parent(),level+1); - } - // from the root up to node n do... - if (level==0) // item before a dir or document - { - if (de->isLast()) - { - if (de->kind()==DirEntry::Dir) - { - t << "<img " << FTV_IMGATTRIBS(plastnode) << "/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(lastnode) << "/>"; - } - } - else - { - if (de->kind()==DirEntry::Dir) - { - t << "<img " << FTV_IMGATTRIBS(pnode) << "/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(node) << "/>"; - } - } - } - else // item at another level - { - if (de->isLast()) - { - t << "<img " << FTV_IMGATTRIBS(blank) << "/>"; - } - else - { - t << "<img " << FTV_IMGATTRIBS(vertline) << "/>"; - } - } -} - -static void writeDirTreeNode(QTextStream &t,Directory *root,int level) -{ - QCString indent; - indent.fill(' ',level*2); - QListIterator<DirEntry> dli(root->children()); - DirEntry *de; - for (dli.toFirst();(de=dli.current());++dli) - { - t << indent << "<p>"; - generateIndent(t,de,0); - if (de->kind()==DirEntry::Dir) - { - Directory *dir=(Directory *)de; - //printf("%s [dir]: %s (last=%d,dir=%d)\n",indent.data(),dir->name().data(),dir->isLast(),dir->kind()==DirEntry::Dir); - t << "<img " << FTV_IMGATTRIBS(folderclosed) << "/>"; - t << dir->name(); - t << "</p>\n"; - t << indent << "<div>\n"; - writeDirTreeNode(t,dir,level+1); - t << indent << "</div>\n"; - } - else - { - //printf("%s [file]: %s (last=%d,dir=%d)\n",indent.data(),de->file()->name().data(),de->isLast(),de->kind()==DirEntry::Dir); - t << "<img " << FTV_IMGATTRIBS(doc) << "/>"; - t << de->file()->name(); - t << "</p>\n"; - } - } -} -#endif - -static void addDirsAsGroups(Directory *root,GroupDef *parent,int level) -{ - GroupDef *gd=0; - if (root->kind()==DirEntry::Dir) - { - gd = Doxygen::groupLinkedMap->add(root->path(), - std::unique_ptr<GroupDef>( - createGroupDef("[generated]", - 1, - root->path(), // name - root->name() // title - ))); - if (parent) - { - parent->addGroup(gd); - gd->makePartOfGroup(parent); - } - } - QListIterator<DirEntry> dli(root->children()); - DirEntry *de; - for (dli.toFirst();(de=dli.current());++dli) - { - if (de->kind()==DirEntry::Dir) - { - addDirsAsGroups((Directory *)de,gd,level+1); - } - } -} - -void generateFileTree() -{ - Directory *root=new Directory(0,"root"); - root->setLast(TRUE); - for (const auto &fn : *Doxygen::inputNameLinkedMap) - { - for (const auto &fd : *fn) - { - mergeFileDef(root,fd.get()); - } - } - //t << "<div class=\"directory\">\n"; - //writeDirTreeNode(t,root,0); - //t << "</div>\n"; - addDirsAsGroups(root,0,0); - delete root; -} - -//------------------------------------------------------------------- - void FileDefImpl::combineUsingRelations() { LinkedRefMap<const NamespaceDef> usingDirList = m_usingDirList; diff --git a/src/filedef.h b/src/filedef.h index 3228b00..9655f38 100644 --- a/src/filedef.h +++ b/src/filedef.h @@ -210,54 +210,5 @@ struct FilesInDir std::vector<const FileDef *> files; }; -/** Class representing an entry (file or sub directory) in a directory */ -class DirEntry -{ - public: - enum EntryKind { Dir, File }; - DirEntry(DirEntry *parent,FileDef *fd) - : m_parent(parent), m_name(fd->name()), m_kind(File), m_fd(fd), - m_isLast(FALSE) { } - DirEntry(DirEntry *parent,QCString name) - : m_parent(parent), m_name(name), m_kind(Dir), - m_fd(0), m_isLast(FALSE) { } - virtual ~DirEntry() { } - EntryKind kind() const { return m_kind; } - FileDef *file() const { return m_fd; } - bool isLast() const { return m_isLast; } - void setLast(bool b) { m_isLast=b; } - DirEntry *parent() const { return m_parent; } - QCString name() const { return m_name; } - QCString path() const { return parent() ? parent()->path()+"/"+name() : name(); } - - protected: - DirEntry *m_parent; - QCString m_name; - - private: - EntryKind m_kind; - FileDef *m_fd; - bool m_isLast; -}; - -/** Class representing a directory tree of DirEntry objects. */ -class Directory : public DirEntry -{ - public: - Directory(Directory *parent,const QCString &name) - : DirEntry(parent,name) - { m_children.setAutoDelete(TRUE); } - virtual ~Directory() {} - void addChild(DirEntry *d) { m_children.append(d); d->setLast(TRUE); } - QList<DirEntry> &children() { return m_children; } - void rename(const QCString &name) { m_name=name; } - void reParent(Directory *parent) { m_parent=parent; } - - private: - QList<DirEntry> m_children; -}; - -void generateFileTree(); - #endif |