📄 qtextstream.3qt
字号:
.TH QTextStream 3qt "6 July 1999" "Troll Tech AS" \" -*- nroff -*-.\" Copyright 1992-1999 Troll Tech AS. All rights reserved. See the.\" license file included in the distribution for a complete license.\" statement..\".ad l.nh.SH NAMEQTextStream \- Basic functions for reading and writing text using a QIODevice.SH SYNOPSIS.br.PP\fC#include <qtextstream.h>\fR.PPInherited by QTextIStream and QTextOStream..PP.SS "Public Members".in +1c.ti -1c.BI "enum \fBEncoding\fR { Locale, Latin1, Unicode, UnicodeNetworkOrder, UnicodeReverse, RawUnicode }".br.ti -1c.BI "void \fBsetEncoding\fR ( Encoding )".br.ti -1c.BI "void \fBsetCodec\fR ( QTextCodec * )".br.ti -1c.BI "\fBQTextStream\fR ()".br.ti -1c.BI "\fBQTextStream\fR ( QIODevice * )".br.ti -1c.BI "\fBQTextStream\fR ( QString *, int mode )".br.ti -1c.BI "\fBQTextStream\fR ( QString &, int mode )".br.ti -1c.BI "\fBQTextStream\fR ( QByteArray, int mode )".br.ti -1c.BI "\fBQTextStream\fR ( FILE *, int mode )".br.ti -1c.BI "virtual \fB~QTextStream\fR ()".br.ti -1c.BI "QIODevice* \fBdevice\fR () const".br.ti -1c.BI "void \fBsetDevice\fR ( QIODevice * )".br.ti -1c.BI "void \fBunsetDevice\fR ()".br.ti -1c.BI "bool \fBatEnd\fR () const".br.ti -1c.BI "bool \fBeof\fR () const".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( QChar & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( char & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( signed short & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( unsigned short & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( signed int & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( unsigned int & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( signed long & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( unsigned long & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( float & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( double & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( char * )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( QString & )".br.ti -1c.BI "QTextStream& \fBoperator>>\fR ( QCString & )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( char )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( signed short )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( unsigned short )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( signed int )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( unsigned int )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( signed long )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( unsigned long )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( float )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( double )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( const char * )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( const QString & )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( const QCString & )".br.ti -1c.BI "QTextStream& \fBoperator<<\fR ( void * )".br.ti -1c.BI "QTextStream& \fBreadRawBytes\fR ( char *, uint len )".br.ti -1c.BI "QTextStream& \fBwriteRawBytes\fR ( const char *, uint len )".br.ti -1c.BI "QString \fBreadLine\fR ()".br.ti -1c.BI "QString \fBread\fR ()".br.ti -1c.BI "void \fBskipWhiteSpace\fR ()".br.ti -1c.BI "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 }".br.ti -1c.BI "int \fBflags\fR () const".br.ti -1c.BI "int \fBflags\fR ( int f )".br.ti -1c.BI "int \fBsetf\fR ( int bits )".br.ti -1c.BI "int \fBsetf\fR ( int " "bits" ", int mask )".br.ti -1c.BI "int \fBunsetf\fR ( int bits )".br.ti -1c.BI "void \fBreset\fR ()".br.ti -1c.BI "int \fBwidth\fR () const".br.ti -1c.BI "int \fBwidth\fR ( int )".br.ti -1c.BI "int \fBfill\fR () const".br.ti -1c.BI "int \fBfill\fR ( int )".br.ti -1c.BI "int \fBprecision\fR () const".br.ti -1c.BI "int \fBprecision\fR ( int )".br.in -1c.SH DESCRIPTIONThe QTextStream class provides basic functions for reading and writing text using a QIODevice..PPThe text stream class has a functional interface that is very similar to that of the standard C++ iostream class. The difference between iostream and QTextStream is that our stream operates on a QIODevice, which is easily subclassed, while iostream operates on FILE * pointers, which can not be subclassed..PPQt provides several global functions similar to the ones in iostream:.TP\fCbin\fR sets the QTextStream to read/write binary numbers.TP\fCoct\fR sets the QTextStream to read/write octal numbers.TP\fCdec\fR sets the QTextStream to read/write decimal numbers.TP\fChex\fR sets the QTextStream to read/write hexadecimal numbers.TP\fCendl\fR forces a line break.TP\fCflush\fR forces the QIODevice to flush any buffered data.TP\fCws\fR eats any available white space (on input).TP\fCreset\fR resets the QTextStream to its default mode (see reset())..PP\fBWarning:\fR 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, ie. the sequence "0100" will be interpreted as 64..PPThe QTextStream class reads and writes text and it is not appropriate for dealing with binary data (but QDataStream is)..PPNote that all 8-bit characters are interpreted as Latin1 characters..PPSee also: QDataStream..PPExamples:.(lgrapher/grapher.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QTextStream::QTextStream ()"Constructs a data stream that has no IO device..SH "QTextStream::QTextStream ( QIODevice * d )"Constructs a text stream that uses the IO device \fId.\fR.SH "QTextStream::QTextStream ( QString & str, int filemode )"\fBThis function is obsolete.\fR It is provided to keep old programs working. We strongly advise against using it in new code..PPThis constructor is equivalent to the constructor taking a QString* parameter..SH "QTextStream::QTextStream ( QString * str, int filemode )"Constructs a text stream that operates on a Unicode QString through an internal device..PPExample:.PP.nf.br QString str;.br QTextStream ts( &str, IO_WriteOnly );.br ts << "pi = " << 3.14; // str == "pi = 3.14...".fi.PPWriting 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..PPNote that since QString is Unicode, you should not use readRawBytes() or writeRawBytes() on such a stream..SH "QTextStream::QTextStream ( FILE * fh, int mode )"Constructs a text stream that operates on an existing file handle \fIfh\fR through an internal QFile device..PPExample:.PP.nf.br QTextStream cout( stdout, IO_WriteOnly );.br
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -