diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2021-05-02 09:20:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-02 09:20:20 (GMT) |
commit | 4f4688844b3c6ff67782c2be95b2ceb195702067 (patch) | |
tree | 90cf8871d4cffc81ff99d392bc2b00191456de85 /src/dot.cpp | |
parent | 4fd8254c903b251be91ab669f4d83cb86ebaf499 (diff) | |
parent | 4784ecea4d15c34af41c1adaa188159b124a1ed0 (diff) | |
download | Doxygen-4f4688844b3c6ff67782c2be95b2ceb195702067.zip Doxygen-4f4688844b3c6ff67782c2be95b2ceb195702067.tar.gz Doxygen-4f4688844b3c6ff67782c2be95b2ceb195702067.tar.bz2 |
Merge branch 'master' into feature/bug_code_lang
Diffstat (limited to 'src/dot.cpp')
-rw-r--r-- | src/dot.cpp | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/src/dot.cpp b/src/dot.cpp index ddabbc7..8aa30b7 100644 --- a/src/dot.cpp +++ b/src/dot.cpp @@ -15,8 +15,8 @@ #include <cstdlib> #include <cassert> - -#include <qdir.h> +#include <sstream> +#include <algorithm> #include "config.h" #include "dot.h" @@ -25,10 +25,10 @@ #include "util.h" #include "portable.h" #include "message.h" -#include "ftextstream.h" #include "doxygen.h" #include "language.h" #include "index.h" +#include "dir.h" #define MAP_CMD "cmapx" @@ -36,17 +36,16 @@ static QCString g_dotFontPath; -static void setDotFontPath(const char *path) +static void setDotFontPath(const QCString &path) { ASSERT(g_dotFontPath.isEmpty()); g_dotFontPath = Portable::getenv("DOTFONTPATH"); QCString newFontPath = Config_getString(DOT_FONTPATH); - QCString spath = path; - if (!newFontPath.isEmpty() && !spath.isEmpty()) + if (!newFontPath.isEmpty() && !path.isEmpty()) { - newFontPath.prepend(spath+Portable::pathListSeparator()); + newFontPath.prepend(path+Portable::pathListSeparator()); } - else if (newFontPath.isEmpty() && !spath.isEmpty()) + else if (newFontPath.isEmpty() && !path.isEmpty()) { newFontPath=path; } @@ -118,22 +117,22 @@ DotManager::~DotManager() delete m_queue; } -DotRunner* DotManager::createRunner(const std::string &absDotName, const std::string& md5Hash) +DotRunner* DotManager::createRunner(const QCString &absDotName, const QCString& md5Hash) { DotRunner* rv = nullptr; - auto const runit = m_runners.find(absDotName); + auto const runit = m_runners.find(absDotName.str()); if (runit == m_runners.end()) { auto insobj = std::make_unique<DotRunner>(absDotName, md5Hash); rv = insobj.get(); - m_runners.emplace(absDotName, std::move(insobj)); + m_runners.emplace(absDotName.str(), std::move(insobj)); } else { // we have a match if (md5Hash != runit->second->getMd5Hash()) { - err("md5 hash does not match for two different runs of %s !\n", absDotName.data()); + err("md5 hash does not match for two different runs of %s !\n", qPrint(absDotName)); } rv = runit->second.get(); } @@ -141,13 +140,13 @@ DotRunner* DotManager::createRunner(const std::string &absDotName, const std::st return rv; } -DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName) +DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName) { - auto patcher = m_filePatchers.find(fileName); + auto patcher = m_filePatchers.find(fileName.str()); if (patcher != m_filePatchers.end()) return &(patcher->second); - auto rv = m_filePatchers.emplace(fileName, fileName.c_str()); + auto rv = m_filePatchers.emplace(fileName.str(), fileName.data()); assert(rv.second); return &(rv.first->second); } @@ -164,7 +163,7 @@ bool DotManager::run() const } else { - msg("Generating dot graphs using %zu parallel threads...\n",QMIN(numDotRuns+numFilePatchers,m_workers.size())); + msg("Generating dot graphs using %zu parallel threads...\n",std::min(numDotRuns+numFilePatchers,m_workers.size())); } } size_t i=1; @@ -270,19 +269,19 @@ bool DotManager::run() const //-------------------------------------------------------------------- -void writeDotGraphFromFile(const char *inFile,const char *outDir, - const char *outFile,GraphOutputFormat format) +void writeDotGraphFromFile(const QCString &inFile,const QCString &outDir, + const QCString &outFile,GraphOutputFormat format) { - QDir d(outDir); + Dir d(outDir.str()); if (!d.exists()) { - term("Output dir %s does not exist!\n",outDir); + term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString imgExt = getDotImageExtension(); QCString imgName = (QCString)outFile+"."+imgExt; - QCString absImgName = d.absPath().utf8()+"/"+imgName; - QCString absOutFile = d.absPath().utf8()+"/"+outFile; + QCString absImgName = QCString(d.absPath())+"/"+imgName; + QCString absOutFile = QCString(d.absPath())+"/"+outFile; DotRunner dotRun(inFile); if (format==GOF_BITMAP) @@ -320,24 +319,24 @@ void writeDotGraphFromFile(const char *inFile,const char *outDir, * \param context the scope in which this graph is found (for resolving links) * \param graphId a unique id for this graph, use for dynamic sections */ -void writeDotImageMapFromFile(FTextStream &t, +void writeDotImageMapFromFile(TextStream &t, const QCString &inFile, const QCString &outDir, const QCString &relPath, const QCString &baseName, const QCString &context,int graphId) { - QDir d(outDir); + Dir d(outDir.str()); if (!d.exists()) { - term("Output dir %s does not exist!\n",outDir.data()); + term("Output dir %s does not exist!\n",qPrint(outDir)); } QCString mapName = baseName+".map"; QCString imgExt = getDotImageExtension(); QCString imgName = baseName+"."+imgExt; - QCString absOutFile = d.absPath().utf8()+"/"+mapName; + QCString absOutFile = QCString(d.absPath())+"/"+mapName; - DotRunner dotRun(inFile.data()); + DotRunner dotRun(inFile); dotRun.addJob(MAP_CMD,absOutFile); dotRun.preventCleanUp(); if (!dotRun.run()) @@ -347,7 +346,7 @@ void writeDotImageMapFromFile(FTextStream &t, if (imgExt=="svg") // vector graphics { - QCString svgName=outDir+"/"+baseName+".svg"; + QCString svgName = outDir+"/"+baseName+".svg"; DotFilePatcher::writeSVGFigureLink(t,relPath,baseName,svgName); DotFilePatcher patcher(svgName); patcher.addSVGConversion("",TRUE,context,TRUE,graphId); @@ -355,18 +354,16 @@ void writeDotImageMapFromFile(FTextStream &t, } else // bitmap graphics { - QGString result; - FTextStream tt(&result); - + TextStream tt; t << "<img src=\"" << relPath << imgName << "\" alt=\"" - << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>" << endl; + << imgName << "\" border=\"0\" usemap=\"#" << mapName << "\"/>\n"; DotFilePatcher::convertMapFile(tt, absOutFile, relPath ,TRUE, context); - if (!result.isEmpty()) + if (!tt.empty()) { t << "<map name=\"" << mapName << "\" id=\"" << mapName << "\">"; - t << result; - t << "</map>" << endl; + t << tt.str(); + t << "</map>\n"; } } - d.remove(absOutFile); + d.remove(absOutFile.str()); } |