diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/global/qfeatures.h | 3 | ||||
-rw-r--r-- | src/corelib/global/qfeatures.txt | 7 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 10 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qregularexpression.h | 4 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 26 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qstringlist.cpp | 12 | ||||
-rw-r--r-- | src/corelib/tools/qstringlist.h | 12 | ||||
-rw-r--r-- | src/gui/util/qvalidator.cpp | 9 | ||||
-rw-r--r-- | src/gui/util/qvalidator.h | 4 |
15 files changed, 76 insertions, 57 deletions
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index a63d3a3b3d..da5ef4687b 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -154,6 +154,9 @@ // Properties //#define QT_NO_PROPERTIES +// QRegularExpression +//#define QT_NO_REGULAREXPRESSION + // Resize Handler //#define QT_NO_RESIZEHANDLER diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ad1ca5a6d5..25fd28c4cd 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -28,6 +28,13 @@ Requires: Name: CssParser SeeAlso: ??? +Feature: REGULAREXPRESSION +Description: Perl-compatible regular expression APIs +Section: Kernel +Requires: +Name: QRegularExpression +SeeAlso: ??? + Feature: CONCURRENT Description: Provides a high-level multi-threaded APIs Section: Kernel diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 6194f20912..8a04b06c42 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -943,11 +943,11 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) break; #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION case QMetaType::QRegularExpression: stream << *static_cast<const NS(QRegularExpression)*>(data); break; -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION case QMetaType::QEasingCurve: stream << *static_cast<const NS(QEasingCurve)*>(data); break; @@ -1166,11 +1166,11 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) break; #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION case QMetaType::QRegularExpression: stream >> *static_cast< NS(QRegularExpression)*>(data); break; -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION case QMetaType::QEasingCurve: stream >> *static_cast< NS(QEasingCurve)*>(data); break; diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h index 351baa9aaa..f31392e00d 100644 --- a/src/corelib/kernel/qmetatype_p.h +++ b/src/corelib/kernel/qmetatype_p.h @@ -221,7 +221,7 @@ template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = fals #ifdef QT_NO_REGEXP template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; }; #endif -#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGEXP) +#if defined(QT_BOOTSTRAPPED) || defined(QT_NO_REGULAREXPRESSION) template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; }; #endif #ifdef QT_NO_SHORTCUT diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 9091b5579e..28b0b66ba8 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1690,7 +1690,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegExp &re, } #endif // QT_NO_REGEXP -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION /*! \internal */ @@ -1712,7 +1712,7 @@ void qt_qFindChildren_helper(const QObject *parent, const QRegularExpression &re qt_qFindChildren_helper(obj, re, mo, list, options); } } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION /*! \internal diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index e9316c98f0..36aded2cdb 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -73,7 +73,7 @@ class QWidget; #ifndef QT_NO_REGEXP class QRegExp; #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION class QRegularExpression; #endif #ifndef QT_NO_USERDATA @@ -187,7 +187,7 @@ public: } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION template<typename T> inline QList<T> findChildren(const QRegularExpression &re, Qt::FindChildOptions options = Qt::FindChildrenRecursively) const { diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 26deeba6a2..a88b7d2b1f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1529,10 +1529,13 @@ QVariant::QVariant(const QLocale &l) QVariant::QVariant(const QRegExp ®Exp) : d(RegExp) { v_construct<QRegExp>(&d, regExp); } +#endif // QT_NO_REGEXP #ifndef QT_BOOTSTRAPPED +#ifndef QT_NO_REGULAREXPRESSION QVariant::QVariant(const QRegularExpression &re) : d(RegularExpression) { v_construct<QRegularExpression>(&d, re); } +#endif QVariant::QVariant(const QUuid &uuid) : d(Uuid) { v_construct<QUuid>(&d, uuid); } @@ -1552,7 +1555,6 @@ QVariant::QVariant(const QJsonDocument &jsonDocument) : d(QMetaType::QJsonDocument) { v_construct<QJsonDocument>(&d, jsonDocument); } #endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGEXP /*! Returns the storage type of the value stored in the variant. @@ -2214,6 +2216,7 @@ QRegExp QVariant::toRegExp() const } #endif +#ifndef QT_BOOTSTRAPPED /*! \fn QRegularExpression QVariant::toRegularExpression() const \since 5.0 @@ -2223,13 +2226,12 @@ QRegExp QVariant::toRegExp() const \sa canConvert(), convert() */ -#ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION QRegularExpression QVariant::toRegularExpression() const { return qVariantToHelper<QRegularExpression>(d, handlerManager); } -#endif +#endif // QT_NO_REGULAREXPRESSION /*! \since 5.0 diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 86b43cf69a..692af9afc6 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -76,8 +76,10 @@ class QRect; class QRectF; #ifndef QT_NO_REGEXP class QRegExp; -class QRegularExpression; #endif // QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION +class QRegularExpression; +#endif // QT_NO_REGULAREXPRESSION class QTextFormat; class QTextLength; class QUrl; @@ -240,11 +242,11 @@ class Q_CORE_EXPORT QVariant QVariant(const QLocale &locale); #ifndef QT_NO_REGEXP QVariant(const QRegExp ®Exp); -#ifndef QT_BOOTSRAPPED - QVariant(const QRegularExpression &re); -#endif // QT_BOOTSTRAPPED #endif // QT_NO_REGEXP #ifndef QT_BOOTSTRAPPED +#ifndef QT_NO_REGULAREXPRESSION + QVariant(const QRegularExpression &re); +#endif // QT_NO_REGULAREXPRESSION QVariant(const QUrl &url); QVariant(const QEasingCurve &easing); QVariant(const QUuid &uuid); @@ -253,7 +255,7 @@ class Q_CORE_EXPORT QVariant QVariant(const QJsonObject &jsonObject); QVariant(const QJsonArray &jsonArray); QVariant(const QJsonDocument &jsonDocument); -#endif +#endif // QT_BOOTSTRAPPED QVariant& operator=(const QVariant &other); #ifdef Q_COMPILER_RVALUE_REFS @@ -313,11 +315,11 @@ class Q_CORE_EXPORT QVariant QLocale toLocale() const; #ifndef QT_NO_REGEXP QRegExp toRegExp() const; -#ifndef QT_BOOTSTRAPPED - QRegularExpression toRegularExpression() const; -#endif // QT_BOOTSTRAPPED #endif // QT_NO_REGEXP #ifndef QT_BOOTSTRAPPED +#ifndef QT_NO_REGULAREXPRESSION + QRegularExpression toRegularExpression() const; +#endif // QT_NO_REGULAREXPRESSION QUrl toUrl() const; QEasingCurve toEasingCurve() const; QUuid toUuid() const; @@ -326,7 +328,7 @@ class Q_CORE_EXPORT QVariant QJsonObject toJsonObject() const; QJsonArray toJsonArray() const; QJsonDocument toJsonDocument() const; -#endif +#endif // QT_BOOTSTRAPPED #ifndef QT_NO_DATASTREAM void load(QDataStream &ds); diff --git a/src/corelib/tools/qregularexpression.h b/src/corelib/tools/qregularexpression.h index 4c95a5b3a0..e312b10ff1 100644 --- a/src/corelib/tools/qregularexpression.h +++ b/src/corelib/tools/qregularexpression.h @@ -42,7 +42,7 @@ #ifndef QREGULAREXPRESSION_H #define QREGULAREXPRESSION_H -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION #include <QtCore/qstring.h> #include <QtCore/qshareddata.h> @@ -241,6 +241,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QREGULAREXPRESSION_H diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 6db4fed0f8..10ef6b34dd 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2762,13 +2762,17 @@ int QString::lastIndexOf(const QStringRef &str, int from, Qt::CaseSensitivity cs str.size(), cs); } -#ifndef QT_NO_REGEXP + +#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION)) struct QStringCapture { int pos; int len; int no; }; +#endif + +#ifndef QT_NO_REGEXP /*! \overload replace() @@ -2925,7 +2929,7 @@ QString& QString::replace(const QRegExp &rx, const QString &after) } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION #ifndef QT_BOOTSTRAPPED /*! \overload replace() @@ -3055,7 +3059,7 @@ QString &QString::replace(const QRegularExpression &re, const QString &after) return *this; } #endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION /*! Returns the number of (potentially overlapping) occurrences of @@ -3256,7 +3260,7 @@ int QString::count(const QRegExp& rx) const } #endif // QT_NO_REGEXP -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION #ifndef QT_BOOTSTRAPPED /*! \overload indexOf() @@ -3366,7 +3370,7 @@ int QString::count(const QRegularExpression &re) const return count; } #endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION /*! \fn int QString::count() const @@ -3487,7 +3491,7 @@ QString QString::section(const QString &sep, int start, int end, SectionFlags fl return ret; } -#ifndef QT_NO_REGEXP +#if !(defined(QT_NO_REGEXP) && defined(QT_NO_REGULAREXPRESSION)) class qt_section_chunk { public: qt_section_chunk(int l, QString s) { length = l; string = s; } @@ -3537,7 +3541,9 @@ static QString extractSections(const QList<qt_section_chunk> §ions, return ret; } +#endif +#ifndef QT_NO_REGEXP /*! \overload section() @@ -3575,7 +3581,7 @@ QString QString::section(const QRegExp ®, int start, int end, SectionFlags fl } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION #ifndef QT_BOOTSTRAPPED /*! \overload section() @@ -3621,7 +3627,7 @@ QString QString::section(const QRegularExpression &re, int start, int end, Secti return extractSections(sections, start, end, flags); } #endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION /*! Returns a substring that contains the \a n leftmost characters @@ -6416,7 +6422,7 @@ QStringList QString::split(const QRegExp &rx, SplitBehavior behavior) const } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION #ifndef QT_BOOTSTRAPPED /*! \overload @@ -6470,7 +6476,7 @@ QStringList QString::split(const QRegularExpression &re, SplitBehavior behavior) return list; } #endif // QT_BOOTSTRAPPED -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION /*! \enum QString::NormalizationForm diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index b679f0f990..574285fa1e 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -335,7 +335,7 @@ public: inline bool contains(QRegExp &rx) const { return indexOf(rx) != -1; } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION int indexOf(const QRegularExpression &re, int from = 0) const; int lastIndexOf(const QRegularExpression &re, int from = -1) const; bool contains(const QRegularExpression &re) const; @@ -356,7 +356,7 @@ public: #ifndef QT_NO_REGEXP QString section(const QRegExp ®, int start, int end = -1, SectionFlags flags = SectionDefault) const; #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION QString section(const QRegularExpression &re, int start, int end = -1, SectionFlags flags = SectionDefault) const; #endif QString left(int n) const Q_REQUIRED_RESULT; @@ -432,7 +432,7 @@ public: inline QString &remove(const QRegExp &rx) { return replace(rx, QString()); } #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION QString &replace(const QRegularExpression &re, const QString &after); inline QString &remove(const QRegularExpression &re) { return replace(re, QString()); } @@ -447,7 +447,7 @@ public: #ifndef QT_NO_REGEXP QStringList split(const QRegExp &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION QStringList split(const QRegularExpression &sep, SplitBehavior behavior = KeepEmptyParts) const Q_REQUIRED_RESULT; #endif enum NormalizationForm { diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index d56f531e52..35ff2d3d84 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -320,7 +320,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegExp #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION /*! \fn QStringList QStringList::filter(const QRegularExpression &re) const \overload @@ -338,7 +338,7 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula } return res; } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED /*! @@ -395,7 +395,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegExp &r #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION /*! \fn QStringList &QStringList::replaceInStrings(const QRegularExpression &re, const QString &after) \overload @@ -424,7 +424,7 @@ void QtPrivate::QStringList_replaceInStrings(QStringList *that, const QRegularEx for (int i = 0; i < that->size(); ++i) (*that)[i].replace(re, after); } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED /*! @@ -619,7 +619,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, QRegExp &rx, int #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION /*! \fn int QStringList::indexOf(const QRegularExpression &re, int from) const \overload @@ -676,7 +676,7 @@ int QtPrivate::QStringList_lastIndexOf(const QStringList *that, const QRegularEx } return -1; } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED /*! diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 2448081004..9f7e41d800 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -99,12 +99,12 @@ public: #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION inline QStringList filter(const QRegularExpression &re) const; inline QStringList &replaceInStrings(const QRegularExpression &re, const QString &after); inline int indexOf(const QRegularExpression &re, int from = 0) const; inline int lastIndexOf(const QRegularExpression &re, int from = -1) const; -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED #if !defined(Q_NO_USING_KEYWORD) @@ -141,12 +141,12 @@ namespace QtPrivate { #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION void Q_CORE_EXPORT QStringList_replaceInStrings(QStringList *that, const QRegularExpression &rx, const QString &after); QStringList Q_CORE_EXPORT QStringList_filter(const QStringList *that, const QRegularExpression &re); int Q_CORE_EXPORT QStringList_indexOf(const QStringList *that, const QRegularExpression &re, int from); int Q_CORE_EXPORT QStringList_lastIndexOf(const QStringList *that, const QRegularExpression &re, int from); -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED } @@ -220,7 +220,7 @@ inline int QStringList::lastIndexOf(QRegExp &rx, int from) const #endif #ifndef QT_BOOTSTRAPPED -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION inline QStringList &QStringList::replaceInStrings(const QRegularExpression &rx, const QString &after) { QtPrivate::QStringList_replaceInStrings(this, rx, after); @@ -241,7 +241,7 @@ inline int QStringList::lastIndexOf(const QRegularExpression &rx, int from) cons { return QtPrivate::QStringList_lastIndexOf(this, rx, from); } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_BOOTSTRAPPED #ifndef QT_NO_DATASTREAM diff --git a/src/gui/util/qvalidator.cpp b/src/gui/util/qvalidator.cpp index 0d38ebaf14..645e7ceeda 100644 --- a/src/gui/util/qvalidator.cpp +++ b/src/gui/util/qvalidator.cpp @@ -502,9 +502,6 @@ void QIntValidator::setTop(int top) setRange(bottom(), top); } - -#ifndef QT_NO_REGEXP - /*! \internal */ @@ -521,6 +518,8 @@ QValidator::QValidator(QValidatorPrivate &d, QObject *parent) { } +#ifndef QT_NO_REGEXP + class QDoubleValidatorPrivate : public QValidatorPrivate { Q_DECLARE_PUBLIC(QDoubleValidator) @@ -907,7 +906,7 @@ void QRegExpValidator::setRegExp(const QRegExp& rx) #endif -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION /*! \class QRegularExpressionValidator @@ -1058,7 +1057,7 @@ void QRegularExpressionValidatorPrivate::setRegularExpression(const QRegularExpr } } -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION QT_END_NAMESPACE diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index 53acdfb31e..459af44ffc 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -197,7 +197,7 @@ private: #endif // QT_NO_REGEXP -#ifndef QT_NO_REGEXP +#ifndef QT_NO_REGULAREXPRESSION class QRegularExpressionValidatorPrivate; @@ -226,7 +226,7 @@ private: Q_DECLARE_PRIVATE(QRegularExpressionValidator) }; -#endif // QT_NO_REGEXP +#endif // QT_NO_REGULAREXPRESSION #endif // QT_NO_VALIDATOR |