diff options
Diffstat (limited to 'src/corelib/io/qdatastream.cpp')
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index b4eb98e062..2369fe4726 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -42,6 +42,7 @@ #if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) #include "qbuffer.h" +#include "qfloat16.h" #include "qstring.h" #include <stdio.h> #include <ctype.h> @@ -448,6 +449,9 @@ QDataStream::FloatingPointPrecision QDataStream::floatingPointPrecision() const The default is DoublePrecision. + Note that this property does not affect the serialization or deserialization of \c qfloat16 + instances. + \warning This property must be set to the same value on the object that writes and the object that reads the data stream. @@ -557,6 +561,7 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_5_6 Version 17 (Qt 5.6) \value Qt_5_7 Same as Qt_5_6 \value Qt_5_8 Same as Qt_5_6 + \value Qt_5_9 Same as Qt_5_6 \omitvalue Qt_DefaultCompiledVersion \sa setVersion(), version() @@ -972,6 +977,20 @@ QDataStream &QDataStream::operator>>(double &f) /*! \overload + \since 5.9 + + Reads a floating point number from the stream into \a f, + using the standard IEEE 754 format. Returns a reference to the + stream. +*/ +QDataStream &QDataStream::operator>>(qfloat16 &f) +{ + return *this >> reinterpret_cast<qint16&>(f); +} + + +/*! + \overload Reads the '\\0'-terminated string \a s from the stream and returns a reference to the stream. @@ -1259,6 +1278,19 @@ QDataStream &QDataStream::operator<<(double f) /*! + \fn QDataStream &QDataStream::operator<<(qfloat16 f) + \overload + \since 5.9 + + Writes a floating point number, \a f, to the stream using + the standard IEEE 754 format. Returns a reference to the stream. +*/ +QDataStream &QDataStream::operator<<(qfloat16 f) +{ + return *this << reinterpret_cast<qint16&>(f); +} + +/*! \overload Writes the '\\0'-terminated string \a s to the stream and returns a @@ -1281,7 +1313,6 @@ QDataStream &QDataStream::operator<<(const char *s) return *this; } - /*! Writes the length specifier \a len and the buffer \a s to the stream and returns a reference to the stream. |