add regex support to C define reading

This commit is contained in:
garak 2019-04-28 20:57:25 -04:00 committed by huderlem
parent 9098055054
commit 0a4be71ae2
2 changed files with 2 additions and 4 deletions

View file

@ -80,8 +80,6 @@ void MainWindow::initCustomUI() {
ui->mapList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->mapList, SIGNAL(customContextMenuRequested(const QPoint &)),
this, SLOT(onOpenMapListContextMenu(const QPoint &)));
// temporary
}
void MainWindow::initExtraSignals() {

View file

@ -1588,7 +1588,7 @@ void Project::readCoordEventWeatherNames() {
void Project::readSecretBaseIds() {
QString filepath = root + "/include/constants/secret_bases.h";
QStringList prefixes = (QStringList() << "SECRET_BASE_");
QStringList prefixes = (QStringList() << "SECRET_BASE_[A-Za-z0-9_]*_[0-9]+");
readCDefinesSorted(filepath, prefixes, secretBaseIds);
}
@ -1842,7 +1842,7 @@ QMap<QString, int> Project::readCDefines(QString text, QStringList prefixes) {
int value = parser.evaluateDefine(expression, &allDefines);
allDefines.insert(name, value);
for (QString prefix : prefixes) {
if (name.startsWith(prefix)) {
if (name.startsWith(prefix) || QRegularExpression(prefix).match(name).hasMatch()) {
filteredDefines.insert(name, value);
}
}