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

📄 qbuffer.3qt

📁 linux下GUI编程工具qt的在线连接帮助手册
💻 3QT
字号:
'\" t.TH QBuffer 3qt "11 October 2001" "Trolltech AS" \" -*- nroff -*-.\" Copyright 1992-2001 Trolltech 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.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 buf )".br.ti -1c.BI "\fB~QBuffer\fR ()".br.ti -1c.BI "QByteArray \fBbuffer\fR () const".br.ti -1c.BI "bool \fBsetBuffer\fR ( QByteArray buf )".br.ti -1c.BI "virtual Q_LONG \fBwriteBlock\fR ( const char * p, Q_ULONG len )".br.ti -1c.BI "Q_LONG \fBwriteBlock\fR ( const QByteArray & data )".br.in -1c.SH DESCRIPTIONThe QBuffer class is an I/O device that operates on a QByteArray..PPQBuffer is used to read and write to a memory buffer. It is normally used with a QTextStream or a QDataStream. QBuffer has an associated QByteArray which holds the buffer data. The size() of the buffer is automatically adjusted as data is written..PPThe constructor \fCQBuffer(QByteArray)\fR creates a QBuffer with an existing byte array. The byte array can also be set with setBuffer(). Writing to the QBuffer will modify the original byte array because QByteArray is explicitly shared..PPUse open() to open the buffer before use and to set the mode (read-only, write-only, etc.). close() closes the buffer. The buffer must be closed before reopening or calling setBuffer()..PPA common way to use QBuffer is through QDataStream or QTextStream, which have constructors that take a QBuffer parameter. For convenience, there are also QDataStream and QTextStream constructors that take a QByteArray parameter. These constructors create and open an internal QBuffer..PPNote that QTextStream can also operate on a QString (a Unicode string); a QBuffer cannot..PPYou can also use QBuffer directly through the standard QIODevice functions readBlock(), writeBlock() readLine(), at(), getch(), putch() and ungetch()..PPSee also QFile, QDataStream, QTextStream, QByteArray, Shared Classes, Collection Classes and Input/Output and Networking..SH MEMBER FUNCTION DOCUMENTATION.SH "QBuffer::QBuffer ()"Constructs an empty buffer..SH "QBuffer::QBuffer ( QByteArray buf )"Constructs a buffer that operates on \fIbuf\fR. If you open the buffer in write mode (<a href="qfile.html#open">IO_WriteOnly</a> or IO_ReadWrite) and write something into the buffer, \fIbuf\fR will be modified..PPExample:.PP.nf.br    QCString str = "abc";.br    QBuffer b( str );.br    b.open( IO_WriteOnly );.br    b.at( 3 ); // position at the 4th character (the terminating \\0).br    b.writeBlock( "def", 4 ); // write "def" including the terminating \\0.br    b.close();.br    // Now, str == "abcdef" with a terminating \\0.br.fi.PPSee also setBuffer()..SH "QBuffer::~QBuffer ()"Destroys the buffer..SH "QByteArray QBuffer::buffer () const"Returns this buffer's byte array..PPSee also setBuffer()..SH "bool QBuffer::setBuffer ( QByteArray buf )"Replaces the buffer's contents with \fIbuf\fR..PPThis may not be done when isOpen() is TRUE..PPNote that if you open the buffer in write mode (<a href="qfile.html#open">IO_WriteOnly</a> or IO_ReadWrite) and write something into the buffer, \fIbuf\fR is also modified because QByteArray is an explicitly shared class..PPSee also buffer(), open() and close()..SH "Q_LONG QBuffer::writeBlock ( const char * p, Q_ULONG 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 an error occurred..PPSee also readBlock()..PPReimplemented from QIODevice..SH "Q_LONG QBuffer::writeBlock ( const QByteArray & data )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPThis convenience function takes \fIdata\fR and is the same as calling \fCwriteBlock( data.data(), data.size() )\fR..PP.SH "SEE ALSO".BR http://doc.trolltech.com/qbuffer.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 (qbuffer.3qt) and the Qtversion (3.0.0).

⌨️ 快捷键说明

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