<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt - 3.3.8 - espenr - 2499/qt - x11 - free - 3.3.8/src/tools/tqtextstream.cpp:56 -->
< html >
< head >
< meta http-equiv = "Content-Type" content = "text/html; charset=ISO-8859-1" >
< title > TQTextStream Class< / title >
< style type = "text/css" > < ! - -
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
-->< / style >
< / head >
< body >
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" >
< tr bgcolor = "#E5E5E5" >
< td valign = center >
< a href = "index.html" >
< font color = "#004faf" > Home< / font > < / a >
| < a href = "classes.html" >
< font color = "#004faf" > All Classes< / font > < / a >
| < a href = "mainclasses.html" >
< font color = "#004faf" > Main Classes< / font > < / a >
| < a href = "annotated.html" >
< font color = "#004faf" > Annotated< / font > < / a >
| < a href = "groups.html" >
< font color = "#004faf" > Grouped Classes< / font > < / a >
| < a href = "functions.html" >
< font color = "#004faf" > Functions< / font > < / a >
< / td >
< td align = "right" valign = "center" > < img src = "logo32.png" align = "right" width = "64" height = "32" border = "0" > < / td > < / tr > < / table > < h1 align = center > TQTextStream Class Reference< / h1 >
< p > The TQTextStream class provides basic functions for reading
and writing text using a TQIODevice.
< a href = "#details" > More...< / a >
< p > All the functions in this class are < a href = "threads.html#reentrant" > reentrant< / a > when TQt is built with thread support.< / p >
< p > < tt > #include < < a href = "tqtextstream-h.html" > tqtextstream.h< / a > > < / tt >
< p > Inherited by < a href = "tqtextistream.html" > TQTextIStream< / a > and < a href = "tqtextostream.html" > TQTextOStream< / a > .
< p > < a href = "tqtextstream-members.html" > List of all member functions.< / a >
< h2 > Public Members< / h2 >
< ul >
< li class = fn > enum < a href = "#Encoding-enum" > < b > Encoding< / b > < / a > { Locale, Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse, RawUnicode, UnicodeUTF8 }< / li >
< li class = fn > void < a href = "#setEncoding" > < b > setEncoding< / b > < / a > ( Encoding e )< / li >
< li class = fn > void < a href = "#setCodec" > < b > setCodec< / b > < / a > ( TQTextCodec * codec )< / li >
< li class = fn > TQTextCodec * < a href = "#codec" > < b > codec< / b > < / a > ()< / li >
< li class = fn > < a href = "#TQTextStream" > < b > TQTextStream< / b > < / a > ()< / li >
< li class = fn > < a href = "#TQTextStream-2" > < b > TQTextStream< / b > < / a > ( TQIODevice * iod )< / li >
< li class = fn > < a href = "#TQTextStream-3" > < b > TQTextStream< / b > < / a > ( TQString * str, int filemode )< / li >
< li class = fn > TQTextStream ( TQString & str, int filemode ) < em > (obsolete)< / em > < / li >
< li class = fn > < a href = "#TQTextStream-5" > < b > TQTextStream< / b > < / a > ( TQByteArray a, int mode )< / li >
< li class = fn > < a href = "#TQTextStream-6" > < b > TQTextStream< / b > < / a > ( FILE * fh, int mode )< / li >
< li class = fn > virtual < a href = "#~TQTextStream" > < b > ~TQTextStream< / b > < / a > ()< / li >
< li class = fn > TQIODevice * < a href = "#device" > < b > device< / b > < / a > () const< / li >
< li class = fn > void < a href = "#setDevice" > < b > setDevice< / b > < / a > ( TQIODevice * iod )< / li >
< li class = fn > void < a href = "#unsetDevice" > < b > unsetDevice< / b > < / a > ()< / li >
< li class = fn > bool < a href = "#atEnd" > < b > atEnd< / b > < / a > () const< / li >
< li class = fn > bool eof () const < em > (obsolete)< / em > < / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt" > < b > operator> > < / b > < / a > ( TQChar & c )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-2" > < b > operator> > < / b > < / a > ( char & c )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-3" > < b > operator> > < / b > < / a > ( signed short & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-4" > < b > operator> > < / b > < / a > ( unsigned short & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-5" > < b > operator> > < / b > < / a > ( signed int & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-6" > < b > operator> > < / b > < / a > ( unsigned int & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-7" > < b > operator> > < / b > < / a > ( signed long & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-8" > < b > operator> > < / b > < / a > ( unsigned long & i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-9" > < b > operator> > < / b > < / a > ( float & f )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-a" > < b > operator> > < / b > < / a > ( double & f )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-b" > < b > operator> > < / b > < / a > ( char * s )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-c" > < b > operator> > < / b > < / a > ( TQString & str )< / li >
< li class = fn > TQTextStream & < a href = "#operator-gt-gt-d" > < b > operator> > < / b > < / a > ( TQCString & str )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt" > < b > operator< < < / b > < / a > ( TQChar c )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-2" > < b > operator< < < / b > < / a > ( char c )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-3" > < b > operator< < < / b > < / a > ( signed short i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-4" > < b > operator< < < / b > < / a > ( unsigned short i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-5" > < b > operator< < < / b > < / a > ( signed int i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-6" > < b > operator< < < / b > < / a > ( unsigned int i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-7" > < b > operator< < < / b > < / a > ( signed long i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-8" > < b > operator< < < / b > < / a > ( unsigned long i )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-9" > < b > operator< < < / b > < / a > ( float f )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-a" > < b > operator< < < / b > < / a > ( double f )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-b" > < b > operator< < < / b > < / a > ( const char * s )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-c" > < b > operator< < < / b > < / a > ( const TQString & s )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-d" > < b > operator< < < / b > < / a > ( const TQCString & s )< / li >
< li class = fn > TQTextStream & < a href = "#operator-lt-lt-e" > < b > operator< < < / b > < / a > ( void * ptr )< / li >
< li class = fn > TQTextStream & < a href = "#readRawBytes" > < b > readRawBytes< / b > < / a > ( char * s, uint len )< / li >
< li class = fn > TQTextStream & < a href = "#writeRawBytes" > < b > writeRawBytes< / b > < / a > ( const char * s, uint len )< / li >
< li class = fn > TQString < a href = "#readLine" > < b > readLine< / b > < / a > ()< / li >
< li class = fn > TQString < a href = "#read" > < b > read< / b > < / a > ()< / li >
< li class = fn > void < a href = "#skipWhiteSpace" > < b > skipWhiteSpace< / b > < / a > ()< / li >
< li class = fn > int < a href = "#flags" > < b > flags< / b > < / a > () const< / li >
< li class = fn > int < a href = "#flags-2" > < b > flags< / b > < / a > ( int f )< / li >
< li class = fn > int < a href = "#setf" > < b > setf< / b > < / a > ( int bits )< / li >
< li class = fn > int < a href = "#setf-2" > < b > setf< / b > < / a > ( int bits, int mask )< / li >
< li class = fn > int < a href = "#unsetf" > < b > unsetf< / b > < / a > ( int bits )< / li >
< li class = fn > void < a href = "#reset" > < b > reset< / b > < / a > ()< / li >
< li class = fn > int < a href = "#width" > < b > width< / b > < / a > () const< / li >
< li class = fn > int < a href = "#width-2" > < b > width< / b > < / a > ( int w )< / li >
< li class = fn > int < a href = "#fill" > < b > fill< / b > < / a > () const< / li >
< li class = fn > int < a href = "#fill-2" > < b > fill< / b > < / a > ( int f )< / li >
< li class = fn > int < a href = "#precision" > < b > precision< / b > < / a > () const< / li >
< li class = fn > int < a href = "#precision-2" > < b > precision< / b > < / a > ( int p )< / li >
< / ul >
< hr > < a name = "details" > < / a > < h2 > Detailed Description< / h2 >
The TQTextStream class provides basic functions for reading
and writing text using a < a href = "ntqiodevice.html" > TQIODevice< / a > .
< p >
< p > The text stream class has a functional interface that is very
similar to that of the standard C++ iostream class.
< p > TQt provides several global functions similar to the ones in iostream:
< center > < table cellpadding = "4" cellspacing = "2" border = "0" >
< tr bgcolor = "#a2c511" > < th valign = "top" > Function < th valign = "top" > Meaning
< tr bgcolor = "#f0f0f0" > < td valign = "top" > bin < td valign = "top" > sets the TQTextStream to read/write binary numbers
< tr bgcolor = "#d0d0d0" > < td valign = "top" > oct < td valign = "top" > sets the TQTextStream to read/write octal numbers
< tr bgcolor = "#f0f0f0" > < td valign = "top" > dec < td valign = "top" > sets the TQTextStream to read/write decimal numbers
< tr bgcolor = "#d0d0d0" > < td valign = "top" > hex < td valign = "top" > sets the TQTextStream to read/write hexadecimal numbers
< tr bgcolor = "#f0f0f0" > < td valign = "top" > endl < td valign = "top" > forces a line break
< tr bgcolor = "#d0d0d0" > < td valign = "top" > flush < td valign = "top" > forces the TQIODevice to flush any buffered data
< tr bgcolor = "#f0f0f0" > < td valign = "top" > ws < td valign = "top" > eats any available whitespace (on input)
< tr bgcolor = "#d0d0d0" > < td valign = "top" > reset < td valign = "top" > resets the TQTextStream to its default mode (see < a href = "#reset" > reset< / a > ())
< tr bgcolor = "#f0f0f0" > < td valign = "top" > qSetW(int) < td valign = "top" > sets the < a href = "#width" > field width< / a >
to the given argument
< tr bgcolor = "#d0d0d0" > < td valign = "top" > qSetFill(int) < td valign = "top" > sets the < a href = "#fill" > fill character< / a > to the given argument
< tr bgcolor = "#f0f0f0" > < td valign = "top" > qSetPrecision(int) < td valign = "top" > sets the < a href = "#precision" > precision< / a > to the given argument
< / table > < / center >
< p > < b > Warning:< / b > By default TQTextStream 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.
< p > The TQTextStream class reads and writes text; it is not appropriate
for dealing with binary data (but < a href = "ntqdatastream.html" > TQDataStream< / a > is).
< p > By default, output of Unicode text (i.e. < a href = "tqstring.html" > TQString< / a > ) is done using
the local 8-bit encoding. This can be changed using the
< a href = "#setEncoding" > setEncoding< / a > () method. For input, the TQTextStream will auto-detect
standard Unicode "byte order marked" text files; otherwise the
local 8-bit encoding is used.
< p > The < a href = "ntqiodevice.html" > TQIODevice< / a > is set in the constructor, or later using
< a href = "#setDevice" > setDevice< / a > (). If the end of the input is reached < a href = "#atEnd" > atEnd< / a > () returns
TRUE. Data can be read into variables of the appropriate type
using the < a href = "#operator-gt-gt" > operator> > < / a > () overloads, or read in its entirety into a
single string using < a href = "#read" > read< / a > (), or read a line at a time using
< a href = "#readLine" > readLine< / a > (). Whitespace can be skipped over using < a href = "#skipWhiteSpace" > skipWhiteSpace< / a > ().
You can set flags for the stream using < a href = "#flags" > flags< / a > () or < a href = "#setf" > setf< / a > (). The
stream also supports < a href = "#width" > width< / a > (), < a href = "#precision" > precision< / a > () and < a href = "#fill" > fill< / a > (); use < a href = "#reset" > reset< / a > ()
to reset the defaults.
< p > < p > See also < a href = "ntqdatastream.html" > TQDataStream< / a > , < a href = "io.html" > Input/Output and Networking< / a > , and < a href = "text.html" > Text Related Classes< / a > .
< hr > < h2 > Member Type Documentation< / h2 >
< h3 class = fn > < a name = "Encoding-enum" > < / a > TQTextStream::Encoding< / h3 >
< ul >
< li > < tt > TQTextStream::Locale< / tt >
< li > < tt > TQTextStream::Latin1< / tt >
< li > < tt > TQTextStream::Unicode< / tt >
< li > < tt > TQTextStream::UnicodeNetworkOrder< / tt >
< li > < tt > TQTextStream::UnicodeReverse< / tt >
< li > < tt > TQTextStream::RawUnicode< / tt >
< li > < tt > TQTextStream::UnicodeUTF8< / tt >
< / ul > < p > See < a href = "#setEncoding" > setEncoding< / a > () for an explanation of the encodings.
< hr > < h2 > Member Function Documentation< / h2 >
< h3 class = fn > < a name = "TQTextStream" > < / a > TQTextStream::TQTextStream ()
< / h3 >
Constructs a data stream that has no IO device.
< h3 class = fn > < a name = "TQTextStream-2" > < / a > TQTextStream::TQTextStream ( < a href = "ntqiodevice.html" > TQIODevice< / a > * iod )
< / h3 >
Constructs a text stream that uses the IO device < em > iod< / em > .
< h3 class = fn > < a name = "TQTextStream-3" > < / a > TQTextStream::TQTextStream ( < a href = "tqstring.html" > TQString< / a > * str, int filemode )
< / h3 >
Constructs a text stream that operates on the Unicode < a href = "tqstring.html" > TQString< / a > , < em > str< / em > , through an internal device. The < em > filemode< / em > argument is
passed to the device's open() function; see < a href = "ntqiodevice.html#mode" > TQIODevice::mode< / a > ().
< p > If you set an encoding or codec with < a href = "#setEncoding" > setEncoding< / a > () or < a href = "#setCodec" > setCodec< / a > (),
this setting is ignored for text streams that operate on TQString.
< p > Example:
< pre >
< a href = "tqstring.html" > TQString< / a > str;
TQTextStream ts( & str, < a href = "ntqfile.html#open" > IO_WriteOnly< / a > );
ts < < "pi = " < < 3.14; // str == "pi = 3.14"
< / pre >
< p > 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:
< pre >
< a href = "tqstring.html" > TQString< / a > str = "pi = 3.14";
TQTextStream ts( & str, IO_WriteOnly );
ts < < "2+2 = " < < 2+2; // str == "2+2 = 414"
< / pre >
< p > Note that because TQString is Unicode, you should not use
< a href = "#readRawBytes" > readRawBytes< / a > () or < a href = "#writeRawBytes" > writeRawBytes< / a > () on such a stream.
< h3 class = fn > < a name = "TQTextStream-4" > < / a > TQTextStream::TQTextStream ( < a href = "tqstring.html" > TQString< / a > & str, int filemode )
< / h3 > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > This constructor is equivalent to the constructor taking a < a href = "tqstring.html" > TQString< / a > *
parameter.
< h3 class = fn > < a name = "TQTextStream-5" > < / a > TQTextStream::TQTextStream ( < a href = "tqbytearray.html" > TQByteArray< / a > a, int mode )
< / h3 >
Constructs a text stream that operates on the byte array, < em > a< / em > ,
through an internal < a href = "ntqbuffer.html" > TQBuffer< / a > device. The < em > mode< / em > argument is passed
to the device's open() function; see < a href = "ntqiodevice.html#mode" > TQIODevice::mode< / a > ().
< p > Example:
< pre >
< a href = "tqbytearray.html" > TQByteArray< / a > array;
TQTextStream ts( array, < a href = "ntqfile.html#open" > IO_WriteOnly< / a > );
ts < < "pi = " < < 3.14 < < '\0'; // array == "pi = 3.14"
< / pre >
< p > 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.
< p > Same example, using a TQBuffer:
< pre >
< a href = "tqbytearray.html" > TQByteArray< / a > array;
< a href = "ntqbuffer.html" > TQBuffer< / a > buf( array );
buf.< a href = "ntqiodevice.html#open" > open< / a > ( IO_WriteOnly );
TQTextStream ts( & buf );
ts < < "pi = " < < 3.14 < < '\0'; // array == "pi = 3.14"
buf.< a href = "ntqiodevice.html#close" > close< / a > ();
< / pre >
< h3 class = fn > < a name = "TQTextStream-6" > < / a > TQTextStream::TQTextStream ( FILE * fh, int mode )
< / h3 >
Constructs a text stream that operates on an existing file handle
< em > fh< / em > through an internal < a href = "ntqfile.html" > TQFile< / a > device. The < em > mode< / em > argument is
passed to the device's open() function; see < a href = "ntqiodevice.html#mode" > TQIODevice::mode< / a > ().
< p > Note that if you create a TQTextStream < tt > cout< / tt > 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.
< h3 class = fn > < a name = "~TQTextStream" > < / a > TQTextStream::~TQTextStream ()< tt > [virtual]< / tt >
< / h3 >
Destroys the text stream.
< p > The destructor does not affect the current IO device.
< h3 class = fn > bool < a name = "atEnd" > < / a > TQTextStream::atEnd () const
< / h3 >
< p > 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.
< p > < p > See also < a href = "ntqiodevice.html#atEnd" > TQIODevice::atEnd< / a > ().
< p > Examples: < a href = "addressbook-example.html#x601" > addressbook/centralwidget.cpp< / a > and < a href = "grapher-nsplugin-example.html#x2774" > grapher/grapher.cpp< / a > .
< h3 class = fn > < a href = "tqtextcodec.html" > TQTextCodec< / a > * < a name = "codec" > < / a > TQTextStream::codec ()
< / h3 >
Returns the codec actually used for this stream.
< p > If Unicode is automatically detected in input, a codec with < a href = "tqtextcodec.html#name" > name()< / a > "ISO-10646-UCS-2" is returned.
< p > < p > See also < a href = "#setCodec" > setCodec< / a > ().
< h3 class = fn > < a href = "ntqiodevice.html" > TQIODevice< / a > * < a name = "device" > < / a > TQTextStream::device () const
< / h3 >
< p > Returns the IO device currently set.
< p > < p > See also < a href = "#setDevice" > setDevice< / a > () and < a href = "#unsetDevice" > unsetDevice< / a > ().
< h3 class = fn > bool < a name = "eof" > < / a > TQTextStream::eof () const
< / h3 >
< p > < b > This function is obsolete.< / b > It is provided to keep old source working. We strongly advise against using it in new code.
< p > This function has been renamed to < a href = "#atEnd" > atEnd< / a > ().
< p > < p > See also < a href = "ntqiodevice.html#atEnd" > TQIODevice::atEnd< / a > ().
< p > Example: < a href = "tutorial2-07.html#x2592" > chart/chartform_files.cpp< / a > .
< h3 class = fn > int < a name = "fill" > < / a > TQTextStream::fill () const
< / h3 >
< p > Returns the fill character. The default value is ' ' (space).
< h3 class = fn > int < a name = "fill-2" > < / a > TQTextStream::fill ( int f )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the fill character to < em > f< / em > . Returns the previous fill character.
< h3 class = fn > int < a name = "flags" > < / a > TQTextStream::flags () const
< / h3 >
< p > Returns the current stream flags. The default value is 0.
< p > < center > < table cellpadding = "4" cellspacing = "2" border = "0" >
< tr bgcolor = "#a2c511" > < th valign = "top" > Flag < th valign = "top" > Meaning
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > skipws< / tt > < td valign = "top" > Not currently used; whitespace always skipped
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > left< / tt > < td valign = "top" > Numeric fields are left-aligned
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > right< / tt >
< td valign = "top" > Not currently used (by default, numerics are right-aligned)
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > internal< / tt > < td valign = "top" > Puts any padding spaces between +/- and value
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > bin< / tt > < td valign = "top" > Output < em > and< / em > input only in binary
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > oct< / tt > < td valign = "top" > Output < em > and< / em > input only in octal
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > dec< / tt > < td valign = "top" > Output < em > and< / em > input only in decimal
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > hex< / tt > < td valign = "top" > Output < em > and< / em > input only in hexadecimal
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > showbase< / tt >
< td valign = "top" > Annotates numeric outputs with 0b, 0, or 0x if in < tt > bin< / tt > ,
< tt > oct< / tt > , or < tt > hex< / tt > format
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > showpoint< / tt > < td valign = "top" > Not currently used
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > uppercase< / tt > < td valign = "top" > Uses 0B and 0X rather than 0b and 0x
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > showpos< / tt > < td valign = "top" > Shows + for positive numeric values
< tr bgcolor = "#f0f0f0" > < td valign = "top" > < tt > scientific< / tt > < td valign = "top" > Uses scientific notation for floating point values
< tr bgcolor = "#d0d0d0" > < td valign = "top" > < tt > fixed< / tt > < td valign = "top" > Uses fixed-point notation for floating point values
< / table > < / center >
< p > Note that unless < tt > bin< / tt > , < tt > oct< / tt > , < tt > dec< / tt > , or < tt > hex< / tt > 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.
< p > < p > See also < a href = "#setf" > setf< / a > () and < a href = "#unsetf" > unsetf< / a > ().
< h3 class = fn > int < a name = "flags-2" > < / a > TQTextStream::flags ( int f )
< / h3 >
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the stream flags to < em > f< / em > . Returns the previous stream flags.
< p > < p > See also < a href = "#setf" > setf< / a > () and < a href = "#unsetf" > unsetf< / a > ().
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt" > < / a > TQTextStream::operator< < ( < a href = "qchar.html" > TQChar< / a > c )
< / h3 >
Writes character < tt > char< / tt > to the stream and returns a reference to
the stream.
< p > The character < em > c< / em > is assumed to be Latin1 encoded independent of
the Encoding set for the TQTextStream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-2" > < / a > TQTextStream::operator< < ( char c )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes character < em > c< / em > to the stream and returns a reference to the
stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-3" > < / a > TQTextStream::operator< < ( signed short i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a < tt > short< / tt > integer < em > i< / em > to the stream and returns a
reference to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-4" > < / a > TQTextStream::operator< < ( unsigned short i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes an < tt > unsigned< / tt > < tt > short< / tt > integer < em > i< / em > to the stream and
returns a reference to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-5" > < / a > TQTextStream::operator< < ( signed int i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes an < tt > int< / tt > < em > i< / em > to the stream and returns a reference to the
stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-6" > < / a > TQTextStream::operator< < ( unsigned int i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes an < tt > unsigned< / tt > < tt > int< / tt > < em > i< / em > to the stream and returns a
reference to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-7" > < / a > TQTextStream::operator< < ( signed long i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a < tt > long< / tt > < tt > int< / tt > < em > i< / em > to the stream and returns a reference
to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-8" > < / a > TQTextStream::operator< < ( unsigned long i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes an < tt > unsigned< / tt > < tt > long< / tt > < tt > int< / tt > < em > i< / em > to the stream and
returns a reference to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-9" > < / a > TQTextStream::operator< < ( float f )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a < tt > float< / tt > < em > f< / em > to the stream and returns a reference to
the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-a" > < / a > TQTextStream::operator< < ( double f )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a < tt > double< / tt > < em > f< / em > to the stream and returns a reference to
the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-b" > < / a > TQTextStream::operator< < ( const char * s )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a string to the stream and returns a reference to the
stream.
< p > The string < em > s< / em > is assumed to be Latin1 encoded independent of the
Encoding set for the TQTextStream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-c" > < / a > TQTextStream::operator< < ( const < a href = "tqstring.html" > TQString< / a > & s )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes < em > s< / em > to the stream and returns a reference to the stream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-d" > < / a > TQTextStream::operator< < ( const < a href = "tqcstring.html" > TQCString< / a > & s )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes < em > s< / em > to the stream and returns a reference to the stream.
< p > The string < em > s< / em > is assumed to be Latin1 encoded independent of the
Encoding set for the TQTextStream.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-lt-lt-e" > < / a > TQTextStream::operator< < ( void * ptr )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Writes a pointer to the stream and returns a reference to the
stream.
< p > The < em > ptr< / em > is output as an unsigned long hexadecimal integer.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt" > < / a > TQTextStream::operator> > ( < a href = "qchar.html" > TQChar< / a > & c )
< / h3 >
Reads a char < em > c< / em > from the stream and returns a reference to the
stream. Note that whitespace is < em > not< / em > skipped.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-2" > < / a > TQTextStream::operator> > ( char & c )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a char < em > c< / em > from the stream and returns a reference to the
stream. Note that whitespace is skipped.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-3" > < / a > TQTextStream::operator> > ( signed short & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a signed < tt > short< / tt > integer < em > i< / em > from the stream and returns a
reference to the stream. See < a href = "#flags" > flags< / a > () for an explanation of the
expected input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-4" > < / a > TQTextStream::operator> > ( unsigned short & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads an unsigned < tt > short< / tt > integer < em > i< / em > from the stream and
returns a reference to the stream. See < a href = "#flags" > flags< / a > () for an explanation
of the expected input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-5" > < / a > TQTextStream::operator> > ( signed int & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a signed < tt > int< / tt > < em > i< / em > from the stream and returns a reference
to the stream. See < a href = "#flags" > flags< / a > () for an explanation of the expected
input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-6" > < / a > TQTextStream::operator> > ( unsigned int & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads an unsigned < tt > int< / tt > < em > i< / em > from the stream and returns a
reference to the stream. See < a href = "#flags" > flags< / a > () for an explanation of the
expected input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-7" > < / a > TQTextStream::operator> > ( signed long & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a signed < tt > long< / tt > int < em > i< / em > from the stream and returns a
reference to the stream. See < a href = "#flags" > flags< / a > () for an explanation of the
expected input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-8" > < / a > TQTextStream::operator> > ( unsigned long & i )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads an unsigned < tt > long< / tt > int < em > i< / em > from the stream and returns a
reference to the stream. See < a href = "#flags" > flags< / a > () for an explanation of the
expected input format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-9" > < / a > TQTextStream::operator> > ( float & f )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a < tt > float< / tt > < em > f< / em > from the stream and returns a reference to
the stream. See < a href = "#flags" > flags< / a > () for an explanation of the expected input
format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-a" > < / a > TQTextStream::operator> > ( double & f )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a < tt > double< / tt > < em > f< / em > from the stream and returns a reference to
the stream. See < a href = "#flags" > flags< / a > () for an explanation of the expected input
format.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-b" > < / a > TQTextStream::operator> > ( char * s )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a "word" from the stream into < em > s< / em > and returns a reference
to the stream.
< p > A word consists of characters for which isspace() returns FALSE.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-c" > < / a > TQTextStream::operator> > ( < a href = "tqstring.html" > TQString< / a > & str )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a "word" from the stream into < em > str< / em > and returns a reference
to the stream.
< p > A word consists of characters for which isspace() returns FALSE.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "operator-gt-gt-d" > < / a > TQTextStream::operator> > ( < a href = "tqcstring.html" > TQCString< / a > & str )
< / h3 >
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Reads a "word" from the stream into < em > str< / em > and returns a reference
to the stream.
< p > A word consists of characters for which isspace() returns FALSE.
< h3 class = fn > int < a name = "precision" > < / a > TQTextStream::precision () const
< / h3 >
< p > Returns the precision. The default value is 6.
< h3 class = fn > int < a name = "precision-2" > < / a > TQTextStream::precision ( int p )
< / h3 >
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the precision to < em > p< / em > . Returns the previous precision setting.
< h3 class = fn > < a href = "tqstring.html" > TQString< / a > < a name = "read" > < / a > TQTextStream::read ()
< / h3 >
Reads the entire stream from the current position, and returns a string
containing the text.
< p > < p > See also < a href = "ntqiodevice.html#readLine" > TQIODevice::readLine< / a > ().
< p > Examples: < a href = "tqaction-application-example.html#x1171" > action/application.cpp< / a > , < a href = "simple-application-example.html#x1589" > application/application.cpp< / a > , < a href = "mdi-example.html#x2074" > mdi/application.cpp< / a > , < a href = "qdir-example.html#x1847" > qdir/qdir.cpp< / a > , and < a href = "qwerty-example.html#x401" > qwerty/qwerty.cpp< / a > .
< h3 class = fn > < a href = "tqstring.html" > TQString< / a > < a name = "readLine" > < / a > TQTextStream::readLine ()
< / h3 >
Reads a line from the stream and returns a string containing the
text.
< p > The returned string does not contain any trailing newline or
carriage return. Note that this is different from
< a href = "ntqiodevice.html#readLine" > TQIODevice::readLine< / a > (), which does not strip the newline at the end
of the line.
< p > On EOF you will get a < a href = "tqstring.html" > TQString< / a > that is null. On reading an empty
line the returned TQString is empty but not null.
< p > < p > See also < a href = "ntqiodevice.html#readLine" > TQIODevice::readLine< / a > ().
< p > Examples: < a href = "addressbook-example.html#x602" > addressbook/centralwidget.cpp< / a > , < a href = "tutorial2-03.html#x2553" > chart/element.cpp< / a > , and < a href = "clientserver-example.html#x787" > network/clientserver/server/server.cpp< / a > .
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "readRawBytes" > < / a > TQTextStream::readRawBytes ( char * s, uint len )
< / h3 >
Reads < em > len< / em > bytes from the stream into < em > s< / em > and returns a
reference to the stream.
< p > The buffer < em > s< / em > must be preallocated.
< p > Note that no encoding is done by this function.
< p > < b > Warning:< / b > The behavior of this function is undefined unless the
stream's encoding is set to Unicode or Latin1.
< p > < p > See also < a href = "ntqiodevice.html#readBlock" > TQIODevice::readBlock< / a > ().
< h3 class = fn > void < a name = "reset" > < / a > TQTextStream::reset ()
< / h3 >
Resets the text stream.
< p > < ul >
< li > All flags are set to 0.
< li > The field width is set to 0.
< li > The fill character is set to ' ' (Space).
< li > The precision is set to 6.
< / ul >
< p > < p > See also < a href = "#setf" > setf< / a > (), < a href = "#width" > width< / a > (), < a href = "#fill" > fill< / a > (), and < a href = "#precision" > precision< / a > ().
< h3 class = fn > void < a name = "setCodec" > < / a > TQTextStream::setCodec ( < a href = "tqtextcodec.html" > TQTextCodec< / a > * codec )
< / h3 >
Sets the codec for this stream to < em > codec< / em > . Will not try to
autodetect Unicode.
< p > Note that this function should be called before any data is read
to/written from the stream.
< p > < p > See also < a href = "#setEncoding" > setEncoding< / a > () and < a href = "#codec" > codec< / a > ().
< p > Example: < a href = "qwerty-example.html#x402" > qwerty/qwerty.cpp< / a > .
< h3 class = fn > void < a name = "setDevice" > < / a > TQTextStream::setDevice ( < a href = "ntqiodevice.html" > TQIODevice< / a > * iod )
< / h3 >
Sets the IO device to < em > iod< / em > .
< p > < p > See also < a href = "#device" > device< / a > () and < a href = "#unsetDevice" > unsetDevice< / a > ().
< h3 class = fn > void < a name = "setEncoding" > < / a > TQTextStream::setEncoding ( < a href = "tqtextstream.html#Encoding-enum" > Encoding< / a > e )
< / h3 >
Sets the encoding of this stream to < em > e< / em > , where < em > e< / em > is one of the
following values:
< center > < table cellpadding = "4" cellspacing = "2" border = "0" >
< tr bgcolor = "#a2c511" > < th valign = "top" > Encoding < th valign = "top" > Meaning
< tr bgcolor = "#f0f0f0" > < td valign = "top" > Locale
< td valign = "top" > Uses local file format (Latin1 if locale is not set), but
autodetecting Unicode(utf16) on input.
< tr bgcolor = "#d0d0d0" > < td valign = "top" > Unicode
< td valign = "top" > 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 < a href = "tqstring.html" > TQString< / a > ).
< tr bgcolor = "#f0f0f0" > < td valign = "top" > UnicodeUTF8
< td valign = "top" > Using Unicode(utf8) for input and output. If you use it for
input it will autodetect utf16 and use it instead of utf8.
< tr bgcolor = "#d0d0d0" > < td valign = "top" > Latin1
< td valign = "top" > ISO-8859-1. Will not autodetect utf16.
< tr bgcolor = "#f0f0f0" > < td valign = "top" > UnicodeNetworkOrder
< td valign = "top" > Uses network order Unicode(utf16) for input and output.
Useful when reading Unicode data that does not start with the
byte order marker.
< tr bgcolor = "#d0d0d0" > < td valign = "top" > UnicodeReverse
< td valign = "top" > 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.
< tr bgcolor = "#f0f0f0" > < td valign = "top" > RawUnicode
< td valign = "top" > 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.
< / table > < / center >
< p > < a href = "#Encoding-enum" > Locale< / a > and all Unicode encodings, except < a href = "#Encoding-enum" > RawUnicode< / a > , 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.
< p > Note that this function should be called before any data is read to
or written from the stream.
< p > < p > See also < a href = "#setCodec" > setCodec< / a > ().
< p > Examples: < a href = "addressbook-example.html#x603" > addressbook/centralwidget.cpp< / a > , < a href = "httpd-example.html#x735" > network/httpd/httpd.cpp< / a > , and < a href = "qwerty-example.html#x403" > qwerty/qwerty.cpp< / a > .
< h3 class = fn > int < a name = "setf" > < / a > TQTextStream::setf ( int bits )
< / h3 >
< p > Sets the stream flag bits < em > bits< / em > . Returns the previous stream
flags.
< p > Equivalent to < tt > flags( flags() | bits )< / tt > .
< p > < p > See also < a href = "#unsetf" > unsetf< / a > ().
< h3 class = fn > int < a name = "setf-2" > < / a > TQTextStream::setf ( int bits, int mask )
< / h3 >
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the stream flag bits < em > bits< / em > with a bit mask < em > mask< / em > . Returns
the previous stream flags.
< p > Equivalent to < tt > flags( (flags() & ~mask) | (bits & mask) )< / tt > .
< p > < p > See also < a href = "#unsetf" > unsetf< / a > ().
< h3 class = fn > void < a name = "skipWhiteSpace" > < / a > TQTextStream::skipWhiteSpace ()
< / h3 >
Positions the read pointer at the first non-whitespace character.
< h3 class = fn > void < a name = "unsetDevice" > < / a > TQTextStream::unsetDevice ()
< / h3 >
Unsets the IO device. Equivalent to < a href = "#setDevice" > setDevice< / a > ( 0 ).
< p > < p > See also < a href = "#device" > device< / a > () and < a href = "#setDevice" > setDevice< / a > ().
< h3 class = fn > int < a name = "unsetf" > < / a > TQTextStream::unsetf ( int bits )
< / h3 >
< p > Clears the stream flag bits < em > bits< / em > . Returns the previous stream
flags.
< p > Equivalent to < tt > flags( flags() & ~mask )< / tt > .
< p > < p > See also < a href = "#setf" > setf< / a > ().
< h3 class = fn > int < a name = "width" > < / a > TQTextStream::width () const
< / h3 >
< p > Returns the field width. The default value is 0.
< h3 class = fn > int < a name = "width-2" > < / a > TQTextStream::width ( int w )
< / h3 >
< p > This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
< p > Sets the field width to < em > w< / em > . Returns the previous field width.
< h3 class = fn > < a href = "tqtextstream.html" > TQTextStream< / a > & < a name = "writeRawBytes" > < / a > TQTextStream::writeRawBytes ( const char * s, uint len )
< / h3 >
Writes the < em > len< / em > bytes from < em > s< / em > to the stream and returns a
reference to the stream.
< p > Note that no encoding is done by this function.
< p > < p > See also < a href = "ntqiodevice.html#writeBlock" > TQIODevice::writeBlock< / a > ().
<!-- eof -->
< hr > < p >
This file is part of the < a href = "index.html" > TQt toolkit< / a > .
Copyright © 1995-2007
< a href = "http://www.trolltech.com/" > Trolltech< / a > . All Rights Reserved.< p > < address > < hr > < div align = center >
< table width = 100% cellspacing = 0 border = 0 > < tr >
< td > Copyright © 2007
< a href = "troll.html" > Trolltech< / a > < td align = center > < a href = "trademarks.html" > Trademarks< / a >
< td align = right > < div align = right > TQt 3.3.8< / div >
< / table > < / div > < / address > < / body >
< / html >