📄 qtextstream.3qt
字号:
The destructor does not affect the current IO device..SH "bool QTextStream::atEnd () const"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..PPSee also QIODevice::atEnd()..PPExamples:.)l addressbook/centralwidget.cpp and grapher/grapher.cpp..SH "QIODevice * QTextStream::device () const"Returns the IO device currently set..PPSee also setDevice() and unsetDevice()..SH "bool QTextStream::eof () const"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPThis function has been renamed to atEnd()..PPSee also QIODevice::atEnd()..SH "int QTextStream::fill () const"Returns the fill character. The default value is ' ' (space)..SH "int QTextStream::fill ( int f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the fill character to \fIf\fR. Returns the previous fill character..SH "int QTextStream::flags () const"Returns the current stream flags. The default value is 0..PPThe meanings of the flags are:.TP\fIskipws\fR - Not currently used; whitespace always skipped.TP\fIleft\fR - Numeric fields are left-aligned.TP\fIright\fR - Not currently used (by default, numerics are right-aligned).TP\fIinternal\fR - Puts any padding spaces between +/- and value.TP\fIbin\fR - Output \fIand\fR input only in binary.TP\fIoct\fR - Output \fIand\fR input only in octal.TP\fIdec\fR - Output \fIand\fR input only in decimal.TP\fIhex\fR - Output \fIand\fR input only in hexadecimal.TP\fIshowbase\fR - Annotates numeric outputs with 0b, 0, or 0x if in \fIbin\fR, \fIoct\fR, or \fIhex\fR format.TP\fIshowpoint\fR - Not currently used.TP\fIuppercase\fR - Uses 0B and 0X rather than 0b and 0x.TP\fIshowpos\fR - Shows + for positive numeric values.TP\fIscientific\fR - Uses scientific notation for floating point values.TP\fIfixed\fR - Uses fixed-point notation for floating point values.PPNote that unless \fIbin\fR, \fIoct\fR, \fIdec\fR, or \fIhex\fR 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..PPSee also setf() and unsetf()..SH "int QTextStream::flags ( int f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the stream flags to \fIf\fR. Returns the previous stream flags..PPSee also setf() and unsetf()..SH "QTextStream & QTextStream::operator<< ( QChar c )"Writes character \fCchar\fR to the stream and returns a reference to the stream..PPThe character \fIc\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream..SH "QTextStream & QTextStream::operator<< ( char c )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites character \fIc\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( signed short i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( unsigned short i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites an \fCunsigned\fR \fCshort\fR integer \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( signed int i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites an \fCint\fR \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( unsigned int i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites an \fCunsigned\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( signed long i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( unsigned long i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites an \fCunsigned\fR \fClong\fR \fCint\fR \fIi\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( float f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a \fCfloat\fR \fIf\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( double f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a \fCdouble\fR \fIf\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( const char * s )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a string to the stream and returns a reference to the stream..PPThe string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream..SH "QTextStream & QTextStream::operator<< ( const QString & s )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites \fIs\fR to the stream and returns a reference to the stream..SH "QTextStream & QTextStream::operator<< ( const QCString & s )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites \fIs\fR to the stream and returns a reference to the stream..PPThe string \fIs\fR is assumed to be Latin1 encoded independent of the Encoding set for the QTextStream..SH "QTextStream & QTextStream::operator<< ( void * ptr )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPWrites a pointer to the stream and returns a reference to the stream..PPThe \fIptr\fR is output as an unsigned long hexadecimal integer..SH "QTextStream & QTextStream::operator>> ( QChar & c )"Reads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is \fInot\fR skipped..SH "QTextStream & QTextStream::operator>> ( char & c )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a char \fIc\fR from the stream and returns a reference to the stream. Note that whitespace is skipped..SH "QTextStream & QTextStream::operator>> ( signed short & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a signed \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( unsigned short & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads an unsigned \fCshort\fR integer \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( signed int & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a signed \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( unsigned int & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads an unsigned \fCint\fR \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( signed long & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a signed \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( unsigned long & i )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads an unsigned \fClong\fR int \fIi\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( float & f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a \fCfloat\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( double & f )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a \fCdouble\fR \fIf\fR from the stream and returns a reference to the stream. See flags() for an explanation of the expected input format..SH "QTextStream & QTextStream::operator>> ( char * s )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a "word" from the stream into \fIs\fR and returns a reference to the stream..PPA word consists of characters for which isspace() returns FALSE..SH "QTextStream & QTextStream::operator>> ( QString & str )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a "word" from the stream into \fIstr\fR and returns a reference to the stream..PPA word consists of characters for which isspace() returns FALSE..SH "QTextStream & QTextStream::operator>> ( QCString & str )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReads a "word" from the stream into \fIstr\fR and returns a reference to the stream..PPA word consists of characters for which isspace() returns FALSE..SH "int QTextStream::precision () const"Returns the precision. The default value is 6..SH "int QTextStream::precision ( int p )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the precision to \fIp\fR. Returns the previous precision setting..SH "QString QTextStream::read ()"Reads the entire stream and returns a string containing the text..PPSee also QIODevice::readLine()..PPExamples:.)l action/application.cpp, application/application.cpp, helpviewer/helpwindow.cpp, mdi/application.cpp, qdir/qdir.cpp and qwerty/qwerty.cpp..SH "QString QTextStream::readLine ()"Reads a line from the stream and returns a string containing the text..PPThe 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..PPOn EOF you will get a QString that is null. On reading an empty line the returned QString is empty but not null..PPSee also QIODevice::readLine()..PPExample: addressbook/centralwidget.cpp..SH "QTextStream & QTextStream::readRawBytes ( char * s, uint len )"Reads \fIlen\fR bytes from the stream into \fIs\fR and returns a reference to the stream..PPThe buffer \fIs\fR must be preallocated..PPNote that no encoding is done by this function..PP\fBWarning:\fR The behavior of this function is undefined unless the stream's encoding is set to Unicode or Latin1..PPSee also QIODevice::readBlock()..SH "void QTextStream::reset ()"Resets the text stream..TPAll flags are set to 0..TPThe field width is set to 0..TPThe fill character is set to ' ' (space)..TPThe precision is set to 6..PPSee also setf(), width(), fill() and precision()..SH "void QTextStream::setCodec ( QTextCodec * codec )"Sets the codec for this stream to \fIcodec\fR. Will not try to autodetect Unicode..PPNote that this function should be called before any data is read to/written from the stream..PPSee also setEncoding()..PPExample: qwerty/qwerty.cpp..SH "void QTextStream::setDevice ( QIODevice * iod )"Sets the IO device to \fIiod\fR..PPSee also device() and unsetDevice()..SH "void QTextStream::setEncoding ( Encoding e )"Sets the encoding of this stream to \fIe\fR, where \fIe\fR is one of:.TPLocale - Uses local file format (Latin1 if locale is not set), but autodetecting Unicode(utf16) on input..TPUnicode - 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)..TPUnicodeUTF8 Using Unicode(utf8) for input and output. If you use it for input it will autodetect utf16 and use it instead of utf8..TPLatin1 - ISO-8859-1. Will not autodetect utf16..TPUnicodeNetworkOrder - Uses network order Unicode(utf16) for input and output. Useful when reading Unicode data that does not start with the byte order marker..TPUnicodeReverse - 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..TPRawUnicode - Like Unicode, but does not write the byte order marker nor does it auto-detect the byte order. Useful only when writing to nonpersistent storage used by a single process..PPLocale 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..PPNote that this function should be called before any data is read to or written from the stream..PPSee also setCodec()..PPExamples:.)l network/httpd/httpd.cpp and qwerty/qwerty.cpp..SH "int QTextStream::setf ( int bits )"Sets the stream flag bits \fIbits\fR. Returns the previous stream flags..PPEquivalent to \fCflags( flags() | bits )\fR..PPSee also unsetf()..SH "int QTextStream::setf ( int bits, int mask )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the stream flag bits \fIbits\fR with a bit mask \fImask\fR. Returns the previous stream flags..PPEquivalent to \fCflags( (flags() & ~mask) | (bits & mask) )\fR..PPSee also unsetf()..SH "void QTextStream::skipWhiteSpace ()"Positions the read pointer at the first non-whitespace character..SH "void QTextStream::unsetDevice ()"Unsets the IO device. Equivalent to setDevice( 0 )..PPSee also device() and setDevice()..SH "int QTextStream::unsetf ( int bits )"Clears the stream flag bits \fIbits\fR. Returns the previous stream flags..PPEquivalent to \fCflags( flags() & ~mask )\fR..PPSee also setf()..SH "int QTextStream::width () const"Returns the field width. The default value is 0..SH "int QTextStream::width ( int w )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPSets the field width to \fIw\fR. Returns the previous field width..SH "QTextStream & QTextStream::writeRawBytes ( const char * s, uint len )"Writes the \fIlen\fR bytes from \fIs\fR to the stream and returns a reference to the stream..PPNote that no encoding is done by this function..PPSee also QIODevice::writeBlock()..SH "SEE ALSO".BR http://doc.trolltech.com/qtextstream.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qtextstream.3qt) and the Qtversion (3.0.0).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -