QStringConverter: mark QStringConverterBase as removed in Qt 7
It's an internal class containing the common content between QStringConverter and QTextCodec (Qt5CoreCompat) so the latter didn't get the new API from the former. This allows us to remove the QStringConverter::Flags qdoc hack too. Change-Id: Iacf32fb88e3c3d0ea369fffd153356cec308e3dd Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit c2fa41a081e4c9fe308dcd47283537eedf05c24a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9a634a5c4b
commit
b80f632f28
@ -707,7 +707,7 @@ QByteArray QUtf8::convertFromUnicode(QStringView in)
|
||||
return result;
|
||||
}
|
||||
|
||||
QByteArray QUtf8::convertFromUnicode(QStringView in, QStringConverterBase::State *state)
|
||||
QByteArray QUtf8::convertFromUnicode(QStringView in, QStringConverter::State *state)
|
||||
{
|
||||
QByteArray ba(3*in.size() +3, Qt::Uninitialized);
|
||||
char *end = convertFromUnicode(ba.data(), in, state);
|
||||
@ -1959,13 +1959,6 @@ static qsizetype toLatin1Len(qsizetype l) { return l + 1; }
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
\class QStringConverterBase
|
||||
\internal
|
||||
|
||||
Just a common base class for QStringConverter and QTextCodec
|
||||
*/
|
||||
|
||||
/*!
|
||||
\class QStringConverter
|
||||
\inmodule QtCore
|
||||
@ -2159,7 +2152,7 @@ static bool nameMatch(const char *a, QAnyStringView b)
|
||||
// only derives from QStringConverter to get access to protected types
|
||||
struct QStringConverterICU : QStringConverter
|
||||
{
|
||||
static void clear_function(QStringConverterBase::State *state) noexcept
|
||||
static void clear_function(QStringConverter::State *state) noexcept
|
||||
{
|
||||
ucnv_close(static_cast<UConverter *>(state->d[0]));
|
||||
state->d[0] = nullptr;
|
||||
@ -2375,11 +2368,11 @@ struct QStringConverterICU : QStringConverter
|
||||
{ return name.visit([](auto name) { return nul_terminate_impl(name); }); }
|
||||
|
||||
static const QStringConverter::Interface *
|
||||
make_icu_converter(QStringConverterBase::State *state, QAnyStringView name)
|
||||
make_icu_converter(QStringConverter::State *state, QAnyStringView name)
|
||||
{ return make_icu_converter(state, nul_terminate(name).data()); }
|
||||
|
||||
static const QStringConverter::Interface *make_icu_converter(
|
||||
QStringConverterBase::State *state,
|
||||
QStringConverter::State *state,
|
||||
const char *name)
|
||||
{
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
@ -2397,7 +2390,7 @@ struct QStringConverterICU : QStringConverter
|
||||
}
|
||||
state->d[1] = const_cast<char *>(persistentName);
|
||||
state->d[0] = conv;
|
||||
state->flags |= QStringConverterBase::Flag::UsesIcu;
|
||||
state->flags |= QStringConverter::Flag::UsesIcu;
|
||||
qsizetype maxCharSize = ucnv_getMaxCharSize(conv);
|
||||
state->clearFn = QStringConverterICU::clear_function;
|
||||
if (maxCharSize > 8 || maxCharSize < 1) {
|
||||
|
@ -26,7 +26,11 @@ class QChar;
|
||||
class QByteArrayView;
|
||||
class QStringView;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(Q_QDOC) && !defined(QT_BOOTSTRAPPED)
|
||||
class QStringConverterBase
|
||||
#else
|
||||
class QStringConverter
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
enum class Flag {
|
||||
@ -80,17 +84,19 @@ public:
|
||||
private:
|
||||
Q_DISABLE_COPY(State)
|
||||
};
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) && !defined(Q_QDOC) && !defined(QT_BOOTSTRAPPED)
|
||||
protected:
|
||||
QStringConverterBase() = default;
|
||||
~QStringConverterBase() = default;
|
||||
QStringConverterBase(QStringConverterBase &&) = default;
|
||||
QStringConverterBase &operator=(QStringConverterBase &&) = default;
|
||||
};
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QStringConverterBase::Flags)
|
||||
|
||||
class QStringConverter : public QStringConverterBase
|
||||
{
|
||||
public:
|
||||
#endif // Qt 6 compat for QStringConverterBase
|
||||
|
||||
enum Encoding {
|
||||
Utf8,
|
||||
@ -106,18 +112,6 @@ public:
|
||||
System,
|
||||
LastEncoding = System
|
||||
};
|
||||
#ifdef Q_QDOC
|
||||
// document the flags here
|
||||
enum class Flag {
|
||||
Default = 0,
|
||||
Stateless = 0x1,
|
||||
ConvertInvalidToNull = 0x2,
|
||||
WriteBom = 0x4,
|
||||
ConvertInitialBom = 0x8,
|
||||
UsesIcu = 0x10,
|
||||
};
|
||||
Q_DECLARE_FLAGS(Flags, Flag)
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
@ -182,6 +176,8 @@ private:
|
||||
Q_CORE_EXPORT static const Interface encodingInterfaces[Encoding::LastEncoding + 1];
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QStringConverter::Flags)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
@ -43,7 +43,7 @@ struct QLatin1
|
||||
}
|
||||
|
||||
static QChar *convertToUnicode(QChar *dst, QByteArrayView in,
|
||||
[[maybe_unused]] QStringConverterBase::State *state) noexcept
|
||||
[[maybe_unused]] QStringConverter::State *state) noexcept
|
||||
{
|
||||
Q_ASSERT(state);
|
||||
|
||||
@ -321,7 +321,7 @@ struct QUtf8
|
||||
static char16_t *convertToUnicode(char16_t *dst, QByteArrayView in, QStringConverter::State *state);
|
||||
|
||||
Q_CORE_EXPORT static QByteArray convertFromUnicode(QStringView in);
|
||||
Q_CORE_EXPORT static QByteArray convertFromUnicode(QStringView in, QStringConverterBase::State *state);
|
||||
Q_CORE_EXPORT static QByteArray convertFromUnicode(QStringView in, QStringConverter::State *state);
|
||||
static char *convertFromUnicode(char *out, QStringView in, QStringConverter::State *state);
|
||||
Q_CORE_EXPORT static char *convertFromLatin1(char *out, QLatin1StringView in);
|
||||
struct ValidUtf8Result {
|
||||
|
Loading…
x
Reference in New Issue
Block a user