aboutsummaryrefslogtreecommitdiff
path: root/src/base/QXmppBitsOfBinaryData.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2021-03-27 14:28:43 +0100
committerLinus Jahn <lnj@kaidan.im>2021-03-28 00:09:13 +0100
commitb9c1ca9b60e3bdfe1371c813750ce31383bcc25f (patch)
tree3b7943d00f08104717a929dfd35ca01fab56fd77 /src/base/QXmppBitsOfBinaryData.cpp
parent5c6a6b8385df6b3f9cc640781eb76900e9364015 (diff)
downloadqxmpp-b9c1ca9b60e3bdfe1371c813750ce31383bcc25f.tar.gz
doc: Fix warnings for BitsOfBinary* classes
Diffstat (limited to 'src/base/QXmppBitsOfBinaryData.cpp')
-rw-r--r--src/base/QXmppBitsOfBinaryData.cpp88
1 files changed, 78 insertions, 10 deletions
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 <data/> 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