QDataStream: inline status()

The implementation is trivial, and unchanged since the beginning of
the public project history, so I'd venture that it's safe to commit to
it not changing until Qt 7 at this point.

The reason to make it inline is that a good stream operator
implementation should be checking the stream state quite often, so we
shouldn't make that an expensive DLL entry point.

Change-Id: Iba8cbfbaf02326c86ab95be17b603cd2e785f78c
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
Marc Mutz 2024-02-09 21:34:41 +01:00
parent 612b67cf13
commit fc23fa459c
3 changed files with 21 additions and 5 deletions

View File

@ -914,3 +914,14 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
// order sections alphabetically to reduce chances of merge conflicts
#endif // QT_CORE_REMOVED_SINCE(6, 7)
#if QT_CORE_REMOVED_SINCE(6, 8)
#include "qdatastream.h" // inlined API
// #include "qotherheader.h"
// // implement removed functions from qotherheader.h
// order sections alphabetically to reduce chances of merge conflicts
#endif // QT_CORE_REMOVED_SINCE(6, 8)

View File

@ -442,16 +442,13 @@ void QDataStream::setFloatingPointPrecision(QDataStream::FloatingPointPrecision
}
/*!
\fn QDataStream::status() const
Returns the status of the data stream.
\sa Status, setStatus(), resetStatus()
*/
QDataStream::Status QDataStream::status() const
{
return q_status;
}
/*!
Resets the status of the data stream.

View File

@ -122,6 +122,7 @@ public:
bool atEnd() const;
QT_CORE_INLINE_SINCE(6, 8)
Status status() const;
void setStatus(Status status);
void resetStatus();
@ -409,6 +410,13 @@ using QDataStreamIfHasIStreamOperatorsContainer =
inline QIODevice *QDataStream::device() const
{ return dev; }
#if QT_CORE_INLINE_IMPL_SINCE(6, 8)
QDataStream::Status QDataStream::status() const
{
return q_status;
}
#endif // INLINE_SINCE 6.8
inline QDataStream::ByteOrder QDataStream::byteOrder() const
{ return byteorder; }