summaryrefslogtreecommitdiffstats
path: root/src/htags.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2021-01-07 20:34:26 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2021-01-22 20:45:19 (GMT)
commitb9b341d9543958b3e2feea6ba9197bee4e38a93b (patch)
treed25c8d52b6d1722d1917847e7b0e829992e7df17 /src/htags.cpp
parentc1e12d9b9b3a9699765a0e8b17ac8145858afed4 (diff)
downloadDoxygen-b9b341d9543958b3e2feea6ba9197bee4e38a93b.zip
Doxygen-b9b341d9543958b3e2feea6ba9197bee4e38a93b.tar.gz
Doxygen-b9b341d9543958b3e2feea6ba9197bee4e38a93b.tar.bz2
Refactoring: modernize htags g_symbolDict
Diffstat (limited to 'src/htags.cpp')
-rw-r--r--src/htags.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/htags.cpp b/src/htags.cpp
index 0c3a9af..6b5e5fd 100644
--- a/src/htags.cpp
+++ b/src/htags.cpp
@@ -15,8 +15,10 @@
#include <stdio.h>
+#include <unordered_map>
+#include <string>
+
#include <qdir.h>
-#include <qdict.h>
#include "htags.h"
#include "util.h"
@@ -28,7 +30,7 @@
bool Htags::useHtags = FALSE;
static QDir g_inputDir;
-static QDict<QCString> g_symbolDict(10007);
+static std::unordered_map<std::string,std::string> g_symbolMap;
/*! constructs command line of htags(1) and executes it.
* \retval TRUE success
@@ -111,7 +113,7 @@ bool Htags::loadFilemap(const QCString &htmlDir)
QCString fileMapName = htmlDir+"/HTML/FILEMAP";
QFileInfo fi(fileMapName);
/*
- * Construct FILEMAP dictionary using QDict.
+ * Construct FILEMAP dictionary.
*
* In FILEMAP, URL includes 'html' suffix but we cut it off according
* to the method of FileDef class.
@@ -141,8 +143,7 @@ bool Htags::loadFilemap(const QCString &htmlDir)
QCString value = line.mid(sep+1).stripWhiteSpace();
int ext=value.findRev('.');
if (ext!=-1) value=value.left(ext); // strip extension
- g_symbolDict.setAutoDelete(TRUE);
- g_symbolDict.insert(key,new QCString(value));
+ g_symbolMap.insert(std::make_pair(key.str(),value.str()));
//printf("Key/Value=(%s,%s)\n",key.data(),value.data());
}
}
@@ -171,11 +172,11 @@ QCString Htags::path2URL(const QCString &path)
}
if (!symName.isEmpty())
{
- QCString *result = g_symbolDict[symName];
+ auto it = g_symbolMap.find(symName.str());
//printf("path2URL=%s symName=%s result=%p\n",path.data(),symName.data(),result);
- if (result)
+ if (it!=g_symbolMap.end())
{
- url = "HTML/" + *result;
+ url = QCString("HTML/") + it->second;
}
}
return url;