summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qtextstream.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/serialization/qtextstream.cpp')
-rw-r--r--src/corelib/serialization/qtextstream.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/corelib/serialization/qtextstream.cpp b/src/corelib/serialization/qtextstream.cpp
index 05a5a55926..fb7b677b2d 100644
--- a/src/corelib/serialization/qtextstream.cpp
+++ b/src/corelib/serialization/qtextstream.cpp
@@ -326,7 +326,7 @@ QT_BEGIN_NAMESPACE
*/
QTextStreamPrivate::QTextStreamPrivate(QTextStream *q_ptr)
:
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
readConverterSavedState(0),
#endif
readConverterSavedStateOffset(0),
@@ -347,12 +347,12 @@ QTextStreamPrivate::~QTextStreamPrivate()
#endif
delete device;
}
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
delete readConverterSavedState;
#endif
}
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
static void resetCodecConverterStateHelper(QTextCodec::ConverterState *state)
{
state->~ConverterState();
@@ -401,7 +401,7 @@ void QTextStreamPrivate::reset()
readBufferStartDevicePos = 0;
lastTokenSize = 0;
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
codec = QTextCodec::codecForLocale();
resetCodecConverterStateHelper(&readConverterState);
resetCodecConverterStateHelper(&writeConverterState);
@@ -461,7 +461,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
if (bytesRead <= 0)
return false;
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
// codec auto detection, explicitly defaults to locale encoding if the
// codec has been set to 0.
if (!codec || autoDetectUnicode) {
@@ -485,7 +485,7 @@ bool QTextStreamPrivate::fillReadBuffer(qint64 maxBytes)
#endif
int oldReadBufferSize = readBuffer.size();
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
// convert to unicode
readBuffer += Q_LIKELY(codec) ? codec->toUnicode(buf, bytesRead, &readConverterState)
: QString::fromLatin1(buf, bytesRead);
@@ -567,7 +567,7 @@ void QTextStreamPrivate::flushWriteBuffer()
}
#endif
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
if (!codec)
codec = QTextCodec::codecForLocale();
#if defined (QTEXTSTREAM_DEBUG)
@@ -786,7 +786,7 @@ inline void QTextStreamPrivate::consume(int size)
*/
inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
{
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
if (readConverterState.d) {
// converter cannot be copied, so don't save anything
// don't update readBufferStartDevicePos either
@@ -807,7 +807,7 @@ inline void QTextStreamPrivate::saveConverterState(qint64 newPos)
*/
inline void QTextStreamPrivate::restoreToSavedConverterState()
{
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
if (readConverterSavedState) {
// we have a saved state
// that means the converter can be copied
@@ -1202,7 +1202,7 @@ bool QTextStream::seek(qint64 pos)
return false;
d->resetReadBuffer();
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
// Reset the codec converter states.
resetCodecConverterStateHelper(&d->readConverterState);
resetCodecConverterStateHelper(&d->writeConverterState);
@@ -1253,7 +1253,7 @@ qint64 QTextStream::pos() const
QTextStreamPrivate *thatd = const_cast<QTextStreamPrivate *>(d);
thatd->readBuffer.clear();
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
thatd->restoreToSavedConverterState();
if (d->readBufferStartDevicePos == 0)
thatd->autoDetectUnicode = true;
@@ -3036,7 +3036,7 @@ QTextStream &ws(QTextStream &stream)
Equivalent to QTextStream::setRealNumberPrecision(\a precision).
*/
-#ifndef QT_NO_TEXTCODEC
+#if QT_CONFIG(textcodec)
/*!
\relates QTextStream
@@ -3111,15 +3111,15 @@ QTextCodec *QTextStream::codec() const
}
/*!
- If \a enabled is true, QTextStream will attempt to detect Unicode
- encoding by peeking into the stream data to see if it can find the
- UTF-16 or UTF-32 BOM (Byte Order Mark). If this mark is found, QTextStream
- will replace the current codec with the UTF codec.
+ If \a enabled is true, QTextStream will attempt to detect Unicode encoding
+ by peeking into the stream data to see if it can find the UTF-8, UTF-16, or
+ UTF-32 Byte Order Mark (BOM). If this mark is found, QTextStream will
+ replace the current codec with the UTF codec.
This function can be used together with setCodec(). It is common
to set the codec to UTF-8, and then enable UTF-16 detection.
- \sa autoDetectUnicode(), setCodec()
+ \sa autoDetectUnicode(), setCodec(), QTextCodec::codecForUtfText()
*/
void QTextStream::setAutoDetectUnicode(bool enabled)
{
@@ -3131,7 +3131,7 @@ void QTextStream::setAutoDetectUnicode(bool enabled)
Returns \c true if automatic Unicode detection is enabled, otherwise
returns \c false. Automatic Unicode detection is enabled by default.
- \sa setAutoDetectUnicode(), setCodec()
+ \sa setAutoDetectUnicode(), setCodec(), QTextCodec::codecForUtfText()
*/
bool QTextStream::autoDetectUnicode() const
{