summaryrefslogtreecommitdiff
path: root/src/dot.cpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 10:52:06 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2021-10-15 10:52:06 +0900
commitb3e03c958bd4534210bdb8d87ab0b56ada4562fb (patch)
treef3aacdae9418762e601ca1d3cb430065b2d5c312 /src/dot.cpp
parenta65b883ee4bf1831f586218430470f0a493bbe5a (diff)
downloaddoxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.tar.gz
doxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.tar.bz2
doxygen-b3e03c958bd4534210bdb8d87ab0b56ada4562fb.zip
Imported Upstream version 1.8.9upstream/1.8.9
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp222
1 files changed, 116 insertions, 106 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index c64729a..f9b4302 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -772,18 +772,18 @@ static bool checkDeliverables(const QCString &file1,
//--------------------------------------------------------------------
-/** Class representing a list of DotNode objects. */
-class DotNodeList : public QList<DotNode>
+inline int DotNode::findParent( DotNode *n )
{
- public:
- DotNodeList() : QList<DotNode>() {}
- ~DotNodeList() {}
- private:
- int compareValues(const DotNode *n1,const DotNode *n2) const
- {
- return qstricmp(n1->m_label,n2->m_label);
- }
-};
+ if ( !m_parents ) return -1;
+ return m_parents->find(n);
+}
+
+//--------------------------------------------------------------------
+
+int DotNodeList::compareValues(const DotNode *n1,const DotNode *n2) const
+{
+ return qstricmp(n1->m_label,n2->m_label);
+}
//--------------------------------------------------------------------
@@ -1093,7 +1093,11 @@ bool DotFilePatcher::run()
Map *map = m_maps.at(mapId);
//printf("patching FIG %d in file %s with contents of %s\n",
// mapId,m_patchFile.data(),map->mapFile.data());
- writeVecGfxFigure(t,map->label,map->mapFile);
+ if (!writeVecGfxFigure(t,map->label,map->mapFile))
+ {
+ err("problem writing FIG %d figure!\n",mapId);
+ return FALSE;
+ }
}
else // error invalid map id!
{
@@ -1904,7 +1908,7 @@ void DotNode::write(FTextStream &t,
bool reNumber
)
{
- //printf("DotNode::write(%d) name=%s this=%p written=%d\n",distance,m_label.data(),this,m_written);
+ //printf("DotNode::write(%d) name=%s this=%p written=%d visible=%d\n",m_distance,m_label.data(),this,m_written,m_visible);
if (m_written) return; // node already written to the output
if (!m_visible) return; // node is not visible
writeBox(t,gt,format,m_truncated==Truncated,reNumber);
@@ -2257,12 +2261,106 @@ const DotNode *DotNode::findDocNode() const
int DotGfxHierarchyTable::m_curNodeNumber;
+void DotGfxHierarchyTable::createGraph(DotNode *n,FTextStream &out,
+ const char *path,const char *fileName,int id) const
+{
+ QDir d(path);
+ QCString baseName;
+ QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
+ baseName.sprintf("inherit_graph_%d",id);
+ QCString imgName = baseName+"."+ imgExt;
+ QCString mapName = baseName+".map";
+ QCString absImgName = QCString(d.absPath().data())+"/"+imgName;
+ QCString absMapName = QCString(d.absPath().data())+"/"+mapName;
+ QCString absBaseName = QCString(d.absPath().data())+"/"+baseName;
+ QListIterator<DotNode> dnli2(*m_rootNodes);
+ DotNode *node;
+
+ // compute md5 checksum of the graph were are about to generate
+ QGString theGraph;
+ FTextStream md5stream(&theGraph);
+ writeGraphHeader(md5stream,theTranslator->trGraphicalHierarchy());
+ md5stream << " rankdir=\"LR\";" << endl;
+ for (dnli2.toFirst();(node=dnli2.current());++dnli2)
+ {
+ if (node->m_subgraphId==n->m_subgraphId)
+ {
+ node->clearWriteFlag();
+ }
+ }
+ for (dnli2.toFirst();(node=dnli2.current());++dnli2)
+ {
+ if (node->m_subgraphId==n->m_subgraphId)
+ {
+ node->write(md5stream,DotNode::Hierarchy,GOF_BITMAP,FALSE,TRUE,TRUE,TRUE);
+ }
+ }
+ writeGraphFooter(md5stream);
+ resetReNumbering();
+ uchar md5_sig[16];
+ QCString sigStr(33);
+ MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
+ MD5SigToString(md5_sig,sigStr.data(),33);
+ bool regenerate=FALSE;
+ if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
+ !checkDeliverables(absImgName,absMapName))
+ {
+ regenerate=TRUE;
+ // image was new or has changed
+ QCString dotName=absBaseName+".dot";
+ QFile f(dotName);
+ if (!f.open(IO_WriteOnly)) return;
+ FTextStream t(&f);
+ t << theGraph;
+ f.close();
+ resetReNumbering();
+
+ DotRunner *dotRun = new DotRunner(dotName,d.absPath().data(),TRUE,absImgName);
+ dotRun->addJob(imgExt,absImgName);
+ dotRun->addJob(MAP_CMD,absMapName);
+ DotManager::instance()->addRun(dotRun);
+ }
+ else
+ {
+ removeDotGraph(absBaseName+".dot");
+ }
+ Doxygen::indexList->addImageFile(imgName);
+ // write image and map in a table row
+ QCString mapLabel = escapeCharsInString(n->m_label,FALSE);
+ if (imgExt=="svg") // vector graphics
+ {
+ if (regenerate || !writeSVGFigureLink(out,QCString(),baseName,absImgName))
+ {
+ if (regenerate)
+ {
+ DotManager::instance()->addSVGConversion(absImgName,QCString(),
+ FALSE,QCString(),FALSE,0);
+ }
+ int mapId = DotManager::instance()->addSVGObject(fileName,baseName,
+ absImgName,QCString());
+ out << "<!-- SVG " << mapId << " -->" << endl;
+ }
+ }
+ else // normal bitmap
+ {
+ out << "<img src=\"" << imgName << "\" border=\"0\" alt=\"\" usemap=\"#"
+ << mapLabel << "\"/>" << endl;
+
+ if (regenerate || !insertMapFile(out,absMapName,QCString(),mapLabel))
+ {
+ int mapId = DotManager::instance()->addMap(fileName,absMapName,QCString(),
+ FALSE,QCString(),mapLabel);
+ out << "<!-- MAP " << mapId << " -->" << endl;
+ }
+ }
+}
+
void DotGfxHierarchyTable::writeGraph(FTextStream &out,
const char *path,const char *fileName) const
{
//printf("DotGfxHierarchyTable::writeGraph(%s)\n",name);
//printf("m_rootNodes=%p count=%d\n",m_rootNodes,m_rootNodes->count());
-
+
if (m_rootSubgraphs->count()==0) return;
QDir d(path);
@@ -2280,97 +2378,8 @@ void DotGfxHierarchyTable::writeGraph(FTextStream &out,
int count=0;
for (dnli.toFirst();(n=dnli.current());++dnli)
{
- QCString baseName;
- QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT");
- baseName.sprintf("inherit_graph_%d",count++);
- //baseName = convertNameToFile(baseName);
- QCString imgName = baseName+"."+ imgExt;
- QCString mapName = baseName+".map";
- QCString absImgName = QCString(d.absPath().data())+"/"+imgName;
- QCString absMapName = QCString(d.absPath().data())+"/"+mapName;
- QCString absBaseName = QCString(d.absPath().data())+"/"+baseName;
- QListIterator<DotNode> dnli2(*m_rootNodes);
- DotNode *node;
-
- // compute md5 checksum of the graph were are about to generate
- QGString theGraph;
- FTextStream md5stream(&theGraph);
- writeGraphHeader(md5stream,theTranslator->trGraphicalHierarchy());
- md5stream << " rankdir=\"LR\";" << endl;
- for (dnli2.toFirst();(node=dnli2.current());++dnli2)
- {
- if (node->m_subgraphId==n->m_subgraphId)
- {
- node->clearWriteFlag();
- }
- }
- for (dnli2.toFirst();(node=dnli2.current());++dnli2)
- {
- if (node->m_subgraphId==n->m_subgraphId)
- {
- node->write(md5stream,DotNode::Hierarchy,GOF_BITMAP,FALSE,TRUE,TRUE,TRUE);
- }
- }
- writeGraphFooter(md5stream);
- resetReNumbering();
- uchar md5_sig[16];
- QCString sigStr(33);
- MD5Buffer((const unsigned char *)theGraph.data(),theGraph.length(),md5_sig);
- MD5SigToString(md5_sig,sigStr.data(),33);
- bool regenerate=FALSE;
- if (checkAndUpdateMd5Signature(absBaseName,sigStr) ||
- !checkDeliverables(absImgName,absMapName))
- {
- regenerate=TRUE;
- // image was new or has changed
- QCString dotName=absBaseName+".dot";
- QFile f(dotName);
- if (!f.open(IO_WriteOnly)) return;
- FTextStream t(&f);
- t << theGraph;
- f.close();
- resetReNumbering();
-
- DotRunner *dotRun = new DotRunner(dotName,d.absPath().data(),TRUE,absImgName);
- dotRun->addJob(imgExt,absImgName);
- dotRun->addJob(MAP_CMD,absMapName);
- DotManager::instance()->addRun(dotRun);
- }
- else
- {
- removeDotGraph(absBaseName+".dot");
- }
- Doxygen::indexList->addImageFile(imgName);
- // write image and map in a table row
- QCString mapLabel = escapeCharsInString(n->m_label,FALSE);
out << "<tr><td>";
- if (imgExt=="svg") // vector graphics
- {
- if (regenerate || !writeSVGFigureLink(out,QCString(),baseName,absImgName))
- {
- if (regenerate)
- {
- DotManager::instance()->addSVGConversion(absImgName,QCString(),
- FALSE,QCString(),FALSE,0);
- }
- int mapId = DotManager::instance()->addSVGObject(fileName,baseName,
- absImgName,QCString());
- out << "<!-- SVG " << mapId << " -->" << endl;
- }
- }
- else // normal bitmap
- {
- out << "<img src=\"" << imgName << "\" border=\"0\" alt=\"\" usemap=\"#"
- << mapLabel << "\"/>" << endl;
-
- if (regenerate || !insertMapFile(out,absMapName,QCString(),mapLabel))
- {
- int mapId = DotManager::instance()->addMap(fileName,absMapName,QCString(),
- FALSE,QCString(),mapLabel);
- out << "<!-- MAP " << mapId << " -->" << endl;
- }
- }
-
+ createGraph(n,out,path,fileName,count++);
out << "</td></tr>" << endl;
}
out << "</table>" << endl;
@@ -4667,9 +4676,10 @@ void DotGroupCollaboration::Edge::write( FTextStream &t ) const
}
switch( eType )
{
- case thierarchy :
+ case thierarchy:
arrowStyle = "dir=\"back\", style=\"solid\"";
- default :
+ break;
+ default:
t << ", color=\"" << linkTypeColor[(int)eType] << "\"";
break;
}