diff options
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/codecs/qutfcodec.cpp | 163 | ||||
-rw-r--r-- | src/corelib/codecs/qutfcodec_p.h | 7 | ||||
-rw-r--r-- | src/corelib/global/qglobal.cpp | 4 | ||||
-rw-r--r-- | src/corelib/global/qlogging.cpp | 2 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.h | 3 | ||||
-rw-r--r-- | src/corelib/global/qnamespace.qdoc | 20 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 4 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.cpp | 119 | ||||
-rw-r--r-- | src/corelib/plugin/quuid.h | 9 | ||||
-rw-r--r-- | src/corelib/tools/qvarlengtharray.qdoc | 30 | ||||
-rw-r--r-- | src/corelib/tools/qvector.h | 8 | ||||
-rw-r--r-- | src/corelib/tools/qvector.qdoc | 36 |
12 files changed, 326 insertions, 79 deletions
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index 74a716db4a..ce1b092a54 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Intel Corporation. +** Copyright (C) 2018 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -152,6 +152,44 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const } return src == end; } + +static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end, const uchar *&nextAscii) +{ + // do sixteen characters at a time + for ( ; end - src >= 16; src += 16) { + __m128i data = _mm_loadu_si128(reinterpret_cast<const __m128i*>(src)); + + // check if everything is ASCII + // movemask extracts the high bit of every byte, so n is non-zero if something isn't ASCII + uint n = _mm_movemask_epi8(data); + if (!n) + continue; + + // find the next probable ASCII character + // we don't want to load 16 bytes again in this loop if we know there are non-ASCII + // characters still coming + nextAscii = src + qBitScanReverse(n) + 1; + + // return the non-ASCII character + return src + qCountTrailingZeroBits(n); + } + + // do four characters at a time + for ( ; end - src >= 4; src += 4) { + quint32 data = qFromUnaligned<quint32>(src); + data &= 0x80808080U; + if (!data) + continue; + + // We don't try to guess which of the three bytes is ASCII and which + // one isn't. The chance that at least two of them are non-ASCII is + // better than 75%. + nextAscii = src; + return src; + } + nextAscii = end; + return src; +} #elif defined(__ARM_NEON__) && defined(Q_PROCESSOR_ARM_64) // vaddv is only available on Aarch64 static inline bool simdEncodeAscii(uchar *&dst, const ushort *&nextAscii, const ushort *&src, const ushort *end) { @@ -220,6 +258,34 @@ static inline bool simdDecodeAscii(ushort *&dst, const uchar *&nextAscii, const } return src == end; } + +static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end, const uchar *&nextAscii) +{ + // The SIMD code below is untested, so just force an early return until + // we've had the time to verify it works. + nextAscii = end; + return src; + + // do eight characters at a time + uint8x8_t msb_mask = vdup_n_u8(0x80); + uint8x8_t add_mask = { 1, 1 << 1, 1 << 2, 1 << 3, 1 << 4, 1 << 5, 1 << 6, 1 << 7 }; + for ( ; end - src >= 8; src += 8) { + uint8x8_t c = vld1_u8(src); + uint8_t n = vaddv_u8(vand_u8(vcge_u8(c, msb_mask), add_mask)); + if (!n) + continue; + + // find the next probable ASCII character + // we don't want to load 16 bytes again in this loop if we know there are non-ASCII + // characters still coming + nextAscii = src + qBitScanReverse(n) + 1; + + // return the non-ASCII character + return src + qCountTrailingZeroBits(n); + } + nextAscii = end; + return src; +} #else static inline bool simdEncodeAscii(uchar *, const ushort *, const ushort *, const ushort *) { @@ -230,6 +296,12 @@ static inline bool simdDecodeAscii(ushort *, const uchar *, const uchar *, const { return false; } + +static inline const uchar *simdFindNonAscii(const uchar *src, const uchar *end, const uchar *&nextAscii) +{ + nextAscii = end; + return src; +} #endif QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len) @@ -518,6 +590,95 @@ QString QUtf8::convertToUnicode(const char *chars, int len, QTextCodec::Converte return result; } +struct QUtf8NoOutputTraits : public QUtf8BaseTraitsNoAscii +{ + struct NoOutput {}; + static void appendUtf16(const NoOutput &, ushort) {} + static void appendUcs4(const NoOutput &, uint) {} +}; + +QUtf8::ValidUtf8Result QUtf8::isValidUtf8(const char *chars, qsizetype len) +{ + const uchar *src = reinterpret_cast<const uchar *>(chars); + const uchar *end = src + len; + const uchar *nextAscii = src; + bool isValidAscii = true; + + while (src < end) { + if (src >= nextAscii) + src = simdFindNonAscii(src, end, nextAscii); + if (src == end) + break; + + do { + uchar b = *src++; + if ((b & 0x80) == 0) + continue; + + isValidAscii = false; + QUtf8NoOutputTraits::NoOutput output; + int res = QUtf8Functions::fromUtf8<QUtf8NoOutputTraits>(b, output, src, end); + if (res < 0) { + // decoding error + return { false, false }; + } + } while (src < nextAscii); + } + + return { true, isValidAscii }; +} + +int QUtf8::compareUtf8(const char *utf8, qsizetype u8len, const QChar *utf16, int u16len) +{ + uint uc1, uc2; + auto src1 = reinterpret_cast<const uchar *>(utf8); + auto end1 = src1 + u8len; + QStringIterator src2(utf16, utf16 + u16len); + + while (src1 < end1 && src2.hasNext()) { + uchar b = *src1++; + uint *output = &uc1; + int res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(b, output, src1, end1); + if (res < 0) { + // decoding error + uc1 = QChar::ReplacementCharacter; + } + + uc2 = src2.next(); + if (uc1 != uc2) + return int(uc1) - int(uc2); + } + + // the shorter string sorts first + return (end1 > src1) - int(src2.hasNext()); +} + +int QUtf8::compareUtf8(const char *utf8, qsizetype u8len, QLatin1String s) +{ + uint uc1; + auto src1 = reinterpret_cast<const uchar *>(utf8); + auto end1 = src1 + u8len; + auto src2 = reinterpret_cast<const uchar *>(s.latin1()); + auto end2 = src2 + s.size(); + + while (src1 < end1 && src2 < end2) { + uchar b = *src1++; + uint *output = &uc1; + int res = QUtf8Functions::fromUtf8<QUtf8BaseTraits>(b, output, src1, end1); + if (res < 0) { + // decoding error + uc1 = QChar::ReplacementCharacter; + } + + uint uc2 = *src2++; + if (uc1 != uc2) + return int(uc1) - int(uc2); + } + + // the shorter string sorts first + return (end1 > src1) - (end2 > src2); +} + QByteArray QUtf16::convertFromUnicode(const QChar *uc, int len, QTextCodec::ConverterState *state, DataEndianness e) { DataEndianness endian = e; diff --git a/src/corelib/codecs/qutfcodec_p.h b/src/corelib/codecs/qutfcodec_p.h index 36752cc909..659a229dae 100644 --- a/src/corelib/codecs/qutfcodec_p.h +++ b/src/corelib/codecs/qutfcodec_p.h @@ -290,6 +290,13 @@ struct QUtf8 static QString convertToUnicode(const char *, int, QTextCodec::ConverterState *); static QByteArray convertFromUnicode(const QChar *, int); static QByteArray convertFromUnicode(const QChar *, int, QTextCodec::ConverterState *); + struct ValidUtf8Result { + bool isValidUtf8; + bool isValidAscii; + }; + static ValidUtf8Result isValidUtf8(const char *, qsizetype); + static int compareUtf8(const char *, qsizetype, const QChar *, int); + static int compareUtf8(const char *, qsizetype, QLatin1String s); }; struct QUtf16 diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index c6197660e7..1fe1c8c0d1 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -3610,7 +3610,7 @@ bool qunsetenv(const char *varName) */ /*! - \fn template <typename T> qAsConst(T &t) + \fn template <typename T> typename std::add_const<T>::type &qAsConst(T &t) \relates <QtGlobal> \since 5.7 @@ -3662,7 +3662,7 @@ bool qunsetenv(const char *varName) */ /*! - \fn template <typename T> qAsConst(const T &&t) + \fn template <typename T> void qAsConst(const T &&t) \relates <QtGlobal> \since 5.7 \overload diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index a3cab2b627..c727d5738b 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1664,7 +1664,7 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con handledStderr |= android_default_message_handler(type, context, message); #endif - if (handledStderr || !qt_logging_to_console()) + if (handledStderr) return; QString formattedMessage = qFormatLogMessage(type, context, message); diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index fb40c71f7a..31b1823690 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -1406,6 +1406,9 @@ public: ImhMultiLine = 0x400, + ImhNoEditMenu = 0x800, + ImhNoTextHandles = 0x1000, + ImhDigitsOnly = 0x10000, ImhFormattedNumbersOnly = 0x20000, ImhUppercaseOnly = 0x40000, diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index dd0b18dfa0..11c431d015 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -993,12 +993,7 @@ \value WA_LayoutUsesWidgetRect Ignore the layout item rect from the style when laying out this widget with QLayout. - \value WA_MacNoClickThrough When a widget that has this attribute set - is clicked, and its window is inactive, the click will make the window - active but won't be seen by the widget. Typical use of this attribute - is on widgets with "destructive" actions, such as a "Delete" button. - WA_MacNoClickThrough also applies to all child widgets of the widget - that has it set. + \value WA_MacNoClickThrough This value is obsolete and has no effect. \value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip should be opaque instead of transparent (the default). This attribute @@ -1027,9 +1022,7 @@ alternative sizes for widgets to avoid clipping. This attribute is only applicable to \macos. - \value WA_MacBrushedMetal Indicates the widget should be drawn in - the brushed metal style as supported by the windowing system. This - attribute is only applicable to \macos. + \value WA_MacBrushedMetal This value is obsolete and has no effect. \omitvalue WA_MacMetalStyle @@ -1284,9 +1277,7 @@ has no effect on non-X11 platforms. \b Note: Qt automatically sets this attribute on the feedback widget used during a drag. - \value WA_MacFrameworkScaled Enables resolution independence aware mode - on Mac when using Carbon. This attribute has no effect on Cocoa. - The attribute is off by default and can be enabled on a per-window basis. + \value WA_MacFrameworkScaled This value is obsolete and has no effect. \value WA_AcceptTouchEvents Allows touch events (see QTouchEvent) to be sent to the widget. Must be set on all widgets that can @@ -2160,7 +2151,7 @@ with a somewhat lighter frame. It can also be combined with Qt::FramelessWindowHint. On \macos, tool windows correspond to the - \l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating} + \l{https://developer.apple.com/documentation/appkit/nspanel}{NSPanel} class of windows. This means that the window lives on a level above normal windows making it impossible to put a normal window on top of it. By default, tool windows will disappear @@ -2595,6 +2586,9 @@ \value ImhMultiLine Multiple lines can be entered into the text field. + \value ImhNoEditMenu Do not use built-in edit menu. This flag was introduced in Qt 5.11. + \value ImhNoTextHandles Do not use built-in text cursor and selection handles. This flag was introduced in Qt 5.11. + Flags that restrict input (exclusive flags): \value ImhDigitsOnly Only digits are allowed. diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 24f36b3b01..7ccacd883f 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -440,10 +440,10 @@ static bool convert(const QVariant::Private *d, int t, void *result, bool *ok) *str = v_cast<QDate>(d)->toString(Qt::ISODate); break; case QVariant::Time: - *str = v_cast<QTime>(d)->toString(Qt::ISODate); + *str = v_cast<QTime>(d)->toString(Qt::ISODateWithMs); break; case QVariant::DateTime: - *str = v_cast<QDateTime>(d)->toString(Qt::ISODate); + *str = v_cast<QDateTime>(d)->toString(Qt::ISODateWithMs); break; #endif case QVariant::Bool: diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp index 5dfbf23c33..b113ca13ce 100644 --- a/src/corelib/plugin/quuid.cpp +++ b/src/corelib/plugin/quuid.cpp @@ -83,21 +83,27 @@ bool _q_fromHex(const char *&src, Integral &value) return true; } -static char *_q_uuidToHex(const QUuid &uuid, char *dst) +static char *_q_uuidToHex(const QUuid &uuid, char *dst, QUuid::StringFormat mode = QUuid::WithBraces) { - *dst++ = '{'; + if ((mode & QUuid::WithoutBraces) == 0) + *dst++ = '{'; _q_toHex(dst, uuid.data1); - *dst++ = '-'; + if ((mode & QUuid::Id128) != QUuid::Id128) + *dst++ = '-'; _q_toHex(dst, uuid.data2); - *dst++ = '-'; + if ((mode & QUuid::Id128) != QUuid::Id128) + *dst++ = '-'; _q_toHex(dst, uuid.data3); - *dst++ = '-'; + if ((mode & QUuid::Id128) != QUuid::Id128) + *dst++ = '-'; for (int i = 0; i < 2; i++) _q_toHex(dst, uuid.data4[i]); - *dst++ = '-'; + if ((mode & QUuid::Id128) != QUuid::Id128) + *dst++ = '-'; for (int i = 2; i < 8; i++) _q_toHex(dst, uuid.data4[i]); - *dst++ = '}'; + if ((mode & QUuid::WithoutBraces) == 0) + *dst++ = '}'; return dst; } @@ -305,6 +311,22 @@ static QUuid createFromName(const QUuid &ns, const QByteArray &baseData, QCrypto */ /*! + \enum QUuid::StringFormat + \since 5.11 + + This enum is used by toString(StringFormat) to control the formatting of the + string representation. The possible values are: + + \value WithBraces The default, toString() will return five hex fields, separated by + dashes and surrounded by braces. Example: + {00000000-0000-0000-0000-000000000000}. + \value WithoutBraces Only the five dash-separated fields, without the braces. Example: + 00000000-0000-0000-0000-000000000000. + \value Id128 Only the hex digits, without braces or dashes. Note that QUuid + cannot parse this back again as input. +*/ + +/*! \fn QUuid::QUuid(const GUID &guid) Casts a Windows \a guid to a Qt QUuid. @@ -590,6 +612,47 @@ QString QUuid::toString() const } /*! + \since 5.11 + + Returns the string representation of this QUuid, with the formattiong + controlled by the \a mode parameter. From left to right, the five hex + fields are obtained from the four public data members in QUuid as follows: + + \table + \header + \li Field # + \li Source + + \row + \li 1 + \li data1 + + \row + \li 2 + \li data2 + + \row + \li 3 + \li data3 + + \row + \li 4 + \li data4[0] .. data4[1] + + \row + \li 5 + \li data4[2] .. data4[7] + + \endtable +*/ +QString QUuid::toString(QUuid::StringFormat mode) const +{ + char latin1[MaxStringUuidLength]; + const auto end = _q_uuidToHex(*this, latin1, mode); + return QString::fromLatin1(latin1, end - latin1); +} + +/*! Returns the binary representation of this QUuid. The byte array is formatted as five hex fields separated by '-' and enclosed in curly braces, i.e., "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" where @@ -635,6 +698,48 @@ QByteArray QUuid::toByteArray() const } /*! + \since 5.11 + + Returns the string representation of this QUuid, with the formattiong + controlled by the \a mode parameter. From left to right, the five hex + fields are obtained from the four public data members in QUuid as follows: + + \table + \header + \li Field # + \li Source + + \row + \li 1 + \li data1 + + \row + \li 2 + \li data2 + + \row + \li 3 + \li data3 + + \row + \li 4 + \li data4[0] .. data4[1] + + \row + \li 5 + \li data4[2] .. data4[7] + + \endtable +*/ +QByteArray QUuid::toByteArray(QUuid::StringFormat mode) const +{ + QByteArray result(MaxStringUuidLength, Qt::Uninitialized); + const auto end = _q_uuidToHex(*this, const_cast<char*>(result.constData()), mode); + result.resize(end - result.constData()); + return result; +} + +/*! Returns the binary representation of this QUuid. The byte array is in big endian format, and formatted according to RFC 4122, section 4.1.2 - "Layout and byte order". diff --git a/src/corelib/plugin/quuid.h b/src/corelib/plugin/quuid.h index 014b69831e..08a1843640 100644 --- a/src/corelib/plugin/quuid.h +++ b/src/corelib/plugin/quuid.h @@ -85,7 +85,14 @@ public: Sha1 = 5 // 0 1 0 1 }; + enum StringFormat { + WithBraces = 0, + WithoutBraces = 1, + Id128 = 3 + }; + #if defined(Q_COMPILER_UNIFORM_INIT) && !defined(Q_CLANG_QDOC) + Q_DECL_CONSTEXPR QUuid() Q_DECL_NOTHROW : data1(0), data2(0), data3(0), data4{0,0,0,0,0,0,0,0} {} Q_DECL_CONSTEXPR QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, @@ -121,8 +128,10 @@ public: static QUuid fromString(QLatin1String string) Q_DECL_NOTHROW; QUuid(const char *); QString toString() const; + QString toString(StringFormat mode) const; // ### Qt6: merge with previous QUuid(const QByteArray &); QByteArray toByteArray() const; + QByteArray toByteArray(StringFormat mode) const; // ### Qt6: merge with previous QByteArray toRfc4122() const; static QUuid fromRfc4122(const QByteArray &); bool isNull() const Q_DECL_NOTHROW; diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc index dd86a80e9d..336f2afaca 100644 --- a/src/corelib/tools/qvarlengtharray.qdoc +++ b/src/corelib/tools/qvarlengtharray.qdoc @@ -516,7 +516,9 @@ Typedef for \c{std::reverse_iterator<T*>}. Provided for STL compatibility. */ -/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::prepend(const T &value) +/*! + \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::prepend(const T &value) + \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::prepend(T &&value) \since 4.8 Inserts \a value at the beginning of the array. @@ -533,13 +535,6 @@ \sa append(), insert() */ -/*! - \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::prepend(T &&value) - \since 5.11 - - \overload -*/ - /*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::replace(int i, const T &value) \since 4.8 @@ -703,7 +698,9 @@ before the call. */ -/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, const T &value) +/*! + \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, const T &value) + \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, T &&value) \since 4.8 Inserts \a value at index position \a i in the array. If \a i is @@ -728,15 +725,8 @@ vector. */ - -/*! \fn template<class T, int Prealloc> void QVarLengthArray<T, Prealloc>::insert(int i, T &&value) - - \overload - \since 5.11 - -*/ - /*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, const T &value) + \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, T &&value) \overload \since 4.8 @@ -745,12 +735,6 @@ \a before. Returns an iterator pointing at the inserted item. */ -/*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, T &&value) - - \overload - \since 5.11 -*/ - /*! \fn template<class T, int Prealloc> QVarLengthArray<T, Prealloc>::iterator QVarLengthArray<T, Prealloc>::insert(const_iterator before, int count, const T &value) \since 4.8 diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 5ebf7f7435..24a19e68d4 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -72,7 +72,7 @@ public: inline QVector(const QVector<T> &v); inline ~QVector() { if (!d->ref.deref()) freeData(d); } QVector<T> &operator=(const QVector<T> &v); -#ifdef Q_COMPILER_RVALUE_REFS +#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) QVector(QVector<T> &&other) Q_DECL_NOTHROW : d(other.d) { other.d = Data::sharedNull(); } QVector<T> &operator=(QVector<T> &&other) Q_DECL_NOTHROW { QVector moved(std::move(other)); swap(moved); return *this; } @@ -133,7 +133,7 @@ public: T &operator[](int i); const T &operator[](int i) const; void append(const T &t); -#ifdef Q_COMPILER_RVALUE_REFS +#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) void append(T &&t); #endif inline void append(const QVector<T> &l) { *this += l; } @@ -201,7 +201,7 @@ public: typedef typename Data::const_iterator const_iterator; typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; -#if !defined(QT_STRICT_ITERATORS) || defined(Q_QDOC) +#if !defined(QT_STRICT_ITERATORS) || defined(Q_CLANG_QDOC) inline iterator begin() { detach(); return d->begin(); } inline const_iterator begin() const Q_DECL_NOTHROW { return d->constBegin(); } inline const_iterator cbegin() const Q_DECL_NOTHROW { return d->constBegin(); } @@ -258,7 +258,7 @@ public: typedef const_iterator ConstIterator; typedef int size_type; inline void push_back(const T &t) { append(t); } -#ifdef Q_COMPILER_RVALUE_REFS +#if defined(Q_COMPILER_RVALUE_REFS) || defined(Q_CLANG_QDOC) void push_back(T &&t) { append(std::move(t)); } void push_front(T &&t) { prepend(std::move(t)); } #endif diff --git a/src/corelib/tools/qvector.qdoc b/src/corelib/tools/qvector.qdoc index e344a9023d..cc250b72a5 100644 --- a/src/corelib/tools/qvector.qdoc +++ b/src/corelib/tools/qvector.qdoc @@ -587,7 +587,9 @@ */ -/*! \fn template <typename T> void QVector<T>::prepend(const T &value) +/*! + \fn template <typename T> void QVector<T>::prepend(const T &value) + \fn template <typename T> void QVector<T>::prepend(T &&value) Inserts \a value at the beginning of the vector. @@ -605,17 +607,8 @@ \sa append(), insert() */ -/*! - \fn template <typename T> void QVector<T>::prepend(T &&value) - \since 5.11 - - \overload - - Inserts \a value at the beginning of the vector using move semantics. -*/ - - /*! \fn template <typename T> void QVector<T>::insert(int i, const T &value) + \fn template <typename T> void QVector<T>::insert(int i, T &&value) Inserts \a value at index position \a i in the vector. If \a i is 0, the value is prepended to the vector. If \a i is size(), the @@ -633,14 +626,6 @@ \sa append(), prepend(), remove() */ -/*! \fn template <typename T> void QVector<T>::insert(int i, T &&value) - \since 5.11 - - \overload - - Inserts \a value at index position \a i in the vector using move semantics. -*/ - /*! \fn template <typename T> void QVector<T>::insert(int i, int count, const T &value) \overload @@ -652,7 +637,9 @@ \snippet code/src_corelib_tools_qvector.cpp 10 */ -/*! \fn template <typename T> QVector<T>::iterator QVector<T>::insert(iterator before, const T &value) +/*! + \fn template <typename T> QVector<T>::iterator QVector<T>::insert(iterator before, const T &value) + \fn template <typename T> QVector<T>::iterator QVector<T>::insert(iterator before, T &&value) \overload @@ -1102,17 +1089,14 @@ \overload */ -/*! \fn template <typename T> void QVector<T>::push_front(const T &value) +/*! + \fn template <typename T> void QVector<T>::push_front(const T &value) + \fn template <typename T> void QVector<T>::push_front(T &&value) This function is provided for STL compatibility. It is equivalent to prepend(\a value). */ -/*! \fn template <typename T> void QVector<T>::push_front(T &&value) - \since 5.11 - \overload -*/ - /*! \fn template <typename T> void QVector<T>::pop_front() This function is provided for STL compatibility. It is equivalent |