summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2014-02-24 20:11:15 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2014-03-01 15:46:21 (GMT)
commit47adeb82d67208db88a4aaae5c3427291462611a (patch)
tree332c9852a91ee13afe01eb91a1e6e0654ddc3351 /src
parentdf839603204979113b96678e2ab21b3eba64476c (diff)
downloadDoxygen-47adeb82d67208db88a4aaae5c3427291462611a.zip
Doxygen-47adeb82d67208db88a4aaae5c3427291462611a.tar.gz
Doxygen-47adeb82d67208db88a4aaae5c3427291462611a.tar.bz2
Added directory info to the context
Diffstat (limited to 'src')
-rw-r--r--src/context.cpp134
-rw-r--r--src/context.h18
-rw-r--r--src/dirdef.cpp6
-rw-r--r--src/dirdef.h1
-rw-r--r--src/filedef.cpp3
5 files changed, 157 insertions, 5 deletions
diff --git a/src/context.cpp b/src/context.cpp
index 2a5cc35..e54184e 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -726,6 +726,10 @@ class TranslateContext::Private : public PropertyMapper
bool extractAll = Config_getBool("EXTRACT_ALL");
return theTranslator->trFileListDescription(extractAll);
}
+ TemplateVariant directories() const
+ {
+ return theTranslator->trDirectories();
+ }
Private()
{
//%% string generatedBy
@@ -838,6 +842,8 @@ class TranslateContext::Private : public PropertyMapper
addProperty("detailLevel", this,&Private::detailLevel);
//%% string fileListDescription
addProperty("fileListDescription",this,&Private::fileListDescription);
+ //%% string directories
+ addProperty("directories", this,&Private::directories);
m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
@@ -1133,6 +1139,10 @@ class DefinitionContext : public PropertyMapper
{
fillPath(m_def->getOuterScope(),list);
}
+ else if (m_def->definitionType()==Definition::TypeFile && ((const FileDef *)m_def)->getDirDef())
+ {
+ fillPath(((const FileDef *)m_def)->getDirDef(),list);
+ }
m_cache.navPath.reset(list);
}
return m_cache.navPath.get();
@@ -2082,6 +2092,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
addProperty("detailedFunctions", this,&Private::detailedFunctions);
addProperty("detailedVariables", this,&Private::detailedVariables);
addProperty("inlineClasses", this,&Private::inlineClasses);
+ addProperty("compoundType", this,&Private::compoundType);
}
TemplateVariant title() const
{
@@ -2369,6 +2380,10 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
}
return m_cache.inlineClasses.get();
}
+ TemplateVariant compoundType() const
+ {
+ return theTranslator->trFile(FALSE,TRUE);
+ }
private:
FileDef *m_fileDef;
@@ -2422,10 +2437,14 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
public:
Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd)
{
- addProperty("title",this,&Private::title);
- addProperty("highlight",this,&Private::highlight);
- addProperty("subhighlight",this,&Private::subHighlight);
- addProperty("dirName",this,&Private::dirName);
+ addProperty("title", this,&Private::title);
+ addProperty("highlight", this,&Private::highlight);
+ addProperty("subhighlight", this,&Private::subHighlight);
+ addProperty("dirName", this,&Private::dirName);
+ addProperty("dirs", this,&Private::dirs);
+ addProperty("files", this,&Private::files);
+ addProperty("hasDetails", this,&Private::hasDetails);
+ addProperty("compoundType", this,&Private::compoundType);
}
TemplateVariant title() const
{
@@ -2443,8 +2462,68 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
{
return TemplateVariant(m_dirDef->shortName());
}
+ TemplateVariant dirs() const
+ {
+ if (!m_cache.dirs)
+ {
+ m_cache.dirs.reset(new TemplateList);
+ const DirList &subDirs = m_dirDef->subDirs();
+ QListIterator<DirDef> it(subDirs);
+ DirDef *dd;
+ for (it.toFirst();(dd=it.current());++it)
+ {
+ DirContext *dc = new DirContext(dd);
+ m_cache.dirs->append(dc);
+ m_cache.dirContextList.append(dc);
+ }
+ }
+ return m_cache.dirs.get();
+ }
+ TemplateVariant files() const
+ {
+ // FileList *list = m_dirDef->getFiles();
+ if (!m_cache.files)
+ {
+ m_cache.files.reset(new TemplateList);
+ FileList *files = m_dirDef->getFiles();
+ if (files)
+ {
+ QListIterator<FileDef> it(*files);
+ FileDef *fd;
+ for (it.toFirst();(fd=it.current());++it)
+ {
+ FileContext *fc = new FileContext(fd);
+ m_cache.files->append(fc);
+ m_cache.fileContextList.append(fc);
+ }
+ }
+ }
+ return m_cache.files.get();
+ }
+ TemplateVariant hasDetails() const
+ {
+ return m_dirDef->hasDetailedDescription();
+ }
+ TemplateVariant compoundType() const
+ {
+ return theTranslator->trDir(FALSE,TRUE);
+ }
+
private:
DirDef *m_dirDef;
+ struct Cachable
+ {
+ Cachable()
+ {
+ dirContextList.setAutoDelete(TRUE);
+ fileContextList.setAutoDelete(TRUE);
+ }
+ QList<DirContext> dirContextList;
+ QList<FileContext> fileContextList;
+ ScopedPtr<TemplateList> dirs;
+ ScopedPtr<TemplateList> files;
+ };
+ mutable Cachable m_cache;
};
//%% }
@@ -4838,6 +4917,50 @@ TemplateListIntf::ConstIterator *FileListContext::createIterator() const
//------------------------------------------------------------------------
+//%% list DirList[Dir] : list of files
+class DirListContext::Private : public GenericNodeListContext<DirContext>
+{
+ public:
+ Private()
+ {
+ DirDef *dir;
+ DirSDict::Iterator sdi(*Doxygen::directories);
+ for (sdi.toFirst();(dir=sdi.current());++sdi)
+ {
+ append(new DirContext(dir));
+ }
+ }
+};
+
+DirListContext::DirListContext()
+{
+ p = new Private;
+}
+
+DirListContext::~DirListContext()
+{
+ delete p;
+}
+
+// TemplateListIntf
+int DirListContext::count() const
+{
+ return p->count();
+}
+
+TemplateVariant DirListContext::at(int index) const
+{
+ return p->at(index);
+}
+
+TemplateListIntf::ConstIterator *DirListContext::createIterator() const
+{
+ return p->createIterator();
+}
+
+
+//------------------------------------------------------------------------
+
//%% list UsedFiles[File] : list of files
class UsedFilesContext::Private : public GenericNodeListContext<FileContext>
{
@@ -6618,6 +6741,7 @@ void generateOutputViaTemplate()
ClassHierarchyContext classHierarchy;
NamespaceListContext namespaceList;
NamespaceTreeContext namespaceTree;
+ DirListContext dirList;
FileListContext fileList;
FileTreeContext fileTree;
PageTreeContext pageTree;
@@ -6654,6 +6778,8 @@ void generateOutputViaTemplate()
ctx->set("moduleTree",&moduleTree);
//%% ExampleList exampleList
ctx->set("exampleList",&exampleList);
+ //%% DirList dirList
+ ctx->set("dirList",&dirList);
// render HTML output
Template *tpl = e.loadByName("htmllayout.tpl",1);
diff --git a/src/context.h b/src/context.h
index ece2eaa..9f81bda 100644
--- a/src/context.h
+++ b/src/context.h
@@ -497,6 +497,24 @@ class DirFileContext : public TemplateListIntf
//----------------------------------------------------
+class DirListContext : public TemplateListIntf
+{
+ public:
+ DirListContext();
+ ~DirListContext();
+
+ // TemplateListIntf
+ virtual int count() const;
+ virtual TemplateVariant at(int index) const;
+ virtual TemplateListIntf::ConstIterator *createIterator() const;
+
+ private:
+ class Private;
+ Private *p;
+};
+
+//----------------------------------------------------
+
class FileListContext : public TemplateListIntf
{
public:
diff --git a/src/dirdef.cpp b/src/dirdef.cpp
index ab4e5c2..284d1ee 100644
--- a/src/dirdef.cpp
+++ b/src/dirdef.cpp
@@ -335,6 +335,12 @@ QCString DirDef::shortTitle() const
return theTranslator->trDirReference(m_shortName);
}
+bool DirDef::hasDetailedDescription() const
+{
+ static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
+ return (!briefDescription().isEmpty() && repeatBrief) || !documentation().isEmpty();
+}
+
void DirDef::writeDocumentation(OutputList &ol)
{
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
diff --git a/src/dirdef.h b/src/dirdef.h
index 6650d45..8f4fbc2 100644
--- a/src/dirdef.h
+++ b/src/dirdef.h
@@ -67,6 +67,7 @@ class DirDef : public Definition
bool isParentOf(DirDef *dir) const;
bool depGraphIsTrivial() const;
QCString shortTitle() const;
+ bool hasDetailedDescription() const;
// generate output
void writeDocumentation(OutputList &ol);
diff --git a/src/filedef.cpp b/src/filedef.cpp
index 04c56de..b6cfb80 100644
--- a/src/filedef.cpp
+++ b/src/filedef.cpp
@@ -172,8 +172,9 @@ void FileDef::findSectionsInDocumentation()
bool FileDef::hasDetailedDescription() const
{
+ static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
- return ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) ||
+ return ((!briefDescription().isEmpty() && repeatBrief) ||
!documentation().stripWhiteSpace().isEmpty() || // avail empty section
(sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())
);