Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/3rdparty/masm/stubs/wtf/Vector.h |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /**************************************************************************** | - | ||||||
2 | ** | - | ||||||
3 | ** Copyright (C) 2016 The Qt Company Ltd. | - | ||||||
4 | ** Contact: https://www.qt.io/licensing/ | - | ||||||
5 | ** | - | ||||||
6 | ** This file is part of the QtQml module of the Qt Toolkit. | - | ||||||
7 | ** | - | ||||||
8 | ** $QT_BEGIN_LICENSE:LGPL$ | - | ||||||
9 | ** Commercial License Usage | - | ||||||
10 | ** Licensees holding valid commercial Qt licenses may use this file in | - | ||||||
11 | ** accordance with the commercial license agreement provided with the | - | ||||||
12 | ** Software or, alternatively, in accordance with the terms contained in | - | ||||||
13 | ** a written agreement between you and The Qt Company. For licensing terms | - | ||||||
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - | ||||||
15 | ** information use the contact form at https://www.qt.io/contact-us. | - | ||||||
16 | ** | - | ||||||
17 | ** GNU Lesser General Public License Usage | - | ||||||
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - | ||||||
19 | ** General Public License version 3 as published by the Free Software | - | ||||||
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - | ||||||
21 | ** packaging of this file. Please review the following information to | - | ||||||
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - | ||||||
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - | ||||||
24 | ** | - | ||||||
25 | ** GNU General Public License Usage | - | ||||||
26 | ** Alternatively, this file may be used under the terms of the GNU | - | ||||||
27 | ** General Public License version 2.0 or (at your option) the GNU General | - | ||||||
28 | ** Public license version 3 or any later version approved by the KDE Free | - | ||||||
29 | ** Qt Foundation. The licenses are as published by the Free Software | - | ||||||
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - | ||||||
31 | ** included in the packaging of this file. Please review the following | - | ||||||
32 | ** information to ensure the GNU General Public License requirements will | - | ||||||
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - | ||||||
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - | ||||||
35 | ** | - | ||||||
36 | ** $QT_END_LICENSE$ | - | ||||||
37 | ** | - | ||||||
38 | ****************************************************************************/ | - | ||||||
39 | #ifndef VECTOR_H | - | ||||||
40 | #define VECTOR_H | - | ||||||
41 | - | |||||||
42 | #include <vector> | - | ||||||
43 | #include <wtf/Assertions.h> | - | ||||||
44 | #include <wtf/NotFound.h> | - | ||||||
45 | #include <qalgorithms.h> | - | ||||||
46 | - | |||||||
47 | enum WTF_UnusedOverflowMode { | - | ||||||
48 | UnsafeVectorOverflow | - | ||||||
49 | }; | - | ||||||
50 | - | |||||||
51 | namespace WTF { | - | ||||||
52 | - | |||||||
53 | template <typename T, int capacity = 1, int overflowMode = UnsafeVectorOverflow> | - | ||||||
54 | class Vector : public std::vector<T> { | - | ||||||
55 | public: | - | ||||||
56 | Vector() {} | - | ||||||
57 | Vector(int initialSize) : std::vector<T>(initialSize) {} executed 1163958 times by 153 tests: end of block Executed by:
| 1163958 | ||||||
58 | - | |||||||
59 | inline void append(const T& value) | - | ||||||
60 | { this->push_back(value); } executed 7517512 times by 153 tests: end of block Executed by:
| 7517512 | ||||||
61 | - | |||||||
62 | template <typename OtherType> | - | ||||||
63 | inline void append(const OtherType& other) | - | ||||||
64 | { this->push_back(T(other)); } executed 4705914 times by 153 tests: end of block Executed by:
| 4705914 | ||||||
65 | - | |||||||
66 | inline void append(const Vector<T>& vector) | - | ||||||
67 | { | - | ||||||
68 | this->insert(this->end(), vector.begin(), vector.end()); | - | ||||||
69 | } never executed: end of block | 0 | ||||||
70 | - | |||||||
71 | inline void append(const T* ptr, size_t count) | - | ||||||
72 | { | - | ||||||
73 | for (size_t i = 0; i < count; ++i)
| 0 | ||||||
74 | this->push_back(T(ptr[i])); never executed: this->push_back(T(ptr[i])); | 0 | ||||||
75 | } never executed: end of block | 0 | ||||||
76 | - | |||||||
77 | inline void append(typename std::vector<T>::const_iterator it, size_t count) | - | ||||||
78 | { | - | ||||||
79 | for (size_t i = 0; i < count; ++i, ++it)
| 1590429-2382701 | ||||||
80 | this->push_back(*it); executed 1590523 times by 9 tests: this->push_back(*it); Executed by:
| 1590523 | ||||||
81 | } executed 2382716 times by 9 tests: end of block Executed by:
| 2382716 | ||||||
82 | - | |||||||
83 | using std::vector<T>::insert; | - | ||||||
84 | - | |||||||
85 | inline void reserveInitialCapacity(size_t size) { this->reserve(size); } executed 469 times by 2 tests: end of block Executed by:
| 469 | ||||||
86 | - | |||||||
87 | inline void insert(size_t position, T value) | - | ||||||
88 | { this->insert(this->begin() + position, value); } executed 5514 times by 3 tests: end of block Executed by:
| 5514 | ||||||
89 | - | |||||||
90 | inline void grow(size_t size) | - | ||||||
91 | { this->resize(size); } executed 1089576 times by 65 tests: end of block Executed by:
| 1089576 | ||||||
92 | - | |||||||
93 | inline void shrink(size_t size) | - | ||||||
94 | { this->erase(this->begin() + size, this->end()); } executed 2141 times by 1 test: end of block Executed by:
| 2141 | ||||||
95 | - | |||||||
96 | inline void shrinkToFit() | - | ||||||
97 | { this->shrink(this->size()); } executed 622 times by 1 test: end of block Executed by:
| 622 | ||||||
98 | - | |||||||
99 | inline void remove(size_t position) | - | ||||||
100 | { this->erase(this->begin() + position); } executed 684 times by 1 test: end of block Executed by:
| 684 | ||||||
101 | - | |||||||
102 | inline bool isEmpty() const { return this->empty(); } executed 2300965 times by 153 tests: return this->empty(); Executed by:
| 2300965 | ||||||
103 | - | |||||||
104 | inline T &last() { return *(this->begin() + this->size() - 1); } executed 3360452 times by 153 tests: return *(this->begin() + this->size() - 1); Executed by:
| 3360452 | ||||||
105 | }; | - | ||||||
106 | - | |||||||
107 | template <typename T, int capacity> | - | ||||||
108 | void deleteAllValues(const Vector<T, capacity> &vector) | - | ||||||
109 | { | - | ||||||
110 | qDeleteAll(vector); | - | ||||||
111 | } never executed: end of block | 0 | ||||||
112 | - | |||||||
113 | } | - | ||||||
114 | - | |||||||
115 | using WTF::Vector; | - | ||||||
116 | using WTF::deleteAllValues; | - | ||||||
117 | - | |||||||
118 | #endif // VECTOR_H | - | ||||||
Source code | Switch to Preprocessed file |