summaryrefslogtreecommitdiffstats
path: root/src/corelib/text/qbytearray.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2019-07-27 15:47:54 +0300
committerMarc Mutz <marc.mutz@kdab.com>2020-03-05 07:49:40 +0000
commit728cc964f3f25d23c72317a119b839701f5941e8 (patch)
tree5dead38f11dffbc37fcb56734c46aec4451b8122 /src/corelib/text/qbytearray.h
parent9e46dd7719b63710a6e4ffc6c43e55be710b2c5a (diff)
QString/QByteArray: make all symmetry-checked member-compare() combinations noexcept
In QByteArray, they were just not marked as such. In QString and QStringRef, the implicit conversion from QChar to QString would destroy it. Add a QChar overload, delegating to QStringView. Added docs for the new overloads, copying from the nearest neighbor so as to not look out of place. All string classes use different wording for these functions. A cleanup of this state of affairs is out of the scope of this patch. Change-Id: I0b7b1d037aa229bcaf29b793841a18caf977d66b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearray.h')
-rw-r--r--src/corelib/text/qbytearray.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index 36cf580cd9..e3bb9ea937 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -240,8 +240,8 @@ public:
int count(const char *a) const;
int count(const QByteArray &a) const;
- inline int compare(const char *c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
- inline int compare(const QByteArray &a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
+ inline int compare(const char *c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
+ inline int compare(const QByteArray &a, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
Q_REQUIRED_RESULT QByteArray left(int len) const;
Q_REQUIRED_RESULT QByteArray right(int len) const;
@@ -663,12 +663,12 @@ inline bool QByteArray::contains(const QByteArray &a) const
{ return indexOf(a) != -1; }
inline bool QByteArray::contains(char c) const
{ return indexOf(c) != -1; }
-inline int QByteArray::compare(const char *c, Qt::CaseSensitivity cs) const
+inline int QByteArray::compare(const char *c, Qt::CaseSensitivity cs) const noexcept
{
return cs == Qt::CaseSensitive ? qstrcmp(*this, c) :
qstrnicmp(data(), size(), c, -1);
}
-inline int QByteArray::compare(const QByteArray &a, Qt::CaseSensitivity cs) const
+inline int QByteArray::compare(const QByteArray &a, Qt::CaseSensitivity cs) const noexcept
{
return cs == Qt::CaseSensitive ? qstrcmp(*this, a) :
qstrnicmp(data(), size(), a.data(), a.size());