forked from qt-creator/qt-creator
Utils: Add more conversion operators to SmallString
An explicit operator for QLatin1StringView. That is dangerous if the string is not ASCII and one for QUtf8StringView. Change-Id: I2d0a0ca3854b47595563a19263aacd7f8825d026 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -203,6 +203,15 @@ public:
|
||||
SmallStringView toStringView() const noexcept { return SmallStringView(data(), size()); }
|
||||
|
||||
operator SmallStringView() const noexcept { return SmallStringView(data(), size()); }
|
||||
explicit operator QLatin1StringView() const noexcept
|
||||
{
|
||||
return QLatin1StringView(data(), Utils::ssize(*this));
|
||||
}
|
||||
|
||||
operator QUtf8StringView() const noexcept
|
||||
{
|
||||
return QUtf8StringView(data(), Utils::ssize(*this));
|
||||
}
|
||||
|
||||
explicit operator QString() const noexcept { return toQString(); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user