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

Change-Id: Id59bdd8f1a804b809e22fffd153fd5174b58014d
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Thiago Macieira 2018-07-09 15:51:22 -07:00
parent 8d3b9841e1
commit 2dca4ef19c
4 changed files with 24 additions and 2 deletions

View File

@ -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()
*/
/*!

View File

@ -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); }

View File

@ -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.

View File

@ -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