Commit 2dca4ef1 authored by Thiago Macieira's avatar Thiago Macieira
Browse files

CBOR: Add missing clear() methods to the two container classes


Change-Id: Id59bdd8f1a804b809e22fffd153fd5174b58014d
Reviewed-by: default avatarMårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: default avatarEdward Welbourne <edward.welbourne@qt.io>
Showing with 24 additions and 2 deletions
......@@ -185,12 +185,22 @@ qsizetype QCborArray::size() const noexcept
return d ? d->elements.size() : 0;
}
/*!
Empties this array.
\sa isEmpty()
*/
void QCborArray::clear()
{
d.reset();
}
/*!
\fn bool QCborArray::isEmpty() const
Returns true if this QCborArray is empty (that is if size() is 0).
\sa size()
\sa size(), clear()
*/
/*!
......
......@@ -180,6 +180,7 @@ public:
qsizetype size() const noexcept;
bool isEmpty() const { return size() == 0; }
void clear();
QCborValue at(qsizetype i) const;
QCborValue first() const { return at(0); }
......
......@@ -270,7 +270,7 @@ QCborMap &QCborMap::operator=(const QCborMap &other) noexcept
Returns true if this map is empty (that is, size() is 0).
\sa size()
\sa size(), clear()
*/
/*!
......@@ -283,6 +283,16 @@ qsizetype QCborMap::size() const noexcept
return d ? d->elements.size() / 2 : 0;
}
/*!
Empties this map.
\sa isEmpty()
*/
void QCborMap::clear()
{
d.reset();
}
/*!
Returns a list of all keys in this map.
......
......@@ -184,6 +184,7 @@ public:
qsizetype size() const noexcept Q_DECL_PURE_FUNCTION;
bool isEmpty() const { return size() == 0; }
void clear();
QVector<QCborValue> keys() const;
QCborValue value(qint64 key) const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment