summaryrefslogtreecommitdiff
path: root/qmake/include/qgarray.h
Side-by-side diff
Diffstat (limited to 'qmake/include/qgarray.h') (more/less context) (show whitespace changes)
-rw-r--r--qmake/include/qgarray.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/qmake/include/qgarray.h b/qmake/include/qgarray.h
index 12edea6..40720a6 100644
--- a/qmake/include/qgarray.h
+++ b/qmake/include/qgarray.h
@@ -28,69 +28,78 @@
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef QGARRAY_H
#define QGARRAY_H
#ifndef QT_H
#include "qshared.h"
#endif // QT_H
class Q_EXPORT QGArray // generic array
{
friend class QBuffer;
public:
//### DO NOT USE THIS. IT IS PUBLIC BUT DO NOT USE IT IN NEW CODE.
struct array_data : public QShared { // shared array
- array_data() { data=0; len=0; }
+ array_data():data(0),len(0)
+#ifdef QT_QGARRAY_SPEED_OPTIM
+ ,maxl(0)
+#endif
+ {}
char *data; // actual array data
uint len;
+#ifdef QT_QGARRAY_SPEED_OPTIM
+ uint maxl;
+#endif
};
QGArray();
+ enum Optimization { MemOptim, SpeedOptim };
protected:
QGArray( int, int ); // dummy; does not alloc
QGArray( int size ); // allocate 'size' bytes
QGArray( const QGArray &a ); // shallow copy
virtual ~QGArray();
QGArray &operator=( const QGArray &a ) { return assign( a ); }
virtual void detach() { duplicate(*this); }
// ### Qt 4.0: maybe provide two versions of data(), at(), etc.
char *data() const { return shd->data; }
uint nrefs() const { return shd->count; }
uint size() const { return shd->len; }
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 { return shd; }
void setSharedBlock( array_data *p ) { shd=(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;