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

📄 qmemarray.3qt

📁 Linux下的基于X11的图形开发环境。
💻 3QT
📖 第 1 页 / 共 2 页
字号:
.SS "Member Type Documentation".SH "QMemArray::ConstIterator"A const QMemArray iterator..PPSee also begin() and end()..SH "QMemArray::Iterator"A QMemArray iterator..PPSee also begin() and end()..SH MEMBER FUNCTION DOCUMENTATION.SH "QMemArray::QMemArray ( int, int )\fC [protected]\fR"Constructs an array \fIwithout allocating\fR array space. The arguments should be (0, 0). Use at your own risk..SH "QMemArray::QMemArray ()"Constructs a null array..PPSee also isNull()..SH "QMemArray::QMemArray ( int size )"Constructs an array with room for \fIsize\fR elements. Makes a null array if \fIsize\fR == 0..PPThe elements are left uninitialized..PPSee also resize() and isNull()..SH "QMemArray::QMemArray ( const QMemArray<type> & a )"Constructs a shallow copy of \fIa\fR..PPSee also assign()..SH "QMemArray::~QMemArray ()"Dereferences the array data and deletes it if this was the last reference..SH "QMemArray<type> & QMemArray::assign ( const QMemArray<type> & a )"Shallow copy. Dereferences the current array and references the data contained in \fIa\fR instead. Returns a reference to this array..PPSee also operator=()..SH "QMemArray<type> & QMemArray::assign ( const type * data, uint size )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPShallow copy. Dereferences the current array and references the array data \fIdata\fR, which contains \fIsize\fR elements. Returns a reference to this array..PPDo not delete \fIdata\fR later; QMemArray will call free() on it at the right time..SH "type & QMemArray::at ( uint index ) const"Returns a reference to the element at position \fIindex\fR in the array..PPThis can be used to both read and set an element..PPSee also operator[]()..SH "Iterator QMemArray::begin ()"Returns an iterator pointing at the beginning of this array. This iterator can be used in the same way as the iterators of QValueList and QMap, for example..SH "ConstIterator QMemArray::begin () const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a const iterator pointing at the beginning of this array. This iterator can be used in the same way as the iterators of QValueList and QMap, for example..SH "int QMemArray::bsearch ( const type & v ) const"In a sorted array, finds the first occurrence of \fIv\fR by using a binary search. For a sorted array this is generally much faster than find(), which does a linear search..PPReturns the position of \fIv\fR, or -1 if \fIv\fR could not be found..PPSee also sort() and find()..SH "int QMemArray::contains ( const type & v ) const"Returns the number of times \fIv\fR occurs in the array..PPSee also find()..SH "QMemArray<type> QMemArray::copy () const"Returns a deep copy of this array..PPSee also detach() and duplicate()..SH "uint QMemArray::count () const"Returns the same as size()..PPSee also size()..PPExample: scribble/scribble.cpp..SH "type * QMemArray::data () const"Returns a pointer to the actual array data..PPThe array is a null array if data() == 0 (null pointer)..PPSee also isNull()..PPExamples:.)l fileiconview/qfileiconview.cpp and network/networkprotocol/nntp.cpp..SH "void QMemArray::detach ()\fC [virtual]\fR"Detaches this array from shared array data; i.e. it makes a private, deep copy of the data..PPCopying will be performed only if the reference count is greater than one..PPSee also copy()..PPReimplemented in QBitArray..SH "QMemArray<type> & QMemArray::duplicate ( const QMemArray<type> & a )"Deep copy. Dereferences the current array and obtains a copy of the data contained in \fIa\fR instead. Returns a reference to this array..PPSee also copy()..SH "QMemArray<type> & QMemArray::duplicate ( const type * data, uint size )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPDeep copy. Dereferences the current array and obtains a copy of the array data \fIdata\fR instead. Returns a reference to this array. The size of the array is given by \fIsize\fR..PPSee also copy()..SH "Iterator QMemArray::end ()"Returns an iterator pointing behind the last element of this array. This iterator can be used in the same way as the iterators of QValueList and QMap, for example..SH "ConstIterator QMemArray::end () const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns a const iterator pointing behind the last element of this array. This iterator can be used in the same way as the iterators of QValueList and QMap, for example..SH "bool QMemArray::fill ( const type & v, int size = -1 )"Fills the array with the value \fIv\fR. If \fIsize\fR is specified as different from -1, then the array will be resized before being filled..PPReturns TRUE if successful, i.e. if \fIsize\fR is -1, or \fIsize\fR is != -1 and the memory can be allocated; otherwise returns FALSE..PPSee also resize()..SH "int QMemArray::find ( const type & v, uint index = 0 ) const"Finds the first occurrence of \fIv\fR, starting at position \fIindex\fR..PPReturns the position of \fIv\fR, or -1 if \fIv\fR could not be found..PPSee also contains()..SH "bool QMemArray::isEmpty () const"Returns TRUE if the array is empty; otherwise returns FALSE..PPisEmpty() is equivalent to isNull() for QMemArray (unlike QString)..SH "bool QMemArray::isNull () const"Returns TRUE if the array is null; otherwise returns FALSE..PPA null array has size() == 0 and data() == 0..SH "uint QMemArray::nrefs () const"Returns the reference count for the shared array data. This reference count is always greater than zero..SH "QMemArray::operator const type * () const"Cast operator. Returns a pointer to the array..PPSee also data()..SH "bool QMemArray::operator!= ( const QMemArray<type> & a ) const"Returns TRUE if this array is different from \fIa\fR; otherwise returns FALSE..PPThe two arrays are compared bitwise..PPSee also operator==()..SH "QMemArray<type> & QMemArray::operator= ( const QMemArray<type> & a )"Assigns a shallow copy of \fIa\fR to this array and returns a reference to this array..PPEquivalent to assign( a )..SH "bool QMemArray::operator== ( const QMemArray<type> & a ) const"Returns TRUE if this array is equal to \fIa\fR; otherwise returns FALSE..PPThe two arrays are compared bitwise..PPSee also operator!=()..SH "type & QMemArray::operator[] ( int index ) const"Returns a reference to the element at position \fIindex\fR in the array..PPThis can be used to both read and set an element. Equivalent to at()..PPSee also at()..SH "void QMemArray::resetRawData ( const type * data, uint size )"Removes internal references to the raw data that was set using setRawData(). This means that QMemArray no longer has access to the \fIdata\fR, so you are free to manipulate \fIdata\fR as you wish. You can now use the QMemArray without affecting the original \fIdata\fR, for example by calling setRawData() with a pointer to some other data..PPThe arguments must be the \fIdata\fR and length, \fIsize\fR, that were passed to setRawData(). This is for consistency checking..PPSee also setRawData()..SH "bool QMemArray::resize ( uint size, Optimization optim )"Resizes (expands or shrinks) the array to \fIsize\fR elements. The array becomes a null array if \fIsize\fR == 0..PPReturns TRUE if successful, or FALSE if the memory cannot be allocated..PPNew elements are not initialized..PP\fIoptim\fR is either QGArray::MemOptim (the default) or QGArray::SpeedOptim. When optimizing for speed rather than memory consumption, the array uses a smart grow and shrink algorithm that might allocate more memory than is actually needed for \fIsize\fR elements. This speeds up subsequent resize operations, for example when appending many elements to an array, since the space has already been allocated..PPSee also size()..PPExample: fileiconview/qfileiconview.cpp..SH "bool QMemArray::resize ( uint size )"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPResizes (expands or shrinks) the array to \fIsize\fR elements. The array becomes a null array if \fIsize\fR == 0..PPReturns TRUE if successful, i.e. if the memory can be allocated; otherwise returns FALSE..PPNew elements are not initialized..PPSee also size()..SH "QMemArray<type> & QMemArray::setRawData ( const type * data, uint size )"Sets raw data and returns a reference to the array..PPDereferences the current array and sets the new array data to \fIdata\fR and the new array size to \fIsize\fR. Do not attempt to resize or re-assign the array data when raw data has been set. Call resetRawData(\fIdata\fR, \fIsize\fR) to reset the array..PPSetting raw data is useful because it sets QMemArray data without allocating memory or copying data..PPExample I (intended use):.PP.nf.br    static char bindata[] = { 231, 1, 44, ... };.br    QByteArray  a;.br    a.setRawData( bindata, sizeof(bindata) );   // a points to bindata.br    QDataStream s( a, IO_ReadOnly );            // open on a's data.br    s >> <something>;                           // read raw bindata.br    a.resetRawData( bindata, sizeof(bindata) ); // finished.br.fi.PPExample II (you don't want to do this):.PP.nf.br    static char bindata[] = { 231, 1, 44, ... };.br    QByteArray  a, b;.br    a.setRawData( bindata, sizeof(bindata) );   // a points to bindata.br    a.resize( 8 );                              // will crash.br    b = a;                                      // will crash.br    a[2] = 123;                                 // might crash.br    // forget to resetRawData: will crash.br.fi.PP\fBWarning:\fR If you do not call resetRawData(), QMemArray will attempt to deallocate or reallocate the raw data, which might not be too good. Be careful..PPSee also resetRawData()..SH "uint QMemArray::size () const"Returns the size of the array (maximum number of elements)..PPThe array is a null array if size() == 0..PPSee also isNull() and resize()..SH "void QMemArray::sort ()"Sorts the array elements in ascending order, using bitwise comparison (memcmp())..PPSee also bsearch()..SH "bool QMemArray::truncate ( uint pos )"Truncates the array at position \fIpos\fR..PPReturns TRUE if successful, i.e. if the memory can be allocated; otherwise returns FALSE..PPEquivalent to resize(\fIpos\fR)..PPSee also resize()..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< ( QDataStream & s, const QByteArray & a )"Writes byte array \fIa\fR to the stream \fIs\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators..SH "QDataStream & operator>> ( QDataStream & s, QByteArray & a )"Reads a byte array into \fIa\fR from the stream \fIs\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators..SH "Q_UINT16 qChecksum ( const char * data, uint len )"Returns the CRC-16 checksum of \fIlen\fR bytes starting at \fIdata\fR..PPThe checksum is independent of the byte order (endianness)..SH "SEE ALSO".BR http://doc.trolltech.com/qmemarray.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 (qmemarray.3qt) and the Qtversion (3.1.1).

⌨️ 快捷键说明

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