Fix compilation with -no-feature-regularexpression
Change-Id: I4d213a266034d388af723337deeeb4cdd1f5cbdb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
965bcca6d4
commit
a87b549edf
@ -65,7 +65,6 @@
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QMutexLocker>
|
||||
#include <QtCore/QUuid>
|
||||
#include <QtCore/QRegularExpression>
|
||||
#include <QtCore/QTemporaryFile>
|
||||
#include <QtCore/private/qsystemlibrary_p.h>
|
||||
|
||||
@ -1153,12 +1152,32 @@ void QWindowsNativeFileDialogBase::setLabelText(QFileDialogOptions::DialogLabel
|
||||
}
|
||||
}
|
||||
|
||||
static bool isHexRange(const QString& s, int start, int end)
|
||||
{
|
||||
for (;start < end; ++start) {
|
||||
QChar ch = s.at(start);
|
||||
if (!(ch.isDigit()
|
||||
|| (ch >= QLatin1Char('a') && ch <= QLatin1Char('f'))
|
||||
|| (ch >= QLatin1Char('A') && ch <= QLatin1Char('F'))))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool isClsid(const QString &s)
|
||||
{
|
||||
// detect "374DE290-123F-4565-9164-39C4925E467B".
|
||||
static const QRegularExpression pattern(QLatin1String("\\A[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\\z"));
|
||||
Q_ASSERT(pattern.isValid());
|
||||
return pattern.match(s).hasMatch();
|
||||
const QChar dash(QLatin1Char('-'));
|
||||
return s.size() == 36
|
||||
&& isHexRange(s, 0, 8)
|
||||
&& s.at(8) == dash
|
||||
&& isHexRange(s, 9, 13)
|
||||
&& s.at(13) == dash
|
||||
&& isHexRange(s, 14, 18)
|
||||
&& s.at(18) == dash
|
||||
&& isHexRange(s, 19, 23)
|
||||
&& s.at(23) == dash
|
||||
&& isHexRange(s, 24, 36);
|
||||
}
|
||||
|
||||
void QWindowsNativeFileDialogBase::selectFile(const QString &fileName) const
|
||||
|
Loading…
x
Reference in New Issue
Block a user