summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-11-17 14:15:53 +0100
committerLiang Qi <liang.qi@qt.io>2016-11-17 14:43:26 +0100
commite5ac4afbf954a3e1616ce8543d46ddc668d0374f (patch)
treebe6d97001edebd5cb74c64aaf0010f3cc76a7293 /src/corelib/tools
parente3ed95dd44b95b6e9361b562807e711d7ce5a58b (diff)
parent03c1a6ac717e3c5693653a5e294214056bda970e (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: mkspecs/features/mac/default_post.prf mkspecs/features/uikit/default_post.prf Change-Id: I2a6f783451f2ac9eb4c1a050f605435d2dacf218
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qalgorithms.h2
-rw-r--r--src/corelib/tools/qbytearray_p.h3
-rw-r--r--src/corelib/tools/qhash.h9
-rw-r--r--src/corelib/tools/qlist.h4
-rw-r--r--src/corelib/tools/qmap.h7
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/tools/qstring.cpp33
-rw-r--r--src/corelib/tools/qstringalgorithms_p.h4
8 files changed, 47 insertions, 17 deletions
diff --git a/src/corelib/tools/qalgorithms.h b/src/corelib/tools/qalgorithms.h
index 038f4149c3..38753a6726 100644
--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -42,7 +42,7 @@
#include <QtCore/qglobal.h>
-#if defined(Q_CC_MSVC)
+#if defined(Q_CC_MSVC) && _MSC_VER > 1500
#include <intrin.h>
#endif
diff --git a/src/corelib/tools/qbytearray_p.h b/src/corelib/tools/qbytearray_p.h
index 0824611d99..6ebff739cd 100644
--- a/src/corelib/tools/qbytearray_p.h
+++ b/src/corelib/tools/qbytearray_p.h
@@ -52,14 +52,13 @@
//
#include <QtCore/qbytearray.h>
-#include <QtCore/qtypetraits.h>
#include "qtools_p.h"
QT_BEGIN_NAMESPACE
enum {
// Define as enum to force inlining. Don't expose MaxAllocSize in a public header.
- MaxByteArraySize = MaxAllocSize - sizeof(QtPrivate::remove_pointer<QByteArray::DataPtr>::type)
+ MaxByteArraySize = MaxAllocSize - sizeof(std::remove_pointer<QByteArray::DataPtr>::type)
};
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index 6a2d7bdd11..66b5e75a1a 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -744,7 +744,7 @@ Q_INLINE_TEMPLATE T &QHash<Key, T>::operator[](const Key &akey)
Node **node = findNode(akey, &h);
if (*node == e) {
if (d->willGrow())
- node = findNode(akey, &h);
+ node = findNode(akey, h);
return createNode(h, akey, T(), node)->value;
}
return (*node)->value;
@@ -760,11 +760,11 @@ Q_INLINE_TEMPLATE typename QHash<Key, T>::iterator QHash<Key, T>::insert(const K
Node **node = findNode(akey, &h);
if (*node == e) {
if (d->willGrow())
- node = findNode(akey, &h);
+ node = findNode(akey, h);
return iterator(createNode(h, akey, avalue, node));
}
- if (!QtPrivate::is_same<T, QHashDummyValue>::value)
+ if (!std::is_same<T, QHashDummyValue>::value)
(*node)->value = avalue;
return iterator(*node);
}
@@ -961,8 +961,7 @@ QPair<typename QHash<Key, T>::iterator, typename QHash<Key, T>::iterator> QHash<
template <class Key, class T>
QPair<typename QHash<Key, T>::const_iterator, typename QHash<Key, T>::const_iterator> QHash<Key, T>::equal_range(const Key &akey) const Q_DECL_NOTHROW
{
- uint h;
- Node *node = *findNode(akey, &h);
+ Node *node = *findNode(akey);
const_iterator firstIt = const_iterator(node);
if (node != e) {
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index c7f27abdd6..c0a92aaa10 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -125,10 +125,10 @@ class QList
{
public:
struct MemoryLayout
- : QtPrivate::if_<
+ : std::conditional<
QTypeInfo<T>::isStatic || QTypeInfo<T>::isLarge,
QListData::IndirectLayout,
- typename QtPrivate::if_<
+ typename std::conditional<
sizeof(T) == sizeof(void*),
QListData::ArrayCompatibleLayout,
QListData::InlineWithPaddingLayout
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index baa10b7a95..96ce787446 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -44,7 +44,6 @@
#include <QtCore/qlist.h>
#include <QtCore/qrefcount.h>
#include <QtCore/qpair.h>
-#include <QtCore/qtypetraits.h>
#ifdef Q_MAP_DEBUG
#include <QtCore/qdebug.h>
@@ -130,15 +129,15 @@ struct QMapNode : public QMapNodeBase
{
callDestructorIfNecessary(key);
callDestructorIfNecessary(value);
- doDestroySubTree(QtPrivate::integral_constant<bool, QTypeInfo<T>::isComplex || QTypeInfo<Key>::isComplex>());
+ doDestroySubTree(std::integral_constant<bool, QTypeInfo<T>::isComplex || QTypeInfo<Key>::isComplex>());
}
QMapNode<Key, T> *lowerBound(const Key &key);
QMapNode<Key, T> *upperBound(const Key &key);
private:
- void doDestroySubTree(QtPrivate::false_type) {}
- void doDestroySubTree(QtPrivate::true_type)
+ void doDestroySubTree(std::false_type) {}
+ void doDestroySubTree(std::true_type)
{
if (left)
leftNode()->destroySubTree();
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index a0c22c9179..5738413bfb 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -464,7 +464,7 @@ private:
template <class X>
inline void enableSharedFromThis(const QEnableSharedFromThis<X> *ptr)
{
- ptr->initializeFromSharedPointer(constCast<typename QtPrivate::remove_cv<T>::type>());
+ ptr->initializeFromSharedPointer(constCast<typename std::remove_cv<T>::type>());
}
inline void enableSharedFromThis(...) {}
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index c6af05c73e..94d2b5f65e 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -4830,6 +4830,39 @@ QString QString::fromUtf16(const ushort *unicode, int size)
return QUtf16::convertToUnicode((const char *)unicode, size*2, 0);
}
+/*!
+ \fn QString QString::fromUtf16(const char16_t *str, int size)
+ \since 5.3
+
+ Returns a QString initialized with the first \a size characters
+ of the Unicode string \a str (ISO-10646-UTF-16 encoded).
+
+ If \a size is -1 (default), \a str must be terminated
+ with a 0.
+
+ This function checks for a Byte Order Mark (BOM). If it is missing,
+ host byte order is assumed.
+
+ This function is slow compared to the other Unicode conversions.
+ Use QString(const QChar *, int) or QString(const QChar *) if possible.
+
+ QString makes a deep copy of the Unicode data.
+
+ \sa utf16(), setUtf16(), fromStdU16String()
+*/
+
+/*!
+ \fn QString QString::fromUcs4(const char32_t *str, int size)
+ \since 5.3
+
+ Returns a QString initialized with the first \a size characters
+ of the Unicode string \a str (ISO-10646-UCS-4 encoded).
+
+ If \a size is -1 (default), \a str must be terminated
+ with a 0.
+
+ \sa toUcs4(), fromUtf16(), utf16(), setUtf16(), fromWCharArray(), fromStdU32String()
+*/
/*!
\since 4.2
diff --git a/src/corelib/tools/qstringalgorithms_p.h b/src/corelib/tools/qstringalgorithms_p.h
index d7127517e0..c5470bc7ad 100644
--- a/src/corelib/tools/qstringalgorithms_p.h
+++ b/src/corelib/tools/qstringalgorithms_p.h
@@ -60,8 +60,8 @@ template <typename StringType> struct QStringAlgorithms
{
typedef typename StringType::value_type Char;
typedef typename StringType::size_type size_type;
- typedef typename QtPrivate::remove_cv<StringType>::type NakedStringType;
- static const bool isConst = QtPrivate::is_const<StringType>::value;
+ typedef typename std::remove_cv<StringType>::type NakedStringType;
+ static const bool isConst = std::is_const<StringType>::value;
static inline bool isSpace(char ch) { return ascii_isspace(ch); }
static inline bool isSpace(QChar ch) { return ch.isSpace(); }