Eneboo - Documentación para desarrolladores
Tipos públicos | Métodos públicos | Atributos públicos estáticos
Referencia de la Clase QTextStream

The QTextStream class provides basic functions for reading and writing text using a QIODevice. Más...

#include <qtextstream.h>

Diagrama de herencias de QTextStream
QTextIStream QTextIStream QTextOStream QTextOStream

Lista de todos los miembros.

Tipos públicos

enum  Encoding {
  Locale, Latin1, Unicode, UnicodeNetworkOrder,
  UnicodeReverse, RawUnicode, UnicodeUTF8, Locale,
  Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse,
  RawUnicode, UnicodeUTF8
}
enum  {
  skipws = 0x0001, left = 0x0002, right = 0x0004, internal = 0x0008,
  bin = 0x0010, oct = 0x0020, dec = 0x0040, hex = 0x0080,
  showbase = 0x0100, showpoint = 0x0200, uppercase = 0x0400, showpos = 0x0800,
  scientific = 0x1000, fixed = 0x2000
}
enum  Encoding {
  Locale, Latin1, Unicode, UnicodeNetworkOrder,
  UnicodeReverse, RawUnicode, UnicodeUTF8, Locale,
  Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse,
  RawUnicode, UnicodeUTF8
}
enum  {
  skipws = 0x0001, left = 0x0002, right = 0x0004, internal = 0x0008,
  bin = 0x0010, oct = 0x0020, dec = 0x0040, hex = 0x0080,
  showbase = 0x0100, showpoint = 0x0200, uppercase = 0x0400, showpos = 0x0800,
  scientific = 0x1000, fixed = 0x2000
}

Métodos públicos

void setEncoding (Encoding)
void setCodec (QTextCodec *)
QTextCodeccodec ()
 QTextStream ()
 QTextStream (QIODevice *)
 QTextStream (QString *, int mode)
 QTextStream (QString &, int mode)
 QTextStream (QByteArray, int mode)
 QTextStream (FILE *, int mode)
virtual ~QTextStream ()
QIODevicedevice () const
void setDevice (QIODevice *)
void unsetDevice ()
bool atEnd () const
bool eof () const
QTextStreamoperator>> (QChar &)
QTextStreamoperator>> (char &)
QTextStreamoperator>> (signed short &)
QTextStreamoperator>> (unsigned short &)
QTextStreamoperator>> (signed int &)
QTextStreamoperator>> (unsigned int &)
QTextStreamoperator>> (signed long &)
QTextStreamoperator>> (unsigned long &)
QTextStreamoperator>> (float &)
QTextStreamoperator>> (double &)
QTextStreamoperator>> (char *)
QTextStreamoperator>> (QString &)
QTextStreamoperator>> (QCString &)
QTextStreamoperator<< (QChar)
QTextStreamoperator<< (char)
QTextStreamoperator<< (signed short)
QTextStreamoperator<< (unsigned short)
QTextStreamoperator<< (signed int)
QTextStreamoperator<< (unsigned int)
QTextStreamoperator<< (signed long)
QTextStreamoperator<< (unsigned long)
QTextStreamoperator<< (float)
QTextStreamoperator<< (double)
QTextStreamoperator<< (const char *)
QTextStreamoperator<< (const QString &)
QTextStreamoperator<< (const QCString &)
QTextStreamoperator<< (void *)
QTextStreamreadRawBytes (char *, uint len)
QTextStreamwriteRawBytes (const char *, uint len)
QString readLine ()
QString read ()
void skipWhiteSpace ()
int flags () const
int flags (int f)
int setf (int bits)
int setf (int bits, int mask)
int unsetf (int bits)
void reset ()
int width () const
int width (int)
int fill () const
int fill (int)
int precision () const
int precision (int)
void setEncoding (Encoding)
void setCodec (QTextCodec *)
QTextCodeccodec ()
 QTextStream ()
 QTextStream (QIODevice *)
 QTextStream (QString *, int mode)
 QTextStream (QString &, int mode)
 QTextStream (QByteArray, int mode)
 QTextStream (FILE *, int mode)
virtual ~QTextStream ()
QIODevicedevice () const
void setDevice (QIODevice *)
void unsetDevice ()
bool atEnd () const
bool eof () const
QTextStreamoperator>> (QChar &)
QTextStreamoperator>> (char &)
QTextStreamoperator>> (signed short &)
QTextStreamoperator>> (unsigned short &)
QTextStreamoperator>> (signed int &)
QTextStreamoperator>> (unsigned int &)
QTextStreamoperator>> (signed long &)
QTextStreamoperator>> (unsigned long &)
QTextStreamoperator>> (float &)
QTextStreamoperator>> (double &)
QTextStreamoperator>> (char *)
QTextStreamoperator>> (QString &)
QTextStreamoperator>> (QCString &)
QTextStreamoperator<< (QChar)
QTextStreamoperator<< (char)
QTextStreamoperator<< (signed short)
QTextStreamoperator<< (unsigned short)
QTextStreamoperator<< (signed int)
QTextStreamoperator<< (unsigned int)
QTextStreamoperator<< (signed long)
QTextStreamoperator<< (unsigned long)
QTextStreamoperator<< (float)
QTextStreamoperator<< (double)
QTextStreamoperator<< (const char *)
QTextStreamoperator<< (const QString &)
QTextStreamoperator<< (const QCString &)
QTextStreamoperator<< (void *)
QTextStreamreadRawBytes (char *, uint len)
QTextStreamwriteRawBytes (const char *, uint len)
QString readLine ()
QString read ()
void skipWhiteSpace ()
int flags () const
int flags (int f)
int setf (int bits)
int setf (int bits, int mask)
int unsetf (int bits)
void reset ()
int width () const
int width (int)
int fill () const
int fill (int)
int precision () const
int precision (int)

Atributos públicos estáticos

static const int basefield = I_BASE_MASK
static const int adjustfield
static const int floatfield

Descripción detallada

The QTextStream class provides basic functions for reading and writing text using a QIODevice.

The text stream class has a functional interface that is very similar to that of the standard C++ iostream class.

Qt provides several global functions similar to the ones in iostream: Function Meaning bin sets the QTextStream to read/write binary numbers oct sets the QTextStream to read/write octal numbers dec sets the QTextStream to read/write decimal numbers hex sets the QTextStream to read/write hexadecimal numbers endl forces a line break flush forces the QIODevice to flush any buffered data ws eats any available whitespace (on input) reset resets the QTextStream to its default mode (see reset()) qSetW(int) sets the field width to the given argument qSetFill(int) sets the fill character to the given argument qSetPrecision(int) sets the precision to the given argument

Atención:
By default QTextStream will automatically detect whether integers in the stream are in decimal, octal, hexadecimal or binary format when reading from the stream. In particular, a leading '0' signifies octal, i.e. the sequence "0100" will be interpreted as 64.

The QTextStream class reads and writes text; it is not appropriate for dealing with binary data (but QDataStream is).

By default, output of Unicode text (i.e. QString) is done using the local 8-bit encoding. This can be changed using the setEncoding() method. For input, the QTextStream will auto-detect standard Unicode "byte order marked" text files; otherwise the local 8-bit encoding is used.

The QIODevice is set in the constructor, or later using setDevice(). If the end of the input is reached atEnd() returns TRUE. Data can be read into variables of the appropriate type using the operator>>() overloads, or read in its entirety into a single string using read(), or read a line at a time using readLine(). Whitespace can be skipped over using skipWhiteSpace(). You can set flags for the stream using flags() or setf(). The stream also supports width(), precision() and fill(); use reset() to reset the defaults.

Ver también:
QDataStream

Documentación de las enumeraciones miembro de la clase

anonymous enum
Valores de enumeraciones:
skipws 
left 
right 
internal 
bin 
oct 
dec 
hex 
showbase 
showpoint 
uppercase 
showpos 
scientific 
fixed 
anonymous enum
Valores de enumeraciones:
skipws 
left 
right 
internal 
bin 
oct 
dec 
hex 
showbase 
showpoint 
uppercase 
showpos 
scientific 
fixed 
Valores de enumeraciones:
Locale 
Latin1 
Unicode 
UnicodeNetworkOrder 
UnicodeReverse 
RawUnicode 
UnicodeUTF8 
Locale 
Latin1 
Unicode 
UnicodeNetworkOrder 
UnicodeReverse 
RawUnicode 
UnicodeUTF8 

Locale Latin1 Unicode UnicodeNetworkOrder UnicodeReverse RawUnicode UnicodeUTF8

See setEncoding() for an explanation of the encodings.

Valores de enumeraciones:
Locale 
Latin1 
Unicode 
UnicodeNetworkOrder 
UnicodeReverse 
RawUnicode 
UnicodeUTF8 
Locale 
Latin1 
Unicode 
UnicodeNetworkOrder 
UnicodeReverse 
RawUnicode 
UnicodeUTF8 

Documentación del constructor y destructor

QTextStream::QTextStream ( )

Constructs a data stream that has no IO device.

QTextStream::QTextStream ( QIODevice iod)

Constructs a text stream that uses the IO device iod.

QTextStream::QTextStream ( QString str,
int  filemode 
)

Constructs a text stream that operates on the Unicode QString, str, through an internal device. The filemode argument is passed to the device's open() function; see {QIODevice::mode()}.

If you set an encoding or codec with setEncoding() or setCodec(), this setting is ignored for text streams that operate on QString.

Example:

    QString str;
    QTextStream ts( &str, IO_WriteOnly );
    ts << "pi = " << 3.14; // str == "pi = 3.14"

Writing data to the text stream will modify the contents of the string. The string will be expanded when data is written beyond the end of the string. Note that the string will not be truncated:

    QString str = "pi = 3.14";
    QTextStream ts( &str, IO_WriteOnly );
    ts <<  "2+2 = " << 2+2; // str == "2+2 = 414"

Note that because QString is Unicode, you should not use readRawBytes() or writeRawBytes() on such a stream.

QTextStream::QTextStream ( QString str,
int  filemode 
)

This constructor is equivalent to the constructor taking a QString* parameter.

QTextStream::QTextStream ( QByteArray  a,
int  mode 
)

Constructs a text stream that operates on the byte array, a, through an internal QBuffer device. The mode argument is passed to the device's open() function; see {QIODevice::mode()}.

Example:

    QByteArray array;
    QTextStream ts( array, IO_WriteOnly );
    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"

Writing data to the text stream will modify the contents of the array. The array will be expanded when data is written beyond the end of the string.

Same example, using a QBuffer:

    QByteArray array;
    QBuffer buf( array );
    buf.open( IO_WriteOnly );
    QTextStream ts( &buf );
    ts << "pi = " << 3.14 << '\0'; // array == "pi = 3.14"
    buf.close();
QTextStream::QTextStream ( FILE *  fh,
int  mode 
)

Constructs a text stream that operates on an existing file handle fh through an internal QFile device. The mode argument is passed to the device's open() function; see {QIODevice::mode()}.

Note that if you create a QTextStream cout or another name that is also used for another variable of a different type, some linkers may confuse the two variables, which will often cause crashes.

QTextStream::~QTextStream ( ) [virtual]

Destroys the text stream.

The destructor does not affect the current IO device.

QTextStream::QTextStream ( )
QTextStream::QTextStream ( QIODevice )
QTextStream::QTextStream ( QString ,
int  mode 
)
QTextStream::QTextStream ( QString ,
int  mode 
)
QTextStream::QTextStream ( QByteArray  ,
int  mode 
)
QTextStream::QTextStream ( FILE *  ,
int  mode 
)
virtual QTextStream::~QTextStream ( ) [virtual]

Documentación de las funciones miembro

bool QTextStream::atEnd ( ) const [inline]

Returns TRUE if the IO device has reached the end position (end of the stream or file) or if there is no IO device set; otherwise returns FALSE.

Ver también:
QIODevice::atEnd()
bool QTextStream::atEnd ( ) const
QTextCodec* QTextStream::codec ( )
QTextCodec * QTextStream::codec ( )

Returns the codec actually used for this stream.

If Unicode is automatically detected in input, a codec with name() "ISO-10646-UCS-2" is returned.

Ver también:
setCodec()
QIODevice * QTextStream::device ( ) const [inline]

Returns the IO device currently set.

Ver también:
setDevice(), unsetDevice()
QIODevice* QTextStream::device ( ) const
bool QTextStream::eof ( ) const [inline]

This function has been renamed to atEnd().

Ver también:
QIODevice::atEnd()
bool QTextStream::eof ( ) const
int QTextStream::fill ( int  f) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

Sets the fill character to f. Returns the previous fill character.

int QTextStream::fill ( ) const
int QTextStream::fill ( int  )
int QTextStream::fill ( ) const [inline]

Returns the fill character. The default value is ' ' (space).

int QTextStream::flags ( ) const [inline]

Returns the current stream flags. The default value is 0.

Flag Meaning skipws Not currently used; whitespace always skipped left Numeric fields are left-aligned right Not currently used (by default, numerics are right-aligned) internal Puts any padding spaces between +/- and value bin Output and input only in binary oct Output and input only in octal dec Output and input only in decimal hex Output and input only in hexadecimal showbase Annotates numeric outputs with 0b, 0, or 0x if in bin, oct, or hex format showpoint Not currently used uppercase Uses 0B and 0X rather than 0b and 0x showpos Shows + for positive numeric values scientific Uses scientific notation for floating point values fixed Uses fixed-point notation for floating point values

Note that unless bin, oct, dec, or hex is set, the input base is octal if the value starts with 0, hexadecimal if it starts with 0x, binary if it starts with 0b, and decimal otherwise.

Ver también:
setf(), unsetf()
int QTextStream::flags ( int  f) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the stream flags to f. Returns the previous stream flags.

Ver también:
setf(), unsetf(), flags()
int QTextStream::flags ( ) const
int QTextStream::flags ( int  f)
QTextStream & QTextStream::operator<< ( const char *  s)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a string to the stream and returns a reference to the stream.

The string s is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream.

QTextStream & QTextStream::operator<< ( const QString s)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes s to the stream and returns a reference to the stream.

QTextStream& QTextStream::operator<< ( void *  )
QTextStream & QTextStream::operator<< ( const QCString s)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes s to the stream and returns a reference to the stream.

The string s is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream.

QTextStream& QTextStream::operator<< ( const QString )
QTextStream & QTextStream::operator<< ( void *  ptr)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a pointer to the stream and returns a reference to the stream.

The ptr is output as an unsigned long hexadecimal integer.

QTextStream& QTextStream::operator<< ( QChar  )
QTextStream& QTextStream::operator<< ( char  )
QTextStream& QTextStream::operator<< ( signed  short)
QTextStream& QTextStream::operator<< ( unsigned  short)
QTextStream& QTextStream::operator<< ( signed  int)
QTextStream& QTextStream::operator<< ( unsigned  int)
QTextStream& QTextStream::operator<< ( signed  long)
QTextStream& QTextStream::operator<< ( unsigned  long)
QTextStream& QTextStream::operator<< ( float  )
QTextStream& QTextStream::operator<< ( double  )
QTextStream & QTextStream::operator<< ( QChar  c)

Writes character char to the stream and returns a reference to the stream.

The character c is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream.

QTextStream& QTextStream::operator<< ( const char *  )
QTextStream& QTextStream::operator<< ( const QCString )
QTextStream & QTextStream::operator<< ( char  c)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes character c to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( unsigned short  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes an unsigned short integer i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( signed short  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a short integer i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( signed int  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes an int i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( unsigned int  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes an unsigned int i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( unsigned long  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes an unsigned long int i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( signed long  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a long int i to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( float  f)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a float f to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator<< ( double  f)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Writes a double f to the stream and returns a reference to the stream.

QTextStream & QTextStream::operator>> ( unsigned short &  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads an unsigned short integer i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream& QTextStream::operator>> ( unsigned short &  )
QTextStream& QTextStream::operator>> ( signed int )
QTextStream & QTextStream::operator>> ( unsigned long &  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads an unsigned long int i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream& QTextStream::operator>> ( unsigned int )
QTextStream & QTextStream::operator>> ( float &  f)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a float f from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream& QTextStream::operator>> ( unsigned long &  )
QTextStream& QTextStream::operator>> ( double &  )
QTextStream& QTextStream::operator>> ( QString )
QTextStream& QTextStream::operator>> ( QCString )
QTextStream & QTextStream::operator>> ( QChar c)

Reads a char c from the stream and returns a reference to the stream. Note that whitespace is not skipped.

QTextStream & QTextStream::operator>> ( QCString str)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a "word" from the stream into str and returns a reference to the stream.

A word consists of characters for which isspace() returns FALSE.

QTextStream & QTextStream::operator>> ( char *  s)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a "word" from the stream into s and returns a reference to the stream.

A word consists of characters for which isspace() returns FALSE.

QTextStream& QTextStream::operator>> ( char *  )
QTextStream & QTextStream::operator>> ( QString str)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a "word" from the stream into str and returns a reference to the stream.

A word consists of characters for which isspace() returns FALSE.

QTextStream & QTextStream::operator>> ( double &  f)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a double f from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream & QTextStream::operator>> ( signed short &  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a signed short integer i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream & QTextStream::operator>> ( char &  c)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a char c from the stream and returns a reference to the stream. Note that whitespace is skipped.

QTextStream& QTextStream::operator>> ( signed long &  )
QTextStream & QTextStream::operator>> ( signed int i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a signed int i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream& QTextStream::operator>> ( float &  )
QTextStream& QTextStream::operator>> ( signed short &  )
QTextStream & QTextStream::operator>> ( unsigned int i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads an unsigned int i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream & QTextStream::operator>> ( signed long &  i)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Reads a signed long int i from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format.

QTextStream& QTextStream::operator>> ( QChar )
QTextStream& QTextStream::operator>> ( char &  )
int QTextStream::precision ( ) const [inline]

Returns the precision. The default value is 6.

int QTextStream::precision ( int  )
int QTextStream::precision ( int  p) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the precision to p. Returns the previous precision setting.

int QTextStream::precision ( ) const
QString QTextStream::read ( )

Reads the entire stream from the current position, and returns a string containing the text.

Ver también:
QIODevice::readLine()
QString QTextStream::read ( )
QString QTextStream::readLine ( )
QString QTextStream::readLine ( )

Reads a line from the stream and returns a string containing the text.

The returned string does not contain any trailing newline or carriage return. Note that this is different from QIODevice::readLine(), which does not strip the newline at the end of the line.

On EOF you will get a QString that is null. On reading an empty line the returned QString is empty but not null.

Ver también:
QIODevice::readLine()
QTextStream & QTextStream::readRawBytes ( char *  s,
uint  len 
)

Reads len bytes from the stream into s and returns a reference to the stream.

The buffer s must be preallocated.

Note that no encoding is done by this function.

Atención:
The behavior of this function is undefined unless the stream's encoding is set to Unicode or Latin1.
Ver también:
QIODevice::readBlock()
QTextStream& QTextStream::readRawBytes ( char *  ,
uint  len 
)
void QTextStream::reset ( void  )

Resets the text stream.

All flags are set to 0. The field width is set to 0. The fill character is set to ' ' (Space). The precision is set to 6.

Ver también:
setf(), width(), fill(), precision()
void QTextStream::reset ( )
void QTextStream::setCodec ( QTextCodec codec)

Sets the codec for this stream to codec. Will not try to autodetect Unicode.

Note that this function should be called before any data is read to/written from the stream.

Ver también:
setEncoding(), codec()
void QTextStream::setCodec ( QTextCodec )
void QTextStream::setDevice ( QIODevice )
void QTextStream::setDevice ( QIODevice iod)

Sets the IO device to iod.

Ver también:
device(), unsetDevice()
void QTextStream::setEncoding ( Encoding  e)

Sets the encoding of this stream to e, where e is one of the following values: Encoding Meaning Locale Uses local file format (Latin1 if locale is not set), but autodetecting Unicode(utf16) on input. Unicode Uses Unicode(utf16) for input and output. Output will be written in the order most efficient for the current platform (i.e. the order used internally in QString). UnicodeUTF8 Using Unicode(utf8) for input and output. If you use it for input it will autodetect utf16 and use it instead of utf8. Latin1 ISO-8859-1. Will not autodetect utf16. UnicodeNetworkOrder Uses network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker. UnicodeReverse Uses reverse network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker or when writing data that should be read by buggy Windows applications. RawUnicode Like Unicode, but does not write the byte order marker nor does it auto-detect the byte order. Useful only when writing to non-persistent storage used by a single process.

Locale and all Unicode encodings, except RawUnicode, will look at the first two bytes in an input stream to determine the byte order. The initial byte order marker will be stripped off before data is read.

Note that this function should be called before any data is read to or written from the stream.

Ver también:
setCodec()
void QTextStream::setEncoding ( Encoding  )
int QTextStream::setf ( int  bits,
int  mask 
) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the stream flag bits bits with a bit mask mask. Returns the previous stream flags.

Equivalent to {flags( (flags() & ~mask) | (bits & mask) )}.

Ver también:
setf(), unsetf()
int QTextStream::setf ( int  bits,
int  mask 
)
int QTextStream::setf ( int  bits)
int QTextStream::setf ( int  bits) [inline]

Sets the stream flag bits bits. Returns the previous stream flags.

Equivalent to {flags( flags() | bits )}.

Ver también:
setf(), unsetf()
void QTextStream::skipWhiteSpace ( )

Positions the read pointer at the first non-whitespace character.

void QTextStream::skipWhiteSpace ( )
void QTextStream::unsetDevice ( )

Unsets the IO device. Equivalent to setDevice( 0 ).

Ver también:
device(), setDevice()
void QTextStream::unsetDevice ( )
int QTextStream::unsetf ( int  bits) [inline]

Clears the stream flag bits bits. Returns the previous stream flags.

Equivalent to {flags( flags() & ~mask )}.

Ver también:
setf()
int QTextStream::unsetf ( int  bits)
int QTextStream::width ( ) const
int QTextStream::width ( ) const [inline]

Returns the field width. The default value is 0.

int QTextStream::width ( int  w) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the field width to w. Returns the previous field width.

int QTextStream::width ( int  )
QTextStream& QTextStream::writeRawBytes ( const char *  ,
uint  len 
)
QTextStream & QTextStream::writeRawBytes ( const char *  s,
uint  len 
)

Writes the len bytes from s to the stream and returns a reference to the stream.

Note that no encoding is done by this function.

Ver también:
QIODevice::writeBlock()

Documentación de los datos miembro

static const int QTextStream::adjustfield [static]
static const int QTextStream::basefield = I_BASE_MASK [static]
static const int QTextStream::floatfield [static]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'