summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qoffsetstringarray_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qoffsetstringarray_p.h')
-rw-r--r--src/corelib/tools/qoffsetstringarray_p.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/corelib/tools/qoffsetstringarray_p.h b/src/corelib/tools/qoffsetstringarray_p.h
index 2a0e6de55b..9103606a13 100644
--- a/src/corelib/tools/qoffsetstringarray_p.h
+++ b/src/corelib/tools/qoffsetstringarray_p.h
@@ -63,6 +63,15 @@ public:
constexpr int count() const { return int(m_offsets.size()) - 1; }
+ bool contains(QByteArrayView needle, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
+ {
+ for (qsizetype i = 0; i < count(); ++i) {
+ if (viewAt(i).compare(needle, cs) == 0)
+ return true;
+ }
+ return false;
+ }
+
private:
StaticString m_string;
OffsetList m_offsets;
@@ -72,9 +81,11 @@ private:
namespace QtPrivate {
template <size_t Highest> constexpr auto minifyValue()
{
- if constexpr (Highest <= (std::numeric_limits<quint8>::max)()) {
+ constexpr size_t max8 = (std::numeric_limits<quint8>::max)();
+ constexpr size_t max16 = (std::numeric_limits<quint16>::max)();
+ if constexpr (Highest <= max8) {
return quint8(Highest);
- } else if constexpr (Highest <= (std::numeric_limits<quint16>::max)()) {
+ } else if constexpr (Highest <= max16) {
return quint16(Highest);
} else {
// int is probably enough for everyone