40 #ifndef QSTRINGCONVERTER_H
41 #define QSTRINGCONVERTER_H
43 #include <QtCore/qstring.h>
44 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
45 #include <QtCore/qstringbuilder.h>
55 #if (defined(Q_CC_GNU) && __GNUC__ == 7) || defined(Q_QDOC)
56 #define QSTRINGCONVERTER_CONSTEXPR
58 #define QSTRINGCONVERTER_CONSTEXPR constexpr
75 :
flags(
f), state_data{0, 0, 0, 0} {}
79 remainingChars(
other.remainingChars),
80 invalidChars(
other.invalidChars),
81 state_data{
other.state_data[0],
other.state_data[1],
83 clearFn(
other.clearFn)
84 {
other.clearFn =
nullptr; }
89 remainingChars =
other.remainingChars;
90 invalidChars =
other.invalidChars;
92 clearFn =
other.clearFn;
93 other.clearFn =
nullptr;
96 Q_CORE_EXPORT
void clear();
99 int internalState = 0;
136 ConvertInvalidToNull = 0x2,
138 ConvertInitialBom = 0x8
161 : iface(&encodingInterfaces[int(encoding)]),
state(
f)
170 bool isValid()
const {
return iface !=
nullptr; }
179 {
return isValid() ? iface->name :
nullptr; }
181 Q_CORE_EXPORT
static std::optional<Encoding> encodingForName(
const char *
name);
182 Q_CORE_EXPORT
static const char *nameForEncoding(
Encoding e);
183 Q_CORE_EXPORT
static std::optional<Encoding> encodingForData(
QByteArrayView data, char16_t expectedFirstCharacter = 0);
190 Q_CORE_EXPORT
static const Interface encodingInterfaces[Encoding::LastEncoding + 1];
308 #if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
309 template <
typename T>
315 enum { ExactSize =
false };
319 out =
s.decoder->appendToBuffer(
out,
s.data);
323 template <
typename T>
329 enum { ExactSize =
false };
333 out =
s.encoder->appendToBuffer(
out,
s.data);
337 template <
typename T>
348 template <
typename T>
353 char *
it =
a.data() +
a.size();
362 #undef QSTRINGCONVERTER_CONSTEXPR
small capitals from c petite p scientific i
[1]
The QByteArray class provides an array of bytes.
The QChar class provides a 16-bit Unicode character.
The QStringConverter class provides a base class for encoding and decoding text. \reentrant.
QSTRINGCONVERTER_CONSTEXPR QStringConverter(Encoding encoding, Flags f)
const char * name() const
QSTRINGCONVERTER_CONSTEXPR QStringConverter(const Interface *i)
QSTRINGCONVERTER_CONSTEXPR QStringConverter()
The QStringDecoder class provides a state-based decoder for text. \reentrant.
QSTRINGCONVERTER_CONSTEXPR QStringDecoder(Encoding encoding, Flags flags=Flag::Default)
EncodedData< QByteArrayView > decode(QByteArrayView ba)
qsizetype requiredSpace(qsizetype inputLength) const
QChar * appendToBuffer(QChar *out, QByteArrayView ba)
QSTRINGCONVERTER_CONSTEXPR QStringDecoder(const Interface *i)
Q_WEAK_OVERLOAD EncodedData< const QByteArray & > decode(const QByteArray &ba)
Q_WEAK_OVERLOAD EncodedData< const QByteArray & > operator()(const QByteArray &ba)
QStringDecoder(const char *name, Flags f=Flag::Default)
EncodedData< QByteArrayView > operator()(QByteArrayView ba)
QSTRINGCONVERTER_CONSTEXPR QStringDecoder()
The QStringEncoder class provides a state-based encoder for text. \reentrant.
QStringEncoder(const char *name, Flags flags=Flag::Default)
char * appendToBuffer(char *out, QStringView in)
QSTRINGCONVERTER_CONSTEXPR QStringEncoder(Encoding encoding, Flags flags=Flag::Default)
DecodedData< QStringView > operator()(QStringView in)
qsizetype requiredSpace(qsizetype inputLength) const
DecodedData< QStringView > encode(QStringView in)
Q_WEAK_OVERLOAD DecodedData< const QString & > encode(const QString &str)
QSTRINGCONVERTER_CONSTEXPR QStringEncoder()
QSTRINGCONVERTER_CONSTEXPR QStringEncoder(const Interface *i)
Q_WEAK_OVERLOAD DecodedData< const QString & > operator()(const QString &str)
The QString class provides a Unicode character string.
The QStringView class provides a unified view on UTF-16 strings with a read-only subset of the QStrin...
constexpr Initialization Uninitialized
void *PRIV() memmove(void *d, const void *s, size_t n)
QString & operator+=(QString &that, const ProString &other)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
#define Q_DISABLE_COPY(Class)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QSTRINGCONVERTER_CONSTEXPR
QTextStream out(stdout)
[7]
QChar *(*)(QChar *out, QByteArrayView in, State *state) DecoderFn
qsizetype(*)(qsizetype inLength) LengthFn
char *(*)(char *out, QStringView in, State *state) EncoderFn
constexpr State(Flags f=Flag::Default)
State & operator=(State &&other)
void(*)(State *) ClearDataFn