Qt 4.8
Classes | Macros | Functions | Variables
qtextstream.cpp File Reference
#include "qtextstream.h"
#include "qbuffer.h"
#include "qfile.h"
#include "qnumeric.h"
#include "qtextcodec.h"
#include "private/qlocale_p.h"
#include <stdlib.h>
#include <limits.h>
#include <new>
#include "qtextstream.moc"

Go to the source code of this file.

Classes

class  QDeviceClosedNotifier
 
class  QTextStreamPrivate
 

Macros

#define CHECK_VALID_STREAM(x)
 
#define IMPLEMENT_STREAM_RIGHT_INT_OPERATOR(type)
 
#define IMPLEMENT_STREAM_RIGHT_REAL_OPERATOR(type)
 
#define Q_VOID
 

Functions

static void copyConverterStateHelper (QTextCodec::ConverterState *dest, const QTextCodec::ConverterState *src)
 
static void resetCodecConverterStateHelper (QTextCodec::ConverterState *state)
 

Variables

static const int QTEXTSTREAM_BUFFERSIZE = 16384
 

Macro Definition Documentation

◆ CHECK_VALID_STREAM

#define CHECK_VALID_STREAM (   x)
Value:
do { \
if (!d->string && !d->device) { \
qWarning("QTextStream: No device"); \
return x; \
} } while (0)
double d
Definition: qnumeric_p.h:62

Definition at line 295 of file qtextstream.cpp.

Referenced by QTextStream::atEnd(), QTextStream::operator<<(), QTextStream::operator>>(), QTextStream::read(), QTextStream::readAll(), QTextStream::readLine(), and QTextStream::skipWhiteSpace().

◆ IMPLEMENT_STREAM_RIGHT_INT_OPERATOR

#define IMPLEMENT_STREAM_RIGHT_INT_OPERATOR (   type)
Value:
do { \
Q_D(QTextStream); \
CHECK_VALID_STREAM(*this); \
qulonglong tmp; \
switch (d->getNumber(&tmp)) { \
i = (type)tmp; \
break; \
i = (type)0; \
break; \
} \
return *this; } while (0)
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
The QTextStream class provides a convenient interface for reading and writing text.
Definition: qtextstream.h:73

Definition at line 302 of file qtextstream.cpp.

Referenced by QTextStream::operator>>().

◆ IMPLEMENT_STREAM_RIGHT_REAL_OPERATOR

#define IMPLEMENT_STREAM_RIGHT_REAL_OPERATOR (   type)
Value:
do { \
Q_D(QTextStream); \
CHECK_VALID_STREAM(*this); \
double tmp; \
if (d->getReal(&tmp)) { \
f = (type)tmp; \
} else { \
f = (type)0; \
} \
return *this; } while (0)
double d
Definition: qnumeric_p.h:62
int type
Definition: qmetatype.cpp:239
The QTextStream class provides a convenient interface for reading and writing text.
Definition: qtextstream.h:73

Definition at line 318 of file qtextstream.cpp.

Referenced by QTextStream::operator>>().

◆ Q_VOID

#define Q_VOID

Definition at line 294 of file qtextstream.cpp.

Referenced by QTextStream::skipWhiteSpace().

Function Documentation

◆ copyConverterStateHelper()

static void copyConverterStateHelper ( QTextCodec::ConverterState dest,
const QTextCodec::ConverterState src 
)
static

Definition at line 482 of file qtextstream.cpp.

Referenced by QTextStreamPrivate::restoreToSavedConverterState(), and QTextStreamPrivate::saveConverterState().

484 {
485  // ### QTextCodec::ConverterState's copy constructors and assignments are
486  // private. This function copies the structure manually.
487  Q_ASSERT(!src->d);
488  dest->flags = src->flags;
489  dest->invalidChars = src->invalidChars;
490  dest->state_data[0] = src->state_data[0];
491  dest->state_data[1] = src->state_data[1];
492  dest->state_data[2] = src->state_data[2];
493 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
ConversionFlags flags
Definition: qtextcodec.h:106

◆ resetCodecConverterStateHelper()

static void resetCodecConverterStateHelper ( QTextCodec::ConverterState state)
static

Definition at line 476 of file qtextstream.cpp.

Referenced by QTextStream::locale(), QTextStreamPrivate::reset(), QTextStreamPrivate::restoreToSavedConverterState(), and QTextStream::seek().

477 {
478  state->~ConverterState();
479  new (state) QTextCodec::ConverterState;
480 }
~ConverterState()
Destroys the ConverterState object.
Definition: qtextcodec.cpp:835

Variable Documentation

◆ QTEXTSTREAM_BUFFERSIZE

const int QTEXTSTREAM_BUFFERSIZE = 16384
static