diff options
| author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-05-14 12:59:42 +0200 |
|---|---|---|
| committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-05-15 18:46:39 +0200 |
| commit | 794150e5bda0c203a5373c3fa2f9785f9941f6dd (patch) | |
| tree | 2588b9ad3e3034ac9ee8a03a75d26c23223402cd /src/corelib/serialization/qdatastream.cpp | |
| parent | 45cf8da63c419c27e7476f0a929e9d8ba664bfd3 (diff) | |
QMetaType: Support char16_t and char32_t
Change-Id: Ieec6d4bc64967d875ea12b31638aab05bc682ea3
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
| -rw-r--r-- | src/corelib/serialization/qdatastream.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index df286085bc4..3026e554bf3 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -1025,6 +1025,31 @@ QDataStream &QDataStream::operator>>(char *&s) return readBytes(s, len); } +/*! + \overload + + Reads a char from the stream into char \a chr. +*/ +QDataStream &QDataStream::operator>>(char16_t &c) +{ + quint16 u; + *this >> u; + c = char16_t(u); + return *this; +} + +/*! + \overload + + Reads a char from the stream into char \a chr. +*/ +QDataStream &QDataStream::operator>>(char32_t &c) +{ + quint32 u; + *this >> u; + c = char32_t(u); + return *this; +} /*! Reads the buffer \a s from the stream and returns a reference to @@ -1338,6 +1363,30 @@ QDataStream &QDataStream::operator<<(const char *s) } /*! + \overload + \since 6.0 + + Writes a character, \a c, to the stream. Returns a reference to + the stream +*/ +QDataStream &QDataStream::operator<<(char16_t c) +{ + return *this << qint16(c); +} + +/*! + \overload + \since 6.0 + + Writes a character, \a c, to the stream. Returns a reference to + the stream +*/ +QDataStream &QDataStream::operator<<(char32_t c) +{ + return *this << qint32(c); +} + +/*! Writes the length specifier \a len and the buffer \a s to the stream and returns a reference to the stream. |
