forked from qt-creator/qt-creator
Utils: Add explicit conversion operator to QString to SmallStringView
Change-Id: I759651c6426337256b514055132806bf91e93e33 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -27,7 +27,7 @@
|
||||
|
||||
#include "smallstringiterator.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include <QString>
|
||||
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
@@ -116,6 +116,11 @@ public:
|
||||
return std::string(data(), size());
|
||||
}
|
||||
|
||||
explicit operator QString() const
|
||||
{
|
||||
return QString::fromUtf8(data(), int(size()));
|
||||
}
|
||||
|
||||
bool startsWith(SmallStringView subStringToSearch) const noexcept
|
||||
{
|
||||
if (size() >= subStringToSearch.size())
|
||||
|
||||
Reference in New Issue
Block a user