Commit 47adeb82 authored by Dimitri van Heesch's avatar Dimitri van Heesch

Added directory info to the context

parent df839603
...@@ -726,6 +726,10 @@ class TranslateContext::Private : public PropertyMapper ...@@ -726,6 +726,10 @@ class TranslateContext::Private : public PropertyMapper
bool extractAll = Config_getBool("EXTRACT_ALL"); bool extractAll = Config_getBool("EXTRACT_ALL");
return theTranslator->trFileListDescription(extractAll); return theTranslator->trFileListDescription(extractAll);
} }
TemplateVariant directories() const
{
return theTranslator->trDirectories();
}
Private() Private()
{ {
//%% string generatedBy //%% string generatedBy
...@@ -838,6 +842,8 @@ class TranslateContext::Private : public PropertyMapper ...@@ -838,6 +842,8 @@ class TranslateContext::Private : public PropertyMapper
addProperty("detailLevel", this,&Private::detailLevel); addProperty("detailLevel", this,&Private::detailLevel);
//%% string fileListDescription //%% string fileListDescription
addProperty("fileListDescription",this,&Private::fileListDescription); addProperty("fileListDescription",this,&Private::fileListDescription);
//%% string directories
addProperty("directories", this,&Private::directories);
m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA"); m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN"); m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
...@@ -1133,6 +1139,10 @@ class DefinitionContext : public PropertyMapper ...@@ -1133,6 +1139,10 @@ class DefinitionContext : public PropertyMapper
{ {
fillPath(m_def->getOuterScope(),list); 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); m_cache.navPath.reset(list);
} }
return m_cache.navPath.get(); return m_cache.navPath.get();
...@@ -2082,6 +2092,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> ...@@ -2082,6 +2092,7 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
addProperty("detailedFunctions", this,&Private::detailedFunctions); addProperty("detailedFunctions", this,&Private::detailedFunctions);
addProperty("detailedVariables", this,&Private::detailedVariables); addProperty("detailedVariables", this,&Private::detailedVariables);
addProperty("inlineClasses", this,&Private::inlineClasses); addProperty("inlineClasses", this,&Private::inlineClasses);
addProperty("compoundType", this,&Private::compoundType);
} }
TemplateVariant title() const TemplateVariant title() const
{ {
...@@ -2369,6 +2380,10 @@ class FileContext::Private : public DefinitionContext<FileContext::Private> ...@@ -2369,6 +2380,10 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
} }
return m_cache.inlineClasses.get(); return m_cache.inlineClasses.get();
} }
TemplateVariant compoundType() const
{
return theTranslator->trFile(FALSE,TRUE);
}
private: private:
FileDef *m_fileDef; FileDef *m_fileDef;
...@@ -2422,10 +2437,14 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> ...@@ -2422,10 +2437,14 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
public: public:
Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd) Private(DirDef *dd) : DefinitionContext<DirContext::Private>(dd) , m_dirDef(dd)
{ {
addProperty("title",this,&Private::title); addProperty("title", this,&Private::title);
addProperty("highlight",this,&Private::highlight); addProperty("highlight", this,&Private::highlight);
addProperty("subhighlight",this,&Private::subHighlight); addProperty("subhighlight", this,&Private::subHighlight);
addProperty("dirName",this,&Private::dirName); 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 TemplateVariant title() const
{ {
...@@ -2443,8 +2462,68 @@ class DirContext::Private : public DefinitionContext<DirContext::Private> ...@@ -2443,8 +2462,68 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
{ {
return TemplateVariant(m_dirDef->shortName()); 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: private:
DirDef *m_dirDef; 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;
}; };
//%% } //%% }
...@@ -4836,6 +4915,50 @@ TemplateListIntf::ConstIterator *FileListContext::createIterator() const ...@@ -4836,6 +4915,50 @@ TemplateListIntf::ConstIterator *FileListContext::createIterator() const
return p->createIterator(); return p->createIterator();
} }
//------------------------------------------------------------------------
//%% 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 //%% list UsedFiles[File] : list of files
...@@ -6618,6 +6741,7 @@ void generateOutputViaTemplate() ...@@ -6618,6 +6741,7 @@ void generateOutputViaTemplate()
ClassHierarchyContext classHierarchy; ClassHierarchyContext classHierarchy;
NamespaceListContext namespaceList; NamespaceListContext namespaceList;
NamespaceTreeContext namespaceTree; NamespaceTreeContext namespaceTree;
DirListContext dirList;
FileListContext fileList; FileListContext fileList;
FileTreeContext fileTree; FileTreeContext fileTree;
PageTreeContext pageTree; PageTreeContext pageTree;
...@@ -6654,6 +6778,8 @@ void generateOutputViaTemplate() ...@@ -6654,6 +6778,8 @@ void generateOutputViaTemplate()
ctx->set("moduleTree",&moduleTree); ctx->set("moduleTree",&moduleTree);
//%% ExampleList exampleList //%% ExampleList exampleList
ctx->set("exampleList",&exampleList); ctx->set("exampleList",&exampleList);
//%% DirList dirList
ctx->set("dirList",&dirList);
// render HTML output // render HTML output
Template *tpl = e.loadByName("htmllayout.tpl",1); Template *tpl = e.loadByName("htmllayout.tpl",1);
......
...@@ -497,6 +497,24 @@ class DirFileContext : public TemplateListIntf ...@@ -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 class FileListContext : public TemplateListIntf
{ {
public: public:
......
...@@ -335,6 +335,12 @@ QCString DirDef::shortTitle() const ...@@ -335,6 +335,12 @@ QCString DirDef::shortTitle() const
return theTranslator->trDirReference(m_shortName); 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) void DirDef::writeDocumentation(OutputList &ol)
{ {
static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW"); static bool generateTreeView = Config_getBool("GENERATE_TREEVIEW");
......
...@@ -67,6 +67,7 @@ class DirDef : public Definition ...@@ -67,6 +67,7 @@ class DirDef : public Definition
bool isParentOf(DirDef *dir) const; bool isParentOf(DirDef *dir) const;
bool depGraphIsTrivial() const; bool depGraphIsTrivial() const;
QCString shortTitle() const; QCString shortTitle() const;
bool hasDetailedDescription() const;
// generate output // generate output
void writeDocumentation(OutputList &ol); void writeDocumentation(OutputList &ol);
......
...@@ -172,8 +172,9 @@ void FileDef::findSectionsInDocumentation() ...@@ -172,8 +172,9 @@ void FileDef::findSectionsInDocumentation()
bool FileDef::hasDetailedDescription() const bool FileDef::hasDetailedDescription() const
{ {
static bool repeatBrief = Config_getBool("REPEAT_BRIEF");
static bool sourceBrowser = Config_getBool("SOURCE_BROWSER"); static bool sourceBrowser = Config_getBool("SOURCE_BROWSER");
return ((!briefDescription().isEmpty() && Config_getBool("REPEAT_BRIEF")) || return ((!briefDescription().isEmpty() && repeatBrief) ||
!documentation().stripWhiteSpace().isEmpty() || // avail empty section !documentation().stripWhiteSpace().isEmpty() || // avail empty section
(sourceBrowser && getStartBodyLine()!=-1 && getBodyDef()) (sourceBrowser && getStartBodyLine()!=-1 && getBodyDef())
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment