QString: plaster more and more [[nodiscard]]
The situation was quite inconsistent. Use the attribute more. Change-Id: If21817b4c2ea1148ad4ad80e7a50fab721a58b65 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
d9a6517076
commit
553d4ec464
|
|
@ -489,39 +489,39 @@ public:
|
|||
static QString vasprintf(const char *format, va_list ap) Q_ATTRIBUTE_FORMAT_PRINTF(1, 0);
|
||||
static QString asprintf(const char *format, ...) Q_ATTRIBUTE_FORMAT_PRINTF(1, 2);
|
||||
|
||||
qsizetype indexOf(QChar c, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
qsizetype indexOf(QLatin1String s, 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(QLatin1String s, qsizetype from = 0, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
#if QT_STRINGVIEW_LEVEL < 2
|
||||
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
|
||||
{ return QtPrivate::findString(*this, from, s, cs); }
|
||||
qsizetype lastIndexOf(QChar c, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
qsizetype lastIndexOf(QLatin1String s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[nodiscard]] qsizetype lastIndexOf(QChar c, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[nodiscard]] qsizetype lastIndexOf(QLatin1String s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
#if QT_STRINGVIEW_LEVEL < 2
|
||||
qsizetype lastIndexOf(const QString &s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[nodiscard]] qsizetype lastIndexOf(const QString &s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
#endif
|
||||
|
||||
[[nodiscard]] qsizetype lastIndexOf(QStringView s, qsizetype from = -1, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept
|
||||
{ return QtPrivate::lastIndexOf(*this, from, s, cs); }
|
||||
|
||||
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
|
||||
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
|
||||
inline bool contains(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
inline bool contains(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const noexcept;
|
||||
qsizetype count(QChar c, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
qsizetype count(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
qsizetype count(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[nodiscard]] inline bool contains(QLatin1String s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[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(const QString &s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
[[nodiscard]] qsizetype count(QStringView s, Qt::CaseSensitivity cs = Qt::CaseSensitive) const;
|
||||
|
||||
#if QT_CONFIG(regularexpression)
|
||||
qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0,
|
||||
QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1,
|
||||
QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
qsizetype count(const QRegularExpression &re) const;
|
||||
[[nodiscard]] qsizetype indexOf(const QRegularExpression &re, qsizetype from = 0,
|
||||
QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
[[nodiscard]] qsizetype lastIndexOf(const QRegularExpression &re, qsizetype from = -1,
|
||||
QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
[[nodiscard]] bool contains(const QRegularExpression &re, QRegularExpressionMatch *rmatch = nullptr) const;
|
||||
[[nodiscard]] qsizetype count(const QRegularExpression &re) const;
|
||||
#endif
|
||||
|
||||
enum SectionFlag {
|
||||
|
|
@ -533,10 +533,10 @@ public:
|
|||
};
|
||||
Q_DECLARE_FLAGS(SectionFlags, SectionFlag)
|
||||
|
||||
QString section(QChar sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
QString section(const QString &in_sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
[[nodiscard]] QString section(QChar sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
[[nodiscard]] QString section(const QString &in_sep, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
#if QT_CONFIG(regularexpression)
|
||||
QString section(const QRegularExpression &re, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
[[nodiscard]] QString section(const QRegularExpression &re, qsizetype start, qsizetype end = -1, SectionFlags flags = SectionDefault) const;
|
||||
#endif
|
||||
[[nodiscard]] QString left(qsizetype n) const;
|
||||
[[nodiscard]] QString right(qsizetype n) const;
|
||||
|
|
|
|||
|
|
@ -774,8 +774,7 @@ QStringList QPlatformFileDialogHelper::cleanFilterList(const QString &filter)
|
|||
QRegularExpression regexp(QString::fromLatin1(filterRegExp));
|
||||
Q_ASSERT(regexp.isValid());
|
||||
QString f = filter;
|
||||
QRegularExpressionMatch match;
|
||||
filter.indexOf(regexp, 0, &match);
|
||||
QRegularExpressionMatch match = regexp.match(filter);
|
||||
if (match.hasMatch())
|
||||
f = match.captured(2);
|
||||
return f.split(QLatin1Char(' '), Qt::SkipEmptyParts);
|
||||
|
|
|
|||
Loading…
Reference in New Issue