QCborValue: implement move semantics for QCbor{Array,Map} constructors
Happens a lot because of the implicit conversions. So I made it inline. Change-Id: Icc2c231dc2c44abdb087fffd1533f311b95460b8 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
2bb44414ff
commit
bcaa3cd9d6
|
|
@ -264,6 +264,11 @@ private:
|
|||
|
||||
Q_DECLARE_SHARED(QCborArray)
|
||||
|
||||
inline QCborValue::QCborValue(QCborArray &&a)
|
||||
: n(-1), container(a.d.take()), t(Array)
|
||||
{
|
||||
}
|
||||
|
||||
inline QCborArray QCborValueRef::toArray() const
|
||||
{
|
||||
return concrete().toArray();
|
||||
|
|
|
|||
|
|
@ -322,6 +322,11 @@ private:
|
|||
|
||||
Q_DECLARE_SHARED(QCborMap)
|
||||
|
||||
inline QCborValue::QCborValue(QCborMap &&m)
|
||||
: n(-1), container(m.d.take()), t(Map)
|
||||
{
|
||||
}
|
||||
|
||||
inline QCborMap QCborValueRef::toMap() const
|
||||
{
|
||||
return concrete().toMap();
|
||||
|
|
|
|||
|
|
@ -139,7 +139,9 @@ public:
|
|||
QT_ASCII_CAST_WARN QCborValue(const char *s) : QCborValue(QString::fromUtf8(s)) {}
|
||||
#endif
|
||||
QCborValue(const QCborArray &a);
|
||||
QCborValue(QCborArray &&a);
|
||||
QCborValue(const QCborMap &m);
|
||||
QCborValue(QCborMap &&m);
|
||||
QCborValue(QCborTag tag, const QCborValue &taggedValue = QCborValue());
|
||||
QCborValue(QCborKnownTags t_, const QCborValue &tv = QCborValue())
|
||||
: QCborValue(QCborTag(t_), tv)
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ public:
|
|||
inline T *operator->() const { return d; }
|
||||
inline T *data() const { return d; }
|
||||
inline const T *constData() const { return d; }
|
||||
inline T *take() { T *x = d; d = nullptr; return x; }
|
||||
|
||||
inline void detach() { if (d && d->ref.load() != 1) detach_helper(); }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue