QtBase: eradicate QT_STRINGVIEW_LEVEL uses

It's not used and not useful.

The macro itself has to stay, for now, because Qt5Compat uses it, too.

Task-number: QTBUG-100861
Pick-to: 6.4 6.3 6.2
Change-Id: I5d0557a6c959d6facf6e47f26786a9d365339e95
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
This commit is contained in:
Marc Mutz 2022-02-15 11:48:32 +01:00
parent ad17a1674c
commit 16c453069f
21 changed files with 2 additions and 130 deletions

View File

@ -110,9 +110,7 @@ public:
inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); } inline QDebug &operator<<(double t) { stream->ts << t; return maybeSpace(); }
inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); } inline QDebug &operator<<(const char* t) { stream->ts << QString::fromUtf8(t); return maybeSpace(); }
inline QDebug &operator<<(const char16_t *t) { stream->ts << QStringView(t); return maybeSpace(); } inline QDebug &operator<<(const char16_t *t) { stream->ts << QStringView(t); return maybeSpace(); }
#if QT_STRINGVIEW_LEVEL < 2
inline QDebug &operator<<(const QString & t) { putString(t.constData(), uint(t.length())); return maybeSpace(); } inline QDebug &operator<<(const QString & t) { putString(t.constData(), uint(t.length())); return maybeSpace(); }
#endif
inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); } inline QDebug &operator<<(QStringView s) { putString(s.data(), size_t(s.size())); return maybeSpace(); }
inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast<const char*>(s.data()), s.size(), ContainsBinary); return maybeSpace(); } inline QDebug &operator<<(QUtf8StringView s) { putByteArray(reinterpret_cast<const char*>(s.data()), s.size(), ContainsBinary); return maybeSpace(); }
inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); } inline QDebug &operator<<(QLatin1StringView t) { putByteArray(t.latin1(), t.size(), ContainsLatin1); return maybeSpace(); }

View File

@ -1715,7 +1715,6 @@ QCborValue::QCborValue(const QByteArray &ba)
container->ref.storeRelaxed(1); container->ref.storeRelaxed(1);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Creates a QCborValue with string value \a s. The value can later be Creates a QCborValue with string value \a s. The value can later be
retrieved using toString(). retrieved using toString().
@ -1723,7 +1722,6 @@ QCborValue::QCborValue(const QByteArray &ba)
\sa toString(), isString(), isByteArray() \sa toString(), isString(), isByteArray()
*/ */
QCborValue::QCborValue(const QString &s) : QCborValue(qToStringViewIgnoringNull(s)) {} QCborValue::QCborValue(const QString &s) : QCborValue(qToStringViewIgnoringNull(s)) {}
#endif
/*! /*!
Creates a QCborValue with string value \a s. The value can later be Creates a QCborValue with string value \a s. The value can later be

View File

@ -110,9 +110,7 @@ public:
QCborValue(QCborSimpleType st) : t(type_helper(st)) {} QCborValue(QCborSimpleType st) : t(type_helper(st)) {}
QCborValue(const QByteArray &ba); QCborValue(const QByteArray &ba);
#if QT_STRINGVIEW_LEVEL < 2
QCborValue(const QString &s); QCborValue(const QString &s);
#endif
QCborValue(QStringView s); QCborValue(QStringView s);
QCborValue(QLatin1StringView s); QCborValue(QLatin1StringView s);
#ifndef QT_NO_CAST_FROM_ASCII #ifndef QT_NO_CAST_FROM_ASCII

View File

@ -225,12 +225,10 @@ public:
} }
void appendAsciiString(QStringView s); void appendAsciiString(QStringView s);
#if QT_STRINGVIEW_LEVEL < 2
void append(const QString &s) void append(const QString &s)
{ {
append(qToStringViewIgnoringNull(s)); append(qToStringViewIgnoringNull(s));
} }
#endif
void append(QStringView s) void append(QStringView s)
{ {

View File

@ -391,7 +391,6 @@ void QJsonDocument::setArray(const QJsonArray &array)
d->value = QCborValue::fromJsonValue(array); d->value = QCborValue::fromJsonValue(array);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a QJsonValue representing the value for the key \a key. Returns a QJsonValue representing the value for the key \a key.
@ -408,7 +407,6 @@ const QJsonValue QJsonDocument::operator[](const QString &key) const
{ {
return (*this)[QStringView(key)]; return (*this)[QStringView(key)];
} }
#endif
/*! /*!
\overload \overload

View File

@ -94,9 +94,7 @@ public:
void setObject(const QJsonObject &object); void setObject(const QJsonObject &object);
void setArray(const QJsonArray &array); void setArray(const QJsonArray &array);
#if QT_STRINGVIEW_LEVEL < 2
const QJsonValue operator[](const QString &key) const; const QJsonValue operator[](const QString &key) const;
#endif
const QJsonValue operator[](QStringView key) const; const QJsonValue operator[](QStringView key) const;
const QJsonValue operator[](QLatin1StringView key) const; const QJsonValue operator[](QLatin1StringView key) const;
const QJsonValue operator[](qsizetype i) const; const QJsonValue operator[](qsizetype i) const;

View File

@ -278,7 +278,6 @@ static qsizetype indexOf(const QExplicitlySharedDataPointer<QCborContainerPrivat
return it.it - begin.it; return it.it - begin.it;
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a QJsonValue representing the value for the key \a key. Returns a QJsonValue representing the value for the key \a key.
@ -290,7 +289,6 @@ QJsonValue QJsonObject::value(const QString &key) const
{ {
return value(QStringView(key)); return value(QStringView(key));
} }
#endif
/*! /*!
\overload \overload
@ -326,7 +324,6 @@ QJsonValue QJsonObject::valueImpl(T key) const
return QJsonPrivate::Value::fromTrustedCbor(o->valueAt(i + 1)); return QJsonPrivate::Value::fromTrustedCbor(o->valueAt(i + 1));
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a QJsonValue representing the value for the key \a key. Returns a QJsonValue representing the value for the key \a key.
@ -340,7 +337,6 @@ QJsonValue QJsonObject::operator [](const QString &key) const
{ {
return (*this)[QStringView(key)]; return (*this)[QStringView(key)];
} }
#endif
/*! /*!
\fn QJsonValue QJsonObject::operator [](QStringView key) const \fn QJsonValue QJsonObject::operator [](QStringView key) const
@ -356,7 +352,6 @@ QJsonValue QJsonObject::operator [](const QString &key) const
\since 5.7 \since 5.7
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a reference to the value for \a key. If there is no value with key Returns a reference to the value for \a key. If there is no value with key
\a key in the object, one is created with a QJsonValue::Null value and then \a key in the object, one is created with a QJsonValue::Null value and then
@ -374,7 +369,6 @@ QJsonValueRef QJsonObject::operator [](const QString &key)
{ {
return (*this)[QStringView(key)]; return (*this)[QStringView(key)];
} }
#endif
/*! /*!
\overload \overload
@ -414,7 +408,6 @@ QJsonValueRef QJsonObject::atImpl(T key)
return QJsonValueRef(this, index / 2); return QJsonValueRef(this, index / 2);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Inserts a new item with the key \a key and a value of \a value. Inserts a new item with the key \a key and a value of \a value.
@ -432,7 +425,6 @@ QJsonObject::iterator QJsonObject::insert(const QString &key, const QJsonValue &
{ {
return insert(QStringView(key), value); return insert(QStringView(key), value);
} }
#endif
/*! /*!
\overload \overload
@ -487,7 +479,6 @@ QJsonObject::iterator QJsonObject::insertAt(qsizetype pos, T key, const QJsonVal
return {this, pos / 2}; return {this, pos / 2};
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Removes \a key from the object. Removes \a key from the object.
@ -497,7 +488,6 @@ void QJsonObject::remove(const QString &key)
{ {
remove(QStringView(key)); remove(QStringView(key));
} }
#endif
/*! /*!
\overload \overload
@ -534,7 +524,6 @@ void QJsonObject::removeImpl(T key)
removeAt(index); removeAt(index);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Removes \a key from the object. Removes \a key from the object.
@ -548,7 +537,6 @@ QJsonValue QJsonObject::take(const QString &key)
{ {
return take(QStringView(key)); return take(QStringView(key));
} }
#endif
/*! /*!
\overload \overload
@ -588,7 +576,6 @@ QJsonValue QJsonObject::takeImpl(T key)
return v; return v;
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns \c true if the object contains key \a key. Returns \c true if the object contains key \a key.
@ -598,7 +585,6 @@ bool QJsonObject::contains(const QString &key) const
{ {
return contains(QStringView(key)); return contains(QStringView(key));
} }
#endif
/*! /*!
\overload \overload
@ -680,7 +666,6 @@ QJsonObject::iterator QJsonObject::erase(QJsonObject::iterator it)
return { this, qsizetype(it.item.index) }; return { this, qsizetype(it.item.index) };
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns an iterator pointing to the item with key \a key in the Returns an iterator pointing to the item with key \a key in the
map. map.
@ -692,7 +677,6 @@ QJsonObject::iterator QJsonObject::find(const QString &key)
{ {
return find(QStringView(key)); return find(QStringView(key));
} }
#endif
/*! /*!
\overload \overload
@ -726,12 +710,10 @@ QJsonObject::iterator QJsonObject::findImpl(T key)
return {this, index / 2}; return {this, index / 2};
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! \fn QJsonObject::const_iterator QJsonObject::find(const QString &key) const /*! \fn QJsonObject::const_iterator QJsonObject::find(const QString &key) const
\overload \overload
*/ */
#endif
/*! \fn QJsonObject::const_iterator QJsonObject::find(QStringView key) const /*! \fn QJsonObject::const_iterator QJsonObject::find(QStringView key) const
@ -745,7 +727,6 @@ QJsonObject::iterator QJsonObject::findImpl(T key)
\since 5.7 \since 5.7
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a const iterator pointing to the item with key \a key in the Returns a const iterator pointing to the item with key \a key in the
map. map.
@ -757,7 +738,6 @@ QJsonObject::const_iterator QJsonObject::constFind(const QString &key) const
{ {
return constFind(QStringView(key)); return constFind(QStringView(key));
} }
#endif
/*! /*!
\overload \overload

View File

@ -52,11 +52,9 @@ public:
inline qsizetype length() const { return size(); } inline qsizetype length() const { return size(); }
bool isEmpty() const; bool isEmpty() const;
#if QT_STRINGVIEW_LEVEL < 2
QJsonValue value(const QString &key) const; QJsonValue value(const QString &key) const;
QJsonValue operator[] (const QString &key) const; QJsonValue operator[] (const QString &key) const;
QJsonValueRef operator[] (const QString &key); QJsonValueRef operator[] (const QString &key);
#endif
QJsonValue value(QStringView key) const; QJsonValue value(QStringView key) const;
QJsonValue value(QLatin1StringView key) const; QJsonValue value(QLatin1StringView key) const;
QJsonValue operator[] (QStringView key) const { return value(key); } QJsonValue operator[] (QStringView key) const { return value(key); }
@ -64,11 +62,9 @@ public:
QJsonValueRef operator[] (QStringView key); QJsonValueRef operator[] (QStringView key);
QJsonValueRef operator[] (QLatin1StringView key); QJsonValueRef operator[] (QLatin1StringView key);
#if QT_STRINGVIEW_LEVEL < 2
void remove(const QString &key); void remove(const QString &key);
QJsonValue take(const QString &key); QJsonValue take(const QString &key);
bool contains(const QString &key) const; bool contains(const QString &key) const;
#endif
void remove(QStringView key); void remove(QStringView key);
void remove(QLatin1StringView key); void remove(QLatin1StringView key);
QJsonValue take(QStringView key); QJsonValue take(QStringView key);
@ -219,12 +215,10 @@ public:
// more Qt // more Qt
typedef iterator Iterator; typedef iterator Iterator;
typedef const_iterator ConstIterator; typedef const_iterator ConstIterator;
#if QT_STRINGVIEW_LEVEL < 2
iterator find(const QString &key); iterator find(const QString &key);
const_iterator find(const QString &key) const { return constFind(key); } const_iterator find(const QString &key) const { return constFind(key); }
const_iterator constFind(const QString &key) const; const_iterator constFind(const QString &key) const;
iterator insert(const QString &key, const QJsonValue &value); iterator insert(const QString &key, const QJsonValue &value);
#endif
iterator find(QStringView key); iterator find(QStringView key);
iterator find(QLatin1StringView key); iterator find(QLatin1StringView key);
const_iterator find(QStringView key) const { return constFind(key); } const_iterator find(QStringView key) const { return constFind(key); }

View File

@ -761,7 +761,6 @@ QJsonObject QJsonValue::toObject() const
return toObject(QJsonObject()); return toObject(QJsonObject());
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a QJsonValue representing the value for the key \a key. Returns a QJsonValue representing the value for the key \a key.
@ -778,7 +777,6 @@ const QJsonValue QJsonValue::operator[](const QString &key) const
{ {
return (*this)[QStringView(key)]; return (*this)[QStringView(key)];
} }
#endif
/*! /*!
\overload \overload

View File

@ -87,9 +87,7 @@ public:
QJsonObject toObject() const; QJsonObject toObject() const;
QJsonObject toObject(const QJsonObject &defaultValue) const; QJsonObject toObject(const QJsonObject &defaultValue) const;
#if QT_STRINGVIEW_LEVEL < 2
const QJsonValue operator[](const QString &key) const; const QJsonValue operator[](const QString &key) const;
#endif
const QJsonValue operator[](QStringView key) const; const QJsonValue operator[](QStringView key) const;
const QJsonValue operator[](QLatin1StringView key) const; const QJsonValue operator[](QLatin1StringView key) const;
const QJsonValue operator[](qsizetype i) const; const QJsonValue operator[](qsizetype i) const;

View File

@ -306,7 +306,7 @@ bool QCollator::ignorePunctuation() const
Returns an integer less than, equal to, or greater than zero depending on Returns an integer less than, equal to, or greater than zero depending on
whether \a s1 sorts before, with or after \a s2. whether \a s1 sorts before, with or after \a s2.
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn bool QCollator::operator()(const QString &s1, const QString &s2) const \fn bool QCollator::operator()(const QString &s1, const QString &s2) const
\overload \overload
@ -330,7 +330,6 @@ bool QCollator::ignorePunctuation() const
Returns an integer less than, equal to, or greater than zero depending on Returns an integer less than, equal to, or greater than zero depending on
whether \a s1 sorts before, with or after \a s2. whether \a s1 sorts before, with or after \a s2.
*/ */
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
\since 6.3 \since 6.3

View File

@ -65,7 +65,6 @@ public:
void setIgnorePunctuation(bool on); void setIgnorePunctuation(bool on);
bool ignorePunctuation() const; bool ignorePunctuation() const;
#if QT_STRINGVIEW_LEVEL < 2
int compare(const QString &s1, const QString &s2) const int compare(const QString &s1, const QString &s2) const
{ return compare(QStringView(s1), QStringView(s2)); } { return compare(QStringView(s1), QStringView(s2)); }
int compare(const QChar *s1, int len1, const QChar *s2, int len2) const int compare(const QChar *s1, int len1, const QChar *s2, int len2) const
@ -73,7 +72,6 @@ public:
bool operator()(const QString &s1, const QString &s2) const bool operator()(const QString &s1, const QString &s2) const
{ return compare(s1, s2) < 0; } { return compare(s1, s2) < 0; }
#endif
int compare(QStringView s1, QStringView s2) const; int compare(QStringView s1, QStringView s2) const;
bool operator()(QStringView s1, QStringView s2) const bool operator()(QStringView s1, QStringView s2) const

View File

@ -1007,12 +1007,10 @@ QLocale::QLocale(QStringView name)
{ {
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QLocale::QLocale(const QString &name) \fn QLocale::QLocale(const QString &name)
\overload \overload
*/ */
#endif
/*! /*!
Constructs a QLocale object initialized with the default locale. Constructs a QLocale object initialized with the default locale.
@ -1582,7 +1580,6 @@ QString QLocale::scriptToString(QLocale::Script script)
return QLatin1StringView(script_name_list + script_name_index[script]); return QLatin1StringView(script_name_list + script_name_index[script]);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn short QLocale::toShort(const QString &s, bool *ok) const \fn short QLocale::toShort(const QString &s, bool *ok) const
@ -1745,7 +1742,6 @@ QString QLocale::scriptToString(QLocale::Script script)
\sa toFloat(), toInt(), toString() \sa toFloat(), toInt(), toString()
*/ */
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns the short int represented by the localized string \a s. Returns the short int represented by the localized string \a s.
@ -1987,7 +1983,6 @@ QString QLocale::toString(qulonglong i) const
return d->m_data->unsLongLongToString(i, -1, 10, -1, flags); return d->m_data->unsLongLongToString(i, -1, 10, -1, flags);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a localized string representation of the given \a date in the Returns a localized string representation of the given \a date in the
specified \a format. specified \a format.
@ -2024,7 +2019,6 @@ QString QLocale::toString(QTime time, const QString &format) const
\sa QDateTime::toString(), QDate::toString(), QTime::toString() \sa QDateTime::toString(), QDate::toString(), QTime::toString()
*/ */
#endif
/*! /*!
\since 5.14 \since 5.14

View File

@ -891,10 +891,8 @@ public:
Q_FLAG(DataSizeFormats) Q_FLAG(DataSizeFormats)
QLocale(); QLocale();
#if QT_STRINGVIEW_LEVEL < 2
QT_CORE_INLINE_SINCE(6, 4) QT_CORE_INLINE_SINCE(6, 4)
explicit QLocale(const QString &name); explicit QLocale(const QString &name);
#endif
explicit QLocale(QStringView name); explicit QLocale(QStringView name);
QLocale(Language language, Territory territory); QLocale(Language language, Territory territory);
QLocale(Language language, Script script = AnyScript, Territory territory = AnyTerritory); QLocale(Language language, Script script = AnyScript, Territory territory = AnyTerritory);
@ -922,7 +920,6 @@ public:
QString nativeCountryName() const; QString nativeCountryName() const;
#endif #endif
#if QT_STRINGVIEW_LEVEL < 2
short toShort(const QString &s, bool *ok = nullptr) const short toShort(const QString &s, bool *ok = nullptr) const
{ return toShort(qToStringViewIgnoringNull(s), ok); } { return toShort(qToStringViewIgnoringNull(s), ok); }
ushort toUShort(const QString &s, bool *ok = nullptr) const ushort toUShort(const QString &s, bool *ok = nullptr) const
@ -943,7 +940,6 @@ public:
{ return toFloat(qToStringViewIgnoringNull(s), ok); } { return toFloat(qToStringViewIgnoringNull(s), ok); }
double toDouble(const QString &s, bool *ok = nullptr) const double toDouble(const QString &s, bool *ok = nullptr) const
{ return toDouble(qToStringViewIgnoringNull(s), ok); } { return toDouble(qToStringViewIgnoringNull(s), ok); }
#endif
short toShort(QStringView s, bool *ok = nullptr) const; short toShort(QStringView s, bool *ok = nullptr) const;
ushort toUShort(QStringView s, bool *ok = nullptr) const; ushort toUShort(QStringView s, bool *ok = nullptr) const;
@ -968,13 +964,11 @@ public:
QString toString(float f, char format = 'g', int precision = 6) const QString toString(float f, char format = 'g', int precision = 6) const
{ return toString(double(f), format, precision); } { return toString(double(f), format, precision); }
#if QT_STRINGVIEW_LEVEL < 2
// (Can't inline first two: passing by value doesn't work when only forward-declared.) // (Can't inline first two: passing by value doesn't work when only forward-declared.)
QString toString(QDate date, const QString &format) const; QString toString(QDate date, const QString &format) const;
QString toString(QTime time, const QString &format) const; QString toString(QTime time, const QString &format) const;
QString toString(const QDateTime &dateTime, const QString &format) const QString toString(const QDateTime &dateTime, const QString &format) const
{ return toString(dateTime, qToStringViewIgnoringNull(format)); } { return toString(dateTime, qToStringViewIgnoringNull(format)); }
#endif
QString toString(QDate date, QStringView format) const; QString toString(QDate date, QStringView format) const;
QString toString(QTime time, QStringView format) const; QString toString(QTime time, QStringView format) const;
QString toString(const QDateTime &dateTime, QStringView format) const; QString toString(const QDateTime &dateTime, QStringView format) const;

View File

@ -4079,7 +4079,6 @@ QString &QString::replace(QChar c, QLatin1StringView after, Qt::CaseSensitivity
go through QObject::tr(), for example. go through QObject::tr(), for example.
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns the index position of the first occurrence of the string \a Returns the index position of the first occurrence of the string \a
str in this string, searching forward from index position \a str in this string, searching forward from index position \a
@ -4101,7 +4100,6 @@ qsizetype QString::indexOf(const QString &str, qsizetype from, Qt::CaseSensitivi
{ {
return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.length()), cs); return QtPrivate::findString(QStringView(unicode(), length()), from, QStringView(str.unicode(), str.length()), cs);
} }
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn qsizetype QString::indexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const \fn qsizetype QString::indexOf(QStringView str, qsizetype from, Qt::CaseSensitivity cs) const
@ -4157,7 +4155,6 @@ qsizetype QString::indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) con
return qFindChar(QStringView(unicode(), length()), ch, from, cs); return qFindChar(QStringView(unicode(), length()), ch, from, cs);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns the index position of the last occurrence of the string \a Returns the index position of the last occurrence of the string \a
str in this string, searching backward from index position \a str in this string, searching backward from index position \a
@ -4204,7 +4201,6 @@ qsizetype QString::lastIndexOf(const QString &str, qsizetype from, Qt::CaseSensi
\sa indexOf(), contains(), count() \sa indexOf(), contains(), count()
*/ */
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
\since 4.5 \since 4.5
@ -4496,7 +4492,6 @@ qsizetype QString::count(QStringView str, Qt::CaseSensitivity cs) const
return QtPrivate::count(*this, str, cs); return QtPrivate::count(*this, str, cs);
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! \fn bool QString::contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const /*! \fn bool QString::contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
Returns \c true if this string contains an occurrence of the string Returns \c true if this string contains an occurrence of the string
@ -4510,7 +4505,6 @@ qsizetype QString::count(QStringView str, Qt::CaseSensitivity cs) const
\sa indexOf(), count() \sa indexOf(), count()
*/ */
#endif // QT_STRINGVIEW_LEVEL < 2
/*! \fn bool QString::contains(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const /*! \fn bool QString::contains(QLatin1StringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
\since 5.3 \since 5.3
@ -5036,7 +5030,6 @@ QString QString::mid(qsizetype position, qsizetype n) const
\sa endsWith(), first(), last(), sliced(), chop(), truncate() \sa endsWith(), first(), last(), sliced(), chop(), truncate()
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns \c true if the string starts with \a s; otherwise returns Returns \c true if the string starts with \a s; otherwise returns
\c false. \c false.
@ -5052,7 +5045,6 @@ bool QString::startsWith(const QString& s, Qt::CaseSensitivity cs) const
{ {
return qt_starts_with_impl(QStringView(*this), QStringView(s), cs); return qt_starts_with_impl(QStringView(*this), QStringView(s), cs);
} }
#endif
/*! /*!
\overload startsWith() \overload startsWith()
@ -5091,7 +5083,6 @@ bool QString::startsWith(QChar c, Qt::CaseSensitivity cs) const
\sa endsWith() \sa endsWith()
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns \c true if the string ends with \a s; otherwise returns Returns \c true if the string ends with \a s; otherwise returns
\c false. \c false.
@ -5107,7 +5098,6 @@ bool QString::endsWith(const QString &s, Qt::CaseSensitivity cs) const
{ {
return qt_ends_with_impl(QStringView(*this), QStringView(s), cs); return qt_ends_with_impl(QStringView(*this), QStringView(s), cs);
} }
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn bool QString::endsWith(QStringView str, Qt::CaseSensitivity cs) const \fn bool QString::endsWith(QStringView str, Qt::CaseSensitivity cs) const
@ -6215,7 +6205,6 @@ QString& QString::fill(QChar ch, qsizetype size)
sensitivity setting \a cs. sensitivity setting \a cs.
*/ */
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\overload compare() \overload compare()
\since 4.2 \since 4.2
@ -6231,7 +6220,6 @@ int QString::compare(const QString &other, Qt::CaseSensitivity cs) const noexcep
{ {
return QtPrivate::compareStrings(*this, other, cs); return QtPrivate::compareStrings(*this, other, cs);
} }
#endif
/*! /*!
\internal \internal
@ -8108,7 +8096,6 @@ static QString replaceArgEscapes(QStringView s, const ArgEscapeData &d, qsizetyp
return result; return result;
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
Returns a copy of this string with the lowest numbered place marker Returns a copy of this string with the lowest numbered place marker
replaced by string \a a, i.e., \c %1, \c %2, ..., \c %99. replaced by string \a a, i.e., \c %1, \c %2, ..., \c %99.
@ -8142,7 +8129,6 @@ QString QString::arg(const QString &a, int fieldWidth, QChar fillChar) const
{ {
return arg(qToStringViewIgnoringNull(a), fieldWidth, fillChar); return arg(qToStringViewIgnoringNull(a), fieldWidth, fillChar);
} }
#endif // QT_STRINGVIEW_LEVEL < 2
/*! /*!
\overload \overload

View File

@ -517,10 +517,8 @@ public:
QChar fillChar = u' ') const; QChar fillChar = u' ') const;
[[nodiscard]] QString arg(QChar a, int fieldWidth = 0, [[nodiscard]] QString arg(QChar a, int fieldWidth = 0,
QChar fillChar = u' ') const; QChar fillChar = u' ') const;
#if QT_STRINGVIEW_LEVEL < 2
[[nodiscard]] QString arg(const QString &a, int fieldWidth = 0, [[nodiscard]] QString arg(const QString &a, int fieldWidth = 0,
QChar fillChar = u' ') const; QChar fillChar = u' ') const;
#endif
[[nodiscard]] QString arg(QStringView a, int fieldWidth = 0, [[nodiscard]] QString arg(QStringView a, int fieldWidth = 0,
QChar fillChar = u' ') const; QChar fillChar = u' ') const;
[[nodiscard]] QString arg(QLatin1StringView a, int fieldWidth = 0, [[nodiscard]] QString arg(QLatin1StringView a, int fieldWidth = 0,
@ -557,9 +555,7 @@ public:
[[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
[[nodiscard]] qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype indexOf(QLatin1StringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#if QT_STRINGVIEW_LEVEL < 2
[[nodiscard]] qsizetype indexOf(const QString &s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype indexOf(const QString &s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif
[[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept [[nodiscard]] qsizetype indexOf(QStringView s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::findString(*this, from, s, cs); } { return QtPrivate::findString(*this, from, s, cs); }
[[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept [[nodiscard]] qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
@ -568,11 +564,9 @@ public:
[[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
{ return lastIndexOf(s, size(), cs); } { return lastIndexOf(s, size(), cs); }
[[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype lastIndexOf(QLatin1StringView s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#if QT_STRINGVIEW_LEVEL < 2
[[nodiscard]] qsizetype lastIndexOf(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const [[nodiscard]] qsizetype lastIndexOf(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
{ return lastIndexOf(s, size(), cs); } { return lastIndexOf(s, size(), cs); }
[[nodiscard]] qsizetype lastIndexOf(const QString &s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype lastIndexOf(const QString &s, qsizetype from, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif
[[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept [[nodiscard]] qsizetype lastIndexOf(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return lastIndexOf(s, size(), cs); } { return lastIndexOf(s, size(), cs); }
@ -580,9 +574,7 @@ public:
{ return QtPrivate::lastIndexOf(*this, from, s, cs); } { return QtPrivate::lastIndexOf(*this, from, s, cs); }
[[nodiscard]] inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] inline bool contains(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#if QT_STRINGVIEW_LEVEL < 2
[[nodiscard]] inline bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] inline bool contains(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif
[[nodiscard]] inline bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] inline bool contains(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
[[nodiscard]] inline bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; [[nodiscard]] inline bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
[[nodiscard]] qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; [[nodiscard]] qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@ -636,17 +628,13 @@ public:
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return first(size() - n); } { Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return first(size() - n); }
#if QT_STRINGVIEW_LEVEL < 2
bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif
[[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept [[nodiscard]] bool startsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::startsWith(*this, s, cs); } { return QtPrivate::startsWith(*this, s, cs); }
bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool startsWith(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#if QT_STRINGVIEW_LEVEL < 2
bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
#endif
[[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept [[nodiscard]] bool endsWith(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::endsWith(*this, s, cs); } { return QtPrivate::endsWith(*this, s, cs); }
bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const; bool endsWith(QLatin1StringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
@ -690,33 +678,25 @@ public:
QString &insert(qsizetype i, QChar c); QString &insert(qsizetype i, QChar c);
QString &insert(qsizetype i, const QChar *uc, qsizetype len); QString &insert(qsizetype i, const QChar *uc, qsizetype len);
#if QT_STRINGVIEW_LEVEL < 2
inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.length()); } inline QString &insert(qsizetype i, const QString &s) { return insert(i, s.constData(), s.length()); }
#endif
inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); } inline QString &insert(qsizetype i, QStringView v) { return insert(i, v.data(), v.length()); }
QString &insert(qsizetype i, QLatin1StringView s); QString &insert(qsizetype i, QLatin1StringView s);
QString &append(QChar c); QString &append(QChar c);
QString &append(const QChar *uc, qsizetype len); QString &append(const QChar *uc, qsizetype len);
#if QT_STRINGVIEW_LEVEL < 2
QString &append(const QString &s); QString &append(const QString &s);
#endif
inline QString &append(QStringView v) { return append(v.data(), v.length()); } inline QString &append(QStringView v) { return append(v.data(), v.length()); }
QString &append(QLatin1StringView s); QString &append(QLatin1StringView s);
inline QString &prepend(QChar c) { return insert(0, c); } inline QString &prepend(QChar c) { return insert(0, c); }
inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); } inline QString &prepend(const QChar *uc, qsizetype len) { return insert(0, uc, len); }
#if QT_STRINGVIEW_LEVEL < 2
inline QString &prepend(const QString &s) { return insert(0, s); } inline QString &prepend(const QString &s) { return insert(0, s); }
#endif
inline QString &prepend(QStringView v) { return prepend(v.data(), v.length()); } inline QString &prepend(QStringView v) { return prepend(v.data(), v.length()); }
inline QString &prepend(QLatin1StringView s) { return insert(0, s); } inline QString &prepend(QLatin1StringView s) { return insert(0, s); }
inline QString &operator+=(QChar c) { return append(c); } inline QString &operator+=(QChar c) { return append(c); }
#if QT_STRINGVIEW_LEVEL < 2
inline QString &operator+=(const QString &s) { return append(s); } inline QString &operator+=(const QString &s) { return append(s); }
#endif
inline QString &operator+=(QStringView v) { return append(v); } inline QString &operator+=(QStringView v) { return append(v); }
inline QString &operator+=(QLatin1StringView s) { return append(s); } inline QString &operator+=(QLatin1StringView s) { return append(s); }
@ -862,9 +842,7 @@ public:
QString &setUnicode(const QChar *unicode, qsizetype size); QString &setUnicode(const QChar *unicode, qsizetype size);
inline QString &setUtf16(const ushort *utf16, qsizetype size); // ### Qt 7 char16_t inline QString &setUtf16(const ushort *utf16, qsizetype size); // ### Qt 7 char16_t
#if QT_STRINGVIEW_LEVEL < 2
int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; int compare(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
#endif
int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; int compare(QLatin1StringView other, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
inline int compare(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept; inline int compare(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
int compare(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept int compare(QChar ch, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
@ -1395,10 +1373,8 @@ inline QString::const_iterator QString::cend() const
{ return reinterpret_cast<const QChar*>(d.data() + d.size); } { return reinterpret_cast<const QChar*>(d.data() + d.size); }
inline QString::const_iterator QString::constEnd() const inline QString::const_iterator QString::constEnd() const
{ return reinterpret_cast<const QChar*>(d.data() + d.size); } { return reinterpret_cast<const QChar*>(d.data() + d.size); }
#if QT_STRINGVIEW_LEVEL < 2
inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const inline bool QString::contains(const QString &s, Qt::CaseSensitivity cs) const
{ return indexOf(s, 0, cs) != -1; } { return indexOf(s, 0, cs) != -1; }
#endif
inline bool QString::contains(QLatin1StringView s, Qt::CaseSensitivity cs) const inline bool QString::contains(QLatin1StringView s, Qt::CaseSensitivity cs) const
{ return indexOf(s, 0, cs) != -1; } { return indexOf(s, 0, cs) != -1; }
inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const inline bool QString::contains(QChar c, Qt::CaseSensitivity cs) const

View File

@ -240,7 +240,6 @@ void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs)
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const \fn QStringList QStringList::filter(const QString &str, Qt::CaseSensitivity cs) const
@ -260,7 +259,6 @@ void QtPrivate::QStringList_sort(QStringList *that, Qt::CaseSensitivity cs)
\sa contains() \sa contains()
*/ */
#endif
/*! /*!
\fn QStringList QStringList::filter(QStringView str, Qt::CaseSensitivity cs) const \fn QStringList QStringList::filter(QStringView str, Qt::CaseSensitivity cs) const
@ -289,7 +287,6 @@ static bool stringList_contains(const QStringList &stringList, const T &str, Qt:
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const \fn bool QStringList::contains(const QString &str, Qt::CaseSensitivity cs) const
@ -299,7 +296,6 @@ static bool stringList_contains(const QStringList &stringList, const T &str, Qt:
\sa indexOf(), lastIndexOf(), QString::contains() \sa indexOf(), lastIndexOf(), QString::contains()
*/ */
#endif
/*! /*!
\fn bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const \fn bool QStringList::contains(QStringView str, Qt::CaseSensitivity cs) const
@ -354,7 +350,6 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula
} }
#endif // QT_CONFIG(regularexpression) #endif // QT_CONFIG(regularexpression)
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs) \fn QStringList &QStringList::replaceInStrings(const QString &before, const QString &after, Qt::CaseSensitivity cs)
@ -382,7 +377,6 @@ QStringList QtPrivate::QStringList_filter(const QStringList *that, const QRegula
\overload \overload
\since 5.14 \since 5.14
*/ */
#endif
/*! /*!
\fn QStringList &QStringList::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs) \fn QStringList &QStringList::replaceInStrings(QStringView before, QStringView after, Qt::CaseSensitivity cs)
@ -438,7 +432,6 @@ static qsizetype accumulatedSize(const QStringList &list, qsizetype seplen)
return result; return result;
} }
#if QT_STRINGVIEW_LEVEL < 2
/*! /*!
\fn QString QStringList::join(const QString &separator) const \fn QString QStringList::join(const QString &separator) const
@ -448,7 +441,6 @@ static qsizetype accumulatedSize(const QStringList &list, qsizetype seplen)
\sa QString::split() \sa QString::split()
*/ */
#endif
/*! /*!
\fn QString QStringList::join(QChar separator) const \fn QString QStringList::join(QChar separator) const

View File

@ -86,7 +86,6 @@ public:
return *self(); return *self();
} }
#if QT_STRINGVIEW_LEVEL < 2
inline QString join(const QString &sep) const inline QString join(const QString &sep) const
{ return QtPrivate::QStringList_join(self(), sep.constData(), sep.length()); } { return QtPrivate::QStringList_join(self(), sep.constData(), sep.length()); }
inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const inline QStringList filter(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const
@ -106,7 +105,6 @@ public:
QtPrivate::QStringList_replaceInStrings(self(), before, after, cs); QtPrivate::QStringList_replaceInStrings(self(), before, after, cs);
return *self(); return *self();
} }
#endif
using QListSpecialMethodsBase<QString>::contains; using QListSpecialMethodsBase<QString>::contains;
using QListSpecialMethodsBase<QString>::indexOf; using QListSpecialMethodsBase<QString>::indexOf;
using QListSpecialMethodsBase<QString>::lastIndexOf; using QListSpecialMethodsBase<QString>::lastIndexOf;
@ -116,14 +114,12 @@ public:
inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept inline bool contains(QStringView str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::QStringList_contains(self(), str, cs); } { return QtPrivate::QStringList_contains(self(), str, cs); }
#if QT_STRINGVIEW_LEVEL < 2
inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept inline bool contains(const QString &str, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
{ return QtPrivate::QStringList_contains(self(), str, cs); } { return QtPrivate::QStringList_contains(self(), str, cs); }
qsizetype indexOf(const QString &str, qsizetype from = 0) const noexcept qsizetype indexOf(const QString &str, qsizetype from = 0) const noexcept
{ return indexOf(QStringView(str), from); } { return indexOf(QStringView(str), from); }
qsizetype lastIndexOf(const QString &str, qsizetype from = -1) const noexcept qsizetype lastIndexOf(const QString &str, qsizetype from = -1) const noexcept
{ return lastIndexOf(QStringView(str), from); } { return lastIndexOf(QStringView(str), from); }
#endif
#if QT_CONFIG(regularexpression) #if QT_CONFIG(regularexpression)
inline QStringList filter(const QRegularExpression &re) const inline QStringList filter(const QRegularExpression &re) const

View File

@ -5,14 +5,7 @@
#define QSTRINGVIEW_H #define QSTRINGVIEW_H
/* /*
This macro enables three "levels" of QStringView support: Obsolete.
1. offer QStringView, overload some functions taking QString with
QStringView
2. Obsolete: QStringRef and its overloads have been removed.
3. like 2, but replace functions taking QString, too.
*/ */
#ifndef QT_STRINGVIEW_LEVEL #ifndef QT_STRINGVIEW_LEVEL
# define QT_STRINGVIEW_LEVEL 1 # define QT_STRINGVIEW_LEVEL 1

View File

@ -114,10 +114,8 @@ public:
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
QString toString(Qt::DateFormat format = Qt::TextDate) const; QString toString(Qt::DateFormat format = Qt::TextDate) const;
# if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format, QCalendar cal = QCalendar()) const QString toString(const QString &format, QCalendar cal = QCalendar()) const
{ return toString(qToStringViewIgnoringNull(format), cal); } { return toString(qToStringViewIgnoringNull(format), cal); }
# endif
QString toString(QStringView format, QCalendar cal = QCalendar()) const; QString toString(QStringView format, QCalendar cal = QCalendar()) const;
#endif #endif
bool setDate(int year, int month, int day); // Gregorian-optimized bool setDate(int year, int month, int day); // Gregorian-optimized
@ -146,13 +144,11 @@ public:
static QDate fromString(QStringView string, QStringView format, QCalendar cal = QCalendar()) static QDate fromString(QStringView string, QStringView format, QCalendar cal = QCalendar())
{ return fromString(string.toString(), format, cal); } { return fromString(string.toString(), format, cal); }
static QDate fromString(const QString &string, QStringView format, QCalendar cal = QCalendar()); static QDate fromString(const QString &string, QStringView format, QCalendar cal = QCalendar());
# if QT_STRINGVIEW_LEVEL < 2
static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) static QDate fromString(const QString &string, Qt::DateFormat format = Qt::TextDate)
{ return fromString(qToStringViewIgnoringNull(string), format); } { return fromString(qToStringViewIgnoringNull(string), format); }
static QDate fromString(const QString &string, const QString &format, static QDate fromString(const QString &string, const QString &format,
QCalendar cal = QCalendar()) QCalendar cal = QCalendar())
{ return fromString(string, qToStringViewIgnoringNull(format), cal); } { return fromString(string, qToStringViewIgnoringNull(format), cal); }
# endif
#endif #endif
static bool isValid(int y, int m, int d); static bool isValid(int y, int m, int d);
static bool isLeapYear(int year); static bool isLeapYear(int year);
@ -204,10 +200,8 @@ public:
int msec() const; int msec() const;
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
QString toString(Qt::DateFormat f = Qt::TextDate) const; QString toString(Qt::DateFormat f = Qt::TextDate) const;
#if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format) const QString toString(const QString &format) const
{ return toString(qToStringViewIgnoringNull(format)); } { return toString(qToStringViewIgnoringNull(format)); }
#endif
QString toString(QStringView format) const; QString toString(QStringView format) const;
#endif #endif
bool setHMS(int h, int m, int s, int ms = 0); bool setHMS(int h, int m, int s, int ms = 0);
@ -226,12 +220,10 @@ public:
static QTime fromString(QStringView string, QStringView format) static QTime fromString(QStringView string, QStringView format)
{ return fromString(string.toString(), format); } { return fromString(string.toString(), format); }
static QTime fromString(const QString &string, QStringView format); static QTime fromString(const QString &string, QStringView format);
# if QT_STRINGVIEW_LEVEL < 2
static QTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) static QTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate)
{ return fromString(qToStringViewIgnoringNull(string), format); } { return fromString(qToStringViewIgnoringNull(string), format); }
static QTime fromString(const QString &string, const QString &format) static QTime fromString(const QString &string, const QString &format)
{ return fromString(string, qToStringViewIgnoringNull(format)); } { return fromString(string, qToStringViewIgnoringNull(format)); }
# endif
#endif #endif
static bool isValid(int h, int m, int s, int ms = 0); static bool isValid(int h, int m, int s, int ms = 0);
@ -348,10 +340,8 @@ public:
#if QT_CONFIG(datestring) #if QT_CONFIG(datestring)
QString toString(Qt::DateFormat format = Qt::TextDate) const; QString toString(Qt::DateFormat format = Qt::TextDate) const;
# if QT_STRINGVIEW_LEVEL < 2
QString toString(const QString &format, QCalendar cal = QCalendar()) const QString toString(const QString &format, QCalendar cal = QCalendar()) const
{ return toString(qToStringViewIgnoringNull(format), cal); } { return toString(qToStringViewIgnoringNull(format), cal); }
# endif
QString toString(QStringView format, QCalendar cal = QCalendar()) const; QString toString(QStringView format, QCalendar cal = QCalendar()) const;
#endif #endif
[[nodiscard]] QDateTime addDays(qint64 days) const; [[nodiscard]] QDateTime addDays(qint64 days) const;
@ -385,13 +375,11 @@ public:
{ return fromString(string.toString(), format, cal); } { return fromString(string.toString(), format, cal); }
static QDateTime fromString(const QString &string, QStringView format, static QDateTime fromString(const QString &string, QStringView format,
QCalendar cal = QCalendar()); QCalendar cal = QCalendar());
# if QT_STRINGVIEW_LEVEL < 2
static QDateTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate) static QDateTime fromString(const QString &string, Qt::DateFormat format = Qt::TextDate)
{ return fromString(qToStringViewIgnoringNull(string), format); } { return fromString(qToStringViewIgnoringNull(string), format); }
static QDateTime fromString(const QString &string, const QString &format, static QDateTime fromString(const QString &string, const QString &format,
QCalendar cal = QCalendar()) QCalendar cal = QCalendar())
{ return fromString(string, qToStringViewIgnoringNull(format), cal); } { return fromString(string, qToStringViewIgnoringNull(format), cal); }
# endif
#endif #endif
static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec = Qt::LocalTime, static QDateTime fromMSecsSinceEpoch(qint64 msecs, Qt::TimeSpec spec = Qt::LocalTime,

View File

@ -156,10 +156,8 @@ inline Q_DECL_PURE_FUNCTION size_t qHash(const QByteArray &key, size_t seed = 0
#endif #endif
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QStringView key, size_t seed = 0) noexcept; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QStringView key, size_t seed = 0) noexcept;
#if QT_STRINGVIEW_LEVEL < 2
inline Q_DECL_PURE_FUNCTION size_t qHash(const QString &key, size_t seed = 0) noexcept inline Q_DECL_PURE_FUNCTION size_t qHash(const QString &key, size_t seed = 0) noexcept
{ return qHash(QStringView{key}, seed); } { return qHash(QStringView{key}, seed); }
#endif
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QBitArray &key, size_t seed = 0) noexcept; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(const QBitArray &key, size_t seed = 0) noexcept;
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QLatin1StringView key, size_t seed = 0) noexcept; Q_CORE_EXPORT Q_DECL_PURE_FUNCTION size_t qHash(QLatin1StringView key, size_t seed = 0) noexcept;
Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(QKeyCombination key, size_t seed = 0) noexcept Q_DECL_CONST_FUNCTION constexpr inline size_t qHash(QKeyCombination key, size_t seed = 0) noexcept