7#include <QtCore/qcborvalue.h>
8#include <QtCore/qpair.h>
10#include <initializer_list>
30 QCborValueRef
item {};
37 typedef std::pair<QCborValueConstRef, QCborValueRef>
value_type;
38 typedef std::pair<QCborValueConstRef, QCborValueRef>
reference;
39 typedef std::pair<QCborValueConstRef, QCborValueRef>
pointer;
56#if QT_VERSION >= QT_VERSION_CHECK(7,0,0)
64#if QT_CORE_REMOVED_SINCE(6, 8)
90 static bool comparesEqual_helper(
const Iterator &lhs,
const Iterator &rhs)
noexcept
92 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
95 static bool comparesEqual_helper(
const Iterator &lhs,
const ConstIterator &rhs)
noexcept
97 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
101 const Iterator &rhs)
noexcept
108 const ConstIterator &rhs)
noexcept
117 return comparesEqual_helper(lhs, rhs);
122 return compareThreeWay_helper(lhs, rhs);
127 return comparesEqual_helper(lhs, rhs);
132 return compareThreeWay_helper(lhs, rhs);
142 friend class QCborValueRef;
148 typedef std::pair<QCborValueConstRef, QCborValueConstRef>
value_type;
149 typedef std::pair<QCborValueConstRef, QCborValueConstRef>
reference;
150 typedef std::pair<QCborValueConstRef, QCborValueConstRef>
pointer;
166#if QT_VERSION >= QT_VERSION_CHECK(7,0,0)
174#if QT_CORE_REMOVED_SINCE(6, 8)
202 return lhs.item.d == rhs.item.d && lhs.item.i == rhs.item.i;
205 const ConstIterator &rhs)
noexcept
214 return comparesEqual_helper(lhs, rhs);
219 return compareThreeWay_helper(lhs, rhs);
231 for (
const auto &pair :
args)
232 insert(pair.first, pair.second);
244 bool isEmpty()
const {
return size() == 0; }
246 QList<QCborValue>
keys()
const;
256#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
268#if !defined(QT_NO_CAST_FROM_ASCII) && !defined(QT_RESTRICTED_CAST_FROM_ASCII)
274 QCborValueRef operator[](
const QString &
key);
303#if QT_CORE_REMOVED_SINCE(6, 8)
326 bool empty()
const {
return isEmpty(); }
332 const_iterator constFind(
qint64 key)
const;
334 const_iterator constFind(
const QString &
key)
const;
343 QCborValueRef
v = operator[](
key);
345 return {
d.data(),
v.i };
349 QCborValueRef
v = operator[](
key);
351 return {
d.data(),
v.i };
355 QCborValueRef
v = operator[](
key);
357 return {
d.data(),
v.i };
361 QCborValueRef
v = operator[](
key);
363 return {
d.data(),
v.i };
378 friend class QCborValueRef;
387 int c = lhs.compare(rhs);
399 return comparesEqual_helper(lhs, rhs);
404 return compareThreeWay_helper(lhs, rhs);
415 return comparesEqual_helper(lhs, rhs);
420 return compareThreeWay_helper(lhs, rhs);
425 QExplicitlySharedDataPointer<QCborContainerPrivate>
d;
431 :
n(-1), container(
m.
d.take()),
t(
Map)
435#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(QT_BOOTSTRAPPED)
436inline QCborMap QCborValueRef::toMap()
const
438 return concrete().toMap();
443 return concrete().toMap(
m);
459#if !defined(QT_NO_DEBUG_STREAM)
463#ifndef QT_NO_DATASTREAM
464#if QT_CONFIG(cborstreamwriter)
QCborValueConstRef key() const
Returns the current item's key.
ConstIterator & operator++()
The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this i...
value_type operator[](qsizetype j) const
friend bool comparesEqual(const ConstIterator &lhs, const ConstIterator &rhs) noexcept
constexpr ConstIterator(const ConstIterator &)=default
Constructs an iterator as a copy of other.
ConstIterator operator-(qsizetype j) const
Returns an iterator to the item at j positions backward from this iterator.
ConstIterator & operator--()
The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.
qsizetype difference_type
std::pair< QCborValueConstRef, QCborValueConstRef > reference
qsizetype operator-(ConstIterator j) const
Returns the position of the item at iterator j relative to the item at this iterator.
ConstIterator & operator-=(qsizetype j)
Makes the iterator go back by j items.
const QCborValueConstRef * operator->() const
Returns a pointer to the current pair's value.
QCborValueConstRef value() const
Returns the current item's value.
constexpr ConstIterator()=default
Constructs an uninitialized iterator.
ConstIterator & operator=(const ConstIterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
std::pair< QCborValueConstRef, QCborValueConstRef > pointer
ConstIterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.
friend Qt::strong_ordering compareThreeWay(const ConstIterator &lhs, const ConstIterator &rhs) noexcept
ConstIterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::pair< QCborValueConstRef, QCborValueConstRef > value_type
ConstIterator operator+(qsizetype j) const
Returns an iterator to the item at j positions forward from this iterator.
value_type operator*() const
Returns a pair containing the current item's key and value.
ConstIterator & operator+=(qsizetype j)
Advances the iterator by j items.
\inmodule QtCore\reentrant
Iterator operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, const Iterator &rhs) noexcept
std::random_access_iterator_tag iterator_category
A synonym for {std::random_access_iterator_tag} indicating this iterator is a random-access iterator.
const QCborValueConstRef * operator->() const
Returns a pointer to a modifiable reference to the current pair's value.
Iterator operator+(qsizetype j) const
Returns an iterator to the item at j positions forward from this iterator.
value_type operator*() const
Returns a pair containing the current item's key and a modifiable reference to the current item's val...
QCborValueConstRef key() const
Returns the current item's key.
friend bool comparesEqual(const Iterator &lhs, const Iterator &rhs) noexcept
Iterator & operator=(const Iterator &other)
Makes this iterator a copy of other and returns a reference to this iterator.
constexpr Iterator()=default
Constructs an uninitialized iterator.
Iterator & operator-=(qsizetype j)
Makes the iterator go back by j items.
Iterator operator--(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype operator-(Iterator j) const
Returns the position of the item at iterator j relative to the item at this iterator.
Iterator operator-(qsizetype j) const
Returns an iterator to the item at j positions backward from this iterator.
std::pair< QCborValueConstRef, QCborValueRef > pointer
value_type operator[](qsizetype j) const
Iterator & operator++()
The prefix {++} operator, {++i}, advances the iterator to the next item in the map and returns this i...
qsizetype difference_type
constexpr Iterator(const Iterator &)=default
Constructs an iterator as a copy of other.
QCborValueRef * operator->()
Iterator & operator--()
The prefix {–} operator, {–i}, makes the preceding item current and returns this iterator.
QCborValueRef value() const
Returns a modifiable reference to the current item's value.
Iterator & operator+=(qsizetype j)
Advances the iterator by j items.
std::pair< QCborValueConstRef, QCborValueRef > reference
std::pair< QCborValueConstRef, QCborValueRef > value_type
friend Qt::strong_ordering compareThreeWay(const Iterator &lhs, const ConstIterator &rhs) noexcept
\inmodule QtCore\reentrant
QCborValue extract(const_iterator it)
Extracts a value from the map at the position indicated by iterator it and returns the value so extra...
QCborValue value(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator erase(const_iterator it)
Removes the key-value pair pointed to by the map iterator it and returns a pointer to the next elemen...
QCborValue toCborValue() const
Explicitly constructs a \l QCborValue object that represents this map.
const_iterator find(qint64 key) const
Returns a map iterator to the key-value pair whose key is key, if the map contains such a pair.
friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, const QCborMap &rhs) noexcept
bool contains(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
const_iterator end() const
Returns a map iterator representing an element just past the last element in the map.
QCborValue value(qint64 key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
iterator insert(QLatin1StringView key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, const QCborValueConstRef &rhs) noexcept
bool empty() const
Synonym for isEmpty().
friend bool comparesEqual(const QCborMap &lhs, const QCborValueConstRef &rhs) noexcept
const_iterator cend() const
Returns a map iterator representing an element just past the last element in the map.
void swap(QCborMap &other) noexcept
Swaps the contents of this map and other.
const_iterator find(const QCborValue &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue take(QLatin1StringView key)
Removes the key key and the corresponding value from the map and returns the value,...
qsizetype size_type
The type that QCborMap uses for sizes.
QT_ASCII_CAST_WARN const QCborValue value(const char(&key)[N]) const
iterator end()
Returns a map iterator representing an element just past the last element in the map.
void remove(const QCborValue &key)
Removes the key key and the corresponding value from the map, if it is found.
void remove(const QString &key)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue mapped_type
The type that is mapped to (the value), that is, a QCborValue.
QCborValue take(qint64 key)
Removes the key key and the corresponding value from the map and returns the value,...
const_iterator find(const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend bool comparesEqual(const QCborMap &lhs, const QCborValue &rhs) noexcept
iterator insert(const QCborValue &key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const QCborValue operator[](const QCborValue &key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
const QCborValue operator[](QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue value(const QCborValue &key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
QCborValue take(const QCborValue &key)
Removes the key key and the corresponding value from the map and returns the value,...
std::pair< QCborValue, QCborValue > value_type
The value that is stored in this container: a pair of QCborValues.
const_iterator begin() const
Returns a map iterator pointing to the first key-value pair of this map.
void remove(QLatin1StringView key)
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator insert(const QString &key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
ConstIterator const_iterator
A synonym for QCborMap::ConstIterator.
const_iterator cbegin() const
Returns a map iterator pointing to the first key-value pair of this map.
const_iterator find(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue key_type
The key type for this map.
bool contains(qint64 key) const
Returns true if this map contains a key-value pair identified by key key.
iterator insert(qint64 key, const QCborValue &value_)
This is an overloaded member function, provided for convenience. It differs from the above function o...
const_iterator constBegin() const
Returns a map iterator pointing to the first key-value pair of this map.
QT_ASCII_CAST_WARN const QCborValue operator[](const char(&key)[N]) const
bool contains(const QCborValue &key) const
Returns true if this map contains a key-value pair identified by key key.
bool contains(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
QCborValue take(const QString &key)
Removes the key key and the corresponding value from the map and returns the value,...
friend Qt::strong_ordering compareThreeWay(const QCborMap &lhs, const QCborValue &rhs) noexcept
const QCborValue operator[](const QString &key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
iterator begin()
Returns a map iterator pointing to the first key-value pair of this map.
const QCborValue operator[](qint64 key) const
Returns the QCborValue element in this map that corresponds to key key, if there is one.
QCborValue value(QLatin1StringView key) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
const_iterator constEnd() const
Returns a map iterator representing an element just past the last element in the map.
iterator insert(value_type v)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Iterator iterator
A synonym for QCborMap::Iterator.
void remove(qint64 key)
Removes the key key and the corresponding value from the map, if it is found.
QCborValue concrete() const noexcept
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
qsizetype size() const noexcept
\macro QT_RESTRICTED_CAST_FROM_ASCII
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore \title Classes and helpers for defining comparison operators \keyword qtcompare
QHash< int, QWidget * > hash
[35multi]
QMap< QString, QString > map
[6]
cache insert(employee->id(), employee)
QSet< QString >::iterator it
Combined button and popup list for selecting options.
constexpr Qt::strong_ordering compareThreeWay(LeftInt lhs, RightInt rhs) noexcept
qsizetype erase(QByteArray &ba, const T &t)
Q_CORE_EXPORT QDataStream & operator>>(QDataStream &, QCborMap &)
Q_CORE_EXPORT size_t qHash(const QCborMap &map, size_t seed=0)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QCborMap &m)
#define Q_DECLARE_STRONGLY_ORDERED(...)
#define Q_DECL_PURE_FUNCTION
constexpr bool operator!=(const timespec &t1, const timespec &t2)
bool comparesEqual(const QDir &lhs, const QDir &rhs)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLsizei const GLfloat * v
[13]
GLenum GLuint GLintptr GLsizeiptr size
[1]
bool operator>(const QPoint &a, const QPoint &b)
static Q_CONSTINIT QBasicAtomicInteger< unsigned > seed
bool operator==(const QRandomGenerator &rng1, const QRandomGenerator &rng2)
static bool operator<(const QSettingsIniKey &k1, const QSettingsIniKey &k2)
#define QT_ASCII_CAST_WARN
static int compare(quint64 a, quint64 b)
bool operator<=(const QUuid &lhs, const QUuid &rhs) noexcept
bool operator>=(const QUuid &lhs, const QUuid &rhs) noexcept
QCborValue(QCborTag(2), QByteArray("\x01\0\0\0\0\0\0\0\0", 9))
[0]