diff options
author | Lars Knoll <lars.knoll@qt.io> | 2020-03-18 11:19:19 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2020-03-25 09:34:37 +0100 |
commit | 53f8f233692b6f9cd622eafbf669c5f8bdb0a25d (patch) | |
tree | cd36fdd81e8bb67d5c860e01d9b47979a0a48e13 /src/tools | |
parent | a7fe1af609e905f6e5fbf291ec43261a41d9541f (diff) |
Get rid of QRegExp usage in rcc
As a drive-by, enable testing of rcc in the cmake build.
Change-Id: I4150ff3ffe7404bab0cbc72f80b23b47a60cf33d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/rcc/rcc.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 808208573a..8b1ebad14c 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -37,7 +37,6 @@ #include <qfile.h> #include <qiodevice.h> #include <qlocale.h> -#include <qregexp.h> #include <qstack.h> #include <qxmlstream.h> @@ -1362,7 +1361,17 @@ bool RCCResourceLibrary::writeInitializer() QString initNameStr = m_initName; if (!initNameStr.isEmpty()) { initNameStr.prepend(QLatin1Char('_')); - initNameStr.replace(QRegExp(QLatin1String("[^a-zA-Z0-9_]")), QLatin1String("_")); + auto isAsciiLetterOrNumber = [] (QChar c) -> bool { + ushort ch = c.unicode(); + return (ch >= '0' && ch <= '9') || + (ch >= 'A' && ch <= 'Z') || + (ch >= 'a' && ch <= 'z') || + ch == '_'; + }; + for (QChar &c : initNameStr) { + if (!isAsciiLetterOrNumber(c)) + c = QLatin1Char('_'); + } } QByteArray initName = initNameStr.toLatin1(); |