diff --git a/src/corelib/serialization/qcborvalue.cpp b/src/corelib/serialization/qcborvalue.cpp index 935f761585f..73ac3125e4b 100644 --- a/src/corelib/serialization/qcborvalue.cpp +++ b/src/corelib/serialization/qcborvalue.cpp @@ -1990,12 +1990,10 @@ QUuid QCborValue::toUuid(const QUuid &defaultValue) const return QUuid::fromRfc4122(byteData->asByteArrayView()); } -QCborArray QCborValue::toArray() const -{ - return toArray(QCborArray()); -} - /*! + \fn QCborArray QCborValue::toArray() const + \fn QCborArray QCborValue::toArray(const QCborArray &defaultValue) const + Returns the array value stored in this QCborValue, if it is of the array type. Otherwise, it returns \a defaultValue. @@ -2004,6 +2002,25 @@ QCborArray QCborValue::toArray() const \sa isArray(), isByteArray(), isMap(), isContainer(), toMap() */ + +/*! + \fn QCborArray QCborValueRef::toArray() const + \fn QCborArray QCborValueRef::toArray(const QCborArray &defaultValue) const + \internal + + Returns the array value stored in this QCborValue, if it is of the array + type. Otherwise, it returns \a defaultValue. + + Note that this function performs no conversion from other types to + QCborArray. + + \sa isArray(), isByteArray(), isMap(), isContainer(), toMap() + */ +QCborArray QCborValue::toArray() const +{ + return toArray(QCborArray()); +} + QCborArray QCborValue::toArray(const QCborArray &defaultValue) const { if (!isArray()) @@ -2015,12 +2032,10 @@ QCborArray QCborValue::toArray(const QCborArray &defaultValue) const return dd ? QCborArray(*dd) : defaultValue; } -QCborMap QCborValue::toMap() const -{ - return toMap(QCborMap()); -} - /*! + \fn QCborMap QCborValue::toMap() const + \fn QCborMap QCborValue::toMap(const QCborMap &defaultValue) const + Returns the map value stored in this QCborValue, if it is of the map type. Otherwise, it returns \a defaultValue. @@ -2029,6 +2044,25 @@ QCborMap QCborValue::toMap() const \sa isMap(), isArray(), isContainer(), toArray() */ + +/*! + \fn QCborMap QCborValueRef::toMap() const + \fn QCborMap QCborValueRef::toMap(const QCborMap &defaultValue) const + \internal + + Returns the map value stored in this QCborValue, if it is of the map type. + Otherwise, it returns \a defaultValue. + + Note that this function performs no conversion from other types to + QCborMap. + + \sa isMap(), isArray(), isContainer(), toArray() + */ +QCborMap QCborValue::toMap() const +{ + return toMap(QCborMap()); +} + QCborMap QCborValue::toMap(const QCborMap &defaultValue) const { if (!isMap()) diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h index 0aacbbe66ee..5c7f9a3791e 100644 --- a/src/corelib/serialization/qcborvalue.h +++ b/src/corelib/serialization/qcborvalue.h @@ -237,16 +237,11 @@ public: QRegularExpression toRegularExpression(const QRegularExpression &defaultValue = {}) const; QUuid toUuid(const QUuid &defaultValue = {}) const; -#ifdef Q_QDOC - QCborArray toArray(const QCborArray &a = {}) const; - QCborMap toMap(const QCborMap &m = {}) const; -#else // only forward-declared, need split functions QCborArray toArray() const; QCborArray toArray(const QCborArray &defaultValue) const; QCborMap toMap() const; QCborMap toMap(const QCborMap &defaultValue) const; -#endif const QCborValue operator[](const QString &key) const; const QCborValue operator[](QLatin1String key) const; @@ -386,16 +381,11 @@ public: QUuid toUuid(const QUuid &defaultValue = {}) const { return concrete().toUuid(defaultValue); } -#ifdef Q_QDOC - QCborArray toArray(const QCborArray &a = {}) const; - QCborMap toMap(const QCborMap &m = {}) const; -#else // only forward-declared, need split functions. Implemented in qcbor{array,map}.h QCborArray toArray() const; QCborArray toArray(const QCborArray &a) const; QCborMap toMap() const; QCborMap toMap(const QCborMap &m) const; -#endif int compare(const QCborValue &other) const { return concrete().compare(other); }