From b9c1ca9b60e3bdfe1371c813750ce31383bcc25f Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sat, 27 Mar 2021 14:28:43 +0100 Subject: doc: Fix warnings for BitsOfBinary* classes --- src/base/QXmppBitsOfBinaryData.cpp | 88 +++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 10 deletions(-) (limited to 'src/base/QXmppBitsOfBinaryData.cpp') diff --git a/src/base/QXmppBitsOfBinaryData.cpp b/src/base/QXmppBitsOfBinaryData.cpp index 77dc9131..14797fb3 100644 --- a/src/base/QXmppBitsOfBinaryData.cpp +++ b/src/base/QXmppBitsOfBinaryData.cpp @@ -49,88 +49,114 @@ QXmppBitsOfBinaryDataPrivate::QXmppBitsOfBinaryDataPrivate() { } +/// +/// \class QXmppBitsOfBinaryData +/// +/// QXmppBitsOfBinaryData represents a data element for \xep{0231, Bits of +/// Binary}. It can be used as an extension in other stanzas. +/// +/// \see QXmppBitsOfBinaryIq, QXmppBitsOfBinaryDataList +/// +/// \since QXmpp 1.2 +/// + +/// +/// Default constructor +/// QXmppBitsOfBinaryData::QXmppBitsOfBinaryData() : d(new QXmppBitsOfBinaryDataPrivate) { } +/// Default copy-constructor QXmppBitsOfBinaryData::QXmppBitsOfBinaryData(const QXmppBitsOfBinaryData &) = default; +/// Default destructor QXmppBitsOfBinaryData::~QXmppBitsOfBinaryData() = default; +/// Default assignment operator QXmppBitsOfBinaryData &QXmppBitsOfBinaryData::operator=(const QXmppBitsOfBinaryData &) = default; +/// /// Returns the content id of the data - +/// QXmppBitsOfBinaryContentId QXmppBitsOfBinaryData::cid() const { return d->cid; } +/// /// Sets the content id of the data - +/// void QXmppBitsOfBinaryData::setCid(const QXmppBitsOfBinaryContentId &cid) { d->cid = cid; } +/// /// Returns the time in seconds the data should be cached /// /// A value of 0 means that the data should not be cached, while a value of -1 /// means that nothing was set. /// /// The default value is -1. - +/// int QXmppBitsOfBinaryData::maxAge() const { return d->maxAge; } +/// /// Sets the time in seconds the data should be cached /// /// A value of 0 means that the data should not be cached, while a value of -1 /// means that nothing was set. /// /// The default value is -1. - +/// void QXmppBitsOfBinaryData::setMaxAge(int maxAge) { d->maxAge = maxAge; } +/// /// Returns the content type of the data /// /// \note This is the advertised content type and may differ from the actual /// content type of the data. - +/// QMimeType QXmppBitsOfBinaryData::contentType() const { return d->contentType; } +/// /// Sets the content type of the data - +/// void QXmppBitsOfBinaryData::setContentType(const QMimeType &contentType) { d->contentType = contentType; } +/// /// Returns the included data in binary form - +/// QByteArray QXmppBitsOfBinaryData::data() const { return d->data; } +/// /// Sets the data in binary form - +/// void QXmppBitsOfBinaryData::setData(const QByteArray &data) { d->data = data; } -/// Returns true, if \c element is a \xep{0231}: Bits of Binary data element - +/// +/// Returns true, if \c element is a \xep{0231, Bits of Binary} data element +/// bool QXmppBitsOfBinaryData::isBitsOfBinaryData(const QDomElement &element) { return element.tagName() == QStringLiteral("data") && element.namespaceURI() == ns_bob; @@ -158,6 +184,9 @@ void QXmppBitsOfBinaryData::toXmlElementFromChild(QXmlStreamWriter *writer) cons } /// \endcond +/// +/// Returns true, if cid, maxAge, contentType and data equal. +/// bool QXmppBitsOfBinaryData::operator==(const QXmppBitsOfBinaryData &other) const { return d->cid == other.cid() && @@ -165,3 +194,42 @@ bool QXmppBitsOfBinaryData::operator==(const QXmppBitsOfBinaryData &other) const d->contentType == other.contentType() && d->data == other.data(); } + +/// +/// \class QXmppBitsOfBinaryDataList +/// +/// QXmppBitsOfBinaryDataList represents a list of data elements from +/// \xep{0231, Bits of Binary}. +/// +/// \since QXmpp 1.2 +/// + +QXmppBitsOfBinaryDataList::QXmppBitsOfBinaryDataList() = default; + +QXmppBitsOfBinaryDataList::~QXmppBitsOfBinaryDataList() = default; + +/// \cond +void QXmppBitsOfBinaryDataList::parse(const QDomElement &element) +{ + // clear previous data elements + clear(); + + // parse all elements + QDomElement child = element.firstChildElement(); + while (!child.isNull()) { + if (QXmppBitsOfBinaryData::isBitsOfBinaryData(child)) { + QXmppBitsOfBinaryData data; + data.parseElementFromChild(child); + append(data); + } + child = child.nextSiblingElement(); + } +} + +void QXmppBitsOfBinaryDataList::toXml(QXmlStreamWriter *writer) const +{ + for (const auto &bitsOfBinaryData : *this) { + bitsOfBinaryData.toXmlElementFromChild(writer); + } +} +/// \endcond -- cgit v1.2.3