summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2015-08-28 08:20:26 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2015-08-28 08:20:26 (GMT)
commitabe254fbe2235f5b913653acd076d2acd579d5e1 (patch)
tree2fb6321e6b6ce62b0ee3b3a81f16ebba033e8b41 /src
parent43a0883022f64539498b84220d487b16ffd49a7e (diff)
downloadDoxygen-abe254fbe2235f5b913653acd076d2acd579d5e1.zip
Doxygen-abe254fbe2235f5b913653acd076d2acd579d5e1.tar.gz
Doxygen-abe254fbe2235f5b913653acd076d2acd579d5e1.tar.bz2
Added support for directory dependency graphs to template engine
Diffstat (limited to 'src')
-rw-r--r--src/context.cpp96
-rw-r--r--src/dirdef.cpp9
-rw-r--r--src/dirdef.h1
-rw-r--r--src/dot.cpp18
-rw-r--r--src/dot.h5
5 files changed, 107 insertions, 22 deletions
diff --git a/src/context.cpp b/src/context.cpp
index 39d7b07..68e1167 100644
--- a/src/context.cpp
+++ b/src/context.cpp
@@ -456,6 +456,18 @@ class TranslateContext::Private : public PropertyMapper
}
return TemplateVariant();
}
+ TemplateVariant handleDirDependencyGraphFor(const QValueList<TemplateVariant> &args) const
+ {
+ if (args.count()==1)
+ {
+ return theTranslator->trDirDepGraph(args[0].toString());
+ }
+ else
+ {
+ err("tr.dirDependencyGraphFor should take one argument, got %d!\n",args.count());
+ }
+ return TemplateVariant();
+ }
TemplateVariant handleInheritsList(const QValueList<TemplateVariant> &args) const
{
if (args.count()==1)
@@ -571,6 +583,10 @@ class TranslateContext::Private : public PropertyMapper
{
return TemplateVariant::Delegate::fromMethod<Private,&Private::handleCollaborationDiagramFor>(this);
}
+ TemplateVariant dirDependencyGraphFor() const
+ {
+ return TemplateVariant::Delegate::fromMethod<Private,&Private::handleDirDependencyGraphFor>(this);
+ }
TemplateVariant search() const
{
return theTranslator->trSearch();
@@ -1138,6 +1154,8 @@ class TranslateContext::Private : public PropertyMapper
addProperty("panelSyncOn", this,&Private::panelSyncOn);
//%% string panelSyncOff
addProperty("panelSyncOff", this,&Private::panelSyncOff);
+ //%% string dirDependencyGraph
+ addProperty("dirDependencyGraphFor", this,&Private::dirDependencyGraphFor);
m_javaOpt = Config_getBool("OPTIMIZE_OUTPUT_JAVA");
m_fortranOpt = Config_getBool("OPTIMIZE_FOR_FORTRAN");
@@ -1819,6 +1837,7 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
else if (classDiagrams)
{
@@ -1850,8 +1869,8 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
- g_globals.dynSectionId++;
return TemplateVariant(result.data(),TRUE);
}
DotClassGraph *getCollaborationGraph() const
@@ -1900,8 +1919,8 @@ class ClassContext::Private : public DefinitionContext<ClassContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
- g_globals.dynSectionId++;
return TemplateVariant(result.data(),TRUE);
}
@@ -2794,8 +2813,8 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
- g_globals.dynSectionId++;
return TemplateVariant(result.data(),TRUE);
}
DotInclDepGraph *getIncludedByGraph() const
@@ -2845,8 +2864,8 @@ class FileContext::Private : public DefinitionContext<FileContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
- g_globals.dynSectionId++;
return TemplateVariant(result.data(),TRUE);
}
TemplateVariant hasDetails() const
@@ -3109,6 +3128,8 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
addProperty("dirs", this,&Private::dirs);
addProperty("files", this,&Private::files);
addProperty("hasDetails", this,&Private::hasDetails);
+ addProperty("hasDirGraph", this,&Private::hasDirGraph);
+ addProperty("dirGraph", this,&Private::dirGraph);
addProperty("compoundType", this,&Private::compoundType);
}
virtual ~Private() {}
@@ -3176,6 +3197,70 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
{
return "";
}
+ DotDirDeps *getDirDepsGraph() const
+ {
+ if (!m_cache.dirDepsGraph)
+ {
+ m_cache.dirDepsGraph.reset(new DotDirDeps(m_dirDef));
+ }
+ return m_cache.dirDepsGraph.get();
+ }
+ TemplateVariant hasDirGraph() const
+ {
+ bool result=FALSE;
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ static bool dirGraph = Config_getBool("DIRECTORY_GRAPH");
+ if (haveDot && dirGraph)
+ {
+ DotDirDeps *graph = getDirDepsGraph();
+ result = !graph->isTrivial();
+ }
+ return result;
+ }
+ TemplateVariant dirGraph() const
+ {
+ QGString result;
+ static bool haveDot = Config_getBool("HAVE_DOT");
+ static bool dirGraph = Config_getBool("DIRECTORY_GRAPH");
+ if (haveDot && dirGraph)
+ {
+ DotDirDeps *graph = getDirDepsGraph();
+ FTextStream t(&result);
+ switch (g_globals.outputFormat)
+ {
+ case ContextOutputFormat_Html:
+ {
+ graph->writeGraph(t,GOF_BITMAP,
+ EOF_Html,
+ g_globals.outputDir,
+ g_globals.outputDir+portable_pathSeparator()+m_dirDef->getOutputFileBase()+Doxygen::htmlFileExtension,
+ relPathAsString(),
+ TRUE,
+ g_globals.dynSectionId,
+ FALSE);
+ }
+ break;
+ case ContextOutputFormat_Latex:
+ {
+ graph->writeGraph(t,GOF_EPS,
+ EOF_LaTeX,
+ g_globals.outputDir,
+ g_globals.outputDir+portable_pathSeparator()+m_dirDef->getOutputFileBase()+".tex",
+ relPathAsString(),
+ TRUE,
+ g_globals.dynSectionId,
+ FALSE);
+ }
+ break;
+ // TODO: support other generators
+ default:
+ err("context.cpp: output format not yet supported");
+ break;
+ }
+ g_globals.dynSectionId++;
+ }
+ return TemplateVariant(result.data(),TRUE);
+ }
private:
DirDef *m_dirDef;
@@ -3184,6 +3269,7 @@ class DirContext::Private : public DefinitionContext<DirContext::Private>
Cachable() {}
SharedPtr<TemplateList> dirs;
SharedPtr<TemplateList> files;
+ ScopedPtr<DotDirDeps> dirDepsGraph;
};
mutable Cachable m_cache;
};
@@ -4687,8 +4773,8 @@ class ModuleContext::Private : public DefinitionContext<ModuleContext::Private>
err("context.cpp: output format not yet supported");
break;
}
+ g_globals.dynSectionId++;
}
- g_globals.dynSectionId++;
return TemplateVariant(result.data(),TRUE);
}
TemplateVariant hasDetails() const
diff --git a/src/dirdef.cpp b/src/dirdef.cpp
index 067daa0..28c073e 100644
--- a/src/dirdef.cpp
+++ b/src/dirdef.cpp
@@ -385,7 +385,7 @@ void DirDef::writeDocumentation(OutputList &ol)
ol.pushGeneratorState();
QCString title=theTranslator->trDirReference(m_dispName);
- startFile(ol,getOutputFileBase(),name(),title,HLI_None,!generateTreeView);
+ startFile(ol,getOutputFileBase(),name(),title,HLI_Files,!generateTreeView);
if (!generateTreeView)
{
@@ -610,7 +610,7 @@ bool DirDef::isParentOf(DirDef *dir) const
bool DirDef::depGraphIsTrivial() const
{
- return FALSE;
+ return m_usedDirs->count()==0;
}
//----------------------------------------------------------------------
@@ -696,11 +696,6 @@ DirDef *DirDef::mergeDirectoryInTree(const QCString &path)
return dir;
}
-void DirDef::writeDepGraph(FTextStream &t)
-{
- writeDotDirDepGraph(t,this);
-}
-
//----------------------------------------------------------------------
static void writePartialDirPath(OutputList &ol,const DirDef *root,const DirDef *target)
diff --git a/src/dirdef.h b/src/dirdef.h
index 1a87f5b..611ba3e 100644
--- a/src/dirdef.h
+++ b/src/dirdef.h
@@ -71,7 +71,6 @@ class DirDef : public Definition
// generate output
void writeDocumentation(OutputList &ol);
- void writeDepGraph(FTextStream &t);
void writeTagFile(FTextStream &t);
static DirDef *mergeDirectoryInTree(const QCString &path);
diff --git a/src/dot.cpp b/src/dot.cpp
index 705aa27..701f868 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -3965,6 +3965,7 @@ bool DotCallGraph::isTooBig() const
}
//-------------------------------------------------------------
+static void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations);
DotDirDeps::DotDirDeps(DirDef *dir) : m_dir(dir)
{
@@ -3981,7 +3982,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
const char *fileName,
const char *relPath,
bool generateImageMap,
- int graphId) const
+ int graphId,
+ bool linkRelations) const
{
QDir d(path);
// store the original directory
@@ -4006,7 +4008,8 @@ QCString DotDirDeps::writeGraph(FTextStream &out,
// compute md5 checksum of the graph were are about to generate
QGString theGraph;
FTextStream md5stream(&theGraph);
- m_dir->writeDepGraph(md5stream);
+ //m_dir->writeDepGraph(md5stream);
+ writeDotDirDepGraph(md5stream,m_dir,linkRelations);
uchar md5_sig[16];
QCString sigStr(33);
MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
@@ -4764,7 +4767,7 @@ void DotGroupCollaboration::writeGraphHeader(FTextStream &t,
t << " rankdir=LR;\n";
}
-void writeDotDirDepGraph(FTextStream &t,DirDef *dd)
+void writeDotDirDepGraph(FTextStream &t,DirDef *dd,bool linkRelations)
{
t << "digraph \"" << dd->displayName() << "\" {\n";
if (Config_getBool("DOT_TRANSPARENT"))
@@ -4896,11 +4899,14 @@ void writeDotDirDepGraph(FTextStream &t,DirDef *dd)
new DirRelation(relationName,dir,udir));
}
int nrefs = udir->filePairs().count();
- t << " " << dir->getOutputFileBase() << "->"
+ t << " " << dir->getOutputFileBase() << "->"
<< usedDir->getOutputFileBase();
t << " [headlabel=\"" << nrefs << "\", labeldistance=1.5";
- t << " headhref=\"" << relationName << Doxygen::htmlFileExtension
- << "\"];\n";
+ if (linkRelations)
+ {
+ t << " headhref=\"" << relationName << Doxygen::htmlFileExtension << "\"";
+ }
+ t << "];\n";
}
}
}
diff --git a/src/dot.h b/src/dot.h
index 3de7d79..64d6dd4 100644
--- a/src/dot.h
+++ b/src/dot.h
@@ -262,7 +262,8 @@ class DotDirDeps
const char *fileName,
const char *relPath,
bool writeImageMap=TRUE,
- int graphId=-1) const;
+ int graphId=-1,
+ bool linkRelations=TRUE) const;
private:
DirDef *m_dir;
};
@@ -459,6 +460,4 @@ void writeDotImageMapFromFile(FTextStream &t,
const QCString& relPath,const QCString& baseName,
const QCString& context,int graphId=-1);
-void writeDotDirDepGraph(FTextStream &t,DirDef *dd);
-
#endif