From 6f51fee995cf6f4a746077209f4dbb729c463769 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 26 Mar 2012 15:28:40 -0300 Subject: Remove references to QT_NO_STL from QtCore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QT_NO_STL is now no longer defined, so remove the conditionals and select the STL side. Change-Id: Ieedd248ae16e5a128b4ac287f850b3ebc8fb6181 Reviewed-by: João Abecasis --- src/corelib/global/qglobal.h | 8 -------- src/corelib/global/qtypeinfo.h | 4 ---- src/corelib/tools/qlinkedlist.h | 4 ---- src/corelib/tools/qlist.h | 5 ----- src/corelib/tools/qmap.h | 8 -------- src/corelib/tools/qscopedpointer.h | 2 -- src/corelib/tools/qshareddata.h | 2 -- src/corelib/tools/qsharedpointer_impl.h | 2 -- src/corelib/tools/qstring.cpp | 9 --------- src/corelib/tools/qstring.h | 9 ++------- src/corelib/tools/qvector.h | 4 ---- 11 files changed, 2 insertions(+), 55 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 22f65a6aba..ec7de3b1c5 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -69,9 +69,7 @@ #ifdef __cplusplus -#ifndef QT_NO_STL #include -#endif #ifndef QT_NAMESPACE /* user namespace */ @@ -1183,14 +1181,8 @@ static inline bool qIsNull(float f) template inline void qSwap(T &value1, T &value2) { -#ifdef QT_NO_STL - const T t = value1; - value1 = value2; - value2 = t; -#else using std::swap; swap(value1, value2); -#endif } #if QT_DEPRECATED_SINCE(5, 0) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 1c08bbe1cf..48ee99ef27 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -172,9 +172,6 @@ Q_DECLARE_TYPEINFO_BODY(QFlags, Q_PRIMITIVE_TYPE); types must declare a 'bool isDetached(void) const;' member for this to work. */ -#ifdef QT_NO_STL -#define Q_DECLARE_SHARED_STL(TYPE) -#else #define Q_DECLARE_SHARED_STL(TYPE) \ QT_END_NAMESPACE \ namespace std { \ @@ -182,7 +179,6 @@ namespace std { \ { swap(value1.data_ptr(), value2.data_ptr()); } \ } \ QT_BEGIN_NAMESPACE -#endif #define Q_DECLARE_SHARED(TYPE) \ template <> inline void qSwap(TYPE &value1, TYPE &value2) \ diff --git a/src/corelib/tools/qlinkedlist.h b/src/corelib/tools/qlinkedlist.h index 27d0ffe875..a8a97b308a 100644 --- a/src/corelib/tools/qlinkedlist.h +++ b/src/corelib/tools/qlinkedlist.h @@ -45,10 +45,8 @@ #include #include -#ifndef QT_NO_STL #include #include -#endif QT_BEGIN_HEADER @@ -221,12 +219,10 @@ public: typedef const value_type &const_reference; typedef qptrdiff difference_type; -#ifndef QT_NO_STL static inline QLinkedList fromStdList(const std::list &list) { QLinkedList tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } inline std::list toStdList() const { std::list tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif // comfort QLinkedList &operator+=(const QLinkedList &l); diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 9d70e55b1e..0d5b109f2f 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -46,12 +46,9 @@ #include #include -#ifndef QT_NO_STL #include #include -#endif #ifdef Q_COMPILER_INITIALIZER_LISTS -#include #include #endif @@ -333,12 +330,10 @@ public: static QList fromVector(const QVector &vector); static QList fromSet(const QSet &set); -#ifndef QT_NO_STL static inline QList fromStdList(const std::list &list) { QList tmp; qCopy(list.begin(), list.end(), std::back_inserter(tmp)); return tmp; } inline std::list toStdList() const { std::list tmp; qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif private: Node *detach_helper_grow(int i, int n); diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index 3f46a8ad1e..3494bd0c4c 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -51,10 +51,7 @@ #include #endif -#ifndef QT_NO_STL #include -#endif - #include QT_BEGIN_HEADER @@ -349,10 +346,8 @@ public: { qSwap(d, other.d); return *this; } #endif inline void swap(QMap &other) { qSwap(d, other.d); } -#ifndef QT_NO_STL explicit QMap(const typename std::map &other); std::map toStdMap() const; -#endif bool operator==(const QMap &other) const; inline bool operator!=(const QMap &other) const { return !(*this == other); } @@ -939,7 +934,6 @@ Q_OUTOFLINE_TEMPLATE bool QMap::operator==(const QMap &other) co return true; } -#ifndef QT_NO_STL template Q_OUTOFLINE_TEMPLATE QMap::QMap(const std::map &other) { @@ -963,8 +957,6 @@ Q_OUTOFLINE_TEMPLATE std::map QMap::toStdMap() const return map; } -#endif // QT_NO_STL - template class QMultiMap : public QMap { diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index c01a623414..316991e23f 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -185,7 +185,6 @@ template Q_INLINE_TEMPLATE void qSwap(QScopedPointer &p1, QScopedPointer &p2) { p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE namespace std { template @@ -193,7 +192,6 @@ namespace std { { p1.swap(p2); } } QT_BEGIN_NAMESPACE -#endif diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index 1003baaae3..b38a7d6e80 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -264,7 +264,6 @@ template Q_INLINE_TEMPLATE void qSwap(QExplicitlySharedDataPointer &p1, QExplicitlySharedDataPointer &p2) { p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE namespace std { template @@ -276,7 +275,6 @@ namespace std { { p1.swap(p2); } } QT_BEGIN_NAMESPACE -#endif template Q_DECLARE_TYPEINFO_BODY(QSharedDataPointer, Q_MOVABLE_TYPE); template Q_DECLARE_TYPEINFO_BODY(QExplicitlySharedDataPointer, Q_MOVABLE_TYPE); diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index fadb4e0586..c656e54513 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -791,7 +791,6 @@ inline void qSwap(QSharedPointer &p1, QSharedPointer &p2) p1.swap(p2); } -#ifndef QT_NO_STL QT_END_NAMESPACE namespace std { template @@ -799,7 +798,6 @@ namespace std { { p1.swap(p2); } } QT_BEGIN_NAMESPACE -#endif namespace QtSharedPointer { // helper functions: diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f551e328e7..c4eef38971 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -944,9 +944,6 @@ const QStaticStringData<1> QString::shared_empty = { Q_STATIC_STRING_DATA_HEADER windows) and ucs4 if the size of wchar_t is 4 bytes (most Unix systems). - This method is only available if Qt is configured with STL - compatibility enabled and if QT_NO_STL is not defined. - \sa fromUtf16(), fromLatin1(), fromLocal8Bit(), fromUtf8(), fromUcs4() */ @@ -972,9 +969,6 @@ const QStaticStringData<1> QString::shared_empty = { Q_STATIC_STRING_DATA_HEADER This operator is mostly useful to pass a QString to a function that accepts a std::wstring object. - This operator is only available if Qt is configured with STL - compatibility enabled and if QT_NO_STL is not defined. - \sa utf16(), toAscii(), toLatin1(), toUtf8(), toLocal8Bit() */ @@ -7399,9 +7393,6 @@ bool QString::isRightToLeft() const If the QString contains non-Latin1 Unicode characters, using this can lead to loss of information. - This operator is only available if Qt is configured with STL - compatibility enabled and if QT_NO_STL is not defined. - \sa toAscii(), toLatin1(), toUtf8(), toLocal8Bit() */ diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index c7629fdfdd..d09e3b5ab2 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -47,9 +47,7 @@ #include #include -#ifndef QT_NO_STL -# include -#endif // QT_NO_STL +#include #include @@ -614,12 +612,10 @@ public: inline void push_front(QChar c) { prepend(c); } inline void push_front(const QString &s) { prepend(s); } -#ifndef QT_NO_STL static inline QString fromStdString(const std::string &s); inline std::string toStdString() const; static inline QString fromStdWString(const std::wstring &s); inline std::wstring toStdWString() const; -#endif // compatibility struct Null { }; @@ -1092,7 +1088,6 @@ inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteA # endif // QT_NO_CAST_FROM_ASCII #endif // QT_USE_QSTRINGBUILDER -#ifndef QT_NO_STL inline std::string QString::toStdString() const { const QByteArray asc = toAscii(); return std::string(asc.constData(), asc.length()); } @@ -1113,9 +1108,9 @@ inline std::wstring QString::toStdWString() const str.resize(toWCharArray(&(*str.begin()))); return str; } + inline QString QString::fromStdWString(const std::wstring &s) { return fromWCharArray(s.data(), int(s.size())); } -#endif #if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 04ab9e6e80..3c0db06589 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -47,10 +47,8 @@ #include #include -#ifndef QT_NO_STL #include #include -#endif #include #include #ifdef Q_COMPILER_INITIALIZER_LISTS @@ -308,12 +306,10 @@ public: static QVector fromList(const QList &list); -#ifndef QT_NO_STL static inline QVector fromStdVector(const std::vector &vector) { QVector tmp; tmp.reserve(int(vector.size())); qCopy(vector.begin(), vector.end(), std::back_inserter(tmp)); return tmp; } inline std::vector toStdVector() const { std::vector tmp; tmp.reserve(size()); qCopy(constBegin(), constEnd(), std::back_inserter(tmp)); return tmp; } -#endif private: friend class QRegion; // Optimization for QRegion::rects() -- cgit v1.2.3