diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-10-24 16:49:45 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-03-23 10:00:18 +0000 |
commit | 461e89ee1a53f7669e0215f9015380c4a9d62371 (patch) | |
tree | f20e087349bad81fe806c179fb4ef880ae9abe49 /src/corelib/serialization/qtextstream.h | |
parent | 1e70781e7f0b012fcfbf85f86c24f3b46e362d4e (diff) |
Clean up QTextStream functions
They are the only Qt symbols neither prefixed with q or with the Qt
namespace. This changes preserves source and binary compatibility
while making it possible to define conflicting symbols.
Change-Id: I6d4181206e63faa922fa0c8b644e0a4b88826a97
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/corelib/serialization/qtextstream.h')
-rw-r--r-- | src/corelib/serialization/qtextstream.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/serialization/qtextstream.h b/src/corelib/serialization/qtextstream.h index 1d86a18b9c..7673e5d87e 100644 --- a/src/corelib/serialization/qtextstream.h +++ b/src/corelib/serialization/qtextstream.h @@ -233,6 +233,13 @@ 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); @@ -265,6 +272,18 @@ Q_CORE_EXPORT QTextStream &bom(QTextStream &s); Q_CORE_EXPORT QTextStream &ws(QTextStream &s); +} // namespace QTextStreamFunctions + +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) +namespace Qt { +using namespace QTextStreamFunctions; +} + +// We use 'using namespace' as that doesn't cause +// conflicting definitions compiler errors. +using namespace QTextStreamFunctions; +#endif // QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_QDOC) + inline QTextStreamManipulator qSetFieldWidth(int width) { QTSMFI func = &QTextStream::setFieldWidth; |