diff options
| author | Thiago Macieira <thiago.macieira@intel.com> | 2025-01-22 11:38:43 -0800 |
|---|---|---|
| committer | Thiago Macieira <thiago.macieira@intel.com> | 2025-01-29 19:22:20 -0800 |
| commit | 0f128fd7c5a9ee721d1e631743f6eb61d927cf3b (patch) | |
| tree | 5394c7a7a2e524cf0cd2aef6897f15f84e1bc8f6 /src/corelib/serialization/qdatastream.cpp | |
| parent | ac5ab8ce32c6bd4122ecc690d30eade5c4f4bf2a (diff) | |
QDataStream: move the QChar streaming operators to qdatastream.h
That frees qchar.h/cpp from having to know about QDataStream.
Change-Id: I7c217e32021f67ab27ecfffd47ba5ee025ecb1bf
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/serialization/qdatastream.cpp')
| -rw-r--r-- | src/corelib/serialization/qdatastream.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/serialization/qdatastream.cpp b/src/corelib/serialization/qdatastream.cpp index f9c08cd78e4..4a18c6b781e 100644 --- a/src/corelib/serialization/qdatastream.cpp +++ b/src/corelib/serialization/qdatastream.cpp @@ -1031,6 +1031,21 @@ QDataStream &QDataStream::operator>>(char32_t &c) return *this; } +/*! + \relates QChar + + Reads a char from the stream \a in into char \a chr. + + \sa {Serializing Qt Data Types} +*/ +QDataStream &operator>>(QDataStream &in, QChar &chr) +{ + quint16 u; + in >> u; + chr.unicode() = char16_t(u); + return in; +} + #if QT_DEPRECATED_SINCE(6, 11) /*! @@ -1384,6 +1399,19 @@ QDataStream &QDataStream::operator<<(char32_t c) } /*! + \relates QChar + + Writes the char \a chr to the stream \a out. + + \sa {Serializing Qt Data Types} +*/ +QDataStream &operator<<(QDataStream &out, QChar chr) +{ + out << quint16(chr.unicode()); + return out; +} + +/*! Writes the length specifier \a len and the buffer \a s to the stream and returns a reference to the stream. |
