⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qbuffer.3qt

📁 tmark1.11:用于生成QT/EMBEDDED应用工程的Markfile文件
💻 3QT
字号:
.TH QBuffer 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 NAMEQBuffer \- I/O device that operates on a QByteArray.SH SYNOPSIS.br.PP\fC#include <qbuffer.h>\fR.PPInherits QIODevice..PP.SS "Public Members".in +1c.ti -1c.BI "\fBQBuffer\fR ()".br.ti -1c.BI "\fBQBuffer\fR ( QByteArray )".br.ti -1c.BI "\fB~QBuffer\fR ()".br.ti -1c.BI "QByteArray \fBbuffer\fR () const".br.ti -1c.BI "bool \fBsetBuffer\fR ( QByteArray )".br.ti -1c.BI "virtual bool \fBopen\fR ( int )".br.ti -1c.BI "virtual void \fBclose\fR ()".br.ti -1c.BI "virtual void \fBflush\fR ()".br.ti -1c.BI "virtual uint \fBsize\fR () const".br.ti -1c.BI "virtual int \fBat\fR () const".br.ti -1c.BI "virtual bool \fBat\fR ( int )".br.ti -1c.BI "virtual int \fBreadBlock\fR ( char * " "p" ", uint )".br.ti -1c.BI "virtual int \fBwriteBlock\fR ( const char * " "p" ", uint )".br.ti -1c.BI "virtual int \fBreadLine\fR ( char * " "p" ", uint )".br.ti -1c.BI "virtual int \fBgetch\fR ()".br.ti -1c.BI "virtual int \fBputch\fR ( int )".br.ti -1c.BI "virtual int \fBungetch\fR ( int )".br.in -1c.SH DESCRIPTIONThe QBuffer class is an I/O device that operates on a QByteArray.PPQBuffer is an I/O device for reading and writing a memory buffer. A QBuffer may be used directly (readBlock() and writeBlock()) or more conveniently via QDataStream or QTextStream. Most of its behavior is inherited from QIODevice..PPA QBuffer has an associated QByteArray which holds the buffer data. Writing data at the end (i.e. size()) of the buffer expands the byte array..PPFor convenience, the byte stream classes QDataStream and QTextStream can operate on a QByteArray (or a QString) via an internal QBuffer:.PP.nf.br    QString str;.br    QTextStream ts( str, IO_WriteOnly );.br    ts << "pi = " << 3.14;                      // str == "pi = 3.14".fi.PPSee also: QFile, QDataStream and QTextStream..PPExamples:.(lgrapher/grapher.cpp.)l.SH MEMBER FUNCTION DOCUMENTATION.SH "QBuffer::QBuffer ()"Constructs an empty buffer..SH "QBuffer::QBuffer ( QByteArray buf )"Constructs a buffer and sets the buffer contents to \fIbuf.\fR.PPSee also: setBuffer()..SH "QBuffer::~QBuffer ()"Destroys the buffer..SH "bool QBuffer::at ( int pos ) \fC[virtual]\fR"Sets the buffer index to \fIpos.\fR Returns TRUE if successful, otherwise FALSE..PPSee also: size()..PPReimplemented from QIODevice..SH "int QBuffer::at () const \fC[virtual]\fR"Returns the buffer index..PPSee also: size()..PPReimplemented from QIODevice..SH "QByteArray QBuffer::buffer () const"Returns the buffer most recently set by setBuffer(), or at construction..SH "void QBuffer::close () \fC[virtual]\fR"Closes an open buffer..PPSee also: open()..PPExamples:.(lgrapher/grapher.cpp.)l.PPReimplemented from QIODevice..SH "void QBuffer::flush () \fC[virtual]\fR"The flush function does nothing..PPReimplemented from QIODevice..SH "int QBuffer::getch () \fC[virtual]\fR"Reads a single byte/character from the buffer..PPReturns the byte/character read, or -1 if the end of the buffer has been reached..PPSee also: putch() and ungetch()..PPReimplemented from QIODevice..SH "bool QBuffer::open ( int m ) \fC[virtual]\fR"Opens the file specified by the file name currently set, using the mode \fIm.\fR Returns TRUE if successful, otherwise FALSE..PPThe mode parameter \fIm\fR must be a combination of the following flags..TP\fCIO_ReadOnly\fR opens a buffer in read-only mode..TP\fCIO_WriteOnly\fR opens a buffer in write-only mode..TP\fCIO_ReadWrite\fR opens a buffer in read/write mode..TP\fCIO_Append\fR sets the buffer index to the end of the buffer..TP\fCIO_Truncate\fR truncates the buffer..PPSee also: close() and isOpen()..PPExamples:.(lgrapher/grapher.cpp.)l.PPReimplemented from QIODevice..SH "int QBuffer::putch ( int ch ) \fC[virtual]\fR"Writes the character \fIch\fR into the buffer, overwriting the character at the current index, extending the buffer if necessary..PPReturns \fIch,\fR or -1 if some error occurred..PPSee also: getch() and ungetch()..PPExamples:.(lgrapher/grapher.cpp.)l.PPReimplemented from QIODevice..SH "int QBuffer::readBlock ( char * p, uint len ) \fC[virtual]\fR"Reads at most \fIlen\fR bytes from the buffer into \fIp\fR and returns the number of bytes actually read..PPReturns -1 if a serious error occurred..PPSee also: writeBlock()..PPReimplemented from QIODevice..SH "int QBuffer::readLine ( char * p, uint maxlen ) \fC[virtual]\fR"Reads a line of text..PPReads bytes from the buffer until end-of-line is reached, or up to \fImaxlen\fR bytes..PPSee also: readBlock()..PPReimplemented from QIODevice..SH "bool QBuffer::setBuffer ( QByteArray buf )"Replaces the buffer's contents with \fIbuf.\fR.PPThis may not be done while the buffer is open..PPNote that if you open the buffer in write mode (\fCIO_WriteOnly\fR or IO_ReadWrite) and write something into the buffer, \fIbuf\fR is also modified because QByteArray is an explicitly shared class..PPExample:.PP.nf.br    QString str = "abc";.br    QBuffer b( str );.br    b.open( IO_WriteOnly );.br    b.at( 3 );                                  // position at \\0.br    b.writeBlock( "def", 4 );                   // write including \\0.br    b.close();.br      // Now, str == "abcdef".fi.PPSee also: open and Shared Classes.SH "uint QBuffer::size () const \fC[virtual]\fR"Returns the number of bytes in the buffer..PPSee also: at()..PPReimplemented from QIODevice..SH "int QBuffer::ungetch ( int ch ) \fC[virtual]\fR"Puts the character \fIch\fR back into the buffer and decrements the index if it is not zero..PPThis function is normally called to "undo" a getch() operation..PPReturns \fIch,\fR or -1 if some error occurred..PPSee also: getch() and putch()..PPReimplemented from QIODevice..SH "int QBuffer::writeBlock ( const char * p, uint len ) \fC[virtual]\fR"Writes \fIlen\fR bytes from \fIp\fR into the buffer at the current index, overwriting any characters there and extending the buffer if necessary. Returns the number of bytes actually written..PPReturns -1 if a serious error occurred..PPSee also: readBlock()..PPReimplemented from QIODevice..SH "SEE ALSO".BR http://www.troll.no/qt/qbuffer.html.SH COPYRIGHTCopyright 1992-1999 Troll Tech AS.  See the license file included inthe distribution for a complete license statement..SH AUTHORGenerated automatically from the source code.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -