diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-03-09 13:54:56 +0100 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-04-07 17:41:06 +0000 |
commit | 795a54ff9688697c033fc5d522f4c50c707d5924 (patch) | |
tree | 20468045310d1cc5e65a1faeb2508c96f41eff33 /src/corelib/io/qdatastream.cpp | |
parent | 25d1bbb84939b6960f16e82254fc844839ddfa54 (diff) |
QDataStream: add operator<< and >> for std::nullptr_t
std::nullptr_t is nullary: it accepts only one value, nullptr. So we
don't need to read or write anything. This commit simply adds the two
operators that allow generic code to operate on std::nullptr_t if
required.
This commit also adds the actual use to QMetaType::load/save, even
though there's no change in behavior.
[ChangeLog][QtCore][QDataStream] Added operator<< and operator>>
overloads that take std::nullptr_t, to facilitate generic code.
Change-Id: Iae839f6a131a4f0784bffffd14aa37e7f62d2740
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/io/qdatastream.cpp')
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 2369fe4726..9a42fb4a37 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -771,6 +771,17 @@ int QDataStream::readBlock(char *data, int len) } /*! + \fn QDataStream &QDataStream::operator>>(std::nullptr &ptr) + \since 5.9 + \overload + + Simulates reading a \c{std::nullptr_t} from the stream into \a ptr and + returns a reference to the stream. This function does not actually read + anything from the stream, as \c{std::nullptr_t} values are stored as 0 + bytes. +*/ + +/*! \fn QDataStream &QDataStream::operator>>(quint8 &i) \overload @@ -1084,6 +1095,15 @@ int QDataStream::readRawData(char *s, int len) QDataStream write functions *****************************************************************************/ +/*! + \fn QDataStream &QDataStream::operator<<(std::nullptr ptr) + \since 5.9 + \overload + + Simulates writing a \c{std::nullptr_t}, \a ptr, to the stream and returns a + reference to the stream. This function does not actually write anything to + the stream, as \c{std::nullptr_t} values are stored as 0 bytes. +*/ /*! \fn QDataStream &QDataStream::operator<<(quint8 i) |