From c056e529c808f52e4d9e77b6112e805bdc7d660e Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Thu, 7 May 2015 10:33:39 +0200 Subject: [PATCH] Doc: added doc to undocumented functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-36985 Change-Id: Ia98654f88cf5da77245b3fcd903b860d12862fc2 Reviewed-by: Martin Smith Reviewed-by: Topi Reiniƶ --- src/corelib/codecs/qtextcodec.cpp | 23 ++++- src/corelib/global/qnamespace.qdoc | 17 ++++ src/corelib/tools/qcollator.cpp | 22 ++++- src/corelib/tools/qpair.qdoc | 60 +++++++----- src/corelib/tools/qregularexpression.cpp | 20 ++++ src/corelib/tools/qscopedpointer.cpp | 7 ++ src/corelib/tools/qset.qdoc | 13 +++ src/corelib/tools/qstring.cpp | 112 ++++++++++++++++++++++- 8 files changed, 240 insertions(+), 34 deletions(-) diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 050f8f207f..8fef333a77 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1147,13 +1147,30 @@ QTextCodec *QTextCodec::codecForUtfText(const QByteArray &ba) return codecForUtfText(ba, QTextCodec::codecForMib(/*Latin 1*/ 4)); } +/*! + \fn QTextCodec * QTextCodec::codecForTr () + \obsolete + + Returns the codec used by QObject::tr() on its argument. If this + function returns 0 (the default), tr() assumes Latin-1. + + \sa setCodecForTr() +*/ + +/*! + \fn QTextCodec::setCodecForTr ( QTextCodec * c ) + \obsolete + + Sets the codec used by QObject::tr() on its argument to c. If c + is 0 (the default), tr() assumes Latin-1. +*/ /*! \internal \since 4.3 - Determines whether the decoder encountered a failure while decoding the input. If - an error was encountered, the produced result is undefined, and gets converted as according - to the conversion flags. + Determines whether the decoder encountered a failure while decoding the + input. If an error was encountered, the produced result is undefined, and + gets converted as according to the conversion flags. */ bool QTextDecoder::hasFailure() const { diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index f9d968d47b..38ee8edb49 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -2907,6 +2907,23 @@ \sa QWidget::grabGesture(), QGraphicsObject::grabGesture() */ +/*! + \enum Qt::NativeGestureType + \since 5.2 + + This enum returns the gesture type. + + \value BeginNativeGesture Sent before gesture event stream. + \value EndNativeGesture Sent after gesture event stream. + \value PanNativeGesture Sent after a panning gesture. + Similar to a click-and-drag mouse movement. + \value ZoomNativeGesture Specifies the magnification delta in percent. + \value SmartZoomNativeGesture Boolean magnification state. + \value RotateNativeGesture Rotation delta in degrees. + \value SwipeNativeGesture Sent after a swipe movements. + +*/ + /*! \enum Qt::NavigationMode \since 4.6 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. @@ -366,6 +366,12 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) return *this; } +/*! + \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 @@ -376,6 +382,12 @@ QCollatorSortKey& QCollatorSortKey::operator=(const QCollatorSortKey &other) \sa QCollatorSortKey::compare() */ +/*! + \fn void QCollatorSortKey::swap(QCollatorSortKey & other) + + Swaps this collator key with \a other. +*/ + /*! \fn int QCollatorSortKey::compare(const QCollatorSortKey &otherKey) const 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 &lhs, QPair &rhs) + \overload + \relates QPair + \since 5.5 + + Swaps \a lhs with \a rhs. +*/ + /*! \fn QPair::QPair(const QPair &p) \since 5.2 @@ -108,37 +132,27 @@ */ /*! - \fn QPair &QPair::operator=(const QPair &p) + \fn QPair::QPair(QPair &&p) \since 5.2 - Copies the pair \a p onto this pair. + Move-constructs a QPair instance, making it point to the same object that + \a p was pointing to. +*/ + +/*! + \fn QPair & QPair::operator=(const QPair &p) + \since 5.2 + + Copies pair \a p into this pair. \sa qMakePair() */ /*! - \fn void QPair::swap(QPair &other) - \since 5.5 + \fn QPair & QPair::operator=(QPair &&p) + \since 5.2 - 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 &lhs, QPair &rhs) - \overload - \relates QPair - \since 5.5 - - Swaps \a lhs with \a rhs. + Move-assigns pair \a p into this pair instance. */ /*! \fn bool operator==(const QPair &p1, const QPair &p2) diff --git a/src/corelib/tools/qregularexpression.cpp b/src/corelib/tools/qregularexpression.cpp index 9950b90720..2e3c2ca79f 100644 --- a/src/corelib/tools/qregularexpression.cpp +++ b/src/corelib/tools/qregularexpression.cpp @@ -1828,6 +1828,13 @@ bool QRegularExpression::operator==(const QRegularExpression &re) const (d->pattern == re.d->pattern && d->patternOptions == re.d->patternOptions); } +/*! + \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 @@ -1939,6 +1946,13 @@ QRegularExpressionMatch &QRegularExpressionMatch::operator=(const QRegularExpres return *this; } +/*! + \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) @@ -2303,6 +2317,12 @@ QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(cons return *this; } +/*! + \fn QRegularExpressionMatchIterator &QRegularExpressionMatchIterator::operator=(QRegularExpressionMatchIterator &&iterator) + + Move-assigns the \a iterator to this object. +*/ + /*! \fn void QRegularExpressionMatchIterator::swap(QRegularExpressionMatchIterator &other) 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 @@ -254,6 +254,13 @@ QT_BEGIN_NAMESPACE Constructs a QScopedArrayPointer instance. */ +/*! + \fn QScopedArrayPointer::QScopedArrayPointer(D * p, QtPrivate::QScopedArrayEnsureSameType::Type = 0) + \internal + + Constructs a QScopedArrayPointer and stores the array of objects. +*/ + /*! \fn T *QScopedArrayPointer::operator[](int i) diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index 94cfa729f5..c38fe858fb 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -126,6 +126,13 @@ \sa operator=() */ +/*! + \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 &QSet::operator=(const QSet &other) @@ -133,6 +140,12 @@ this set. */ +/*! + \fn QSet &QSet::operator=(QSet &&other) + + Move-assigns the \a other set to this set. +*/ + /*! \fn void QSet::swap(QSet &other) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 51b1617cdc..c933e261cc 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -2661,6 +2661,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. @@ -2706,9 +2708,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 @@ -8795,6 +8798,110 @@ bool operator<(const QStringRef &s1,const QStringRef &s2) this string reference, returning the result. */ +/*! + \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 @@ -10205,7 +10312,6 @@ QString QString::toHtmlEscaped() const \endlist */ - /*! \internal */