summaryrefslogtreecommitdiffstats
path: root/src/dot.cpp
diff options
context:
space:
mode:
authorMoritz 'Morty' Strübe <moritz.struebe@redheads.de>2020-03-19 21:39:12 (GMT)
committerMoritz 'Morty' Strübe <moritz.struebe@redheads.de>2020-03-21 10:31:58 (GMT)
commit9ab5f68756f1555a805dda5d0215d275d3db8725 (patch)
tree123ac0ea220b4c85d20c7388efc2cc0065191bc7 /src/dot.cpp
parente0fa50b71c74a191a64a2361564a016e6f9c0204 (diff)
downloadDoxygen-9ab5f68756f1555a805dda5d0215d275d3db8725.zip
Doxygen-9ab5f68756f1555a805dda5d0215d275d3db8725.tar.gz
Doxygen-9ab5f68756f1555a805dda5d0215d275d3db8725.tar.bz2
Replace SDict with std::map
Diffstat (limited to 'src/dot.cpp')
-rw-r--r--src/dot.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/dot.cpp b/src/dot.cpp
index 2e07a78..acf4db9 100644
--- a/src/dot.cpp
+++ b/src/dot.cpp
@@ -83,9 +83,8 @@ DotManager *DotManager::instance()
return m_theInstance;
}
-DotManager::DotManager() : m_runners(), m_filePatchers(1009)
+DotManager::DotManager() : m_runners(), m_filePatchers()
{
- m_filePatchers.setAutoDelete(TRUE);
m_queue = new DotRunnerQueue;
int i;
int dotNumThreads = Config_getInt(DOT_NUM_THREADS);
@@ -130,25 +129,27 @@ DotRunner* DotManager::createRunner(const std::string &absDotName, const std::st
{
err("md5 hash does not match for two different runs of %s !\n", absDotName.data());
}
+ rv = runit->second.get();
}
+ assert(rv);
return rv;
}
-DotFilePatcher *DotManager::createFilePatcher(const QCString &fileName)
+DotFilePatcher *DotManager::createFilePatcher(const std::string &fileName)
{
- DotFilePatcher *patcher = m_filePatchers.find(fileName);
- if (patcher==0)
- {
- patcher = new DotFilePatcher(fileName);
- m_filePatchers.append(fileName,patcher);
- }
- return patcher;
+ auto patcher = m_filePatchers.find(fileName);
+
+ if (patcher != m_filePatchers.end()) return &(patcher->second);
+
+ auto rv = m_filePatchers.emplace(fileName, fileName.c_str());
+ assert(rv.second);
+ return &(rv.first->second);
}
bool DotManager::run() const
{
uint numDotRuns = m_runners.size();
- uint numFilePatchers = m_filePatchers.count();
+ uint numFilePatchers = m_filePatchers.size();
if (numDotRuns+numFilePatchers>1)
{
if (m_workers.count()==0)
@@ -236,27 +237,25 @@ bool DotManager::run() const
// patch the output file and insert the maps and figures
i=1;
- SDict<DotFilePatcher>::Iterator di(m_filePatchers);
- const DotFilePatcher *fp;
// since patching the svg files may involve patching the header of the SVG
// (for zoomable SVGs), and patching the .html files requires reading that
// header after the SVG is patched, we first process the .svg files and
// then the other files.
- for (di.toFirst();(fp=di.current());++di)
+ for (auto & fp : m_filePatchers)
{
- if (fp->isSVGFile())
+ if (fp.second.isSVGFile())
{
msg("Patching output file %d/%d\n",i,numFilePatchers);
- if (!fp->run()) return FALSE;
+ if (!fp.second.run()) return FALSE;
i++;
}
}
- for (di.toFirst();(fp=di.current());++di)
+ for (auto& fp : m_filePatchers)
{
- if (!fp->isSVGFile())
+ if (!fp.second.isSVGFile())
{
msg("Patching output file %d/%d\n",i,numFilePatchers);
- if (!fp->run()) return FALSE;
+ if (!fp.second.run()) return FALSE;
i++;
}
}