summaryrefslogtreecommitdiff
path: root/qmake/include/qgarray.h
Side-by-side diff
Diffstat (limited to 'qmake/include/qgarray.h') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/include/qgarray.h13
1 files changed, 11 insertions, 2 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
@@ -46,17 +46,25 @@
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();
@@ -67,12 +75,13 @@ protected:
// ### 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 );
@@ -85,13 +94,13 @@ protected:
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 );