From f70905448f612f52d4c3034faee61fc103b9eb7c Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 23 May 2019 13:55:07 +0200 Subject: Add QT_NO_JAVA_STYLE_ITERATORS and mark QtBase free of it ... except for tests, which manually undefine the macro. Like QT_NO_FOREACH, this is a technical way to keep JSI-free modules JSI-free going forward. Change-Id: Icf1342da00a700f42f9e32a253d1cdb94c38dd7e Reviewed-by: Lars Knoll --- src/corelib/tools/qbytearraylist.h | 3 +++ src/corelib/tools/qiterator.h | 9 +++++++++ src/corelib/tools/qset.h | 2 ++ src/corelib/tools/qstringlist.h | 2 ++ 4 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qbytearraylist.h b/src/corelib/tools/qbytearraylist.h index 1261e1757c..0250b649b8 100644 --- a/src/corelib/tools/qbytearraylist.h +++ b/src/corelib/tools/qbytearraylist.h @@ -48,8 +48,11 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) typedef QListIterator QByteArrayListIterator; typedef QMutableListIterator QMutableByteArrayListIterator; +#endif + #ifndef Q_CLANG_QDOC typedef QList QByteArrayList; diff --git a/src/corelib/tools/qiterator.h b/src/corelib/tools/qiterator.h index 449d1049a0..84a0e116ca 100644 --- a/src/corelib/tools/qiterator.h +++ b/src/corelib/tools/qiterator.h @@ -44,6 +44,8 @@ QT_BEGIN_NAMESPACE +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) + #define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \ \ template \ @@ -179,6 +181,13 @@ public: \ n = c->end(); return false; } \ }; +#else // QT_NO_JAVA_STYLE_ITERATORS +#define Q_DECLARE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) +#define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) +#define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) +#endif // QT_NO_JAVA_STYLE_ITERATORS + template class QKeyValueIterator { diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 98caabfb57..19d6982133 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -402,6 +402,7 @@ QList QList::fromSet(const QSet &set) Q_DECLARE_SEQUENTIAL_ITERATOR(Set) +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) template class QMutableSetIterator { @@ -433,6 +434,7 @@ public: { while (c->constBegin() != i) if (*(n = --i) == t) return true; n = c->end(); return false; } }; +#endif // QT_NO_JAVA_STYLE_ITERATORS QT_END_NAMESPACE diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index 45f51bfcc6..a464d443dc 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -54,8 +54,10 @@ QT_BEGIN_NAMESPACE class QRegExp; class QRegularExpression; +#if !defined(QT_NO_JAVA_STYLE_ITERATORS) typedef QListIterator QStringListIterator; typedef QMutableListIterator QMutableStringListIterator; +#endif class QStringList; -- cgit v1.2.3