diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-12-12 15:00:43 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-12-14 07:52:39 +0000 |
commit | d545d36c8e11dcd974244a69d2beef726be9ed9d (patch) | |
tree | f072d31b8c9f96f84c4bf2d4862d5a7f5996bb91 /src/xml/sax | |
parent | 88d5eb13d7a996772f38e9c9ab90befb3ae0c80d (diff) |
Remove QRegExp dependency from QtXml
Use QRegularExpression instead.
Change-Id: I6fc9400064ef6b7e425b140f5ffac0c9248c1ec0
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Diffstat (limited to 'src/xml/sax')
-rw-r--r-- | src/xml/sax/qxml.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 7b6669b057..fa31e71cc1 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -43,7 +43,9 @@ #include "qtextcodec.h" #endif #include "qbuffer.h" -#include "qregexp.h" +#if QT_CONFIG(regularexpression) +#include "qregularexpression.h" +#endif #include "qmap.h" #include "qhash.h" #include "qstack.h" @@ -193,19 +195,23 @@ static const signed char charLookupTable[256]={ */ static bool stripTextDecl(QString& str) { - QString textDeclStart(QLatin1String("<?xml")); + QLatin1String textDeclStart("<?xml"); if (str.startsWith(textDeclStart)) { - QRegExp textDecl(QString::fromLatin1( +#if QT_CONFIG(regularexpression) + QRegularExpression textDecl(QString::fromLatin1( "^<\\?xml\\s+" "(version\\s*=\\s*((['\"])[-a-zA-Z0-9_.:]+\\3))?" "\\s*" "(encoding\\s*=\\s*((['\"])[A-Za-z][-a-zA-Z0-9_.]*\\6))?" "\\s*\\?>" - )); + )); QString strTmp = str.replace(textDecl, QLatin1String("")); if (strTmp.length() != str.length()) return false; // external entity has wrong TextDecl str = strTmp; +#else + return false; +#endif } return true; } |