Utils: Enable to construct Utf8String with the string literal

It does not make any sense to specify the number of letters
and it is passed to QByteArray anyways which also accepts -1.

Change-Id: If3a9d8cb039853c7b29ea9c73828fb1983e2f584
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-01-17 08:39:53 +01:00
parent bc239e240e
commit 24ac894538

View File

@@ -33,6 +33,7 @@
#include <QMetaType>
#include <QString>
#include <cstring>
#include <iosfwd>
class Utf8StringVector;
@@ -45,10 +46,13 @@ class Utf8String
public:
Utf8String() = default;
explicit Utf8String(const char *utf8Text)
: byteArray(utf8Text, utf8Text ? static_cast<int>(std::strlen(utf8Text)) : -1)
{}
explicit Utf8String(const char *utf8Text, int size)
: byteArray(utf8Text, size)
{
}
{}
Utf8String(const QString &text)
: byteArray(text.toUtf8())