summaryrefslogtreecommitdiffstats
path: root/src/dirdef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/dirdef.cpp')
-rw-r--r--src/dirdef.cpp233
1 files changed, 219 insertions, 14 deletions
diff --git a/src/dirdef.cpp b/src/dirdef.cpp
index d7c46b1..38808f6 100644
--- a/src/dirdef.cpp
+++ b/src/dirdef.cpp
@@ -2,18 +2,34 @@
#include "filename.h"
#include "doxygen.h"
#include "util.h"
+#include "outputlist.h"
+#include "language.h"
//----------------------------------------------------------------------
// method implementation
-DirDef::DirDef(const char *path) : Definition(path,1,path),
- m_parent(0)
+static int g_dirCount=0;
+
+DirDef::DirDef(const char *path) : Definition(path,1,path)
{
- // get short name (stipping the paths mentioned in STRIP_FROM_PATH)
+ // get display name (stipping the paths mentioned in STRIP_FROM_PATH)
m_dispName = stripFromPath(path);
+ // get short name (last part of path)
+ m_shortName = path;
+ if (m_shortName.at(m_shortName.length()-1)=='/')
+ { // strip trailing /
+ m_shortName = m_shortName.left(m_shortName.length()-1);
+ }
+ int pi=m_shortName.findRev('/');
+ if (pi!=-1)
+ { // remove everything till the last /
+ m_shortName = m_shortName.mid(pi+1);
+ }
+
m_subdirs.setAutoDelete(TRUE);
m_fileList = new FileList;
m_classSDict = new ClassSDict(17);
+ m_dirCount = g_dirCount++;
}
DirDef::~DirDef()
@@ -22,16 +38,193 @@ DirDef::~DirDef()
void DirDef::addSubDir(DirDef *subdir)
{
- m_subdirs.append(subdir);
- subdir->m_parent=this;
+ m_subdirs.inSort(subdir);
+ subdir->setOuterScope(this);
}
void DirDef::addFile(FileDef *fd)
{
- m_fileList->append(fd);
+ m_fileList->inSort(fd);
fd->setDirDef(this);
}
+QCString DirDef::getOutputFileBase() const
+{
+ //return "dir_"+convertNameToFile(name());
+ return QCString().sprintf("dir_%06d",m_dirCount);
+}
+
+void DirDef::writeDetailedDocumentation(OutputList &ol)
+{
+ if (!briefDescription().isEmpty() || !documentation().isEmpty())
+ {
+ ol.writeRuler();
+ ol.pushGeneratorState();
+ ol.disable(OutputGenerator::Latex);
+ ol.disable(OutputGenerator::RTF);
+ ol.writeAnchor(0,"_details");
+ ol.popGeneratorState();
+ ol.startGroupHeader();
+ ol.parseText(theTranslator->trDetailedDescription());
+ ol.endGroupHeader();
+
+ // repeat brief description
+ if (!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF"))
+ {
+ ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),FALSE,FALSE);
+ ol.newParagraph();
+ }
+
+ // write documentation
+ if (!documentation().isEmpty())
+ {
+ ol.parseDoc(docFile(),docLine(),this,0,documentation()+"\n",TRUE,FALSE);
+ }
+ }
+}
+
+void DirDef::writeDocumentation(OutputList &ol)
+{
+ ol.pushGeneratorState();
+
+ QCString shortTitle=theTranslator->trDirReference(m_shortName);
+ QCString title=theTranslator->trDirReference(m_dispName);
+ startFile(ol,getOutputFileBase(),name(),title);
+
+ // write navigation path
+ writeNavigationPath(ol);
+
+ startTitle(ol,getOutputFileBase());
+ ol.pushGeneratorState();
+ ol.disableAllBut(OutputGenerator::Html);
+ ol.parseText(shortTitle);
+ ol.enableAll();
+ ol.disable(OutputGenerator::Html);
+ ol.parseText(title);
+ ol.popGeneratorState();
+ endTitle(ol,getOutputFileBase(),title);
+
+ // write brief or details (if DETAILS_AT_TOP)
+ if (Config_getBool("DETAILS_AT_TOP"))
+ {
+ writeDetailedDocumentation(ol);
+ ol.newParagraph();
+ }
+ else if (!briefDescription().isEmpty())
+ {
+ ol.parseDoc(briefFile(),briefLine(),this,0,briefDescription(),TRUE,FALSE);
+ ol.writeString(" \n");
+ ol.pushGeneratorState();
+ ol.disable(OutputGenerator::Latex);
+ ol.disable(OutputGenerator::RTF);
+ ol.disable(OutputGenerator::Man);
+ ol.startTextLink(0,"_details");
+ ol.parseText(theTranslator->trMore());
+ ol.endTextLink();
+ ol.enableAll();
+ ol.disableAllBut(OutputGenerator::Man);
+ ol.newParagraph();
+ ol.popGeneratorState();
+ }
+
+
+ ol.startMemberSections();
+ // write subdir list
+ if (m_subdirs.count()>0)
+ {
+ ol.startMemberHeader();
+ ol.parseText(theTranslator->trDir(TRUE,FALSE));
+ ol.endMemberHeader();
+ ol.startMemberList();
+ DirDef *dd=m_subdirs.first();
+ while (dd)
+ {
+ ol.startMemberItem(0);
+ ol.parseText(theTranslator->trDir(FALSE,TRUE));
+ ol.insertMemberAlign();
+ ol.writeObjectLink(dd->getReference(),dd->getOutputFileBase(),0,dd->shortName());
+ ol.endMemberItem();
+ if (!dd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
+ {
+ ol.startMemberDescription();
+ ol.parseDoc(briefFile(),briefLine(),dd,0,dd->briefDescription(),FALSE,FALSE);
+ ol.endMemberDescription();
+ ol.newParagraph();
+ }
+ dd=m_subdirs.next();
+ }
+
+ ol.endMemberList();
+ }
+
+
+ // write file list
+ if (m_fileList->count()>0)
+ {
+ ol.startMemberHeader();
+ ol.parseText(theTranslator->trFile(TRUE,FALSE));
+ ol.endMemberHeader();
+ ol.startMemberList();
+ FileDef *fd=m_fileList->first();
+ while (fd)
+ {
+ ol.startMemberItem(0);
+ ol.docify("file ");
+ ol.insertMemberAlign();
+ ol.writeObjectLink(fd->getReference(),fd->getOutputFileBase(),0,fd->name());
+ //if (!Config_getString("GENERATE_TAGFILE").isEmpty())
+ //{
+ // Doxygen::tagFile << " <file>" << convertToXML(fd->name()) << "</file>" << endl;
+ //}
+ ol.endMemberItem();
+ if (!fd->briefDescription().isEmpty() && Config_getBool("BRIEF_MEMBER_DESC"))
+ {
+ ol.startMemberDescription();
+ ol.parseDoc(briefFile(),briefLine(),fd,0,fd->briefDescription(),FALSE,FALSE);
+ ol.endMemberDescription();
+ ol.newParagraph();
+ }
+ fd=m_fileList->next();
+ }
+ ol.endMemberList();
+ }
+ ol.endMemberSections();
+
+ if (!Config_getBool("DETAILS_AT_TOP"))
+ {
+ writeDetailedDocumentation(ol);
+ }
+
+
+ // write details (if !DETAILS_AT_TOP)
+
+ endFile(ol);
+ ol.popGeneratorState();
+}
+
+void DirDef::writePathFragment(OutputList &ol)
+{
+ if (getOuterScope()!=Doxygen::globalScope &&
+ getOuterScope()->definitionType()==Definition::TypeDir)
+ {
+ ((DirDef*)getOuterScope())->writePathFragment(ol);
+ ol.writeString("&nbsp;/&nbsp;");
+ }
+ ol.writeObjectLink(getReference(),getOutputFileBase(),0,shortName());
+}
+
+void DirDef::writeNavigationPath(OutputList &ol)
+{
+ ol.pushGeneratorState();
+ ol.disableAllBut(OutputGenerator::Html);
+
+ ol.writeString("<div class=\"nav\">\n");
+ writePathFragment(ol);
+ ol.writeString("</div>\n");
+
+ ol.popGeneratorState();
+}
+
//----------------------------------------------------------------------
// helper functions
@@ -68,6 +261,7 @@ bool DirDef::matchPath(const QCString &path,QStrList &l)
*/
DirDef *DirDef::mergeDirectoryInTree(const QCString &path)
{
+ //printf("DirDef::mergeDirectoryInTree(%s)\n",path.data());
int p=0,i=0;
DirDef *dir=0;
while ((i=path.find('/',p))!=-1)
@@ -96,7 +290,8 @@ void buildDirectories()
FileDef *fd;
for (;(fd=fni.current());++fni)
{
- if (!fd->getReference().isEmpty())
+ //printf("buildDirectories %s\n",fd->name().data());
+ if (fd->getReference().isEmpty())
{
DirDef *dir;
if ((dir=Doxygen::directories.find(fd->getPath()))==0) // new directory
@@ -112,23 +307,33 @@ void buildDirectories()
}
}
- DirDef *root = new DirDef("root:");
+ //DirDef *root = new DirDef("root:");
// compute relations between directories => introduce container dirs.
DirDef *dir;
- SDict<DirDef>::Iterator sdi(Doxygen::directories);
+ DirSDict::Iterator sdi(Doxygen::directories);
for (sdi.toFirst();(dir=sdi.current());++sdi)
{
- printf("New dir %s\n",dir->displayName().data());
+ //printf("New dir %s\n",dir->displayName().data());
QCString name = dir->name();
int i=name.findRev('/',name.length()-2);
if (i!=-1)
{
DirDef *parent = Doxygen::directories.find(name.left(i+1));
- if (parent==0) parent=root;
- parent->addSubDir(dir);
- printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n",
- dir->displayName().data(), parent->displayName().data());
+ //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());
}
}
}
+void generateDirDocs(OutputList &ol)
+{
+ DirDef *dir;
+ DirSDict::Iterator sdi(Doxygen::directories);
+ for (sdi.toFirst();(dir=sdi.current());++sdi)
+ {
+ dir->writeDocumentation(ol);
+ }
+}
+