diff --git a/src/corelib/io/qdebug.cpp b/src/corelib/io/qdebug.cpp index 1889a4c3a24..a7ce66ad148 100644 --- a/src/corelib/io/qdebug.cpp +++ b/src/corelib/io/qdebug.cpp @@ -855,6 +855,14 @@ QDebug &QDebug::resetFormat() \c T need to support streaming into QDebug. */ +/*! + \fn template QDebug operator<<(QDebug debug, const QMultiMap &map) + \relates QDebug + + Writes the contents of \a map to \a debug. Both \c Key and + \c T need to support streaming into QDebug. +*/ + /*! \fn template QDebug operator<<(QDebug debug, const std::map &map) \relates QDebug @@ -881,6 +889,14 @@ QDebug &QDebug::resetFormat() \c T need to support streaming into QDebug. */ +/*! + \fn template QDebug operator<<(QDebug debug, const QMultiHash &hash) + \relates QDebug + + Writes the contents of \a hash to \a debug. Both \c Key and + \c T need to support streaming into QDebug. +*/ + /*! \fn template QDebug operator<<(QDebug debug, const QPair &pair) \relates QDebug @@ -889,6 +905,22 @@ QDebug &QDebug::resetFormat() \c T2 need to support streaming into QDebug. */ +/*! + \fn template QDebug operator<<(QDebug debug, const std::pair &pair) + \relates QDebug + + Writes the contents of \a pair to \a debug. Both \c T1 and + \c T2 need to support streaming into QDebug. +*/ + +/*! + \fn template QDebug operator<<(QDebug debug, const QContiguousCache &cache) + \relates QDebug + + Writes the contents of \a cache to \a debug. \c T needs to + support streaming into QDebug. +*/ + /*! \fn template QDebug operator<<(QDebug debug, const QFlags &flags) \relates QDebug diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h index 1c72c43ec36..2b6522daa16 100644 --- a/src/corelib/io/qdebug.h +++ b/src/corelib/io/qdebug.h @@ -248,6 +248,8 @@ template using QDebugIfHasDebugStreamContainer = std::enable_if_t...>, QDebug>; +#ifndef Q_CLANG_QDOC + template inline QDebugIfHasDebugStreamContainer, T> operator<<(QDebug debug, const QList &vec) { @@ -336,6 +338,51 @@ inline QDebugIfHasDebugStream operator<<(QDebug debug, const QContiguousCache return debug; } +#else +template +QDebug operator<<(QDebug debug, const QList &list); + +template +QDebug operator<<(QDebug debug, const QVarLengthArray &array); + +template +QDebug operator<<(QDebug debug, const std::vector &vec); + +template +QDebug operator<<(QDebug debug, const std::list &vec); + +template +QDebug operator<<(QDebug debug, const std::map &map); + +template +QDebug operator<<(QDebug debug, const std::multimap &map); + +template +QDebug operator<<(QDebug debug, const QMap &map); + +template +QDebug operator<<(QDebug debug, const QMultiMap( &map); + +template +QDebug operator<<(QDebug debug, const QHash &hash); + +template +QDebug operator<<(QDebug debug, const QMultiHash &hash); + +template +QDebug operator<<(QDebug debug, const QSet &set); + +template +QDebug operator<<(QDebug debug, const QPair &pair); + +template +QDebug operator<<(QDebug debug, const std::pair &pair); + +template +QDebug operator<<(QDebug debug, const QContiguousCache &cache); + +#endif // Q_CLANG_QDOC + template inline QDebug operator<<(QDebug debug, const QSharedPointer &ptr) { diff --git a/src/corelib/serialization/qdatastream.h b/src/corelib/serialization/qdatastream.h index 24b5d826060..a21cf4ebbfb 100644 --- a/src/corelib/serialization/qdatastream.h +++ b/src/corelib/serialization/qdatastream.h @@ -434,6 +434,8 @@ typename std::enable_if_t::value, QDataStream &> operator>>(QDataStream &s, T &t) { return s >> reinterpret_cast::type &>(t); } +#ifndef Q_CLANG_QDOC + template inline QDataStreamIfHasIStreamOperatorsContainer, T> operator>>(QDataStream &s, QList &v) { @@ -523,6 +525,52 @@ inline QDataStreamIfHasOStreamOperators operator<<(QDataStream& s, const } #endif +#else + +template +QDataStream &operator>>(QDataStream &s, QList &l); + +template +QDataStream &operator<<(QDataStream &s, const QList &l); + +template +QDataStream &operator>>(QDataStream &s, QSet &set); + +template +QDataStream &operator<<(QDataStream &s, const QSet &set); + +template +QDataStream &operator>>(QDataStream &s, QHash &hash); + +template +QDataStream &operator<<(QDataStream &s, const QHash &hash); + +template +QDataStream &operator>>(QDataStream &s, QMultiHash &hash); + +template +QDataStream &operator<<(QDataStream &s, const QMultiHash &hash); + +template +QDataStream &operator>>(QDataStream &s, QMap &map); + +template +QDataStream &operator<<(QDataStream &s, const QMap &map); + +template +QDataStream &operator>>(QDataStream &s, QMultiMap &map); + +template +QDataStream &operator<<(QDataStream &s, const QMultiMap &map); + +template +QDataStream &operator>>(QDataStream& s, std::pair &p); + +template +QDataStream &operator<<(QDataStream& s, const std::pair &p); + +#endif // Q_CLANG_QDOC + inline QDataStream &operator>>(QDataStream &s, QKeyCombination &combination) { int combined; diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h index f0f5ac5dcbe..62ebfa0658c 100644 --- a/src/corelib/tools/qcontiguouscache.h +++ b/src/corelib/tools/qcontiguouscache.h @@ -99,6 +99,7 @@ public: QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QContiguousCache) inline void swap(QContiguousCache &other) noexcept { qSwap(d, other.d); } +#ifndef Q_CLANG_QDOC template QTypeTraits::compare_eq_result operator==(const QContiguousCache &other) const { @@ -117,6 +118,10 @@ public: template QTypeTraits::compare_eq_result operator!=(const QContiguousCache &other) const { return !(*this == other); } +#else + bool operator==(const QContiguousCache &other) const; + bool operator!=(const QContiguousCache &other) const; +#endif // Q_CLANG_QDOC inline qsizetype capacity() const {return d->alloc; } inline qsizetype count() const { return d->count; } diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a738865a175..fb4b3f3198e 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -830,6 +830,7 @@ public: #endif void swap(QHash &other) noexcept { qSwap(d, other.d); } +#ifndef Q_CLANG_QDOC template QTypeTraits::compare_eq_result_container operator==(const QHash &other) const noexcept { @@ -849,6 +850,10 @@ public: template QTypeTraits::compare_eq_result_container operator!=(const QHash &other) const noexcept { return !(*this == other); } +#else + bool operator==(const QHash &other) const; + bool operator!=(const QHash &other) const; +#endif // Q_CLANG_QDOC inline qsizetype size() const noexcept { return d ? qsizetype(d->size) : 0; } inline bool isEmpty() const noexcept { return !d || d->size == 0; } diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h index 0b33fc1d7b1..9b2a56a66a0 100644 --- a/src/corelib/tools/qlist.h +++ b/src/corelib/tools/qlist.h @@ -356,6 +356,7 @@ public: void swap(QList &other) noexcept { qSwap(d, other.d); } +#ifndef Q_CLANG_QDOC template QTypeTraits::compare_eq_result_container operator==(const QList &other) const { @@ -404,6 +405,14 @@ public: { return !(*this < other); } +#else + bool operator==(const QList &other) const; + bool operator!=(const QList &other) const; + bool operator<(const QList &other) const; + bool operator>(const QList &other) const; + bool operator<=(const QList &other) const; + bool operator>=(const QList &other) const; +#endif // Q_CLANG_QDOC qsizetype size() const noexcept { return d->size; } qsizetype count() const noexcept { return size(); } diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h index b2053127fef..7fd6e4d705f 100644 --- a/src/corelib/tools/qmap.h +++ b/src/corelib/tools/qmap.h @@ -276,6 +276,7 @@ public: return {}; } +#ifndef Q_CLANG_QDOC template friend QTypeTraits::compare_eq_result_container operator==(const QMap &lhs, const QMap &rhs) { @@ -293,6 +294,10 @@ public: return !(lhs == rhs); } // TODO: add the other comparison operators; std::map has them. +#else + friend bool operator==(const QMap &lhs, const QMap &rhs); + friend bool operator!=(const QMap &lhs, const QMap &rhs); +#endif // Q_CLANG_QDOC size_type size() const { return d ? size_type(d->m.size()) : size_type(0); } @@ -904,6 +909,7 @@ public: return {}; } +#ifndef Q_CLANG_QDOC template friend QTypeTraits::compare_eq_result_container operator==(const QMultiMap &lhs, const QMultiMap &rhs) { @@ -921,6 +927,10 @@ public: return !(lhs == rhs); } // TODO: add the other comparison operators; std::multimap has them. +#else + friend bool operator==(const QMultiMap &lhs, const QMultiMap &rhs); + friend bool operator!=(const QMultiMap &lhs, const QMultiMap &rhs); +#endif // Q_CLANG_QDOC size_type size() const { return d ? size_type(d->m.size()) : size_type(0); } diff --git a/src/corelib/tools/qset.h b/src/corelib/tools/qset.h index 9aecbff5bce..299851bf8d6 100644 --- a/src/corelib/tools/qset.h +++ b/src/corelib/tools/qset.h @@ -71,12 +71,17 @@ public: inline void swap(QSet &other) noexcept { q_hash.swap(other.q_hash); } +#ifndef Q_CLANG_QDOC template QTypeTraits::compare_eq_result_container operator==(const QSet &other) const { return q_hash == other.q_hash; } template QTypeTraits::compare_eq_result_container operator!=(const QSet &other) const { return q_hash != other.q_hash; } +#else + bool operator==(const QSet &other) const; + bool operator!=(const QSet &other) const; +#endif inline qsizetype size() const { return q_hash.size(); }