QTextStream: port from QScopedPointer to unique_ptr

In preparation of adding QT_NO_SCOPED_PONTER, which would be rather
pointless for users if public headers continued to mention the type.

Pick-to: 6.9 6.8
Task-number: QTBUG-132213
Change-Id: I6539e83158ab34e4fa4bd22b6d0ac5629a3b6db9
Reviewed-by: Ahmad Samir <a.samirh78@gmail.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2024-05-13 13:26:49 +02:00
parent 38c51dcfc4
commit b815c6f7fd
2 changed files with 5 additions and 4 deletions

View File

@ -318,7 +318,7 @@ void QDebug::putString(const QChar *begin, size_t length)
// we'll reset the QTextStream formatting mechanisms, so save the state
QDebugStateSaver saver(*this);
stream->ts.d_ptr->params.reset();
putEscapedString(stream->ts.d_ptr.data(), reinterpret_cast<const char16_t *>(begin), length);
putEscapedString(stream->ts.d_ptr.get(), reinterpret_cast<const char16_t *>(begin), length);
}
}
@ -338,7 +338,7 @@ void QDebug::putByteArray(const char *begin, size_t length, Latin1Content conten
// we'll reset the QTextStream formatting mechanisms, so save the state
QDebugStateSaver saver(*this);
stream->ts.d_ptr->params.reset();
putEscapedString(stream->ts.d_ptr.data(), reinterpret_cast<const uchar *>(begin),
putEscapedString(stream->ts.d_ptr.get(), reinterpret_cast<const uchar *>(begin),
length, content == ContainsLatin1);
}
}

View File

@ -6,9 +6,10 @@
#include <QtCore/qiodevicebase.h>
#include <QtCore/qchar.h>
#include <QtCore/qscopedpointer.h>
#include <QtCore/qstringconverter_base.h>
#include <memory>
#include <stdio.h>
#if 0
@ -174,7 +175,7 @@ private:
friend class QDebugStateSaverPrivate;
friend class QDebug;
QScopedPointer<QTextStreamPrivate> d_ptr;
std::unique_ptr<QTextStreamPrivate> d_ptr;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QTextStream::NumberFlags)