summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qarraydata/simplevector.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qarraydata/simplevector.h')
-rw-r--r--tests/auto/corelib/tools/qarraydata/simplevector.h47
1 files changed, 9 insertions, 38 deletions
diff --git a/tests/auto/corelib/tools/qarraydata/simplevector.h b/tests/auto/corelib/tools/qarraydata/simplevector.h
index 1fc5e9b8e1..b92cd4a887 100644
--- a/tests/auto/corelib/tools/qarraydata/simplevector.h
+++ b/tests/auto/corelib/tools/qarraydata/simplevector.h
@@ -1,30 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2020 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the test suite of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:GPL-EXCEPT$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2020 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QARRAY_TEST_SIMPLE_VECTOR_H
@@ -32,6 +7,7 @@
#include <QtCore/qarraydata.h>
#include <QtCore/qarraydatapointer.h>
+#include <QtCore/qvarlengtharray.h>
#include <algorithm>
@@ -52,7 +28,7 @@ public:
}
explicit SimpleVector(size_t n, bool capacityReserved = false)
- : d(Data::allocate(n))
+ : d(n)
{
if (n)
d->appendInitialize(n);
@@ -61,7 +37,7 @@ public:
}
SimpleVector(size_t n, const T &t, bool capacityReserved = false)
- : d(Data::allocate(n))
+ : d(n)
{
if (n)
d->copyAppend(n, t);
@@ -70,7 +46,7 @@ public:
}
SimpleVector(const T *begin, const T *end, bool capacityReserved = false)
- : d(Data::allocate(end - begin))
+ : d(end - begin)
{
if (end - begin)
d->copyAppend(begin, end);
@@ -83,11 +59,6 @@ public:
{
}
- explicit SimpleVector(QPair<Data*, T*> ptr, size_t len = 0)
- : d(ptr, len)
- {
- }
-
SimpleVector(const QArrayDataPointer<T> &other)
: d(other)
{
@@ -159,7 +130,7 @@ public:
}
}
- SimpleVector detached(Data::allocate(qMax(n, size())));
+ SimpleVector detached(DataPointer(qMax(n, size())));
if (size()) {
detached.d->copyAppend(constBegin(), constEnd());
detached.d->setFlag(QArrayData::CapacityReserved);
@@ -173,7 +144,7 @@ public:
return;
if (d->needsDetach() || newSize > capacity()) {
- SimpleVector detached(Data::allocate(d->detachCapacity(newSize)));
+ SimpleVector detached(DataPointer(d->detachCapacity(newSize)));
if (newSize) {
if (newSize < size()) {
const T *const begin = constBegin();
@@ -247,7 +218,7 @@ public:
const T *const end = begin + d->size;
if (d->needsDetach()) {
- SimpleVector detached(Data::allocate(d->detachCapacity(size() - (last - first))));
+ SimpleVector detached(DataPointer(d->detachCapacity(size() - (last - first))));
if (first != begin)
detached.d->copyAppend(begin, first);
detached.d->copyAppend(last, end);