From b1d96a6cf89f3743bddae24c1c0142ca6e742883 Mon Sep 17 00:00:00 2001 From: RickyRister Date: Wed, 12 Mar 2025 02:49:54 -0700 Subject: [PATCH] fix build failure --- oracle/src/parsehelpers.cpp | 8 ++++---- tests/oracle/CMakeLists.txt | 20 ++++++-------------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/oracle/src/parsehelpers.cpp b/oracle/src/parsehelpers.cpp index fa778e8f4..c7f340139 100644 --- a/oracle/src/parsehelpers.cpp +++ b/oracle/src/parsehelpers.cpp @@ -1,5 +1,6 @@ #include "parsehelpers.h" +#include #include /** @@ -24,9 +25,8 @@ bool parseCipt(const QString &name, const QString &text) { // Try to split shortname on most non-alphanumeric characters (including _) - static QSet exceptions = {'\'', '\"'}; - static auto isShortnameDivider = [](const QChar &c) { - return c == '_' || (!c.isLetterOrNumber() && !exceptions.contains(c)); + auto isShortnameDivider = [](const QChar &c) { + return c == '_' || (!c.isLetterOrNumber() && c != '\'' && c != '\"'); }; // Try all possible shortnames. @@ -37,7 +37,7 @@ bool parseCipt(const QString &name, const QString &text) if (isShortnameDivider(name.at(i))) { if (inAlphanumericPart) { // only add to names on a "falling edge", in order to reduce the amount of redundant splits - possibleNames.append(QRegularExpression::escape(name.first(i))); + possibleNames.append(QRegularExpression::escape(name.left(i))); inAlphanumericPart = false; } } else { diff --git a/tests/oracle/CMakeLists.txt b/tests/oracle/CMakeLists.txt index da021a971..0c11eb751 100644 --- a/tests/oracle/CMakeLists.txt +++ b/tests/oracle/CMakeLists.txt @@ -1,19 +1,11 @@ -add_executable( - parse_cipt_test - ../../oracle/src/parsehelpers.cpp - parse_cipt_test.cpp -) +add_executable(parse_cipt_test ../../oracle/src/parsehelpers.cpp parse_cipt_test.cpp) -if (NOT GTEST_FOUND) - add_dependencies(parse_cipt_test gtest) -endif () +if(NOT GTEST_FOUND) + add_dependencies(parse_cipt_test gtest) +endif() -set(TEST_QT_MODULES - ${COCKATRICE_QT_VERSION_NAME}::Widgets -) +set(TEST_QT_MODULES ${COCKATRICE_QT_VERSION_NAME}::Widgets) -target_link_libraries( - parse_cipt_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} -) +target_link_libraries(parse_cipt_test cockatrice_common Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) add_test(NAME parse_cipt_test COMMAND parse_cipt_test)