summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/text/qstring.cpp2
-rw-r--r--src/corelib/tools/qarraydata.h43
-rw-r--r--src/corelib/tools/qarraydatapointer.h19
-rw-r--r--src/corelib/tools/qlist.qdoc5
4 files changed, 18 insertions, 51 deletions
diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp
index af3be9ab9f..985c00ae6b 100644
--- a/src/corelib/text/qstring.cpp
+++ b/src/corelib/text/qstring.cpp
@@ -8619,7 +8619,7 @@ bool QString::isRightToLeft() const
*/
QString QString::fromRawData(const QChar *unicode, int size)
{
- return QString(Data::fromRawData(const_cast<char16_t *>(reinterpret_cast<const char16_t *>(unicode)), size));
+ return QString(DataPointer::fromRawData(const_cast<char16_t *>(reinterpret_cast<const char16_t *>(unicode)), size));
}
/*!
diff --git a/src/corelib/tools/qarraydata.h b/src/corelib/tools/qarraydata.h
index d0a285a0e9..c921e4eaa5 100644
--- a/src/corelib/tools/qarraydata.h
+++ b/src/corelib/tools/qarraydata.h
@@ -165,23 +165,6 @@ struct Q_CORE_EXPORT QArrayData
Q_DECLARE_OPERATORS_FOR_FLAGS(QArrayData::ArrayOptions)
-template <class T, size_t N>
-struct QStaticArrayData
-{
- // static arrays are of type RawDataType
- QArrayData header;
- T data[N];
-};
-
-// Support for returning QArrayDataPointer<T> from functions
-template <class T>
-struct QArrayDataPointerRef
-{
- QTypedArrayData<T> *ptr;
- T *data;
- uint size;
-};
-
template <class T>
struct QTypedArrayData
: QArrayData
@@ -218,34 +201,8 @@ struct QTypedArrayData
static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData));
QArrayData::deallocate(data, sizeof(T), alignof(AlignmentDummy));
}
-
- static QArrayDataPointerRef<T> fromRawData(const T *data, size_t n)
- {
- static_assert(sizeof(QTypedArrayData) == sizeof(QArrayData));
- QArrayDataPointerRef<T> result = {
- nullptr, const_cast<T *>(data), uint(n)
- };
- return result;
- }
};
-////////////////////////////////////////////////////////////////////////////////
-// Q_ARRAY_LITERAL
-
-// The idea here is to place a (read-only) copy of header and array data in an
-// mmappable portion of the executable (typically, .rodata section). This is
-// accomplished by hiding a static const instance of QStaticArrayData, which is
-// POD.
-
-// Hide array inside a lambda
-#define Q_ARRAY_LITERAL(Type, ...) \
- ([]() -> QArrayDataPointerRef<Type> { \
- static Type const data[] = { __VA_ARGS__ }; \
- enum { Size = sizeof(data) / sizeof(data[0]) }; \
- return { nullptr, const_cast<Type *>(data), Size }; \
- }())
- /**/
-
namespace QtPrivate {
struct Q_CORE_EXPORT QContainerImplHelper
{
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index a8b472c9bf..8e30373211 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -81,9 +81,10 @@ public:
Q_CHECK_PTR(d);
}
- QArrayDataPointer(QArrayDataPointerRef<T> dd) noexcept
- : d(dd.ptr), ptr(dd.data), size(dd.size)
+ static QArrayDataPointer fromRawData(const T *rawData, size_t length)
{
+ Q_ASSERT(rawData || !length);
+ return { nullptr, const_cast<T *>(rawData), length };
}
QArrayDataPointer &operator=(const QArrayDataPointer &other) noexcept
@@ -235,6 +236,20 @@ inline void qSwap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) noexcept
p1.swap(p2);
}
+////////////////////////////////////////////////////////////////////////////////
+// Q_ARRAY_LITERAL
+
+// The idea here is to place a (read-only) copy of header and array data in an
+// mmappable portion of the executable (typically, .rodata section).
+
+// Hide array inside a lambda
+#define Q_ARRAY_LITERAL(Type, ...) \
+ ([]() -> QArrayDataPointer<Type> { \
+ static Type const data[] = { __VA_ARGS__ }; \
+ return QArrayDataPointer<Type>::fromRawData(const_cast<Type *>(data), std::size(data)); \
+ }())
+/**/
+
QT_END_NAMESPACE
#endif // include guard
diff --git a/src/corelib/tools/qlist.qdoc b/src/corelib/tools/qlist.qdoc
index 1a94bf4315..550663ed0e 100644
--- a/src/corelib/tools/qlist.qdoc
+++ b/src/corelib/tools/qlist.qdoc
@@ -267,11 +267,6 @@
The value type of \c InputIterator must be convertible to \c T.
*/
-/*!
- \fn template <typename T> QList<T>::QList(QArrayDataPointerRef<T> ref)
- \internal
-*/
-
/*! \fn template <typename T> QList<T>::~QList()
Destroys the list.