Create qdoc macros for C++ class docs 1.1: member-swap(), traditional phrasing
We have some patterns for how to document certain functions, but we also vary the sentences a lot, and you have to look up one documentation piece and copy it, essentially. If we ever want to change them, we end up with shotgun surgery. So apply DRY to the documentation and start a collection of macros to help with repetitive C++ class documentation tasks. The first macro is for member-swap(), and the first patch is for documentation that used the traditional phrasing ("Swaps the X \a other with this X."). This doesn't change the documentation, except as follows: * adds the "very fast and never fails" blurb, if it was missing * changes the function's argument name to `other`, as required by the macro. Task-number: QTBUG-129573 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: Ib494bd218334724b3b43796ba6f71fb52b83aa94 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
152cb77f83
commit
3ccb4ce781
15
doc/global/cpp-doc-macros.qdocconf
Normal file
15
doc/global/cpp-doc-macros.qdocconf
Normal file
@ -0,0 +1,15 @@
|
||||
# Macros for documenting repetitive aspects of C++ classes
|
||||
|
||||
# Sort groups alphabetically
|
||||
|
||||
#
|
||||
# Macros for swap()
|
||||
#
|
||||
|
||||
# \memberswap{what}
|
||||
# what - a prose version of the type of object (e.g. "string", "collator", "pen")
|
||||
# The function's argument name must be \a other.
|
||||
macro.memberswap = \
|
||||
"\n\n" \
|
||||
"Swaps \1 \\a{other} with this \1. This operation is very fast and never fails." \
|
||||
"\n\n"
|
@ -174,3 +174,4 @@ macro.qtpolicydeprecatedbehavior = "\\note The \\c{OLD} behavior of a policy is
|
||||
macro.techpreview = "(Technical preview)\n\n\\meta status {Technical preview}\n\\ingroup tech_preview\n"
|
||||
|
||||
include(grid.qdocconf)
|
||||
include(cpp-doc-macros.qdocconf)
|
||||
|
@ -191,10 +191,7 @@ QTemporaryDir::QTemporaryDir(const QString &templatePath)
|
||||
|
||||
/*!
|
||||
\fn void QTemporaryDir::swap(QTemporaryDir &other)
|
||||
|
||||
Swaps temporary-dir \a other with this temporary-dir. This operation is
|
||||
very fast and never fails.
|
||||
|
||||
\memberswap{temporary-dir}
|
||||
\since 6.4
|
||||
*/
|
||||
|
||||
|
@ -3229,9 +3229,7 @@ QUrl &QUrl::operator =(const QString &url)
|
||||
/*!
|
||||
\fn void QUrl::swap(QUrl &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps URL \a other with this URL. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{URL}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -87,9 +87,7 @@ QT_BEGIN_NAMESPACE
|
||||
/*!
|
||||
\fn QBasicTimer::swap(QBasicTimer &other)
|
||||
\since 5.14
|
||||
|
||||
Swaps the timer \a other with this timer.
|
||||
This operation is very fast and never fails.
|
||||
\memberswap{timer}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -729,8 +729,7 @@ QDeadlineTimer operator+(QDeadlineTimer dt, qint64 msecs)
|
||||
|
||||
/*!
|
||||
\fn void QDeadlineTimer::swap(QDeadlineTimer &other)
|
||||
|
||||
Swaps this deadline timer with the \a other deadline timer.
|
||||
\memberswap{deadline timer}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1074,9 +1074,7 @@ QVariant &QVariant::operator=(const QVariant &variant)
|
||||
/*!
|
||||
\fn void QVariant::swap(QVariant &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps variant \a other with this variant. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{variant}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1397,9 +1397,7 @@ QByteArray &QByteArray::operator=(const char *str)
|
||||
|
||||
/*! \fn void QByteArray::swap(QByteArray &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps byte array \a other with this byte array. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{byte array}
|
||||
*/
|
||||
|
||||
/*! \fn qsizetype QByteArray::size() const
|
||||
|
@ -1251,9 +1251,7 @@ bool QLocale::equals(const QLocale &other) const noexcept
|
||||
/*!
|
||||
\fn void QLocale::swap(QLocale &other)
|
||||
\since 5.6
|
||||
|
||||
Swaps locale \a other with this locale. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{locale}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1389,9 +1389,7 @@ QRegularExpression &QRegularExpression::operator=(const QRegularExpression &re)
|
||||
|
||||
/*!
|
||||
\fn void QRegularExpression::swap(QRegularExpression &other)
|
||||
|
||||
Swaps the regular expression \a other with this regular expression. This
|
||||
operation is very fast and never fails.
|
||||
\memberswap{reglar expression}
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -2160,9 +2158,7 @@ QRegularExpressionMatch &QRegularExpressionMatch::operator=(const QRegularExpres
|
||||
|
||||
/*!
|
||||
\fn void QRegularExpressionMatch::swap(QRegularExpressionMatch &other)
|
||||
|
||||
Swaps the match result \a other with this match result. This
|
||||
operation is very fast and never fails.
|
||||
\memberswap{match result}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -2596,9 +2596,7 @@ QString::QString(QChar ch)
|
||||
|
||||
/*! \fn void QString::swap(QString &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps string \a other with this string. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{string}
|
||||
*/
|
||||
|
||||
/*! \fn void QString::detach()
|
||||
|
@ -289,6 +289,5 @@
|
||||
*/
|
||||
|
||||
/*! \fn template<typename T> void QPromise<T>::swap(QPromise<T> &other) noexcept
|
||||
|
||||
Swaps promise \a other with this promise. This operation is very fast and never fails.
|
||||
\memberswap{promise}
|
||||
*/
|
||||
|
@ -496,9 +496,7 @@ quint32 QBitArray::toUInt32(QSysInfo::Endian endianness, bool *ok) const noexcep
|
||||
|
||||
/*! \fn void QBitArray::swap(QBitArray &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps bit array \a other with this bit array. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{bit array}
|
||||
*/
|
||||
|
||||
/*! \fn bool QBitArray::operator==(const QBitArray &lhs, const QBitArray &rhs)
|
||||
|
@ -197,9 +197,7 @@ QCommandLineOption &QCommandLineOption::operator=(const QCommandLineOption &othe
|
||||
|
||||
/*!
|
||||
\fn void QCommandLineOption::swap(QCommandLineOption &other)
|
||||
|
||||
Swaps option \a other with this option. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{option}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -164,9 +164,7 @@ void QContiguousCacheData::freeData(QContiguousCacheData *data)
|
||||
|
||||
/*! \fn template<typename T> void QContiguousCache<T>::swap(QContiguousCache<T> &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps cache \a other with this cache. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{cache}
|
||||
*/
|
||||
|
||||
/*! \fn template<typename T> bool QContiguousCache<T>::operator==(const QContiguousCache<T> &other) const
|
||||
|
@ -467,10 +467,7 @@ QCryptographicHash::~QCryptographicHash()
|
||||
|
||||
/*!
|
||||
\fn void QCryptographicHash::swap(QCryptographicHash &other)
|
||||
|
||||
Swaps cryptographic hash \a other with this cryptographic hash. This
|
||||
operation is very fast and never fails.
|
||||
|
||||
\memberswap{cryptographic hash}
|
||||
\since 6.5
|
||||
*/
|
||||
|
||||
@ -1479,10 +1476,7 @@ QMessageAuthenticationCode::~QMessageAuthenticationCode()
|
||||
|
||||
/*!
|
||||
\fn void QMessageAuthenticationCode::swap(QMessageAuthenticationCode &other)
|
||||
|
||||
Swaps message authentication code \a other with this message authentication
|
||||
code. This operation is very fast and never fails.
|
||||
|
||||
\memberswap{message authentication code}
|
||||
\since 6.6
|
||||
*/
|
||||
|
||||
|
@ -1147,9 +1147,7 @@ QEasingCurve::~QEasingCurve()
|
||||
/*!
|
||||
\fn void QEasingCurve::swap(QEasingCurve &other)
|
||||
\since 5.0
|
||||
|
||||
Swaps curve \a other with this curve. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{curve}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1795,16 +1795,12 @@ size_t qHash(long double key, size_t seed) noexcept
|
||||
|
||||
/*! \fn template <class Key, class T> void QHash<Key, T>::swap(QHash &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps hash \a other with this hash. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{hash}
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> void QMultiHash<Key, T>::swap(QMultiHash &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps hash \a other with this hash. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{multi-hash}
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> bool QHash<Key, T>::operator==(const QHash &lhs, const QHash &rhs)
|
||||
|
@ -342,9 +342,7 @@
|
||||
|
||||
/*! \fn template <typename T> void QList<T>::swap(QList<T> &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps list \a other with this list. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{list}
|
||||
*/
|
||||
|
||||
/*! \fn template <typename T> void QList<T>::swapItemsAt(qsizetype i, qsizetype j)
|
||||
|
@ -172,9 +172,7 @@
|
||||
|
||||
/*! \fn template <class Key, class T> void QMap<Key, T>::swap(QMap<Key, T> &other) noexcept
|
||||
\since 4.8
|
||||
|
||||
Swaps map \a other with this map. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{map}
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> QMap<Key, T>::QMap(std::initializer_list<std::pair<Key,T> > list)
|
||||
|
@ -218,9 +218,7 @@
|
||||
|
||||
/*! \fn template <class Key, class T> void QMultiMap<Key, T>::swap(QMultiMap<Key, T> &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps multi map \a other with this multi map. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{multi map}
|
||||
*/
|
||||
|
||||
/*! \fn template<class Key, class T> bool QMultiMap<Key, T>::operator==(const QMultiMap<Key, T> &lhs, const QMultiMap<Key, T> &rhs)
|
||||
|
@ -43,9 +43,7 @@
|
||||
/*!
|
||||
\fn template <class T> void QQueue<T>::swap(QQueue<T> &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps queue \a other with this queue. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{queue}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -100,9 +100,7 @@
|
||||
|
||||
/*!
|
||||
\fn template <class T> void QSet<T>::swap(QSet<T> &other)
|
||||
|
||||
Swaps set \a other with this set. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{set}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -43,9 +43,7 @@
|
||||
/*!
|
||||
\fn template<class T> void QStack<T>::swap(QStack<T> &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps stack \a other with this stack. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{stack}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -129,9 +129,7 @@ QBitmap::QBitmap(const QString& fileName, const char *format)
|
||||
|
||||
/*!
|
||||
\fn void QBitmap::swap(QBitmap &other)
|
||||
|
||||
Swaps bitmap \a other with this bitmap. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{bitmap}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -827,9 +827,7 @@ QIcon &QIcon::operator=(const QIcon &other)
|
||||
|
||||
/*!
|
||||
\fn void QIcon::swap(QIcon &other)
|
||||
|
||||
Swaps icon \a other with this icon. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{icon}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -1091,9 +1091,7 @@ QImage &QImage::operator=(const QImage &image)
|
||||
|
||||
/*!
|
||||
\fn void QImage::swap(QImage &other)
|
||||
|
||||
Swaps image \a other with this image. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{image}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -925,9 +925,7 @@ QPicture& QPicture::operator=(const QPicture &p)
|
||||
|
||||
/*!
|
||||
\fn void QPicture::swap(QPicture &other)
|
||||
|
||||
Swaps picture \a other with this picture. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{picture}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -368,9 +368,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
|
||||
|
||||
/*!
|
||||
\fn void QPixmap::swap(QPixmap &other)
|
||||
|
||||
Swaps pixmap \a other with this pixmap. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{pixmap}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -137,8 +137,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
/*!
|
||||
\fn void QCursor::swap(QCursor &other)
|
||||
|
||||
Swaps this cursor with the \a other cursor.
|
||||
\memberswap{cursor}
|
||||
|
||||
\since 5.7
|
||||
*/
|
||||
|
@ -1385,9 +1385,7 @@ QKeySequence &QKeySequence::operator=(const QKeySequence &other)
|
||||
/*!
|
||||
\fn void QKeySequence::swap(QKeySequence &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps key sequence \a other with this key sequence. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{key sequence}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -625,9 +625,7 @@ QBrush &QBrush::operator=(const QBrush &b)
|
||||
/*!
|
||||
\fn void QBrush::swap(QBrush &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps brush \a other with this brush. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{brush}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -783,9 +783,7 @@ QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QColorSpacePrivate)
|
||||
QColorSpace::QColorSpace(const QColorSpace &colorSpace) noexcept = default;
|
||||
|
||||
/*! \fn void QColorSpace::swap(QColorSpace &other)
|
||||
|
||||
Swaps color space \a other with this color space. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{color space}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -563,9 +563,7 @@ QPainterPath &QPainterPath::operator=(const QPainterPath &other)
|
||||
/*!
|
||||
\fn void QPainterPath::swap(QPainterPath &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps painter path \a other with this painter path. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{painer path}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -80,9 +80,7 @@ QPdfOutputIntent::~QPdfOutputIntent() = default;
|
||||
|
||||
/*!
|
||||
\fn void QPdfOutputIntent::swap(QPdfOutputIntent &other) noexcept
|
||||
|
||||
Swaps the output intent \a other with this output intent. This
|
||||
operation is very fast and never fails.
|
||||
\memberswap{output intent}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -341,9 +341,7 @@ QPen &QPen::operator=(const QPen &p) noexcept
|
||||
/*!
|
||||
\fn void QPen::swap(QPen &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps pen \a other with this pen. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{pen}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -623,17 +623,13 @@ QPolygon QPolygonF::toPolygon() const
|
||||
/*!
|
||||
\fn void QPolygon::swap(QPolygon &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps polygon \a other with this polygon. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{polygon}
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QPolygonF::swap(QPolygonF &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps polygon \a other with this polygon. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{polygon}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -296,9 +296,7 @@ void QRegion::exec(const QByteArray &buffer, int ver, QDataStream::ByteOrder byt
|
||||
/*!
|
||||
\fn void QRegion::swap(QRegion &other)
|
||||
\since 4.8
|
||||
|
||||
Swaps region \a other with this region. This operation is very
|
||||
fast and never fails.
|
||||
\memberswap{region}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -332,9 +332,7 @@ QShader::~QShader()
|
||||
/*!
|
||||
\fn void QShader::swap(QShader &other)
|
||||
\since 6.7
|
||||
|
||||
Swaps shader \a other with this shader. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{shader}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -198,8 +198,7 @@ bool QHstsPolicy::isExpired() const
|
||||
|
||||
/*!
|
||||
\fn void QHstsPolicy::swap(QHstsPolicy &other)
|
||||
|
||||
Swaps this policy with the \a other policy.
|
||||
\memberswap{policy}
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -281,7 +281,7 @@ unsigned QHttp2Configuration::maxConcurrentStreams() const
|
||||
}
|
||||
|
||||
/*!
|
||||
Swaps this configuration with the \a other configuration.
|
||||
\memberswap{configuration}
|
||||
*/
|
||||
void QHttp2Configuration::swap(QHttp2Configuration &other) noexcept
|
||||
{
|
||||
|
@ -249,10 +249,7 @@ int QHostInfo::lookupHost(const QString &name, const QObject *receiver, const ch
|
||||
|
||||
/*!
|
||||
\fn void QHostInfo::swap(QHostInfo &other)
|
||||
|
||||
Swaps host-info \a other with this host-info. This operation is
|
||||
very fast and never fails.
|
||||
|
||||
\memberswap{host-info}
|
||||
\since 5.10
|
||||
*/
|
||||
|
||||
|
@ -216,9 +216,7 @@ QOpenGLBuffer &QOpenGLBuffer::operator=(const QOpenGLBuffer &other)
|
||||
/*!
|
||||
\fn QOpenGLBuffer::swap(QOpenGLBuffer &other)
|
||||
\since 6.5
|
||||
|
||||
Swaps buffer \a other with this buffer. This operation is very fast and
|
||||
never fails.
|
||||
\memberswap{buffer}
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -846,10 +846,8 @@ QOpenGLDebugMessage &QOpenGLDebugMessage::operator=(const QOpenGLDebugMessage &d
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void QOpenGLDebugMessage::swap(QOpenGLDebugMessage &debugMessage)
|
||||
|
||||
Swaps the message \a debugMessage with this message. This operation is very
|
||||
fast and never fails.
|
||||
\fn void QOpenGLDebugMessage::swap(QOpenGLDebugMessage &other)
|
||||
\memberswap{message]
|
||||
*/
|
||||
|
||||
/*!
|
||||
|
@ -78,9 +78,7 @@ QT_DEFINE_QESDP_SPECIALIZATION_DTOR(QSqlErrorPrivate)
|
||||
*/
|
||||
|
||||
/*! \fn QSqlError::swap(QSqlError &other)
|
||||
Swaps error \a other with this error. This operation is very fast
|
||||
and never fails.
|
||||
|
||||
\memberswap{error}
|
||||
\since 5.10
|
||||
*/
|
||||
|
||||
|
@ -130,9 +130,7 @@ QSqlRecord::QSqlRecord(const QSqlRecord &other)
|
||||
/*!
|
||||
\fn void QSqlRecord::swap(QSqlRecord &other)
|
||||
\since 6.6
|
||||
|
||||
Swaps SQL record \a other with this SQL record. This operation is very fast
|
||||
and never fails.
|
||||
\memberswap{SQL record}
|
||||
*/
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user