From deeaa500ad8c591b3142eb53a57e79b6b4ae1ca6 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 5 Dec 2019 10:44:37 +0100 Subject: Mark the old style unprefixed stream functions deprecated Requires a third definition for the source-compatible but deprecated version. Change-Id: I260ae79f4547f99eed701b10e0b25222f81cd5ff Reviewed-by: Lars Knoll --- src/corelib/serialization/qtextstream.h | 42 +++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'src/corelib/serialization/qtextstream.h') diff --git a/src/corelib/serialization/qtextstream.h b/src/corelib/serialization/qtextstream.h index 935ec16536..6f93826d8a 100644 --- a/src/corelib/serialization/qtextstream.h +++ b/src/corelib/serialization/qtextstream.h @@ -233,13 +233,7 @@ inline QTextStream &operator<<(QTextStream &s, QTextStreamFunction f) inline QTextStream &operator<<(QTextStream &s, QTextStreamManipulator m) { m.exec(s); return s; } -#if defined(Q_QDOC) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) namespace Qt { -#else -// This namespace only exists for 'using namespace' declarations. -namespace QTextStreamFunctions { -#endif - Q_CORE_EXPORT QTextStream &bin(QTextStream &s); Q_CORE_EXPORT QTextStream &oct(QTextStream &s); Q_CORE_EXPORT QTextStream &dec(QTextStream &s); @@ -272,12 +266,36 @@ Q_CORE_EXPORT QTextStream &bom(QTextStream &s); Q_CORE_EXPORT QTextStream &ws(QTextStream &s); -} // namespace QTextStreamFunctions +} // namespace Qt -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) -namespace Qt { -using namespace QTextStreamFunctions; -} +#if QT_DEPRECATED_SINCE(5, 15) && !defined(Q_QDOC) +// This namespace only exists for 'using namespace' declarations. +namespace QTextStreamFunctions { +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bin") QTextStream &bin(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::oct") QTextStream &oct(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::dec") QTextStream &dec(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::hex") QTextStream &hex(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::showbase") QTextStream &showbase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcesign") QTextStream &forcesign(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::forcepoint") QTextStream &forcepoint(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noshowbase") QTextStream &noshowbase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcesign") QTextStream &noforcesign(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::noforcepoint") QTextStream &noforcepoint(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasebase") QTextStream &uppercasebase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::uppercasedigits") QTextStream &uppercasedigits(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasebase") QTextStream &lowercasebase(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::lowercasedigits") QTextStream &lowercasedigits(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::fixed") QTextStream &fixed(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::scientific") QTextStream &scientific(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::left") QTextStream &left(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::right") QTextStream &right(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::center") QTextStream ¢er(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::endl") QTextStream &endl(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::flush") QTextStream &flush(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::reset") QTextStream &reset(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::bom") QTextStream &bom(QTextStream &s); +Q_CORE_EXPORT QT_DEPRECATED_X("Use Qt::ws") QTextStream &ws(QTextStream &s); +} // namespace QTextStreamFunctions QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") @@ -285,7 +303,7 @@ QT_WARNING_DISABLE_CLANG("-Wheader-hygiene") // conflicting definitions compiler errors. using namespace QTextStreamFunctions; QT_WARNING_POP -#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) +#endif // QT_DEPRECATED_SINCE(5, 15) && !defined(Q_QDOC) inline QTextStreamManipulator qSetFieldWidth(int width) { -- cgit v1.2.3