Remove unused parser_util

This commit is contained in:
GriffinR 2024-12-11 01:01:00 -05:00
parent c2cf3cc9c7
commit 11dd7306d3
3 changed files with 0 additions and 71 deletions

View file

@ -1,19 +0,0 @@
#ifndef PARSER_UTIL_H
#define PARSER_UTIL_H
#include <QString>
#include <QStringList>
class ParserUtil
{
public:
ParserUtil(QString root);
QStringList ReadDefines(QString filename, QString prefix);
QStringList ReadDefinesValueSort(QString filename, QString prefix);
private:
QString root_;
};
#endif // PARSER_UTIL_H

View file

@ -44,7 +44,6 @@ SOURCES += src/core/block.cpp \
src/core/editcommands.cpp \
src/lib/fex/lexer.cpp \
src/lib/fex/parser.cpp \
src/lib/fex/parser_util.cpp \
src/lib/orderedjson.cpp \
src/core/regionmapeditcommands.cpp \
src/scriptapi/apimap.cpp \
@ -150,7 +149,6 @@ HEADERS += include/core/block.h \
include/lib/fex/define_statement.h \
include/lib/fex/lexer.h \
include/lib/fex/parser.h \
include/lib/fex/parser_util.h \
include/lib/orderedmap.h \
include/lib/orderedjson.h \
include/ui/aboutporymap.h \

View file

@ -1,50 +0,0 @@
#include "lib/fex/parser_util.h"
#include <QMap>
#include "lib/fex/parser.h"
ParserUtil::ParserUtil(QString root): root_(root) {}
QStringList ParserUtil::ReadDefines(QString filename, QString prefix)
{
if (filename.isEmpty()) {
return QStringList();
}
QString filepath = root_ + "/" + filename;
fex::Parser parser;
std::vector<std::string> match_list = { prefix.toStdString() + ".*" };
std::map<std::string, int> defines = parser.ReadDefines(filepath.toStdString(), match_list);
QStringList out;
for(auto const& define : defines) {
out.append(QString::fromStdString(define.first));
}
return out;
}
QStringList ParserUtil::ReadDefinesValueSort(QString filename, QString prefix)
{
if (filename.isEmpty()) {
return QStringList();
}
QString filepath = root_ + "/" + filename;
fex::Parser parser;
std::vector<std::string> match_list = { prefix.toStdString() + ".*" };
std::map<std::string, int> defines = parser.ReadDefines(filepath.toStdString(), match_list);
QMultiMap<int, QString> defines_keyed_by_value;
for (const auto& pair : defines) {
defines_keyed_by_value.insert(pair.second, QString::fromStdString(pair.first));
}
return defines_keyed_by_value.values();
}