CBOR: Use "noexcept" directly
All supported compilers support it. Doing this just for the new API. We should do it throughout Qt, but only if it won't interfere with the header review. Change-Id: Id59bdd8f1a804b809e22fffd153f9254688e5152 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
503646a331
commit
1016c0af74
@ -113,7 +113,7 @@ using namespace QtCbor;
|
||||
/*!
|
||||
Constructs an empty QCborArray.
|
||||
*/
|
||||
QCborArray::QCborArray() Q_DECL_NOTHROW
|
||||
QCborArray::QCborArray() noexcept
|
||||
: d(nullptr)
|
||||
{
|
||||
}
|
||||
@ -121,7 +121,7 @@ QCborArray::QCborArray() Q_DECL_NOTHROW
|
||||
/*!
|
||||
Copies the contents of \a other into this object.
|
||||
*/
|
||||
QCborArray::QCborArray(const QCborArray &other) Q_DECL_NOTHROW
|
||||
QCborArray::QCborArray(const QCborArray &other) noexcept
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
@ -148,7 +148,7 @@ QCborArray::~QCborArray()
|
||||
Replaces the contents of this array with that found in \a other, then
|
||||
returns a reference to this object.
|
||||
*/
|
||||
QCborArray &QCborArray::operator=(const QCborArray &other) Q_DECL_NOTHROW
|
||||
QCborArray &QCborArray::operator=(const QCborArray &other) noexcept
|
||||
{
|
||||
d = other.d;
|
||||
return *this;
|
||||
@ -180,7 +180,7 @@ QCborArray &QCborArray::operator=(const QCborArray &other) Q_DECL_NOTHROW
|
||||
|
||||
\sa isEmpty()
|
||||
*/
|
||||
qsizetype QCborArray::size() const Q_DECL_NOTHROW
|
||||
qsizetype QCborArray::size() const noexcept
|
||||
{
|
||||
return d ? d->elements.size() : 0;
|
||||
}
|
||||
|
@ -159,9 +159,9 @@ public:
|
||||
typedef const QCborValue &const_reference;
|
||||
typedef qsizetype difference_type;
|
||||
|
||||
QCborArray() Q_DECL_NOTHROW;
|
||||
QCborArray(const QCborArray &other) Q_DECL_NOTHROW;
|
||||
QCborArray &operator=(const QCborArray &other) Q_DECL_NOTHROW;
|
||||
QCborArray() noexcept;
|
||||
QCborArray(const QCborArray &other) noexcept;
|
||||
QCborArray &operator=(const QCborArray &other) noexcept;
|
||||
QCborArray(std::initializer_list<QCborValue> args)
|
||||
: QCborArray()
|
||||
{
|
||||
@ -171,14 +171,14 @@ public:
|
||||
}
|
||||
~QCborArray();
|
||||
|
||||
void swap(QCborArray &other) Q_DECL_NOTHROW
|
||||
void swap(QCborArray &other) noexcept
|
||||
{
|
||||
qSwap(d, other.d);
|
||||
}
|
||||
|
||||
QCborValue toCborValue() const { return *this; }
|
||||
|
||||
qsizetype size() const Q_DECL_NOTHROW;
|
||||
qsizetype size() const noexcept;
|
||||
bool isEmpty() const { return size() == 0; }
|
||||
|
||||
QCborValue at(qsizetype i) const;
|
||||
@ -205,7 +205,7 @@ public:
|
||||
|
||||
bool contains(const QCborValue &value) const;
|
||||
|
||||
int compare(const QCborArray &other) const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
int compare(const QCborArray &other) const noexcept Q_DECL_PURE_FUNCTION;
|
||||
#if QT_HAS_INCLUDE(<compare>)
|
||||
std::strong_ordering operator<=>(const QCborArray &other) const
|
||||
{
|
||||
@ -215,9 +215,9 @@ public:
|
||||
return std::strong_ordering::less;
|
||||
}
|
||||
#else
|
||||
bool operator==(const QCborArray &other) const Q_DECL_NOTHROW
|
||||
bool operator==(const QCborArray &other) const noexcept
|
||||
{ return compare(other) == 0; }
|
||||
bool operator!=(const QCborArray &other) const Q_DECL_NOTHROW
|
||||
bool operator!=(const QCborArray &other) const noexcept
|
||||
{ return !(*this == other); }
|
||||
bool operator<(const QCborArray &other) const
|
||||
{ return compare(other) < 0; }
|
||||
@ -261,7 +261,7 @@ private:
|
||||
void detach(qsizetype reserve = 0);
|
||||
|
||||
friend QCborValue;
|
||||
explicit QCborArray(QCborContainerPrivate &dd) Q_DECL_NOTHROW;
|
||||
explicit QCborArray(QCborContainerPrivate &dd) noexcept;
|
||||
QExplicitlySharedDataPointer<QCborContainerPrivate> d;
|
||||
};
|
||||
|
||||
|
@ -199,7 +199,7 @@ using namespace QtCbor;
|
||||
|
||||
\sa isEmpty()
|
||||
*/
|
||||
QCborMap::QCborMap() Q_DECL_NOTHROW
|
||||
QCborMap::QCborMap() noexcept
|
||||
: d(nullptr)
|
||||
{
|
||||
}
|
||||
@ -207,7 +207,7 @@ QCborMap::QCborMap() Q_DECL_NOTHROW
|
||||
/*!
|
||||
Creates a QCborMap object that is a copy of \a other.
|
||||
*/
|
||||
QCborMap::QCborMap(const QCborMap &other) Q_DECL_NOTHROW
|
||||
QCborMap::QCborMap(const QCborMap &other) noexcept
|
||||
: d(other.d)
|
||||
{
|
||||
}
|
||||
@ -239,7 +239,7 @@ QCborMap::~QCborMap()
|
||||
Replaces the contents of this object with a copy of \a other, then returns
|
||||
a reference to this object.
|
||||
*/
|
||||
QCborMap &QCborMap::operator=(const QCborMap &other) Q_DECL_NOTHROW
|
||||
QCborMap &QCborMap::operator=(const QCborMap &other) noexcept
|
||||
{
|
||||
d = other.d;
|
||||
return *this;
|
||||
@ -278,7 +278,7 @@ QCborMap &QCborMap::operator=(const QCborMap &other) Q_DECL_NOTHROW
|
||||
|
||||
\sa isEmpty()
|
||||
*/
|
||||
qsizetype QCborMap::size() const Q_DECL_NOTHROW
|
||||
qsizetype QCborMap::size() const noexcept
|
||||
{
|
||||
return d ? d->elements.size() / 2 : 0;
|
||||
}
|
||||
|
@ -163,9 +163,9 @@ public:
|
||||
qsizetype operator-(ConstIterator j) const { return (item.i - j.item.i) / 2; }
|
||||
};
|
||||
|
||||
QCborMap() Q_DECL_NOTHROW;
|
||||
QCborMap(const QCborMap &other) Q_DECL_NOTHROW;
|
||||
QCborMap &operator=(const QCborMap &other) Q_DECL_NOTHROW;
|
||||
QCborMap() noexcept;
|
||||
QCborMap(const QCborMap &other) noexcept;
|
||||
QCborMap &operator=(const QCborMap &other) noexcept;
|
||||
QCborMap(std::initializer_list<value_type> args)
|
||||
: QCborMap()
|
||||
{
|
||||
@ -175,14 +175,14 @@ public:
|
||||
}
|
||||
~QCborMap();
|
||||
|
||||
void swap(QCborMap &other) Q_DECL_NOTHROW
|
||||
void swap(QCborMap &other) noexcept
|
||||
{
|
||||
qSwap(d, other.d);
|
||||
}
|
||||
|
||||
QCborValue toCborValue() const { return *this; }
|
||||
|
||||
qsizetype size() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
qsizetype size() const noexcept Q_DECL_PURE_FUNCTION;
|
||||
bool isEmpty() const { return size() == 0; }
|
||||
QVector<QCborValue> keys() const;
|
||||
|
||||
@ -232,7 +232,7 @@ public:
|
||||
bool contains(const QCborValue &key) const
|
||||
{ const_iterator it = find(key); return it != end(); }
|
||||
|
||||
int compare(const QCborMap &other) const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
int compare(const QCborMap &other) const noexcept Q_DECL_PURE_FUNCTION;
|
||||
#if QT_HAS_INCLUDE(<compare>)
|
||||
std::strong_ordering operator<=>(const QCborMap &other) const
|
||||
{
|
||||
@ -242,9 +242,9 @@ public:
|
||||
return std::strong_ordering::less;
|
||||
}
|
||||
#else
|
||||
bool operator==(const QCborMap &other) const Q_DECL_NOTHROW
|
||||
bool operator==(const QCborMap &other) const noexcept
|
||||
{ return compare(other) == 0; }
|
||||
bool operator!=(const QCborMap &other) const Q_DECL_NOTHROW
|
||||
bool operator!=(const QCborMap &other) const noexcept
|
||||
{ return !(*this == other); }
|
||||
bool operator<(const QCborMap &other) const
|
||||
{ return compare(other) < 0; }
|
||||
@ -316,7 +316,7 @@ private:
|
||||
void detach(qsizetype reserve = 0);
|
||||
|
||||
friend QCborValue;
|
||||
explicit QCborMap(QCborContainerPrivate &dd) Q_DECL_NOTHROW;
|
||||
explicit QCborMap(QCborContainerPrivate &dd) noexcept;
|
||||
QExplicitlySharedDataPointer<QCborContainerPrivate> d;
|
||||
};
|
||||
|
||||
|
@ -2037,7 +2037,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void handleError(CborError err) Q_DECL_NOTHROW
|
||||
void handleError(CborError err) noexcept
|
||||
{
|
||||
Q_ASSERT(err);
|
||||
|
||||
@ -2411,7 +2411,7 @@ QCborStreamReader::Type QCborStreamReader::parentContainerType() const
|
||||
|
||||
\sa parentContainerType(), containerDepth(), leaveContainer()
|
||||
*/
|
||||
bool QCborStreamReader::hasNext() const Q_DECL_NOTHROW
|
||||
bool QCborStreamReader::hasNext() const noexcept
|
||||
{
|
||||
return cbor_value_is_valid(&d->currentElement) &&
|
||||
!cbor_value_at_end(&d->currentElement);
|
||||
@ -2487,7 +2487,7 @@ bool QCborStreamReader::next(int maxRecursion)
|
||||
|
||||
\sa length(), QCborStreamWriter::startArray(), QCborStreamWriter::startMap()
|
||||
*/
|
||||
bool QCborStreamReader::isLengthKnown() const Q_DECL_NOTHROW
|
||||
bool QCborStreamReader::isLengthKnown() const noexcept
|
||||
{
|
||||
return cbor_value_is_length_known(&d->currentElement);
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
|
||||
int containerDepth() const;
|
||||
QCborStreamReader::Type parentContainerType() const;
|
||||
bool hasNext() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
bool hasNext() const noexcept Q_DECL_PURE_FUNCTION;
|
||||
bool next(int maxRecursion = 10000);
|
||||
|
||||
Type type() const { return QCborStreamReader::Type(type_); }
|
||||
@ -203,7 +203,7 @@ public:
|
||||
bool isNull() const { return isSimpleType(QCborSimpleType::Null); }
|
||||
bool isUndefined() const { return isSimpleType(QCborSimpleType::Undefined); }
|
||||
|
||||
bool isLengthKnown() const Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
bool isLengthKnown() const noexcept Q_DECL_PURE_FUNCTION;
|
||||
quint64 length() const;
|
||||
|
||||
bool isContainer() const { return isMap() || isArray(); }
|
||||
@ -240,7 +240,7 @@ private:
|
||||
StringResult<QByteArray> _readByteArray_helper();
|
||||
qsizetype _currentStringChunkSize() const;
|
||||
|
||||
template <typename FP> FP _toFloatingPoint() const Q_DECL_NOTHROW
|
||||
template <typename FP> FP _toFloatingPoint() const noexcept
|
||||
{
|
||||
using UInt = typename QIntegerForSizeof<FP>::Unsigned;
|
||||
UInt u = UInt(value64);
|
||||
|
@ -1395,12 +1395,12 @@ int QCborValue::compare(const QCborValue &other) const
|
||||
return compareElementRecursive(container, e1, other.container, e2);
|
||||
}
|
||||
|
||||
int QCborArray::compare(const QCborArray &other) const Q_DECL_NOTHROW
|
||||
int QCborArray::compare(const QCborArray &other) const noexcept
|
||||
{
|
||||
return compareContainer(d.data(), other.d.data());
|
||||
}
|
||||
|
||||
int QCborMap::compare(const QCborMap &other) const Q_DECL_NOTHROW
|
||||
int QCborMap::compare(const QCborMap &other) const noexcept
|
||||
{
|
||||
return compareContainer(d.data(), other.d.data());
|
||||
}
|
||||
@ -2560,22 +2560,22 @@ void QCborValueRef::assign(QCborValueRef that, const QCborValueRef other)
|
||||
assign(that, other.concrete());
|
||||
}
|
||||
|
||||
QCborValue QCborValueRef::concrete(QCborValueRef self) Q_DECL_NOTHROW
|
||||
QCborValue QCborValueRef::concrete(QCborValueRef self) noexcept
|
||||
{
|
||||
return self.d->valueAt(self.i);
|
||||
}
|
||||
|
||||
QCborValue::Type QCborValueRef::concreteType(QCborValueRef self) Q_DECL_NOTHROW
|
||||
QCborValue::Type QCborValueRef::concreteType(QCborValueRef self) noexcept
|
||||
{
|
||||
return self.d->elements.at(self.i).type;
|
||||
}
|
||||
|
||||
inline QCborArray::QCborArray(QCborContainerPrivate &dd) Q_DECL_NOTHROW
|
||||
inline QCborArray::QCborArray(QCborContainerPrivate &dd) noexcept
|
||||
: d(&dd)
|
||||
{
|
||||
}
|
||||
|
||||
inline QCborMap::QCborMap(QCborContainerPrivate &dd) Q_DECL_NOTHROW
|
||||
inline QCborMap::QCborMap(QCborContainerPrivate &dd) noexcept
|
||||
: d(&dd)
|
||||
{
|
||||
}
|
||||
|
@ -164,14 +164,14 @@ public:
|
||||
QCborValue(const void *) = delete;
|
||||
|
||||
QCborValue(const QCborValue &other);
|
||||
QCborValue(QCborValue &&other) Q_DECL_NOTHROW
|
||||
QCborValue(QCborValue &&other) noexcept
|
||||
: n(other.n), container(other.container), t(other.t)
|
||||
{
|
||||
other.t = Undefined;
|
||||
other.container = nullptr;
|
||||
}
|
||||
QCborValue &operator=(const QCborValue &other);
|
||||
QCborValue &operator=(QCborValue &&other) Q_DECL_NOTHROW
|
||||
QCborValue &operator=(QCborValue &&other) noexcept
|
||||
{
|
||||
QCborValue tmp;
|
||||
qSwap(*this, tmp);
|
||||
@ -179,7 +179,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(QCborValue &other) Q_DECL_NOTHROW
|
||||
void swap(QCborValue &other) noexcept
|
||||
{
|
||||
qSwap(n, other.n);
|
||||
qSwap(container, other.container);
|
||||
@ -261,9 +261,9 @@ public:
|
||||
return std::partial_ordering::less;
|
||||
}
|
||||
#else
|
||||
bool operator==(const QCborValue &other) const Q_DECL_NOTHROW
|
||||
bool operator==(const QCborValue &other) const noexcept
|
||||
{ return compare(other) == 0; }
|
||||
bool operator!=(const QCborValue &other) const Q_DECL_NOTHROW
|
||||
bool operator!=(const QCborValue &other) const noexcept
|
||||
{ return !(*this == other); }
|
||||
bool operator<(const QCborValue &other) const
|
||||
{ return compare(other) < 0; }
|
||||
@ -323,8 +323,8 @@ class Q_CORE_EXPORT QCborValueRef
|
||||
public:
|
||||
operator QCborValue() const { return concrete(); }
|
||||
|
||||
QCborValueRef(const QCborValueRef &) Q_DECL_NOTHROW = default;
|
||||
QCborValueRef(QCborValueRef &&) Q_DECL_NOTHROW = default;
|
||||
QCborValueRef(const QCborValueRef &) noexcept = default;
|
||||
QCborValueRef(QCborValueRef &&) noexcept = default;
|
||||
QCborValueRef &operator=(const QCborValue &other)
|
||||
{ assign(*this, other); return *this; }
|
||||
QCborValueRef &operator=(QCborValue &&other)
|
||||
@ -435,11 +435,11 @@ private:
|
||||
static void assign(QCborValueRef that, const QCborValue &other);
|
||||
static void assign(QCborValueRef that, QCborValue &&other);
|
||||
static void assign(QCborValueRef that, const QCborValueRef other);
|
||||
static QCborValue concrete(QCborValueRef that) Q_DECL_NOTHROW;
|
||||
QCborValue concrete() const Q_DECL_NOTHROW { return concrete(*this); }
|
||||
static QCborValue concrete(QCborValueRef that) noexcept;
|
||||
QCborValue concrete() const noexcept { return concrete(*this); }
|
||||
|
||||
static QCborValue::Type concreteType(QCborValueRef self) Q_DECL_NOTHROW Q_DECL_PURE_FUNCTION;
|
||||
QCborValue::Type concreteType() const Q_DECL_NOTHROW { return concreteType(*this); }
|
||||
static QCborValue::Type concreteType(QCborValueRef self) noexcept Q_DECL_PURE_FUNCTION;
|
||||
QCborValue::Type concreteType() const noexcept { return concreteType(*this); }
|
||||
|
||||
// this will actually be invalid...
|
||||
Q_DECL_CONSTEXPR QCborValueRef() : d(nullptr), i(0) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user