summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qarraydata.h
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-11-03 16:04:32 +0100
committerQt by Nokia <qt-info@nokia.com>2012-01-25 20:33:32 +0100
commitf218213a42f4d1b1bbf291ee27730f83cfeed6ad (patch)
treee8ccfdfcfa58e3460174b756b8da57c28fa07953 /src/corelib/tools/qarraydata.h
parentd8ff456b4d762d18d0e3a3b97bb897a826667d67 (diff)
Enable use of QArrayDataPointer as a return type
This is done through a (POD) wrapper around a raw QTypedArrayData pointer. The wrapper forces conscious decisions on the use of that pointer, while implying it is internal API. The pointed-to header is assumed to referenced, as if already owned by the receiving QArrayDataPointer. This wrapper is placed in the generic qarraydata.h header as its definition doesn't depend on QArrayDataPointer by itself. Change-Id: I9b2b6bb7dd9ab073dc7d882ccf999b32d793ed3f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qarraydata.h')
-rw-r--r--src/corelib/tools/qarraydata.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index c022d9f302..5ed8d4ba95 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -177,6 +177,13 @@ struct QStaticArrayData
T data[N];
};
+// Support for returning QArrayDataPointer<T> from functions
+template <class T>
+struct QArrayDataPointerRef
+{
+ QTypedArrayData<T> *ptr;
+};
+
#define Q_STATIC_ARRAY_DATA_HEADER_INITIALIZER(type, size) { \
Q_REFCOUNT_INITIALIZE_STATIC, size, 0, 0, \
(sizeof(QArrayData) + (Q_ALIGNOF(type) - 1)) \