diff options
author | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-02-21 17:58:20 +0100 |
---|---|---|
committer | Sona Kurazyan <sona.kurazyan@qt.io> | 2022-02-22 19:23:39 +0100 |
commit | 9c35ab1cc22f742e6f914c80baa5f365ec2d85c7 (patch) | |
tree | aa251091806b4b2979ad2d5f0282803bfc6d2284 /src/corelib/text/qbytearrayview.h | |
parent | cfe421cee2d4f56180280ecd9da8c3da6a980b84 (diff) |
Make QByteArrayView's numeric conversion methods inline
Make the implementations of these methods free functions in the
QtPrivate namespace, so that they can be called also from
QByteArrayView's corresponding inline methods.
These methods were added in 6.3, so we can still make them inline
without breaking BC.
Fixes: QTBUG-101077
Pick-to: 6.3
Change-Id: Id50c6d4df5471127ae787a544a5651ced9aece99
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/text/qbytearrayview.h')
-rw-r--r-- | src/corelib/text/qbytearrayview.h | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/corelib/text/qbytearrayview.h b/src/corelib/text/qbytearrayview.h index 11db03c62f..40205cae9c 100644 --- a/src/corelib/text/qbytearrayview.h +++ b/src/corelib/text/qbytearrayview.h @@ -243,16 +243,26 @@ public: // Defined in qbytearray.cpp: [[nodiscard]] QByteArrayView trimmed() const noexcept { return QtPrivate::trimmed(*this); } - [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const; - [[nodiscard]] float toFloat(bool *ok = nullptr) const; - [[nodiscard]] double toDouble(bool *ok = nullptr) const; + [[nodiscard]] short toShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<short>(*this, ok, base); } + [[nodiscard]] ushort toUShort(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<ushort>(*this, ok, base); } + [[nodiscard]] int toInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<int>(*this, ok, base); } + [[nodiscard]] uint toUInt(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<uint>(*this, ok, base); } + [[nodiscard]] long toLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<long>(*this, ok, base); } + [[nodiscard]] ulong toULong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<ulong>(*this, ok, base); } + [[nodiscard]] qlonglong toLongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<qlonglong>(*this, ok, base); } + [[nodiscard]] qulonglong toULongLong(bool *ok = nullptr, int base = 10) const + { return QtPrivate::toIntegral<qulonglong>(*this, ok, base); } + [[nodiscard]] float toFloat(bool *ok = nullptr) const + { return QtPrivate::toFloat(*this, ok); } + [[nodiscard]] double toDouble(bool *ok = nullptr) const + { return QtPrivate::toDouble(*this, ok); } [[nodiscard]] bool startsWith(QByteArrayView other) const noexcept { return QtPrivate::startsWith(*this, other); } |