Don't truncate parameters passed to QStringView::{first/last/from/slice}
QStringView doesn't need to convert qsizetype parameters to int. Change-Id: Iba8b5259ab3ed7a24a57bb6748446fd3e45bb182 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
96065b7227
commit
5b686e208f
@ -277,13 +277,13 @@ public:
|
||||
}
|
||||
|
||||
Q_REQUIRED_RESULT constexpr QStringView first(qsizetype n) const
|
||||
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data, int(n)); }
|
||||
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data, n); }
|
||||
Q_REQUIRED_RESULT constexpr QStringView last(qsizetype n) const
|
||||
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, int(n)); }
|
||||
{ Q_ASSERT(n >= 0); Q_ASSERT(n <= size()); return QStringView(m_data + size() - n, n); }
|
||||
Q_REQUIRED_RESULT constexpr QStringView from(qsizetype pos) const
|
||||
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - int(pos)); }
|
||||
{ Q_ASSERT(pos >= 0); Q_ASSERT(pos <= size()); return QStringView(m_data + pos, size() - pos); }
|
||||
Q_REQUIRED_RESULT constexpr QStringView sliced(qsizetype pos, qsizetype n) const
|
||||
{ Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, int(n)); }
|
||||
{ Q_ASSERT(pos >= 0); Q_ASSERT(n >= 0); Q_ASSERT(size_t(pos) + size_t(n) <= size_t(size())); return QStringView(m_data + pos, n); }
|
||||
Q_REQUIRED_RESULT Q_DECL_CONSTEXPR QStringView chopped(qsizetype n) const
|
||||
{ return Q_ASSERT(n >= 0), Q_ASSERT(n <= size()), QStringView(m_data, m_size - n); }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user