QStringConverter: use qt_to_latin1() helper from qstring.cpp
This changes the newly-added QLatin1::convertFromUnicode() overload. Change-Id: Ie465f052e711d72e51217b74b5b51a89c5d8b9e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
92a7c36020
commit
f090a4785b
@ -5389,6 +5389,12 @@ char16_t *QLatin1::convertToUnicode(char16_t *out, QLatin1StringView in) noexcep
|
|||||||
return std::next(out, len);
|
return std::next(out, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *QLatin1::convertFromUnicode(char *out, QStringView in) noexcept
|
||||||
|
{
|
||||||
|
const qsizetype len = in.size();
|
||||||
|
qt_to_latin1(reinterpret_cast<uchar *>(out), in.utf16(), len);
|
||||||
|
return out + len;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QByteArray QString::toLatin1() const
|
\fn QByteArray QString::toLatin1() const
|
||||||
|
@ -50,11 +50,9 @@ struct QLatin1
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char *convertFromUnicode(char *out, QStringView in, QStringConverter::State *state) noexcept;
|
static char *convertFromUnicode(char *out, QStringView in, QStringConverter::State *state) noexcept;
|
||||||
static char *convertFromUnicode(char *out, QStringView in) noexcept
|
|
||||||
{
|
// Defined in qstring.cpp
|
||||||
QStringConverter::State state{QStringConverter::Flag::Stateless};
|
static char *convertFromUnicode(char *out, QStringView in) noexcept;
|
||||||
return convertFromUnicode(out, in, &state);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct QUtf8BaseTraits
|
struct QUtf8BaseTraits
|
||||||
|
Loading…
x
Reference in New Issue
Block a user