diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qcollator.cpp | 22 | ||||
-rw-r--r-- | src/corelib/tools/qcommandlineparser.cpp | 8 | ||||
-rw-r--r-- | src/corelib/tools/qcontiguouscache.h | 2 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser.cpp | 14 | ||||
-rw-r--r-- | src/corelib/tools/qdatetimeparser_p.h | 3 | ||||
-rw-r--r-- | src/corelib/tools/qpair.qdoc | 54 | ||||
-rw-r--r-- | src/corelib/tools/qregularexpression.cpp | 20 | ||||
-rw-r--r-- | src/corelib/tools/qscopedpointer.cpp | 7 | ||||
-rw-r--r-- | src/corelib/tools/qset.qdoc | 13 | ||||
-rw-r--r-- | src/corelib/tools/qsize.h | 20 | ||||
-rw-r--r-- | src/corelib/tools/qstring.cpp | 112 | ||||
-rw-r--r-- | src/corelib/tools/qstring.h | 2 |
12 files changed, 225 insertions, 52 deletions
diff --git a/src/corelib/tools/qcollator.cpp b/src/corelib/tools/qcollator.cpp index 9148ecf6fc..615b7a4e3e 100644 --- a/src/corelib/tools/qcollator.cpp +++ b/src/corelib/tools/qcollator.cpp @@ -87,7 +87,7 @@ QCollator::QCollator(const QCollator &other) } /*! - Destroys the collator. + Destructor for QCollator. */ QCollator::~QCollator() { @@ -109,8 +109,8 @@ QCollator &QCollator::operator=(const QCollator &other) return *this; } -/* - \fn void QCollator::QCollator(QCollator &&other) +/*! + \fn QCollator::QCollator(QCollator &&other) Move constructor. Moves from \a other into this collator. @@ -119,8 +119,8 @@ QCollator &QCollator::operator=(const QCollator &other) one of the assignment operators is undefined. */ -/* - \fn QCollator &QCollator::operator=(QCollator &&other) +/*! + \fn QCollator & QCollator::operator=(QCollator && other) Move-assigns from \a other to this collator. @@ -367,6 +367,12 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) } /*! + \fn QCollatorSortKey &QCollatorSortKey::operator=(QCollatorSortKey && other) + + Move-assigns \a other to this collator key. +*/ + +/*! \fn bool operator<(const QCollatorSortKey &lhs, const QCollatorSortKey &rhs) \relates QCollatorSortKey @@ -377,6 +383,12 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) */ /*! + \fn void QCollatorSortKey::swap(QCollatorSortKey & other) + + Swaps this collator key with \a other. +*/ + +/*! \fn int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const Compares the key to \a otherKey. Returns a negative value if the key diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 7e49253f9b..4cc3a2c293 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -119,8 +119,8 @@ public: QStringList QCommandLineParserPrivate::aliases(const QString &optionName) const { - const NameHash_t::const_iterator it = nameHash.find(optionName); - if (it == nameHash.end()) { + const NameHash_t::const_iterator it = nameHash.constFind(optionName); + if (it == nameHash.cend()) { qWarning("QCommandLineParser: option not defined: \"%s\"", qPrintable(optionName)); return QStringList(); } @@ -847,8 +847,8 @@ QString QCommandLineParser::value(const QString &optionName) const QStringList QCommandLineParser::values(const QString &optionName) const { d->checkParsed("values"); - const NameHash_t::const_iterator it = d->nameHash.find(optionName); - if (it != d->nameHash.end()) { + const NameHash_t::const_iterator it = d->nameHash.constFind(optionName); + if (it != d->nameHash.cend()) { const int optionOffset = *it; QStringList values = d->optionValuesHash.value(optionOffset); if (values.isEmpty()) diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index fc4fb1e7cb..41d198f9bc 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -291,7 +291,7 @@ QContiguousCache<T> &QContiguousCache<T>::operator=(const QContiguousCache<T> &o { other.d->ref.ref(); if (!d->ref.deref()) - freeData(d); + freeData(p); d = other.d; if (!d->sharable) detach_helper(); diff --git a/src/corelib/tools/qdatetimeparser.cpp b/src/corelib/tools/qdatetimeparser.cpp index 255e9557e2..eaa695ef27 100644 --- a/src/corelib/tools/qdatetimeparser.cpp +++ b/src/corelib/tools/qdatetimeparser.cpp @@ -1362,11 +1362,11 @@ int QDateTimeParser::findDay(const QString &str1, int startDay, int sectionIndex \internal returns - 0 if str == QDateTimeEdit::tr("AM") - 1 if str == QDateTimeEdit::tr("PM") - 2 if str can become QDateTimeEdit::tr("AM") - 3 if str can become QDateTimeEdit::tr("PM") - 4 if str can become QDateTimeEdit::tr("PM") and can become QDateTimeEdit::tr("AM") + 0 if str == tr("AM") + 1 if str == tr("PM") + 2 if str can become tr("AM") + 3 if str can become tr("PM") + 4 if str can become tr("PM") and can become tr("AM") -1 can't become anything sensible */ @@ -1737,9 +1737,9 @@ QDateTime QDateTimeParser::getMaximum() const QString QDateTimeParser::getAmPmText(AmPm ap, Case cs) const { if (ap == AmText) { - return (cs == UpperCase ? QLatin1String("AM") : QLatin1String("am")); + return (cs == UpperCase ? tr("AM") : tr("am")); } else { - return (cs == UpperCase ? QLatin1String("PM") : QLatin1String("pm")); + return (cs == UpperCase ? tr("PM") : tr("pm")); } } diff --git a/src/corelib/tools/qdatetimeparser_p.h b/src/corelib/tools/qdatetimeparser_p.h index 55dc3bf7a0..9457e35ad5 100644 --- a/src/corelib/tools/qdatetimeparser_p.h +++ b/src/corelib/tools/qdatetimeparser_p.h @@ -54,7 +54,7 @@ # include "QtCore/qvariant.h" #endif #include "QtCore/qvector.h" - +#include "QtCore/qcoreapplication.h" #define QDATETIMEEDIT_TIME_MIN QTime(0, 0, 0, 0) #define QDATETIMEEDIT_TIME_MAX QTime(23, 59, 59, 999) @@ -72,6 +72,7 @@ QT_BEGIN_NAMESPACE class Q_CORE_EXPORT QDateTimeParser { + Q_DECLARE_TR_FUNCTIONS(QDateTimeParser) public: enum Context { FromString, diff --git a/src/corelib/tools/qpair.qdoc b/src/corelib/tools/qpair.qdoc index 48555ed6d1..4452d2f0b8 100644 --- a/src/corelib/tools/qpair.qdoc +++ b/src/corelib/tools/qpair.qdoc @@ -96,6 +96,30 @@ \sa qMakePair() */ +\fn void QPair::swap(QPair &other) + + \since 5.5 + Swaps this pair with \a other. + + Equivalent to + \code + qSwap(this->first, other.first); + qSwap(this->second, other.second); + \endcode + + Swap overloads are found in namespace \c std as well as via + argument-dependent lookup (ADL) in \c{T}'s namespace. +*/ + +/*! +\fn void swap(QPair<T1, T2> &lhs, QPair<T1, T2> &rhs) + \overload + \relates QPair + \since 5.5 + + Swaps \a lhs with \a rhs. +*/ + /*! \fn QPair::QPair(const QPair<TT1, TT2> &p) \since 5.2 @@ -108,37 +132,27 @@ */ /*! - \fn QPair &QPair::operator=(const QPair<TT1, TT2> &p) + \fn QPair::QPair(QPair<TT1, TT2> &&p) \since 5.2 - Copies the pair \a p onto this pair. - - \sa qMakePair() + Move-constructs a QPair instance, making it point to the same object that + \a p was pointing to. */ /*! - \fn void QPair::swap(QPair &other) - \since 5.5 - - Swaps this pair with \a other. + \fn QPair & QPair::operator=(const QPair<TT1, TT2> &p) + \since 5.2 - Equivalent to - \code - qSwap(this->first, other.first); - qSwap(this->second, other.second); - \endcode + Copies pair \a p into this pair. - Swap overloads are found in namespace \c std as well as via - argument-dependent lookup (ADL) in \c{T}'s namespace. + \sa qMakePair() */ /*! - \fn void swap(QPair<T1, T2> &lhs, QPair<T1, T2> &rhs) - \overload - \relates QPair - \since 5.5 + \fn QPair & QPair::operator=(QPair<TT1, TT2> &&p) + \since 5.2 - Swaps \a lhs with \a rhs. + Move-assigns pair \a p into this pair instance. */ /*! \fn bool operator==(const QPair<T1, T2> &p1, const QPair<T1, T2> &p2) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 18dd2d12c2..47cad6349c 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1830,6 +1830,13 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const } /*! + \fn QRegularExpression & QRegularExpression::operator=(QRegularExpression && re) + + Move-assigns the regular expression \a re to this object, and returns a reference + to the copy. Both the pattern and the pattern options are copied. +*/ + +/*! \fn bool QRegularExpression::operator!=(const QRegularExpression &re) const Returns \c true if the regular expression is different from \a re, or @@ -1956,6 +1963,13 @@ QRegularExpressionMatch &QRegularExpressionMatch::operator=(const QRegularExpres } /*! + \fn QRegularExpressionMatch &QRegularExpressionMatch::operator=(QRegularExpressionMatch &&match) + + Move-assigns the match result \a match to this object, and returns a reference + to the copy. +*/ + +/*! \fn void QRegularExpressionMatch::swap(QRegularExpressionMatch &other) Swaps the match result \a other with this match result. This @@ -2320,6 +2334,12 @@ QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(cons } /*! + \fn QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(QRegularExpressionMatchIterator &&iterator) + + Move-assigns the \a iterator to this object. +*/ + +/*! \fn void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator &other) Swaps the iterator \a other with this iterator object. This operation is diff --git a/src/corelib/tools/qscopedpointer.cpp b/src/corelib/tools/qscopedpointer.cpp index 35551f4061..c113c38aa2 100644 --- a/src/corelib/tools/qscopedpointer.cpp +++ b/src/corelib/tools/qscopedpointer.cpp @@ -255,6 +255,13 @@ QT_BEGIN_NAMESPACE */ /*! + \fn QScopedArrayPointer::QScopedArrayPointer(D * p, QtPrivate::QScopedArrayEnsureSameType<T, D>::Type = 0) + \internal + + Constructs a QScopedArrayPointer and stores the array of objects. +*/ + +/*! \fn T *QScopedArrayPointer::operator[](int i) Provides access to entry \a i of the scoped pointer's array of diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index c4f33deed6..495329b90d 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -127,6 +127,13 @@ */ /*! + \fn QSet::QSet(QSet && other) + + Move-constructs a QSet instance, making it point to the same object that \a other was pointing to. +*/ + + +/*! \fn QSet<T> &QSet::operator=(const QSet<T> &other) Assigns the \a other set to this set and returns a reference to @@ -134,6 +141,12 @@ */ /*! + \fn QSet<T> &QSet::operator=(QSet<T> &&other) + + Move-assigns the \a other set to this set. +*/ + +/*! \fn void QSet::swap(QSet<T> &other) Swaps set \a other with this set. This operation is very fast and diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h index 6e7ed40dff..e71eeb607e 100644 --- a/src/corelib/tools/qsize.h +++ b/src/corelib/tools/qsize.h @@ -54,15 +54,15 @@ public: Q_DECL_RELAXED_CONSTEXPR inline void setWidth(int w) Q_DECL_NOTHROW; Q_DECL_RELAXED_CONSTEXPR inline void setHeight(int h) Q_DECL_NOTHROW; void transpose() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QSize transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; inline void scale(int w, int h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; inline void scale(const QSize &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - QSize scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; + QSize scaled(int w, int h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + QSize scaled(const QSize &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; - Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QSize expandedTo(const QSize &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_DECL_CONSTEXPR inline QSize boundedTo(const QSize &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; Q_DECL_RELAXED_CONSTEXPR inline int &rwidth() Q_DECL_NOTHROW; Q_DECL_RELAXED_CONSTEXPR inline int &rheight() Q_DECL_NOTHROW; @@ -214,15 +214,15 @@ public: Q_DECL_RELAXED_CONSTEXPR inline void setWidth(qreal w) Q_DECL_NOTHROW; Q_DECL_RELAXED_CONSTEXPR inline void setHeight(qreal h) Q_DECL_NOTHROW; void transpose() Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QSizeF transposed() const Q_DECL_NOTHROW Q_REQUIRED_RESULT; inline void scale(qreal w, qreal h, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; inline void scale(const QSizeF &s, Qt::AspectRatioMode mode) Q_DECL_NOTHROW; - QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; - QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW; + QSizeF scaled(qreal w, qreal h, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + QSizeF scaled(const QSizeF &s, Qt::AspectRatioMode mode) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; - Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const Q_DECL_NOTHROW; - Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const Q_DECL_NOTHROW; + Q_DECL_CONSTEXPR inline QSizeF expandedTo(const QSizeF &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; + Q_DECL_CONSTEXPR inline QSizeF boundedTo(const QSizeF &) const Q_DECL_NOTHROW Q_REQUIRED_RESULT; Q_DECL_RELAXED_CONSTEXPR inline qreal &rwidth() Q_DECL_NOTHROW; Q_DECL_RELAXED_CONSTEXPR inline qreal &rheight() Q_DECL_NOTHROW; diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 373d25c6ad..2585686156 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2721,6 +2721,8 @@ bool QString::operator<(QLatin1String other) const /*! \fn bool QString::operator<=(const QString &s1, const QString &s2) + \relates Qstring + Returns \c true if string \a s1 is lexically less than or equal to string \a s2; otherwise returns \c false. @@ -2766,9 +2768,10 @@ bool QString::operator<(QLatin1String other) const */ /*! \fn bool QString::operator>(const QString &s1, const QString &s2) + \relates QString - Returns \c true if string \a s1 is lexically greater than string \a - s2; otherwise returns \c false. + Returns \c true if string \a s1 is lexically greater than string \a s2; + otherwise returns \c false. The comparison is based exclusively on the numeric Unicode values of the characters and is very fast, but is not what a human would @@ -8923,6 +8926,110 @@ bool operator<(const QStringRef &s1,const QStringRef &s2) */ /*! + \fn bool QStringRef::operator==(const char * s) const + + \overload operator==() + + The \a s byte array is converted to a QStringRef using the + fromUtf8() function. This function stops conversion at the + first NUL character found, or the end of the byte array. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is lexically equal to the parameter + string \a s. Otherwise returns \c false. + +*/ + +/*! + \fn bool QStringRef::operator!=(const char * s) const + + \overload operator!=() + + The \a s const char pointer is converted to a QStringRef using + the fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is not lexically equal to the parameter + string \a s. Otherwise returns \c false. +*/ + +/*! + \fn bool QStringRef::operator<(const char * s) const + + \overload operator<() + + The \a s const char pointer is converted to a QStringRef using + the fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is lexically smaller than the parameter + string \a s. Otherwise returns \c false. +*/ + +/*! + \fn bool QStringRef::operator<=(const char * s) const + + \overload operator<=() + + The \a s const char pointer is converted to a QStringRef using + the fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is lexically smaller than or equal to the parameter + string \a s. Otherwise returns \c false. +*/ + +/*! + \fn bool QStringRef::operator>(const char * s) const + + + \overload operator>() + + The \a s const char pointer is converted to a QStringRef using + the fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is lexically greater than the parameter + string \a s. Otherwise returns \c false. +*/ + +/*! + \fn bool QStringRef::operator>= (const char * s) const + + \overload operator>=() + + The \a s const char pointer is converted to a QStringRef using + the fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. + + Returns \c true if this string is lexically greater than or equal to the + parameter string \a s. Otherwise returns \c false. +*/ +/*! \typedef QString::Data \internal */ @@ -10332,7 +10439,6 @@ QString QString::toHtmlEscaped() const \endlist */ - /*! \internal */ diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 532b294c28..670d94279d 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -498,7 +498,7 @@ public: }; QString normalized(NormalizationForm mode, QChar::UnicodeVersion version = QChar::Unicode_Unassigned) const Q_REQUIRED_RESULT; - QString repeated(int times) const; + QString repeated(int times) const Q_REQUIRED_RESULT; const ushort *utf16() const; |