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>
This commit is contained in:
parent
a7fe1af609
commit
53f8f23369
@ -37,7 +37,6 @@
|
|||||||
#include <qfile.h>
|
#include <qfile.h>
|
||||||
#include <qiodevice.h>
|
#include <qiodevice.h>
|
||||||
#include <qlocale.h>
|
#include <qlocale.h>
|
||||||
#include <qregexp.h>
|
|
||||||
#include <qstack.h>
|
#include <qstack.h>
|
||||||
#include <qxmlstream.h>
|
#include <qxmlstream.h>
|
||||||
|
|
||||||
@ -1362,7 +1361,17 @@ bool RCCResourceLibrary::writeInitializer()
|
|||||||
QString initNameStr = m_initName;
|
QString initNameStr = m_initName;
|
||||||
if (!initNameStr.isEmpty()) {
|
if (!initNameStr.isEmpty()) {
|
||||||
initNameStr.prepend(QLatin1Char('_'));
|
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();
|
QByteArray initName = initNameStr.toLatin1();
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ if(NOT WIN32) # @todo: this is broken, see QTBUG-78449
|
|||||||
endif()
|
endif()
|
||||||
# special case end
|
# special case end
|
||||||
#add_subdirectory(moc)
|
#add_subdirectory(moc)
|
||||||
#add_subdirectory(rcc)
|
add_subdirectory(rcc)
|
||||||
if(TARGET Qt::Widgets)
|
if(TARGET Qt::Widgets)
|
||||||
add_subdirectory(uic)
|
add_subdirectory(uic)
|
||||||
endif()
|
endif()
|
||||||
|
66
tests/auto/tools/rcc/CMakeLists.txt
Normal file
66
tests/auto/tools/rcc/CMakeLists.txt
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
# Generated from rcc.pro.
|
||||||
|
|
||||||
|
#####################################################################
|
||||||
|
## tst_rcc Test:
|
||||||
|
#####################################################################
|
||||||
|
|
||||||
|
qt_add_test(tst_rcc
|
||||||
|
SOURCES
|
||||||
|
tst_rcc.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# Resources:
|
||||||
|
set(images_resource_files
|
||||||
|
"images/circle.png"
|
||||||
|
"images/square.png"
|
||||||
|
"images/subdir/triangle.png"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_resource(tst_rcc "images"
|
||||||
|
PREFIX
|
||||||
|
"/"
|
||||||
|
BASE
|
||||||
|
"data/images"
|
||||||
|
FILES
|
||||||
|
${images_resource_files}
|
||||||
|
)
|
||||||
|
set(size-0_resource_files
|
||||||
|
"data/data-0.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_resource(tst_rcc "size-0"
|
||||||
|
PREFIX
|
||||||
|
"/"
|
||||||
|
BASE
|
||||||
|
"data/sizes"
|
||||||
|
FILES
|
||||||
|
${size-0_resource_files}
|
||||||
|
)
|
||||||
|
set(size-2-0-35-1_resource_files
|
||||||
|
"data/data-0.txt"
|
||||||
|
"data/data-1.txt"
|
||||||
|
"data/data-2.txt"
|
||||||
|
"data/data-35.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_resource(tst_rcc "size-2-0-35-1"
|
||||||
|
PREFIX
|
||||||
|
"/"
|
||||||
|
BASE
|
||||||
|
"data/sizes"
|
||||||
|
FILES
|
||||||
|
${size-2-0-35-1_resource_files}
|
||||||
|
)
|
||||||
|
set(size-1_resource_files
|
||||||
|
"data/data-1.txt"
|
||||||
|
)
|
||||||
|
|
||||||
|
qt_add_resource(tst_rcc "size-1"
|
||||||
|
PREFIX
|
||||||
|
"/"
|
||||||
|
BASE
|
||||||
|
"data/sizes"
|
||||||
|
FILES
|
||||||
|
${size-1_resource_files}
|
||||||
|
)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user