Eneboo - Documentación para desarrolladores
|
The QGArray class is an internal class for implementing the QMemArray class. Más...
#include <qgarray.h>
Clases | |
struct | array_data |
Tipos públicos | |
enum | Optimization { MemOptim, SpeedOptim, MemOptim, SpeedOptim } |
enum | Optimization { MemOptim, SpeedOptim, MemOptim, SpeedOptim } |
Métodos públicos | |
QGArray () | |
QGArray () | |
Métodos protegidos | |
QGArray (int, int) | |
QGArray (int size) | |
QGArray (const QGArray &a) | |
virtual | ~QGArray () |
QGArray & | operator= (const QGArray &a) |
virtual void | detach () |
char * | data () const |
uint | nrefs () const |
uint | size () const |
bool | isEqual (const QGArray &a) const |
bool | resize (uint newsize, Optimization optim) |
bool | resize (uint newsize) |
bool | fill (const char *d, int len, uint sz) |
QGArray & | assign (const QGArray &a) |
QGArray & | assign (const char *d, uint len) |
QGArray & | duplicate (const QGArray &a) |
QGArray & | duplicate (const char *d, uint len) |
void | store (const char *d, uint len) |
array_data * | sharedBlock () const |
void | setSharedBlock (array_data *p) |
QGArray & | setRawData (const char *d, uint len) |
void | resetRawData (const char *d, uint len) |
int | find (const char *d, uint index, uint sz) const |
int | contains (const char *d, uint sz) const |
void | sort (uint sz) |
int | bsearch (const char *d, uint sz) const |
char * | at (uint index) const |
bool | setExpand (uint index, const char *d, uint sz) |
virtual array_data * | newData () |
virtual void | deleteData (array_data *p) |
QGArray (int, int) | |
QGArray (int size) | |
QGArray (const QGArray &a) | |
virtual | ~QGArray () |
QGArray & | operator= (const QGArray &a) |
virtual void | detach () |
char * | data () const |
uint | nrefs () const |
uint | size () const |
bool | isEqual (const QGArray &a) const |
bool | resize (uint newsize, Optimization optim) |
bool | resize (uint newsize) |
bool | fill (const char *d, int len, uint sz) |
QGArray & | assign (const QGArray &a) |
QGArray & | assign (const char *d, uint len) |
QGArray & | duplicate (const QGArray &a) |
QGArray & | duplicate (const char *d, uint len) |
void | store (const char *d, uint len) |
array_data * | sharedBlock () const |
void | setSharedBlock (array_data *p) |
QGArray & | setRawData (const char *d, uint len) |
void | resetRawData (const char *d, uint len) |
int | find (const char *d, uint index, uint sz) const |
int | contains (const char *d, uint sz) const |
void | sort (uint sz) |
int | bsearch (const char *d, uint sz) const |
char * | at (uint index) const |
bool | setExpand (uint index, const char *d, uint sz) |
virtual array_data * | newData () |
virtual void | deleteData (array_data *p) |
Amigas | |
class | QBuffer |
QGArray::QGArray | ( | ) |
Constructs a null array.
Dummy constructor; does not allocate any data.
This constructor does not initialize any array data so subclasses must do it. The intention is to make the code more efficient.
QGArray::QGArray | ( | int | size | ) | [protected] |
Constructs an array with room for size bytes.
QGArray::QGArray | ( | const QGArray & | a | ) | [protected] |
Constructs a shallow copy of a.
QGArray::~QGArray | ( | ) | [protected, virtual] |
Dereferences the array data and deletes it if this was the last reference.
QGArray::QGArray | ( | ) |
QGArray::QGArray | ( | int | size | ) | [protected] |
QGArray::QGArray | ( | const QGArray & | a | ) | [protected] |
virtual QGArray::~QGArray | ( | ) | [protected, virtual] |
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Shallow copy. Dereference the current array and references the data contained in a instead. Returns a reference to this array.
Shallow copy. Dereference the current array and references the array data d, which contains len bytes. Returns a reference to this array.
Do not delete d later, because QGArray takes care of that.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
char * QGArray::at | ( | uint | index | ) | const [inline, protected] |
Returns a pointer to the byte at offset index in the array.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
char* QGArray::at | ( | uint | index | ) | const [protected] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
Binary search; assumes that d is a sorted array of size sz.
Returns the number of occurrences of d in the array, where sz is the size of the d element.
This function only compares whole cells, not bytes.
char * QGArray::data | ( | ) | const [inline, protected] |
Returns a pointer to the actual array data.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
char* QGArray::data | ( | ) | const [inline, protected] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
virtual void QGArray::deleteData | ( | array_data * | p | ) | [protected, virtual] |
void QGArray::deleteData | ( | array_data * | p | ) | [protected, virtual] |
Deletes the shared array block p.
void QGArray::detach | ( | ) | [inline, protected, virtual] |
Detaches this array from shared array data.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
virtual void QGArray::detach | ( | ) | [inline, protected, virtual] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Deep copy. Dereferences the current array and obtains a copy of len characters from array data d instead. Returns a reference to this array.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
Deep copy. Dereference the current array and obtains a copy of the data contained in a instead. Returns a reference to this array.
Fills the array with the repeated occurrences of d, which is sz bytes long. If len is specified as different from -1, then the array will be resized to len*sz before it is filled.
Returns TRUE if successful, or FALSE if the memory cannot be allocated (only when len != -1).
Finds the first occurrence of d in the array from position index, where sz is the size of the d element.
Note that index is given in units of sz, not bytes.
This function only compares whole cells, not bytes.
Returns TRUE if this array is equal to a, otherwise FALSE. The comparison is bitwise, of course.
virtual array_data* QGArray::newData | ( | ) | [protected, virtual] |
QGArray::array_data * QGArray::newData | ( | ) | [protected, virtual] |
Returns a new shared array block.
uint QGArray::nrefs | ( | ) | const [inline, protected] |
Returns the reference count.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
uint QGArray::nrefs | ( | ) | const [inline, protected] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
Assigns a shallow copy of a to this array and returns a reference to this array. Equivalent to assign().
void QGArray::resetRawData | ( | const char * | d, |
uint | len | ||
) | [protected] |
Resets raw data.
The arguments must be the data, d, and length len, that were passed to setRawData(). This is for consistency checking.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
void QGArray::resetRawData | ( | const char * | d, |
uint | len | ||
) | [protected] |
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
bool QGArray::resize | ( | uint | newsize, |
Optimization | optim | ||
) | [protected] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
bool QGArray::resize | ( | uint | newsize, |
Optimization | optim | ||
) | [protected] |
Resizes the array to newsize bytes. optim is either MemOptim
(the default) or SpeedOptim
.
Note: SpeedOptim
is only available if Qt is built in a particular configuration. By default, SpeedOptim
is not available for general use.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
Expand the array if necessary, and copies (the first part of) its contents from the index * sz bytes at d.
Returns TRUE if the operation succeeds, FALSE if it runs out of memory.
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
Sets raw data and returns a reference to the array.
Dereferences the current array and sets the new array data to d and the new array size to len. Do not attempt to resize or re-assign the array data when raw data has been set. Call resetRawData(d,len) to reset the array.
Setting raw data is useful because it sets QMemArray data without allocating memory or copying data.
Example of intended use:
static uchar bindata[] = { 231, 1, 44, ... }; QByteArray a; a.setRawData( bindata, sizeof(bindata) ); // a points to bindata QDataStream s( a, IO_ReadOnly ); // open on a's data s >> <something>; // read raw bindata s.close(); a.resetRawData( bindata, sizeof(bindata) ); // finished
Example of misuse (do not do this):
static uchar bindata[] = { 231, 1, 44, ... }; QByteArray a, b; a.setRawData( bindata, sizeof(bindata) ); // a points to bindata a.resize( 8 ); // will crash b = a; // will crash a[2] = 123; // might crash // forget to resetRawData - will crash
Reimplementado en QMemArray< char >, QMemArray< char >, QMemArray< bool > y QMemArray< bool >.
void QGArray::setSharedBlock | ( | array_data * | p | ) | [inline, protected] |
Sets the shared array block to p.
Do not use this function. Using it is begging for trouble. We dare not remove it, for fear of breaking code, but we strongly discourage new use of it.
void QGArray::setSharedBlock | ( | array_data * | p | ) | [inline, protected] |
array_data* QGArray::sharedBlock | ( | ) | const [inline, protected] |
array_data * QGArray::sharedBlock | ( | ) | const [inline, protected] |
Returns a pointer to the shared array block.
Do not use this function. Using it is begging for trouble. We dare not remove it, for fear of breaking code, but we strongly discourage new use of it.
uint QGArray::size | ( | ) | const [inline, protected] |
Returns the size of the array, in bytes.
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
uint QGArray::size | ( | ) | const [inline, protected] |
Reimplementado en QMemArray< type >, QMemArray< type >, QMemArray< GDHandle >, QMemArray< GDHandle >, QMemArray< QRgb >, QMemArray< QRgb >, QMemArray< QTextStringChar >, QMemArray< QTextStringChar >, QMemArray< int >, QMemArray< int >, QMemArray< Range >, QMemArray< Range >, QMemArray< const char * >, QMemArray< const char * >, QMemArray< ulong >, QMemArray< ulong >, QMemArray< ushort >, QMemArray< ushort >, QMemArray< unsigned char >, QMemArray< unsigned char >, QMemArray< AnchorAlternation >, QMemArray< AnchorAlternation >, QMemArray< QLayoutStruct >, QMemArray< QLayoutStruct >, QMemArray< char >, QMemArray< char >, QMemArray< bool >, QMemArray< bool >, QMemArray< QCOORD >, QMemArray< QCOORD >, QMemArray< Atom >, QMemArray< Atom >, QMemArray< QRect >, QMemArray< QRect >, QMemArray< QPoint > y QMemArray< QPoint >.
void QGArray::sort | ( | uint | sz | ) | [protected] |
Sorts the first sz items of the array.
void QGArray::sort | ( | uint | sz | ) | [protected] |
void QGArray::store | ( | const char * | d, |
uint | len | ||
) | [protected] |
Resizes this array to len bytes and copies the len bytes at address d into it.
void QGArray::store | ( | const char * | d, |
uint | len | ||
) | [protected] |
QBuffer [friend] |