qhash.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qhash.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2016 Intel Corporation.-
5** Copyright (C) 2012 Giuseppe D'Angelo <dangelog@gmail.com>.-
6** Contact: https://www.qt.io/licensing/-
7**-
8** This file is part of the QtCore module of the Qt Toolkit.-
9**-
10** $QT_BEGIN_LICENSE:LGPL$-
11** Commercial License Usage-
12** Licensees holding valid commercial Qt licenses may use this file in-
13** accordance with the commercial license agreement provided with the-
14** Software or, alternatively, in accordance with the terms contained in-
15** a written agreement between you and The Qt Company. For licensing terms-
16** and conditions see https://www.qt.io/terms-conditions. For further-
17** information use the contact form at https://www.qt.io/contact-us.-
18**-
19** GNU Lesser General Public License Usage-
20** Alternatively, this file may be used under the terms of the GNU Lesser-
21** General Public License version 3 as published by the Free Software-
22** Foundation and appearing in the file LICENSE.LGPL3 included in the-
23** packaging of this file. Please review the following information to-
24** ensure the GNU Lesser General Public License version 3 requirements-
25** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
26**-
27** GNU General Public License Usage-
28** Alternatively, this file may be used under the terms of the GNU-
29** General Public License version 2.0 or (at your option) the GNU General-
30** Public license version 3 or any later version approved by the KDE Free-
31** Qt Foundation. The licenses are as published by the Free Software-
32** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
33** included in the packaging of this file. Please review the following-
34** information to ensure the GNU General Public License requirements will-
35** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
36** https://www.gnu.org/licenses/gpl-3.0.html.-
37**-
38** $QT_END_LICENSE$-
39**-
40****************************************************************************/-
41-
42// for rand_s, _CRT_RAND_S must be #defined before #including stdlib.h.-
43// put it at the beginning so some indirect inclusion doesn't break it-
44#ifndef _CRT_RAND_S-
45#define _CRT_RAND_S-
46#endif-
47#include <stdlib.h>-
48-
49#include "qhash.h"-
50-
51#ifdef truncate-
52#undef truncate-
53#endif-
54-
55#include <qbitarray.h>-
56#include <qstring.h>-
57#include <qglobal.h>-
58#include <qbytearray.h>-
59#include <qdatetime.h>-
60#include <qbasicatomic.h>-
61#include <qendian.h>-
62#include <private/qsimd_p.h>-
63-
64#ifndef QT_BOOTSTRAPPED-
65#include <qcoreapplication.h>-
66#endif // QT_BOOTSTRAPPED-
67-
68#ifdef Q_OS_UNIX-
69#include <stdio.h>-
70#include "private/qcore_unix_p.h"-
71#endif // Q_OS_UNIX-
72-
73#include <limits.h>-
74-
75QT_BEGIN_NAMESPACE-
76-
77/*-
78 The Java's hashing algorithm for strings is a variation of D. J. Bernstein-
79 hashing algorithm appeared here http://cr.yp.to/cdb/cdb.txt-
80 and informally known as DJB33XX - DJB's 33 Times Xor.-
81 Java uses DJB31XA, that is, 31 Times Add.-
82-
83 The original algorithm was a loop around-
84 (h << 5) + h ^ c-
85 (which is indeed h*33 ^ c); it was then changed to-
86 (h << 5) - h ^ c-
87 (so h*31^c: DJB31XX), and the XOR changed to a sum:-
88 (h << 5) - h + c-
89 (DJB31XA), which can save some assembly instructions.-
90-
91 Still, we can avoid writing the multiplication as "(h << 5) - h"-
92 -- the compiler will turn it into a shift and an addition anyway-
93 (for instance, gcc 4.4 does that even at -O0).-
94*/-
95-
96#if QT_COMPILER_SUPPORTS_HERE(SSE4_2)-
97static inline bool hasFastCrc32()-
98{-
99 return qCpuHasFeature(SSE4_2);
executed 2537828 times by 478 tests: return ((qCompilerCpuFeatures & (static_cast<unsigned long long>(1ULL) << CpuFeatureSSE4_2)) || (qCpuFeatures() & (static_cast<unsigned long long>(1ULL) << CpuFeatureSSE4_2)));
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • ...
2537828
100}-
101-
102template <typename Char>-
103QT_FUNCTION_TARGET(SSE4_2)-
104static uint crc32(const Char *ptr, size_t len, uint h)-
105{-
106 // The CRC32 instructions from Nehalem calculate a 32-bit CRC32 checksum-
107 const uchar *p = reinterpret_cast<const uchar *>(ptr);-
108 const uchar *const e = p + (len * sizeof(Char));-
109# ifdef Q_PROCESSOR_X86_64-
110 // The 64-bit instruction still calculates only 32-bit, but without this-
111 // variable GCC 4.9 still tries to clear the high bits on every loop-
112 qulonglong h2 = h;-
113-
114 p += 8;-
115 for ( ; p <= e; p += 8)
p <= eDescription
TRUEevaluated 3283570 times by 459 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • ...
FALSEevaluated 2537828 times by 478 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • ...
2537828-3283570
116 h2 = _mm_crc32_u64(h2, qFromUnaligned<qlonglong>(p - 8));
executed 3283570 times by 459 tests: h2 = _mm_crc32_u64(h2, qFromUnaligned<qlonglong>(p - 8));
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • ...
3283570
117 h = h2;-
118 p -= 8;-
119-
120 len = e - p;-
121 if (len & 4) {
len & 4Description
TRUEevaluated 978985 times by 428 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCache
  • tst_QCalendarWidget
  • ...
FALSEevaluated 1558843 times by 465 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QByteArray
  • ...
978985-1558843
122 h = _mm_crc32_u32(h, qFromUnaligned<uint>(p));-
123 p += 4;-
124 }
executed 978985 times by 428 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCache
  • tst_QCalendarWidget
  • ...
978985
125# else-
126 p += 4;-
127 for ( ; p <= e; p += 4)-
128 h = _mm_crc32_u32(h, qFromUnaligned<uint>(p - 4));-
129 p -= 4;-
130 len = e - p;-
131# endif-
132 if (len & 2) {
len & 2Description
TRUEevaluated 1536703 times by 458 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
FALSEevaluated 1001125 times by 460 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCache
  • tst_QCalendarWidget
  • ...
1001125-1536703
133 h = _mm_crc32_u16(h, qFromUnaligned<ushort>(p));-
134 p += 2;-
135 }
executed 1536703 times by 458 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
1536703
136 if (sizeof(Char) == 1 && len & 1)
sizeof(Char) == 1Description
TRUEevaluated 145634 times by 401 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • ...
FALSEevaluated 2392194 times by 441 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
len & 1Description
TRUEevaluated 43328 times by 330 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • ...
FALSEevaluated 102306 times by 390 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • ...
43328-2392194
137 h = _mm_crc32_u8(h, *p);
executed 43328 times by 330 tests: h = _mm_crc32_u8(h, *p);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • ...
43328
138 return h;
executed 2537828 times by 478 tests: return h;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • ...
2537828
139}-
140#elif defined(__ARM_FEATURE_CRC32)-
141static inline bool hasFastCrc32()-
142{-
143 return qCpuHasFeature(CRC32);-
144}-
145-
146template <typename Char>-
147QT_FUNCTION_TARGET(CRC32)-
148static uint crc32(const Char *ptr, size_t len, uint h)-
149{-
150 // The crc32[whbd] instructions on Aarch64/Aarch32 calculate a 32-bit CRC32 checksum-
151 const uchar *p = reinterpret_cast<const uchar *>(ptr);-
152 const uchar *const e = p + (len * sizeof(Char));-
153-
154#ifndef __ARM_FEATURE_UNALIGNED-
155 if (Q_UNLIKELY(reinterpret_cast<quintptr>(p) & 7)) {-
156 if ((sizeof(Char) == 1) && (reinterpret_cast<quintptr>(p) & 1) && (e - p > 0)) {-
157 h = __crc32b(h, *p);-
158 ++p;-
159 }-
160 if ((reinterpret_cast<quintptr>(p) & 2) && (e >= p + 2)) {-
161 h = __crc32h(h, *reinterpret_cast<const uint16_t *>(p));-
162 p += 2;-
163 }-
164 if ((reinterpret_cast<quintptr>(p) & 4) && (e >= p + 4)) {-
165 h = __crc32w(h, *reinterpret_cast<const uint32_t *>(p));-
166 p += 4;-
167 }-
168 }-
169#endif-
170-
171 for ( ; p + 8 <= e; p += 8)-
172 h = __crc32d(h, *reinterpret_cast<const uint64_t *>(p));-
173-
174 len = e - p;-
175 if (len == 0)-
176 return h;-
177 if (len & 4) {-
178 h = __crc32w(h, *reinterpret_cast<const uint32_t *>(p));-
179 p += 4;-
180 }-
181 if (len & 2) {-
182 h = __crc32h(h, *reinterpret_cast<const uint16_t *>(p));-
183 p += 2;-
184 }-
185 if (sizeof(Char) == 1 && len & 1)-
186 h = __crc32b(h, *p);-
187 return h;-
188}-
189#else-
190static inline bool hasFastCrc32()-
191{-
192 return false;-
193}-
194-
195static uint crc32(...)-
196{-
197 Q_UNREACHABLE();-
198 return 0;-
199}-
200#endif-
201-
202static inline uint hash(const uchar *p, int len, uint seed) Q_DECL_NOTHROW-
203{-
204 uint h = seed;-
205-
206 if (hasFastCrc32())
hasFastCrc32()Description
TRUEevaluated 145634 times by 401 tests
Evaluated by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • ...
FALSEnever evaluated
0-145634
207 return crc32(p, size_t(len), h);
executed 145634 times by 401 tests: return crc32(p, size_t(len), h);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • ...
145634
208-
209 for (int i = 0; i < len; ++i)
i < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
210 h = 31 * h + p[i];
never executed: h = 31 * h + p[i];
0
211-
212 return h;
never executed: return h;
0
213}-
214-
215uint qHashBits(const void *p, size_t len, uint seed) Q_DECL_NOTHROW-
216{-
217 return hash(static_cast<const uchar*>(p), int(len), seed);
executed 10 times by 1 test: return hash(static_cast<const uchar*>(p), int(len), seed);
Executed by:
  • tst_QHostAddress
10
218}-
219-
220static inline uint hash(const QChar *p, int len, uint seed) Q_DECL_NOTHROW-
221{-
222 uint h = seed;-
223-
224 if (hasFastCrc32())
hasFastCrc32()Description
TRUEevaluated 2392194 times by 441 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
FALSEnever evaluated
0-2392194
225 return crc32(p, size_t(len), h);
executed 2392194 times by 441 tests: return crc32(p, size_t(len), h);
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
2392194
226-
227 for (int i = 0; i < len; ++i)
i < lenDescription
TRUEnever evaluated
FALSEnever evaluated
0
228 h = 31 * h + p[i].unicode();
never executed: h = 31 * h + p[i].unicode();
0
229-
230 return h;
never executed: return h;
0
231}-
232-
233uint qHash(const QByteArray &key, uint seed) Q_DECL_NOTHROW-
234{-
235 return hash(reinterpret_cast<const uchar *>(key.constData()), key.size(), seed);
executed 110206 times by 397 tests: return hash(reinterpret_cast<const uchar *>(key.constData()), key.size(), seed);
Executed by:
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QByteArray
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QClipboard
  • tst_QColorDialog
  • tst_QColumnView
  • ...
110206
236}-
237-
238uint qHash(const QString &key, uint seed) Q_DECL_NOTHROW-
239{-
240 return hash(key.unicode(), key.size(), seed);
executed 2392182 times by 441 tests: return hash(key.unicode(), key.size(), seed);
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • ...
2392182
241}-
242-
243uint qHash(const QStringRef &key, uint seed) Q_DECL_NOTHROW-
244{-
245 return hash(key.unicode(), key.size(), seed);
executed 12 times by 1 test: return hash(key.unicode(), key.size(), seed);
Executed by:
  • tst_QString
12
246}-
247-
248uint qHash(const QBitArray &bitArray, uint seed) Q_DECL_NOTHROW-
249{-
250 int m = bitArray.d.size() - 1;-
251 uint result = hash(reinterpret_cast<const uchar *>(bitArray.d.constData()), qMax(0, m), seed);-
252-
253 // deal with the last 0 to 7 bits manually, because we can't trust that-
254 // the padding is initialized to 0 in bitArray.d-
255 int n = bitArray.size();-
256 if (n & 0x7)
n & 0x7Description
TRUEevaluated 9 times by 1 test
Evaluated by:
  • tst_QHashFunctions
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QHashFunctions
1-9
257 result = ((result << 4) + bitArray.d.at(m)) & ((1 << n) - 1);
executed 9 times by 1 test: result = ((result << 4) + bitArray.d.at(m)) & ((1 << n) - 1);
Executed by:
  • tst_QHashFunctions
9
258 return result;
executed 10 times by 1 test: return result;
Executed by:
  • tst_QHashFunctions
10
259}-
260-
261uint qHash(QLatin1String key, uint seed) Q_DECL_NOTHROW-
262{-
263 return hash(reinterpret_cast<const uchar *>(key.data()), key.size(), seed);
executed 18091 times by 1 test: return hash(reinterpret_cast<const uchar *>(key.data()), key.size(), seed);
Executed by:
  • tst_qdbuscpp2xml - unknown status
18091
264}-
265-
266/*!-
267 \internal-
268-
269 Creates the QHash random seed from various sources.-
270 In order of decreasing precedence:-
271 - under Unix, it attemps to read from /dev/urandom;-
272 - under Unix, it attemps to read from /dev/random;-
273 - under Windows, it attempts to use rand_s;-
274 - as a general fallback, the application's PID, a timestamp and the-
275 address of a stack-local variable are used.-
276*/-
277static uint qt_create_qhash_seed()-
278{-
279 uint seed = 0;-
280-
281#ifndef QT_BOOTSTRAPPED-
282 QByteArray envSeed = qgetenv("QT_HASH_SEED");-
283 if (!envSeed.isNull())
!envSeed.isNull()Description
TRUEnever evaluated
FALSEevaluated 1228 times by 151 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
0-1228
284 return envSeed.toUInt();
never executed: return envSeed.toUInt();
0
285-
286#ifdef Q_OS_UNIX-
287 int randomfd = qt_safe_open("/dev/urandom", O_RDONLY);-
288 if (randomfd == -1)
randomfd == -1Description
TRUEnever evaluated
FALSEevaluated 1228 times by 151 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
0-1228
289 randomfd = qt_safe_open("/dev/random", O_RDONLY | O_NONBLOCK);
never executed: randomfd = qt_safe_open("/dev/random", 00 | 04000);
0
290 if (randomfd != -1) {
randomfd != -1Description
TRUEevaluated 1228 times by 151 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
FALSEnever evaluated
0-1228
291 if (qt_safe_read(randomfd, reinterpret_cast<char *>(&seed), sizeof(seed)) == sizeof(seed)) {
qt_safe_read(r...= sizeof(seed)Description
TRUEevaluated 1228 times by 151 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
FALSEnever evaluated
0-1228
292 qt_safe_close(randomfd);-
293 return seed;
executed 1228 times by 151 tests: return seed;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
1228
294 }-
295 qt_safe_close(randomfd);-
296 }
never executed: end of block
0
297#endif // Q_OS_UNIX-
298-
299#if defined(Q_OS_WIN32) && !defined(Q_CC_GNU)-
300 errno_t err;-
301 err = rand_s(&seed);-
302 if (err == 0)-
303 return seed;-
304#endif // Q_OS_WIN32-
305-
306 // general fallback: initialize from the current timestamp, pid,-
307 // and address of a stack-local variable-
308 quint64 timestamp = QDateTime::currentMSecsSinceEpoch();-
309 seed ^= timestamp;-
310 seed ^= (timestamp >> 32);-
311-
312 quint64 pid = QCoreApplication::applicationPid();-
313 seed ^= pid;-
314 seed ^= (pid >> 32);-
315-
316 quintptr seedPtr = reinterpret_cast<quintptr>(&seed);-
317 seed ^= seedPtr;-
318 seed ^= (qulonglong(seedPtr) >> 32); // no-op on 32-bit platforms-
319#endif // QT_BOOTSTRAPPED-
320-
321 return seed;
never executed: return seed;
0
322}-
323-
324/*-
325 The QHash seed itself.-
326*/-
327Q_CORE_EXPORT QBasicAtomicInt qt_qhash_seed = Q_BASIC_ATOMIC_INITIALIZER(-1);-
328-
329/*!-
330 \internal-
331-
332 Seed == -1 means it that it was not initialized yet.-
333-
334 We let qt_create_qhash_seed return any unsigned integer,-
335 but convert it to signed in order to initialize the seed.-
336-
337 We don't actually care about the fact that different calls to-
338 qt_create_qhash_seed() might return different values,-
339 as long as in the end everyone uses the very same value.-
340*/-
341static void qt_initialize_qhash_seed()-
342{-
343 if (qt_qhash_seed.load() == -1) {
qt_qhash_seed.load() == -1Description
TRUEevaluated 1227 times by 150 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
FALSEevaluated 110327 times by 493 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • ...
1227-110327
344 int x(qt_create_qhash_seed() & INT_MAX);-
345 qt_qhash_seed.testAndSetRelaxed(-1, x);-
346 }
executed 1227 times by 150 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_LargeFile
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QArrayData
  • tst_QArrayData_StrictIterators
  • tst_QAuthenticator
  • tst_QBuffer
  • tst_QByteArray
  • tst_QCache
  • tst_QCommandLineParser
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusContext
  • tst_QDBusInterface
  • tst_QDBusMetaObject
  • tst_QDBusMetaType
  • ...
1227
347}
executed 111554 times by 536 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
111554
348-
349/*! \relates QHash-
350 \since 5.6-
351-
352 Returns the current global QHash seed.-
353-
354 The seed is set in any newly created QHash. See \l{qHash} about how this seed-
355 is being used by QHash.-
356-
357 \sa qSetGlobalQHashSeed-
358 */-
359int qGlobalQHashSeed()-
360{-
361 return qt_qhash_seed.load();
executed 3 times by 1 test: return qt_qhash_seed.load();
Executed by:
  • tst_QHashFunctions
3
362}-
363-
364/*! \relates QHash-
365 \since 5.6-
366-
367 Sets the global QHash seed to \a newSeed.-
368-
369 Manually setting the global QHash seed value should be done only for testing-
370 and debugging purposes, when deterministic and reproducible behavior on a QHash-
371 is needed. We discourage to do it in production code as it can make your-
372 application susceptible to \l{algorithmic complexity attacks}.-
373-
374 The seed is set in any newly created QHash. See \l{qHash} about how this seed-
375 is being used by QHash.-
376-
377 If the environment variable \c QT_HASH_SEED is set, calling this function will-
378 result in a no-op.-
379-
380 Passing the value -1 will reinitialize the global QHash seed to a random value.-
381-
382 \sa qGlobalQHashSeed-
383 */-
384void qSetGlobalQHashSeed(int newSeed)-
385{-
386 if (qEnvironmentVariableIsSet("QT_HASH_SEED"))
qEnvironmentVa...QT_HASH_SEED")Description
TRUEnever evaluated
FALSEevaluated 6 times by 3 tests
Evaluated by:
  • tst_QDBusXmlParser
  • tst_QHashFunctions
  • tst_QSet
0-6
387 return;
never executed: return;
0
388 if (newSeed == -1) {
newSeed == -1Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QHashFunctions
FALSEevaluated 5 times by 3 tests
Evaluated by:
  • tst_QDBusXmlParser
  • tst_QHashFunctions
  • tst_QSet
1-5
389 int x(qt_create_qhash_seed() & INT_MAX);-
390 qt_qhash_seed.store(x);-
391 } else {
executed 1 time by 1 test: end of block
Executed by:
  • tst_QHashFunctions
1
392 qt_qhash_seed.store(newSeed & INT_MAX);-
393 }
executed 5 times by 3 tests: end of block
Executed by:
  • tst_QDBusXmlParser
  • tst_QHashFunctions
  • tst_QSet
5
394}-
395-
396/*!-
397 \internal-
398-
399 Private copy of the implementation of the Qt 4 qHash algorithm for strings,-
400 (that is, QChar-based arrays, so all QString-like classes),-
401 to be used wherever the result is somehow stored or reused across multiple-
402 Qt versions. The public qHash implementation can change at any time,-
403 therefore one must not rely on the fact that it will always give the same-
404 results.-
405-
406 The qt_hash functions must *never* change their results.-
407*/-
408static uint qt_hash(const QChar *p, int n) Q_DECL_NOTHROW-
409{-
410 uint h = 0;-
411-
412 while (n--) {
n--Description
TRUEevaluated 1730761 times by 116 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • tst_QDirIterator
  • tst_QDnsLookup_Appless
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
FALSEevaluated 171327 times by 116 tests
Evaluated by:
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • tst_QDirIterator
  • tst_QDnsLookup_Appless
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
171327-1730761
413 h = (h << 4) + (*p++).unicode();-
414 h ^= (h & 0xf0000000) >> 23;-
415 h &= 0x0fffffff;-
416 }
executed 1730761 times by 116 tests: end of block
Executed by:
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • tst_QDirIterator
  • tst_QDnsLookup_Appless
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
1730761
417 return h;
executed 171327 times by 116 tests: return h;
Executed by:
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • tst_QDirIterator
  • tst_QDnsLookup_Appless
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
171327
418}-
419-
420/*!-
421 \internal-
422 \overload-
423*/-
424uint qt_hash(const QString &key) Q_DECL_NOTHROW-
425{-
426 return qt_hash(key.unicode(), key.size());
executed 5 times by 1 test: return qt_hash(key.unicode(), key.size());
Executed by:
  • tst_QHashFunctions
5
427}-
428-
429/*!-
430 \internal-
431 \overload-
432*/-
433uint qt_hash(const QStringRef &key) Q_DECL_NOTHROW-
434{-
435 return qt_hash(key.unicode(), key.size());
executed 171322 times by 115 tests: return qt_hash(key.unicode(), key.size());
Executed by:
  • tst_QAbstractFileEngine
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QCoreApplication
  • tst_QDBusConnectionNoBus
  • tst_QDBusConnectionNoLibDBus1
  • tst_QDBusConnection_Delayed
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDir
  • tst_QDirIterator
  • tst_QDnsLookup_Appless
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFile
  • ...
171322
436}-
437-
438/*-
439 The prime_deltas array contains the difference between a power-
440 of two and the next prime number:-
441-
442 prime_deltas[i] = nextprime(2^i) - 2^i-
443-
444 Basically, it's sequence A092131 from OEIS, assuming:-
445 - nextprime(1) = 1-
446 - nextprime(2) = 2-
447 and-
448 - left-extending it for the offset 0 (A092131 starts at i=1)-
449 - stopping the sequence at i = 28 (the table is big enough...)-
450*/-
451-
452static const uchar prime_deltas[] = {-
453 0, 0, 1, 3, 1, 5, 3, 3, 1, 9, 7, 5, 3, 17, 27, 3,-
454 1, 29, 3, 21, 7, 17, 15, 9, 43, 35, 15, 0, 0, 0, 0, 0-
455};-
456-
457/*-
458 The primeForNumBits() function returns the prime associated to a-
459 power of two. For example, primeForNumBits(8) returns 257.-
460*/-
461-
462static inline int primeForNumBits(int numBits)-
463{-
464 return (1 << numBits) + prime_deltas[numBits];
executed 140588 times by 539 tests: return (1 << numBits) + prime_deltas[numBits];
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
140588
465}-
466-
467/*-
468 Returns the smallest integer n such that-
469 primeForNumBits(n) >= hint.-
470*/-
471static int countBits(int hint)-
472{-
473 int numBits = 0;-
474 int bits = hint;-
475-
476 while (bits > 1) {
bits > 1Description
TRUEevaluated 2471 times by 134 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • ...
FALSEevaluated 7704 times by 160 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
2471-7704
477 bits >>= 1;-
478 numBits++;-
479 }
executed 2471 times by 134 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • ...
2471
480-
481 if (numBits >= (int)sizeof(prime_deltas)) {
numBits >= (in...(prime_deltas)Description
TRUEnever evaluated
FALSEevaluated 7704 times by 160 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
0-7704
482 numBits = sizeof(prime_deltas) - 1;-
483 } else if (primeForNumBits(numBits) < hint) {
never executed: end of block
primeForNumBit...umBits) < hintDescription
TRUEevaluated 431 times by 132 tests
Evaluated by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • ...
FALSEevaluated 7273 times by 101 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDirModel
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsEffect
  • tst_QGraphicsEffectSource
  • ...
0-7273
484 ++numBits;-
485 }
executed 431 times by 132 tests: end of block
Executed by:
  • tst_Gestures
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • ...
431
486 return numBits;
executed 7704 times by 160 tests: return numBits;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
7704
487}-
488-
489/*-
490 A QHash has initially around pow(2, MinNumBits) buckets. For-
491 example, if MinNumBits is 4, it has 17 buckets.-
492*/-
493const int MinNumBits = 4;-
494-
495const QHashData QHashData::shared_null = {-
496 0, 0, Q_REFCOUNT_INITIALIZE_STATIC, 0, 0, MinNumBits, 0, 0, 0, true, false, 0-
497};-
498-
499void *QHashData::allocateNode(int nodeAlign)-
500{-
501 void *ptr = strictAlignment ? qMallocAligned(nodeSize, nodeAlign) : malloc(nodeSize);
strictAlignmentDescription
TRUEevaluated 600 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 6715790 times by 542 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
600-6715790
502 Q_CHECK_PTR(ptr);
never executed: qBadAlloc();
!(ptr)Description
TRUEnever evaluated
FALSEevaluated 6716390 times by 542 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
0-6716390
503 return ptr;
executed 6716390 times by 542 tests: return ptr;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
6716390
504}-
505-
506void QHashData::freeNode(void *node)-
507{-
508 if (strictAlignment)
strictAlignmentDescription
TRUEevaluated 600 times by 1 test
Evaluated by:
  • tst_Collections
FALSEevaluated 6717701 times by 697 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
600-6717701
509 qFreeAligned(node);
executed 600 times by 1 test: qFreeAligned(node);
Executed by:
  • tst_Collections
600
510 else-
511 free(node);
executed 6717701 times by 697 tests: free(node);
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAnimationGroup
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBackingStore
  • tst_QBoxLayout
  • ...
6717701
512}-
513-
514QHashData *QHashData::detach_helper(void (*node_duplicate)(Node *, void *),-
515 void (*node_delete)(Node *),-
516 int nodeSize,-
517 int nodeAlign)-
518{-
519 union {-
520 QHashData *d;-
521 Node *e;-
522 };-
523 if (this == &shared_null)
this == &shared_nullDescription
TRUEevaluated 111554 times by 536 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
FALSEevaluated 12401 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
12401-111554
524 qt_initialize_qhash_seed(); // may throw
executed 111554 times by 536 tests: qt_initialize_qhash_seed();
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
111554
525 d = new QHashData;-
526 d->fakeNext = 0;-
527 d->buckets = 0;-
528 d->ref.initializeOwned();-
529 d->size = size;-
530 d->nodeSize = nodeSize;-
531 d->userNumBits = userNumBits;-
532 d->numBits = numBits;-
533 d->numBuckets = numBuckets;-
534 d->seed = (this == &shared_null) ? uint(qt_qhash_seed.load()) : seed;
(this == &shared_null)Description
TRUEevaluated 111554 times by 536 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
FALSEevaluated 12401 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
12401-111554
535 d->sharable = true;-
536 d->strictAlignment = nodeAlign > 8;-
537 d->reserved = 0;-
538-
539 if (numBuckets) {
numBucketsDescription
TRUEevaluated 12401 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
FALSEevaluated 111554 times by 536 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
12401-111554
540 QT_TRY {-
541 d->buckets = new Node *[numBuckets];-
542 } QT_CATCH(...) {
executed 12401 times by 50 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
12401
543 // restore a consistent state for d-
544 d->numBuckets = 0;-
545 // roll back-
546 d->free_helper(node_delete);-
547 QT_RETHROW;
never executed: throw;
0
548 }-
549-
550 Node *this_e = reinterpret_cast<Node *>(this);-
551 for (int i = 0; i < numBuckets; ++i) {
i < numBucketsDescription
TRUEevaluated 379517 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
FALSEevaluated 12401 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
12401-379517
552 Node **nextNode = &d->buckets[i];-
553 Node *oldNode = buckets[i];-
554 while (oldNode != this_e) {
oldNode != this_eDescription
TRUEevaluated 177100 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
FALSEevaluated 379517 times by 50 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
177100-379517
555 QT_TRY {-
556 Node *dup = static_cast<Node *>(allocateNode(nodeAlign));-
557-
558 QT_TRY {-
559 node_duplicate(oldNode, dup);-
560 } QT_CATCH(...) {
executed 177100 times by 50 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
177100
561 freeNode( dup );-
562 QT_RETHROW;
never executed: throw;
0
563 }-
564-
565 *nextNode = dup;-
566 nextNode = &dup->next;-
567 oldNode = oldNode->next;-
568 } QT_CATCH(...) {
executed 177100 times by 50 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
177100
569 // restore a consistent state for d-
570 *nextNode = e;-
571 d->numBuckets = i+1;-
572 // roll back-
573 d->free_helper(node_delete);-
574 QT_RETHROW;
never executed: throw;
0
575 }-
576 }-
577 *nextNode = e;-
578 }
executed 379517 times by 50 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
379517
579 }
executed 12401 times by 50 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractProxyModel
  • tst_QCompleter
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusLocalCalls
  • tst_QDBusPendingCall
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDirModel
  • tst_QDockWidget
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • ...
12401
580 return d;
executed 123955 times by 536 tests: return d;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
123955
581}-
582-
583void QHashData::free_helper(void (*node_delete)(Node *))-
584{-
585 if (node_delete) {
node_deleteDescription
TRUEevaluated 124312 times by 659 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
FALSEnever evaluated
0-124312
586 Node *this_e = reinterpret_cast<Node *>(this);-
587 Node **bucket = reinterpret_cast<Node **>(this->buckets);-
588-
589 int n = numBuckets;-
590 while (n--) {
n--Description
TRUEevaluated 8152060 times by 658 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
FALSEevaluated 124312 times by 659 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
124312-8152060
591 Node *cur = *bucket++;-
592 while (cur != this_e) {
cur != this_eDescription
TRUEevaluated 5850074 times by 593 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • ...
FALSEevaluated 8152060 times by 658 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
5850074-8152060
593 Node *next = cur->next;-
594 node_delete(cur);-
595 freeNode(cur);-
596 cur = next;-
597 }
executed 5850074 times by 593 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLineParser
  • ...
5850074
598 }
executed 8152060 times by 658 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
8152060
599 }
executed 124312 times by 659 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
124312
600 delete [] buckets;-
601 delete this;-
602}
executed 124312 times by 659 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QAuthenticator
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCache
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
124312
603-
604QHashData::Node *QHashData::nextNode(Node *node)-
605{-
606 union {-
607 Node *next;-
608 Node *e;-
609 QHashData *d;-
610 };-
611 next = node->next;-
612 Q_ASSERT_X(next, "QHash", "Iterating beyond end()");-
613 if (next->next)
next->nextDescription
TRUEevaluated 804707 times by 358 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
FALSEevaluated 2604328 times by 459 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
804707-2604328
614 return next;
executed 804707 times by 358 tests: return next;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • ...
804707
615-
616 int start = (node->h % d->numBuckets) + 1;-
617 Node **bucket = d->buckets + start;-
618 int n = d->numBuckets - start;-
619 while (n--) {
n--Description
TRUEevaluated 825244482 times by 456 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
FALSEevaluated 234932 times by 459 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
234932-825244482
620 if (*bucket != e)
*bucket != eDescription
TRUEevaluated 2369396 times by 393 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
FALSEevaluated 822875086 times by 456 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
2369396-822875086
621 return *bucket;
executed 2369396 times by 393 tests: return *bucket;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • ...
2369396
622 ++bucket;-
623 }
executed 822875086 times by 456 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
822875086
624 return e;
executed 234932 times by 459 tests: return e;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QApplication
  • tst_QBackingStore
  • tst_QBoxLayout
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • ...
234932
625}-
626-
627QHashData::Node *QHashData::previousNode(Node *node)-
628{-
629 union {-
630 Node *e;-
631 QHashData *d;-
632 };-
633-
634 e = node;-
635 while (e->next)
e->nextDescription
TRUEevaluated 457851 times by 15 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTreeView
  • tst_languageChange
FALSEevaluated 374523 times by 23 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
374523-457851
636 e = e->next;
executed 457851 times by 15 tests: e = e->next;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTreeView
  • tst_languageChange
457851
637-
638 int start;-
639 if (node == e)
node == eDescription
TRUEevaluated 32948 times by 23 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
FALSEevaluated 341575 times by 15 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTreeView
  • tst_languageChange
32948-341575
640 start = d->numBuckets - 1;
executed 32948 times by 23 tests: start = d->numBuckets - 1;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
32948
641 else-
642 start = node->h % d->numBuckets;
executed 341575 times by 15 tests: start = node->h % d->numBuckets;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTreeView
  • tst_languageChange
341575
643-
644 Node *sentinel = node;-
645 Node **bucket = d->buckets + start;-
646 while (start >= 0) {
start >= 0Description
TRUEevaluated 410695517 times by 23 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
FALSEnever evaluated
0-410695517
647 if (*bucket != sentinel) {
*bucket != sentinelDescription
TRUEevaluated 374523 times by 23 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
FALSEevaluated 410320994 times by 22 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_languageChange
374523-410320994
648 Node *prev = *bucket;-
649 while (prev->next != sentinel)
prev->next != sentinelDescription
TRUEevaluated 135850 times by 11 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_languageChange
FALSEevaluated 374523 times by 23 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
135850-374523
650 prev = prev->next;
executed 135850 times by 11 tests: prev = prev->next;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QDataStream
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_languageChange
135850
651 return prev;
executed 374523 times by 23 tests: return prev;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_QWidget
  • tst_languageChange
374523
652 }-
653-
654 sentinel = e;-
655 --bucket;-
656 --start;-
657 }
executed 410320994 times by 22 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_QAbstractNetworkCache
  • tst_QDataStream
  • tst_QDockWidget
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHeaderView
  • tst_QMainWindow
  • tst_QNetworkDiskCache
  • tst_QNetworkReply
  • tst_QScroller
  • tst_QSet
  • tst_QState
  • tst_QStateMachine
  • tst_QTouchEvent
  • tst_QTreeView
  • tst_languageChange
410320994
658 Q_ASSERT_X(start >= 0, "QHash", "Iterating backward beyond begin()");-
659 return e;
never executed: return e;
0
660}-
661-
662/*-
663 If hint is negative, -hint gives the approximate number of-
664 buckets that should be used for the hash table. If hint is-
665 nonnegative, (1 << hint) gives the approximate number-
666 of buckets that should be used.-
667*/-
668void QHashData::rehash(int hint)-
669{-
670 if (hint < 0) {
hint < 0Description
TRUEevaluated 7704 times by 160 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
FALSEevaluated 117443 times by 537 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
7704-117443
671 hint = countBits(-hint);-
672 if (hint < MinNumBits)
hint < MinNumBitsDescription
TRUEevaluated 7309 times by 103 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDirModel
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsEffect
  • tst_QGraphicsEffectSource
  • ...
FALSEevaluated 395 times by 125 tests
Evaluated by:
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • tst_QDockWidget
  • tst_QDoubleSpinBox
  • tst_QErrorMessage
  • tst_QFileDialog2
  • ...
395-7309
673 hint = MinNumBits;
executed 7309 times by 103 tests: hint = MinNumBits;
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDirModel
  • tst_QErrorMessage
  • tst_QFileDialog2
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFontComboBox
  • tst_QFontDialog
  • tst_QGestureRecognizer
  • tst_QGraphicsAnchorLayout
  • tst_QGraphicsEffect
  • tst_QGraphicsEffectSource
  • ...
7309
674 userNumBits = hint;-
675 while (primeForNumBits(hint) < (size >> 1))
primeForNumBit... < (size >> 1)Description
TRUEevaluated 37 times by 4 tests
Evaluated by:
  • tst_Collections
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QSet
FALSEevaluated 7704 times by 160 tests
Evaluated by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
37-7704
676 ++hint;
executed 37 times by 4 tests: ++hint;
Executed by:
  • tst_Collections
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QSet
37
677 } else if (hint < MinNumBits) {
executed 7704 times by 160 tests: end of block
Executed by:
  • tst_Collections
  • tst_Gestures
  • tst_ModelTest
  • tst_QAbstractButton
  • tst_QAbstractItemView
  • tst_QAbstractScrollArea
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBoxLayout
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QCheckBox
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QComplexText
  • tst_QCssParser
  • tst_QDataWidgetMapper
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDialogButtonBox
  • ...
hint < MinNumBitsDescription
TRUEevaluated 99326 times by 534 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
FALSEevaluated 18117 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
7704-99326
678 hint = MinNumBits;-
679 }
executed 99326 times by 534 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
99326
680-
681 if (numBits != hint) {
numBits != hintDescription
TRUEevaluated 125143 times by 539 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_Collections
  • tst_QSet
4-125143
682 Node *e = reinterpret_cast<Node *>(this);-
683 Node **oldBuckets = buckets;-
684 int oldNumBuckets = numBuckets;-
685-
686 int nb = primeForNumBits(hint);-
687 buckets = new Node *[nb];-
688 numBits = hint;-
689 numBuckets = nb;-
690 for (int i = 0; i < numBuckets; ++i)
i < numBucketsDescription
TRUEevaluated 14111153 times by 539 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
FALSEevaluated 125143 times by 539 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
125143-14111153
691 buckets[i] = e;
executed 14111153 times by 539 tests: buckets[i] = e;
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
14111153
692-
693 for (int i = 0; i < oldNumBuckets; ++i) {
i < oldNumBucketsDescription
TRUEevaluated 6344684 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
FALSEevaluated 125143 times by 539 tests
Evaluated by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
125143-6344684
694 Node *firstNode = oldBuckets[i];-
695 while (firstNode != e) {
firstNode != eDescription
TRUEevaluated 854085 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
FALSEevaluated 6344684 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
854085-6344684
696 uint h = firstNode->h;-
697 Node *lastNode = firstNode;-
698 while (lastNode->next != e && lastNode->next->h == h)
lastNode->next != eDescription
TRUEevaluated 5495318 times by 148 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
FALSEevaluated 606469 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
lastNode->next->h == hDescription
TRUEevaluated 5247702 times by 41 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFileSystemWatcher
  • tst_QFontDialog
  • tst_QFtp
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QMainWindow
  • tst_QMenu
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • ...
FALSEevaluated 247616 times by 147 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
247616-5495318
699 lastNode = lastNode->next;
executed 5247702 times by 41 tests: lastNode = lastNode->next;
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QApplication
  • tst_QComboBox
  • tst_QFileSystemWatcher
  • tst_QFontDialog
  • tst_QFtp
  • tst_QGraphicsAnchorLayout1
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsView
  • tst_QHash
  • tst_QHash_StrictIterators
  • tst_QHostInfo
  • tst_QHttpNetworkConnection
  • tst_QItemSelectionModel
  • tst_QListView
  • tst_QMainWindow
  • tst_QMenu
  • tst_QNetworkAccessManager
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkConfiguration
  • tst_QNetworkConfigurationManager
  • ...
5247702
700-
701 Node *afterLastNode = lastNode->next;-
702 Node **beforeFirstNode = &buckets[h % numBuckets];-
703 while (*beforeFirstNode != e)
*beforeFirstNode != eDescription
TRUEevaluated 176120 times by 141 tests
Evaluated by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
FALSEevaluated 854085 times by 156 tests
Evaluated by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
176120-854085
704 beforeFirstNode = &(*beforeFirstNode)->next;
executed 176120 times by 141 tests: beforeFirstNode = &(*beforeFirstNode)->next;
Executed by:
  • tst_Collections
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • tst_QDateTimeEdit
  • tst_QDebug
  • ...
176120
705 lastNode->next = *beforeFirstNode;-
706 *beforeFirstNode = firstNode;-
707 firstNode = afterLastNode;-
708 }
executed 854085 times by 156 tests: end of block
Executed by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
854085
709 }
executed 6344684 times by 156 tests: end of block
Executed by:
  • tst_Collections
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractSpinBox
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCompleter
  • tst_QComplexText
  • tst_QDBusAbstractAdaptor
  • tst_QDBusAbstractInterface
  • tst_QDBusConnection
  • tst_QDBusConnection_NoApplication
  • tst_QDBusConnection_SpyHook
  • tst_QDBusInterface
  • tst_QDBusMarshall
  • tst_QDBusMetaType
  • tst_QDBusPendingReply
  • tst_QDBusReply
  • ...
6344684
710 delete [] oldBuckets;-
711 }
executed 125143 times by 539 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
125143
712}
executed 125147 times by 539 tests: end of block
Executed by:
  • tst_Collections
  • tst_Compiler
  • tst_Gestures
  • tst_Lancelot
  • tst_LargeFile
  • tst_ModelTest
  • tst_NetworkSelfTest
  • tst_PlatformSocketEngine
  • tst_QAbstractButton
  • tst_QAbstractFileEngine
  • tst_QAbstractItemModel
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractProxyModel
  • tst_QAbstractScrollArea
  • tst_QAbstractSlider
  • tst_QAbstractSpinBox
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QAction
  • tst_QActionGroup
  • tst_QAlgorithms
  • tst_QAnimationGroup
  • tst_QApplication
  • ...
125147
713-
714#ifdef QT_QHASH_DEBUG-
715-
716void QHashData::dump()-
717{-
718 qDebug("Hash data (ref = %d, size = %d, nodeSize = %d, userNumBits = %d, numBits = %d, numBuckets = %d)",-
719 int(ref), size, nodeSize, userNumBits, numBits,-
720 numBuckets);-
721 qDebug(" %p (fakeNode = %p)", this, fakeNext);-
722 for (int i = 0; i < numBuckets; ++i) {-
723 Node *n = buckets[i];-
724 if (n != reinterpret_cast<Node *>(this)) {-
725 QString line = QString::asprintf("%d:", i);-
726 while (n != reinterpret_cast<Node *>(this)) {-
727 line += QString::asprintf(" -> [%p]", n);-
728 if (!n) {-
729 line += " (CORRUPT)";-
730 break;-
731 }-
732 n = n->next;-
733 }-
734 qDebug("%s", qPrintable(line));-
735 }-
736 }-
737}-
738-
739void QHashData::checkSanity()-
740{-
741 if (Q_UNLIKELY(fakeNext))-
742 qFatal("Fake next isn't 0");-
743-
744 for (int i = 0; i < numBuckets; ++i) {-
745 Node *n = buckets[i];-
746 Node *p = n;-
747 if (Q_UNLIKELY(!n))-
748 qFatal("%d: Bucket entry is 0", i);-
749 if (n != reinterpret_cast<Node *>(this)) {-
750 while (n != reinterpret_cast<Node *>(this)) {-
751 if (Q_UNLIKELY(!n->next))-
752 qFatal("%d: Next of %p is 0, should be %p", i, n, this);-
753 n = n->next;-
754 }-
755 }-
756 }-
757}-
758#endif-
759-
760/*!-
761 \fn uint qHash(const QPair<T1, T2> &key, uint seed = 0)-
762 \since 5.0-
763 \relates QHash-
764-
765 Returns the hash value for the \a key, using \a seed to seed the calculation.-
766-
767 Types \c T1 and \c T2 must be supported by qHash().-
768*/-
769-
770/*!-
771 \fn uint qHash(const std::pair<T1, T2> &key, uint seed = 0)-
772 \since 5.7-
773 \relates QHash-
774-
775 Returns the hash value for the \a key, using \a seed to seed the calculation.-
776-
777 Types \c T1 and \c T2 must be supported by qHash().-
778-
779 \note The return type of this function is \e{not} the same as that of-
780 \code-
781 qHash(qMakePair(key.first, key.second), seed);-
782 \endcode-
783 The two functions use different hashing algorithms; due to binary compatibility-
784 constraints, we cannot change the QPair algorithm to match the std::pair one before Qt 6.-
785*/-
786-
787/*! \fn uint qHashRange(InputIterator first, InputIterator last, uint seed = 0)-
788 \relates QHash-
789 \since 5.5-
790-
791 Returns the hash value for the range [\a{first},\a{last}), using \a seed-
792 to seed the calculation, by successively applying qHash() to each-
793 element and combining the hash values into a single one.-
794-
795 The return value of this function depends on the order of elements-
796 in the range. That means that-
797-
798 \code-
799 {0, 1, 2}-
800 \endcode-
801-
802 and-
803 \code-
804 {1, 2, 0}-
805 \endcode-
806-
807 hash to \b{different} values. If order does not matter, for example for hash-
808 tables, use qHashRangeCommutative() instead. If you are hashing raw-
809 memory, use qHashBits().-
810-
811 Use this function only to implement qHash() for your own custom-
812 types. For example, here's how you could implement a qHash() overload for-
813 std::vector<int>:-
814-
815 \snippet code/src_corelib_tools_qhash.cpp qhashrange-
816-
817 It bears repeating that the implementation of qHashRange() - like-
818 the qHash() overloads offered by Qt - may change at any time. You-
819 \b{must not} rely on the fact that qHashRange() will give the same-
820 results (for the same inputs) across different Qt versions, even-
821 if qHash() for the element type would.-
822-
823 \sa qHashBits(), qHashRangeCommutative()-
824*/-
825-
826/*! \fn uint qHashRangeCommutative(InputIterator first, InputIterator last, uint seed = 0)-
827 \relates QHash-
828 \since 5.5-
829-
830 Returns the hash value for the range [\a{first},\a{last}), using \a seed-
831 to seed the calculation, by successively applying qHash() to each-
832 element and combining the hash values into a single one.-
833-
834 The return value of this function does not depend on the order of-
835 elements in the range. That means that-
836-
837 \code-
838 {0, 1, 2}-
839 \endcode-
840-
841 and-
842 \code-
843 {1, 2, 0}-
844 \endcode-
845-
846 hash to the \b{same} values. If order matters, for example, for vectors-
847 and arrays, use qHashRange() instead. If you are hashing raw-
848 memory, use qHashBits().-
849-
850 Use this function only to implement qHash() for your own custom-
851 types. For example, here's how you could implement a qHash() overload for-
852 std::unordered_set<int>:-
853-
854 \snippet code/src_corelib_tools_qhash.cpp qhashrangecommutative-
855-
856 It bears repeating that the implementation of-
857 qHashRangeCommutative() - like the qHash() overloads offered by Qt-
858 - may change at any time. You \b{must not} rely on the fact that-
859 qHashRangeCommutative() will give the same results (for the same-
860 inputs) across different Qt versions, even if qHash() for the-
861 element type would.-
862-
863 \sa qHashBits(), qHashRange()-
864*/-
865-
866/*! \fn uint qHashBits(const void *p, size_t len, uint seed = 0)-
867 \relates QHash-
868 \since 5.4-
869-
870 Returns the hash value for the memory block of size \a len pointed-
871 to by \a p, using \a seed to seed the calculation.-
872-
873 Use this function only to implement qHash() for your own custom-
874 types. For example, here's how you could implement a qHash() overload for-
875 std::vector<int>:-
876-
877 \snippet code/src_corelib_tools_qhash.cpp qhashbits-
878-
879 This takes advantage of the fact that std::vector lays out its data-
880 contiguously. If that is not the case, or the contained type has-
881 padding, you should use qHashRange() instead.-
882-
883 It bears repeating that the implementation of qHashBits() - like-
884 the qHash() overloads offered by Qt - may change at any time. You-
885 \b{must not} rely on the fact that qHashBits() will give the same-
886 results (for the same inputs) across different Qt versions.-
887-
888 \sa qHashRange(), qHashRangeCommutative()-
889*/-
890-
891/*! \fn uint qHash(char key, uint seed = 0)-
892 \relates QHash-
893 \since 5.0-
894-
895 Returns the hash value for the \a key, using \a seed to seed the calculation.-
896*/-
897-
898/*! \fn uint qHash(uchar key, uint seed = 0)-
899 \relates QHash-
900 \since 5.0-
901-
902 Returns the hash value for the \a key, using \a seed to seed the calculation.-
903*/-
904-
905/*! \fn uint qHash(signed char key, uint seed = 0)-
906 \relates QHash-
907 \since 5.0-
908-
909 Returns the hash value for the \a key, using \a seed to seed the calculation.-
910*/-
911-
912/*! \fn uint qHash(ushort key, uint seed = 0)-
913 \relates QHash-
914 \since 5.0-
915-
916 Returns the hash value for the \a key, using \a seed to seed the calculation.-
917*/-
918-
919/*! \fn uint qHash(short key, uint seed = 0)-
920 \relates QHash-
921 \since 5.0-
922-
923 Returns the hash value for the \a key, using \a seed to seed the calculation.-
924*/-
925-
926/*! \fn uint qHash(uint key, uint seed = 0)-
927 \relates QHash-
928 \since 5.0-
929-
930 Returns the hash value for the \a key, using \a seed to seed the calculation.-
931*/-
932-
933/*! \fn uint qHash(int key, uint seed = 0)-
934 \relates QHash-
935 \since 5.0-
936-
937 Returns the hash value for the \a key, using \a seed to seed the calculation.-
938*/-
939-
940/*! \fn uint qHash(ulong key, uint seed = 0)-
941 \relates QHash-
942 \since 5.0-
943-
944 Returns the hash value for the \a key, using \a seed to seed the calculation.-
945*/-
946-
947/*! \fn uint qHash(long key, uint seed = 0)-
948 \relates QHash-
949 \since 5.0-
950-
951 Returns the hash value for the \a key, using \a seed to seed the calculation.-
952*/-
953-
954/*! \fn uint qHash(quint64 key, uint seed = 0)-
955 \relates QHash-
956 \since 5.0-
957-
958 Returns the hash value for the \a key, using \a seed to seed the calculation.-
959*/-
960-
961/*! \fn uint qHash(qint64 key, uint seed = 0)-
962 \relates QHash-
963 \since 5.0-
964-
965 Returns the hash value for the \a key, using \a seed to seed the calculation.-
966*/-
967-
968/*! \relates QHash-
969 \since 5.3-
970-
971 Returns the hash value for the \a key, using \a seed to seed the calculation.-
972*/-
973uint qHash(float key, uint seed) Q_DECL_NOTHROW-
974{-
975 return key != 0.0f ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
executed 2 times by 1 test: return key != 0.0f ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
Executed by:
  • tst_QHashFunctions
2
976}-
977-
978/*! \relates QHash-
979 \since 5.3-
980-
981 Returns the hash value for the \a key, using \a seed to seed the calculation.-
982*/-
983uint qHash(double key, uint seed) Q_DECL_NOTHROW-
984{-
985 return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
executed 19289 times by 40 tests: return key != 0.0 ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
Executed by:
  • tst_QAbstractTextDocumentLayout
  • tst_QAccessibility
  • tst_QApplication
  • tst_QCompleter
  • tst_QDataWidgetMapper
  • tst_QErrorMessage
  • tst_QGraphicsItem
  • tst_QGraphicsProxyWidget
  • tst_QGraphicsScene
  • tst_QGraphicsView
  • tst_QHashFunctions
  • tst_QItemDelegate
  • tst_QLabel
  • tst_QMainWindow
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QMessageBox
  • tst_QPlainTextEdit
  • tst_QShortcut
  • tst_QSplitter
  • tst_QStateMachine
  • tst_QStaticText
  • tst_QStyleSheetStyle
  • tst_QSyntaxHighlighter
  • tst_QTableView
  • ...
19289
986}-
987-
988#ifndef Q_OS_DARWIN-
989/*! \relates QHash-
990 \since 5.3-
991-
992 Returns the hash value for the \a key, using \a seed to seed the calculation.-
993*/-
994uint qHash(long double key, uint seed) Q_DECL_NOTHROW-
995{-
996 return key != 0.0L ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
executed 2 times by 1 test: return key != 0.0L ? hash(reinterpret_cast<const uchar *>(&key), sizeof(key), seed) : seed ;
Executed by:
  • tst_QHashFunctions
2
997}-
998#endif-
999-
1000/*! \fn uint qHash(const QChar key, uint seed = 0)-
1001 \relates QHash-
1002 \since 5.0-
1003-
1004 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1005*/-
1006-
1007/*! \fn uint qHash(const QByteArray &key, uint seed = 0)-
1008 \relates QHash-
1009 \since 5.0-
1010-
1011 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1012*/-
1013-
1014/*! \fn uint qHash(const QBitArray &key, uint seed = 0)-
1015 \relates QHash-
1016 \since 5.0-
1017-
1018 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1019*/-
1020-
1021/*! \fn uint qHash(const QString &key, uint seed = 0)-
1022 \relates QHash-
1023 \since 5.0-
1024-
1025 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1026*/-
1027-
1028/*! \fn uint qHash(const QStringRef &key, uint seed = 0)-
1029 \relates QHash-
1030 \since 5.0-
1031-
1032 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1033*/-
1034-
1035/*! \fn uint qHash(QLatin1String key, uint seed = 0)-
1036 \relates QHash-
1037 \since 5.0-
1038-
1039 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1040*/-
1041-
1042/*! \fn uint qHash(const T *key, uint seed = 0)-
1043 \relates QHash-
1044 \since 5.0-
1045-
1046 Returns the hash value for the \a key, using \a seed to seed the calculation.-
1047*/-
1048-
1049/*!-
1050 \class QHash-
1051 \inmodule QtCore-
1052 \brief The QHash class is a template class that provides a hash-table-based dictionary.-
1053-
1054 \ingroup tools-
1055 \ingroup shared-
1056-
1057 \reentrant-
1058-
1059 QHash\<Key, T\> is one of Qt's generic \l{container classes}. It-
1060 stores (key, value) pairs and provides very fast lookup of the-
1061 value associated with a key.-
1062-
1063 QHash provides very similar functionality to QMap. The-
1064 differences are:-
1065-
1066 \list-
1067 \li QHash provides faster lookups than QMap. (See \l{Algorithmic-
1068 Complexity} for details.)-
1069 \li When iterating over a QMap, the items are always sorted by-
1070 key. With QHash, the items are arbitrarily ordered.-
1071 \li The key type of a QMap must provide operator<(). The key-
1072 type of a QHash must provide operator==() and a global-
1073 hash function called qHash() (see \l{qHash}).-
1074 \endlist-
1075-
1076 Here's an example QHash with QString keys and \c int values:-
1077 \snippet code/src_corelib_tools_qhash.cpp 0-
1078-
1079 To insert a (key, value) pair into the hash, you can use operator[]():-
1080-
1081 \snippet code/src_corelib_tools_qhash.cpp 1-
1082-
1083 This inserts the following three (key, value) pairs into the-
1084 QHash: ("one", 1), ("three", 3), and ("seven", 7). Another way to-
1085 insert items into the hash is to use insert():-
1086-
1087 \snippet code/src_corelib_tools_qhash.cpp 2-
1088-
1089 To look up a value, use operator[]() or value():-
1090-
1091 \snippet code/src_corelib_tools_qhash.cpp 3-
1092-
1093 If there is no item with the specified key in the hash, these-
1094 functions return a \l{default-constructed value}.-
1095-
1096 If you want to check whether the hash contains a particular key,-
1097 use contains():-
1098-
1099 \snippet code/src_corelib_tools_qhash.cpp 4-
1100-
1101 There is also a value() overload that uses its second argument as-
1102 a default value if there is no item with the specified key:-
1103-
1104 \snippet code/src_corelib_tools_qhash.cpp 5-
1105-
1106 In general, we recommend that you use contains() and value()-
1107 rather than operator[]() for looking up a key in a hash. The-
1108 reason is that operator[]() silently inserts an item into the-
1109 hash if no item exists with the same key (unless the hash is-
1110 const). For example, the following code snippet will create 1000-
1111 items in memory:-
1112-
1113 \snippet code/src_corelib_tools_qhash.cpp 6-
1114-
1115 To avoid this problem, replace \c hash[i] with \c hash.value(i)-
1116 in the code above.-
1117-
1118 Internally, QHash uses a hash table to perform lookups. Unlike Qt-
1119 3's \c QDict class, which needed to be initialized with a prime-
1120 number, QHash's hash table automatically grows and shrinks to-
1121 provide fast lookups without wasting too much memory. You can-
1122 still control the size of the hash table by calling reserve() if-
1123 you already know approximately how many items the QHash will-
1124 contain, but this isn't necessary to obtain good performance. You-
1125 can also call capacity() to retrieve the hash table's size.-
1126-
1127 If you want to navigate through all the (key, value) pairs stored-
1128 in a QHash, you can use an iterator. QHash provides both-
1129 \l{Java-style iterators} (QHashIterator and QMutableHashIterator)-
1130 and \l{STL-style iterators} (QHash::const_iterator and-
1131 QHash::iterator). Here's how to iterate over a QHash<QString,-
1132 int> using a Java-style iterator:-
1133-
1134 \snippet code/src_corelib_tools_qhash.cpp 7-
1135-
1136 Here's the same code, but using an STL-style iterator:-
1137-
1138 \snippet code/src_corelib_tools_qhash.cpp 8-
1139-
1140 QHash is unordered, so an iterator's sequence cannot be assumed-
1141 to be predictable. If ordering by key is required, use a QMap.-
1142-
1143 Normally, a QHash allows only one value per key. If you call-
1144 insert() with a key that already exists in the QHash, the-
1145 previous value is erased. For example:-
1146-
1147 \snippet code/src_corelib_tools_qhash.cpp 9-
1148-
1149 However, you can store multiple values per key by using-
1150 insertMulti() instead of insert() (or using the convenience-
1151 subclass QMultiHash). If you want to retrieve all-
1152 the values for a single key, you can use values(const Key &key),-
1153 which returns a QList<T>:-
1154-
1155 \snippet code/src_corelib_tools_qhash.cpp 10-
1156-
1157 The items that share the same key are available from most-
1158 recently to least recently inserted. A more efficient approach is-
1159 to call find() to get the iterator for the first item with a key-
1160 and iterate from there:-
1161-
1162 \snippet code/src_corelib_tools_qhash.cpp 11-
1163-
1164 If you only need to extract the values from a hash (not the keys),-
1165 you can also use \l{foreach}:-
1166-
1167 \snippet code/src_corelib_tools_qhash.cpp 12-
1168-
1169 Items can be removed from the hash in several ways. One way is to-
1170 call remove(); this will remove any item with the given key.-
1171 Another way is to use QMutableHashIterator::remove(). In addition,-
1172 you can clear the entire hash using clear().-
1173-
1174 QHash's key and value data types must be \l{assignable data-
1175 types}. You cannot, for example, store a QWidget as a value;-
1176 instead, store a QWidget *.-
1177-
1178 \target qHash-
1179 \section2 The qHash() hashing function-
1180-
1181 A QHash's key type has additional requirements other than being an-
1182 assignable data type: it must provide operator==(), and there must also be-
1183 a qHash() function in the type's namespace that returns a hash value for an-
1184 argument of the key's type.-
1185-
1186 The qHash() function computes a numeric value based on a key. It-
1187 can use any algorithm imaginable, as long as it always returns-
1188 the same value if given the same argument. In other words, if-
1189 \c{e1 == e2}, then \c{qHash(e1) == qHash(e2)} must hold as well.-
1190 However, to obtain good performance, the qHash() function should-
1191 attempt to return different hash values for different keys to the-
1192 largest extent possible.-
1193-
1194 For a key type \c{K}, the qHash function must have one of these signatures:-
1195-
1196 \code-
1197 uint qHash(K key);-
1198 uint qHash(const K &key);-
1199-
1200 uint qHash(K key, uint seed);-
1201 uint qHash(const K &key, uint seed);-
1202 \endcode-
1203-
1204 The two-arguments overloads take an unsigned integer that should be used to-
1205 seed the calculation of the hash function. This seed is provided by QHash-
1206 in order to prevent a family of \l{algorithmic complexity attacks}. If both-
1207 a one-argument and a two-arguments overload are defined for a key type,-
1208 the latter is used by QHash (note that you can simply define a-
1209 two-arguments version, and use a default value for the seed parameter).-
1210-
1211 Here's a partial list of the C++ and Qt types that can serve as keys in a-
1212 QHash: any integer type (char, unsigned long, etc.), any pointer type,-
1213 QChar, QString, and QByteArray. For all of these, the \c <QHash> header-
1214 defines a qHash() function that computes an adequate hash value. Many other-
1215 Qt classes also declare a qHash overload for their type; please refer to-
1216 the documentation of each class.-
1217-
1218 If you want to use other types as the key, make sure that you provide-
1219 operator==() and a qHash() implementation.-
1220-
1221 Example:-
1222 \snippet code/src_corelib_tools_qhash.cpp 13-
1223-
1224 In the example above, we've relied on Qt's global qHash(const-
1225 QString &, uint) to give us a hash value for the employee's name, and-
1226 XOR'ed this with the day they were born to help produce unique-
1227 hashes for people with the same name.-
1228-
1229 Note that the implementation of the qHash() overloads offered by Qt-
1230 may change at any time. You \b{must not} rely on the fact that qHash()-
1231 will give the same results (for the same inputs) across different Qt-
1232 versions.-
1233-
1234 \section2 Algorithmic complexity attacks-
1235-
1236 All hash tables are vulnerable to a particular class of denial of service-
1237 attacks, in which the attacker carefully pre-computes a set of different-
1238 keys that are going to be hashed in the same bucket of a hash table (or-
1239 even have the very same hash value). The attack aims at getting the-
1240 worst-case algorithmic behavior (O(n) instead of amortized O(1), see-
1241 \l{Algorithmic Complexity} for the details) when the data is fed into the-
1242 table.-
1243-
1244 In order to avoid this worst-case behavior, the calculation of the hash-
1245 value done by qHash() can be salted by a random seed, that nullifies the-
1246 attack's extent. This seed is automatically generated by QHash once per-
1247 process, and then passed by QHash as the second argument of the-
1248 two-arguments overload of the qHash() function.-
1249-
1250 This randomization of QHash is enabled by default. Even though programs-
1251 should never depend on a particular QHash ordering, there may be situations-
1252 where you temporarily need deterministic behavior, for example for debugging or-
1253 regression testing. To disable the randomization, define the environment-
1254 variable \c QT_HASH_SEED. The contents of that variable, interpreted as a-
1255 decimal value, will be used as the seed for qHash(). Alternatively, you can-
1256 call the qSetGlobalQHashSeed() function.-
1257-
1258 \sa QHashIterator, QMutableHashIterator, QMap, QSet-
1259*/-
1260-
1261/*! \fn QHash::QHash()-
1262-
1263 Constructs an empty hash.-
1264-
1265 \sa clear()-
1266*/-
1267-
1268/*!-
1269 \fn QHash::QHash(QHash &&other)-
1270-
1271 Move-constructs a QHash instance, making it point at the same-
1272 object that \a other was pointing to.-
1273-
1274 \since 5.2-
1275*/-
1276-
1277/*! \fn QHash::QHash(std::initializer_list<std::pair<Key,T> > list)-
1278 \since 5.1-
1279-
1280 Constructs a hash with a copy of each of the elements in the-
1281 initializer list \a list.-
1282-
1283 This function is only available if the program is being-
1284 compiled in C++11 mode.-
1285*/-
1286-
1287/*! \fn QHash::QHash(const QHash &other)-
1288-
1289 Constructs a copy of \a other.-
1290-
1291 This operation occurs in \l{constant time}, because QHash is-
1292 \l{implicitly shared}. This makes returning a QHash from a-
1293 function very fast. If a shared instance is modified, it will be-
1294 copied (copy-on-write), and this takes \l{linear time}.-
1295-
1296 \sa operator=()-
1297*/-
1298-
1299/*! \fn QHash::~QHash()-
1300-
1301 Destroys the hash. References to the values in the hash and all-
1302 iterators of this hash become invalid.-
1303*/-
1304-
1305/*! \fn QHash &QHash::operator=(const QHash &other)-
1306-
1307 Assigns \a other to this hash and returns a reference to this hash.-
1308*/-
1309-
1310/*!-
1311 \fn QHash &QHash::operator=(QHash &&other)-
1312-
1313 Move-assigns \a other to this QHash instance.-
1314-
1315 \since 5.2-
1316*/-
1317-
1318/*! \fn void QHash::swap(QHash &other)-
1319 \since 4.8-
1320-
1321 Swaps hash \a other with this hash. This operation is very-
1322 fast and never fails.-
1323*/-
1324-
1325/*! \fn void QMultiHash::swap(QMultiHash &other)-
1326 \since 4.8-
1327-
1328 Swaps hash \a other with this hash. This operation is very-
1329 fast and never fails.-
1330*/-
1331-
1332/*! \fn bool QHash::operator==(const QHash &other) const-
1333-
1334 Returns \c true if \a other is equal to this hash; otherwise returns-
1335 false.-
1336-
1337 Two hashes are considered equal if they contain the same (key,-
1338 value) pairs.-
1339-
1340 This function requires the value type to implement \c operator==().-
1341-
1342 \sa operator!=()-
1343*/-
1344-
1345/*! \fn bool QHash::operator!=(const QHash &other) const-
1346-
1347 Returns \c true if \a other is not equal to this hash; otherwise-
1348 returns \c false.-
1349-
1350 Two hashes are considered equal if they contain the same (key,-
1351 value) pairs.-
1352-
1353 This function requires the value type to implement \c operator==().-
1354-
1355 \sa operator==()-
1356*/-
1357-
1358/*! \fn int QHash::size() const-
1359-
1360 Returns the number of items in the hash.-
1361-
1362 \sa isEmpty(), count()-
1363*/-
1364-
1365/*! \fn bool QHash::isEmpty() const-
1366-
1367 Returns \c true if the hash contains no items; otherwise returns-
1368 false.-
1369-
1370 \sa size()-
1371*/-
1372-
1373/*! \fn int QHash::capacity() const-
1374-
1375 Returns the number of buckets in the QHash's internal hash table.-
1376-
1377 The sole purpose of this function is to provide a means of fine-
1378 tuning QHash's memory usage. In general, you will rarely ever-
1379 need to call this function. If you want to know how many items are-
1380 in the hash, call size().-
1381-
1382 \sa reserve(), squeeze()-
1383*/-
1384-
1385/*! \fn void QHash::reserve(int size)-
1386-
1387 Ensures that the QHash's internal hash table consists of at least-
1388 \a size buckets.-
1389-
1390 This function is useful for code that needs to build a huge hash-
1391 and wants to avoid repeated reallocation. For example:-
1392-
1393 \snippet code/src_corelib_tools_qhash.cpp 14-
1394-
1395 Ideally, \a size should be slightly more than the maximum number-
1396 of items expected in the hash. \a size doesn't have to be prime,-
1397 because QHash will use a prime number internally anyway. If \a size-
1398 is an underestimate, the worst that will happen is that the QHash-
1399 will be a bit slower.-
1400-
1401 In general, you will rarely ever need to call this function.-
1402 QHash's internal hash table automatically shrinks or grows to-
1403 provide good performance without wasting too much memory.-
1404-
1405 \sa squeeze(), capacity()-
1406*/-
1407-
1408/*! \fn void QHash::squeeze()-
1409-
1410 Reduces the size of the QHash's internal hash table to save-
1411 memory.-
1412-
1413 The sole purpose of this function is to provide a means of fine-
1414 tuning QHash's memory usage. In general, you will rarely ever-
1415 need to call this function.-
1416-
1417 \sa reserve(), capacity()-
1418*/-
1419-
1420/*! \fn void QHash::detach()-
1421-
1422 \internal-
1423-
1424 Detaches this hash from any other hashes with which it may share-
1425 data.-
1426-
1427 \sa isDetached()-
1428*/-
1429-
1430/*! \fn bool QHash::isDetached() const-
1431-
1432 \internal-
1433-
1434 Returns \c true if the hash's internal data isn't shared with any-
1435 other hash object; otherwise returns \c false.-
1436-
1437 \sa detach()-
1438*/-
1439-
1440/*! \fn void QHash::setSharable(bool sharable)-
1441-
1442 \internal-
1443*/-
1444-
1445/*! \fn bool QHash::isSharedWith(const QHash &other) const-
1446-
1447 \internal-
1448*/-
1449-
1450/*! \fn void QHash::clear()-
1451-
1452 Removes all items from the hash.-
1453-
1454 \sa remove()-
1455*/-
1456-
1457/*! \fn int QHash::remove(const Key &key)-
1458-
1459 Removes all the items that have the \a key from the hash.-
1460 Returns the number of items removed which is usually 1 but will-
1461 be 0 if the key isn't in the hash, or greater than 1 if-
1462 insertMulti() has been used with the \a key.-
1463-
1464 \sa clear(), take(), QMultiHash::remove()-
1465*/-
1466-
1467/*! \fn T QHash::take(const Key &key)-
1468-
1469 Removes the item with the \a key from the hash and returns-
1470 the value associated with it.-
1471-
1472 If the item does not exist in the hash, the function simply-
1473 returns a \l{default-constructed value}. If there are multiple-
1474 items for \a key in the hash, only the most recently inserted one-
1475 is removed.-
1476-
1477 If you don't use the return value, remove() is more efficient.-
1478-
1479 \sa remove()-
1480*/-
1481-
1482/*! \fn bool QHash::contains(const Key &key) const-
1483-
1484 Returns \c true if the hash contains an item with the \a key;-
1485 otherwise returns \c false.-
1486-
1487 \sa count(), QMultiHash::contains()-
1488*/-
1489-
1490/*! \fn const T QHash::value(const Key &key) const-
1491-
1492 Returns the value associated with the \a key.-
1493-
1494 If the hash contains no item with the \a key, the function-
1495 returns a \l{default-constructed value}. If there are multiple-
1496 items for the \a key in the hash, the value of the most recently-
1497 inserted one is returned.-
1498-
1499 \sa key(), values(), contains(), operator[]()-
1500*/-
1501-
1502/*! \fn const T QHash::value(const Key &key, const T &defaultValue) const-
1503 \overload-
1504-
1505 If the hash contains no item with the given \a key, the function returns-
1506 \a defaultValue.-
1507*/-
1508-
1509/*! \fn T &QHash::operator[](const Key &key)-
1510-
1511 Returns the value associated with the \a key as a modifiable-
1512 reference.-
1513-
1514 If the hash contains no item with the \a key, the function inserts-
1515 a \l{default-constructed value} into the hash with the \a key, and-
1516 returns a reference to it. If the hash contains multiple items-
1517 with the \a key, this function returns a reference to the most-
1518 recently inserted value.-
1519-
1520 \sa insert(), value()-
1521*/-
1522-
1523/*! \fn const T QHash::operator[](const Key &key) const-
1524-
1525 \overload-
1526-
1527 Same as value().-
1528*/-
1529-
1530/*! \fn QList<Key> QHash::uniqueKeys() const-
1531 \since 4.2-
1532-
1533 Returns a list containing all the keys in the map. Keys that occur multiple-
1534 times in the map (because items were inserted with insertMulti(), or-
1535 unite() was used) occur only once in the returned list.-
1536-
1537 \sa keys(), values()-
1538*/-
1539-
1540/*! \fn QList<Key> QHash::keys() const-
1541-
1542 Returns a list containing all the keys in the hash, in an-
1543 arbitrary order. Keys that occur multiple times in the hash-
1544 (because items were inserted with insertMulti(), or unite() was-
1545 used) also occur multiple times in the list.-
1546-
1547 To obtain a list of unique keys, where each key from the map only-
1548 occurs once, use uniqueKeys().-
1549-
1550 The order is guaranteed to be the same as that used by values().-
1551-
1552 \sa uniqueKeys(), values(), key()-
1553*/-
1554-
1555/*! \fn QList<Key> QHash::keys(const T &value) const-
1556-
1557 \overload-
1558-
1559 Returns a list containing all the keys associated with value \a-
1560 value, in an arbitrary order.-
1561-
1562 This function can be slow (\l{linear time}), because QHash's-
1563 internal data structure is optimized for fast lookup by key, not-
1564 by value.-
1565*/-
1566-
1567/*! \fn QList<T> QHash::values() const-
1568-
1569 Returns a list containing all the values in the hash, in an-
1570 arbitrary order. If a key is associated with multiple values, all of-
1571 its values will be in the list, and not just the most recently-
1572 inserted one.-
1573-
1574 The order is guaranteed to be the same as that used by keys().-
1575-
1576 \sa keys(), value()-
1577*/-
1578-
1579/*! \fn QList<T> QHash::values(const Key &key) const-
1580-
1581 \overload-
1582-
1583 Returns a list of all the values associated with the \a key,-
1584 from the most recently inserted to the least recently inserted.-
1585-
1586 \sa count(), insertMulti()-
1587*/-
1588-
1589/*! \fn Key QHash::key(const T &value) const-
1590-
1591 Returns the first key mapped to \a value.-
1592-
1593 If the hash contains no item with the \a value, the function-
1594 returns a \l{default-constructed value}{default-constructed key}.-
1595-
1596 This function can be slow (\l{linear time}), because QHash's-
1597 internal data structure is optimized for fast lookup by key, not-
1598 by value.-
1599-
1600 \sa value(), keys()-
1601*/-
1602-
1603/*!-
1604 \fn Key QHash::key(const T &value, const Key &defaultKey) const-
1605 \since 4.3-
1606 \overload-
1607-
1608 Returns the first key mapped to \a value, or \a defaultKey if the-
1609 hash contains no item mapped to \a value.-
1610-
1611 This function can be slow (\l{linear time}), because QHash's-
1612 internal data structure is optimized for fast lookup by key, not-
1613 by value.-
1614*/-
1615-
1616/*! \fn int QHash::count(const Key &key) const-
1617-
1618 Returns the number of items associated with the \a key.-
1619-
1620 \sa contains(), insertMulti()-
1621*/-
1622-
1623/*! \fn int QHash::count() const-
1624-
1625 \overload-
1626-
1627 Same as size().-
1628*/-
1629-
1630/*! \fn QHash::iterator QHash::begin()-
1631-
1632 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the first item in-
1633 the hash.-
1634-
1635 \sa constBegin(), end()-
1636*/-
1637-
1638/*! \fn QHash::const_iterator QHash::begin() const-
1639-
1640 \overload-
1641*/-
1642-
1643/*! \fn QHash::const_iterator QHash::cbegin() const-
1644 \since 5.0-
1645-
1646 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item-
1647 in the hash.-
1648-
1649 \sa begin(), cend()-
1650*/-
1651-
1652/*! \fn QHash::const_iterator QHash::constBegin() const-
1653-
1654 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first item-
1655 in the hash.-
1656-
1657 \sa begin(), constEnd()-
1658*/-
1659-
1660/*! \fn QHash::key_iterator QHash::keyBegin() const-
1661 \since 5.6-
1662-
1663 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the first key-
1664 in the hash.-
1665-
1666 \sa keyEnd()-
1667*/-
1668-
1669/*! \fn QHash::iterator QHash::end()-
1670-
1671 Returns an \l{STL-style iterators}{STL-style iterator} pointing to the imaginary item-
1672 after the last item in the hash.-
1673-
1674 \sa begin(), constEnd()-
1675*/-
1676-
1677/*! \fn QHash::const_iterator QHash::end() const-
1678-
1679 \overload-
1680*/-
1681-
1682/*! \fn QHash::const_iterator QHash::constEnd() const-
1683-
1684 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary-
1685 item after the last item in the hash.-
1686-
1687 \sa constBegin(), end()-
1688*/-
1689-
1690/*! \fn QHash::const_iterator QHash::cend() const-
1691 \since 5.0-
1692-
1693 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary-
1694 item after the last item in the hash.-
1695-
1696 \sa cbegin(), end()-
1697*/-
1698-
1699/*! \fn QHash::key_iterator QHash::keyEnd() const-
1700 \since 5.6-
1701-
1702 Returns a const \l{STL-style iterators}{STL-style iterator} pointing to the imaginary-
1703 item after the last key in the hash.-
1704-
1705 \sa keyBegin()-
1706*/-
1707-
1708/*! \fn QHash::iterator QHash::erase(const_iterator pos)-
1709 \since 5.7-
1710-
1711 Removes the (key, value) pair associated with the iterator \a pos-
1712 from the hash, and returns an iterator to the next item in the-
1713 hash.-
1714-
1715 Unlike remove() and take(), this function never causes QHash to-
1716 rehash its internal data structure. This means that it can safely-
1717 be called while iterating, and won't affect the order of items in-
1718 the hash. For example:-
1719-
1720 \snippet code/src_corelib_tools_qhash.cpp 15-
1721-
1722 \sa remove(), take(), find()-
1723*/-
1724-
1725/*! \fn QHash::iterator QHash::erase(iterator pos)-
1726 \overload-
1727*/-
1728-
1729/*! \fn QHash::iterator QHash::find(const Key &key)-
1730-
1731 Returns an iterator pointing to the item with the \a key in the-
1732 hash.-
1733-
1734 If the hash contains no item with the \a key, the function-
1735 returns end().-
1736-
1737 If the hash contains multiple items with the \a key, this-
1738 function returns an iterator that points to the most recently-
1739 inserted value. The other values are accessible by incrementing-
1740 the iterator. For example, here's some code that iterates over all-
1741 the items with the same key:-
1742-
1743 \snippet code/src_corelib_tools_qhash.cpp 16-
1744-
1745 \sa value(), values(), QMultiHash::find()-
1746*/-
1747-
1748/*! \fn QHash::const_iterator QHash::find(const Key &key) const-
1749-
1750 \overload-
1751*/-
1752-
1753/*! \fn QHash::const_iterator QHash::constFind(const Key &key) const-
1754 \since 4.1-
1755-
1756 Returns an iterator pointing to the item with the \a key in the-
1757 hash.-
1758-
1759 If the hash contains no item with the \a key, the function-
1760 returns constEnd().-
1761-
1762 \sa find(), QMultiHash::constFind()-
1763*/-
1764-
1765/*! \fn QHash::iterator QHash::insert(const Key &key, const T &value)-
1766-
1767 Inserts a new item with the \a key and a value of \a value.-
1768-
1769 If there is already an item with the \a key, that item's value-
1770 is replaced with \a value.-
1771-
1772 If there are multiple items with the \a key, the most-
1773 recently inserted item's value is replaced with \a value.-
1774-
1775 \sa insertMulti()-
1776*/-
1777-
1778/*! \fn QHash::iterator QHash::insertMulti(const Key &key, const T &value)-
1779-
1780 Inserts a new item with the \a key and a value of \a value.-
1781-
1782 If there is already an item with the same key in the hash, this-
1783 function will simply create a new one. (This behavior is-
1784 different from insert(), which overwrites the value of an-
1785 existing item.)-
1786-
1787 \sa insert(), values()-
1788*/-
1789-
1790/*! \fn QHash &QHash::unite(const QHash &other)-
1791-
1792 Inserts all the items in the \a other hash into this hash. If a-
1793 key is common to both hashes, the resulting hash will contain the-
1794 key multiple times.-
1795-
1796 \sa insertMulti()-
1797*/-
1798-
1799/*! \fn bool QHash::empty() const-
1800-
1801 This function is provided for STL compatibility. It is equivalent-
1802 to isEmpty(), returning true if the hash is empty; otherwise-
1803 returns \c false.-
1804*/-
1805-
1806/*! \fn QPair<iterator, iterator> QHash::equal_range(const Key &key)-
1807 \since 5.7-
1808-
1809 Returns a pair of iterators delimiting the range of values \c{[first, second)}, that-
1810 are stored under \a key. If the range is empty then both iterators will be equal to end().-
1811*/-
1812-
1813/*!-
1814 \fn QPair<const_iterator, const_iterator> QHash::equal_range(const Key &key) const-
1815 \overload-
1816 \since 5.7-
1817*/-
1818-
1819/*! \typedef QHash::ConstIterator-
1820-
1821 Qt-style synonym for QHash::const_iterator.-
1822*/-
1823-
1824/*! \typedef QHash::Iterator-
1825-
1826 Qt-style synonym for QHash::iterator.-
1827*/-
1828-
1829/*! \typedef QHash::difference_type-
1830-
1831 Typedef for ptrdiff_t. Provided for STL compatibility.-
1832*/-
1833-
1834/*! \typedef QHash::key_type-
1835-
1836 Typedef for Key. Provided for STL compatibility.-
1837*/-
1838-
1839/*! \typedef QHash::mapped_type-
1840-
1841 Typedef for T. Provided for STL compatibility.-
1842*/-
1843-
1844/*! \typedef QHash::size_type-
1845-
1846 Typedef for int. Provided for STL compatibility.-
1847*/-
1848-
1849/*! \typedef QHash::iterator::difference_type-
1850 \internal-
1851*/-
1852-
1853/*! \typedef QHash::iterator::iterator_category-
1854 \internal-
1855*/-
1856-
1857/*! \typedef QHash::iterator::pointer-
1858 \internal-
1859*/-
1860-
1861/*! \typedef QHash::iterator::reference-
1862 \internal-
1863*/-
1864-
1865/*! \typedef QHash::iterator::value_type-
1866 \internal-
1867*/-
1868-
1869/*! \typedef QHash::const_iterator::difference_type-
1870 \internal-
1871*/-
1872-
1873/*! \typedef QHash::const_iterator::iterator_category-
1874 \internal-
1875*/-
1876-
1877/*! \typedef QHash::const_iterator::pointer-
1878 \internal-
1879*/-
1880-
1881/*! \typedef QHash::const_iterator::reference-
1882 \internal-
1883*/-
1884-
1885/*! \typedef QHash::const_iterator::value_type-
1886 \internal-
1887*/-
1888-
1889/*! \typedef QHash::key_iterator::difference_type-
1890 \internal-
1891*/-
1892-
1893/*! \typedef QHash::key_iterator::iterator_category-
1894 \internal-
1895*/-
1896-
1897/*! \typedef QHash::key_iterator::pointer-
1898 \internal-
1899*/-
1900-
1901/*! \typedef QHash::key_iterator::reference-
1902 \internal-
1903*/-
1904-
1905/*! \typedef QHash::key_iterator::value_type-
1906 \internal-
1907*/-
1908-
1909/*! \class QHash::iterator-
1910 \inmodule QtCore-
1911 \brief The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.-
1912-
1913 QHash features both \l{STL-style iterators} and \l{Java-style-
1914 iterators}. The STL-style iterators are more low-level and more-
1915 cumbersome to use; on the other hand, they are slightly faster-
1916 and, for developers who already know STL, have the advantage of-
1917 familiarity.-
1918-
1919 QHash\<Key, T\>::iterator allows you to iterate over a QHash (or-
1920 QMultiHash) and to modify the value (but not the key) associated-
1921 with a particular key. If you want to iterate over a const QHash,-
1922 you should use QHash::const_iterator. It is generally good-
1923 practice to use QHash::const_iterator on a non-const QHash as-
1924 well, unless you need to change the QHash through the iterator.-
1925 Const iterators are slightly faster, and can improve code-
1926 readability.-
1927-
1928 The default QHash::iterator constructor creates an uninitialized-
1929 iterator. You must initialize it using a QHash function like-
1930 QHash::begin(), QHash::end(), or QHash::find() before you can-
1931 start iterating. Here's a typical loop that prints all the (key,-
1932 value) pairs stored in a hash:-
1933-
1934 \snippet code/src_corelib_tools_qhash.cpp 17-
1935-
1936 Unlike QMap, which orders its items by key, QHash stores its-
1937 items in an arbitrary order. The only guarantee is that items that-
1938 share the same key (because they were inserted using-
1939 QHash::insertMulti()) will appear consecutively, from the most-
1940 recently to the least recently inserted value.-
1941-
1942 Let's see a few examples of things we can do with a-
1943 QHash::iterator that we cannot do with a QHash::const_iterator.-
1944 Here's an example that increments every value stored in the QHash-
1945 by 2:-
1946-
1947 \snippet code/src_corelib_tools_qhash.cpp 18-
1948-
1949 Here's an example that removes all the items whose key is a-
1950 string that starts with an underscore character:-
1951-
1952 \snippet code/src_corelib_tools_qhash.cpp 19-
1953-
1954 The call to QHash::erase() removes the item pointed to by the-
1955 iterator from the hash, and returns an iterator to the next item.-
1956 Here's another way of removing an item while iterating:-
1957-
1958 \snippet code/src_corelib_tools_qhash.cpp 20-
1959-
1960 It might be tempting to write code like this:-
1961-
1962 \snippet code/src_corelib_tools_qhash.cpp 21-
1963-
1964 However, this will potentially crash in \c{++i}, because \c i is-
1965 a dangling iterator after the call to erase().-
1966-
1967 Multiple iterators can be used on the same hash. However, be-
1968 aware that any modification performed directly on the QHash has-
1969 the potential of dramatically changing the order in which the-
1970 items are stored in the hash, as they might cause QHash to rehash-
1971 its internal data structure. There is one notable exception:-
1972 QHash::erase(). This function can safely be called while-
1973 iterating, and won't affect the order of items in the hash. If you-
1974 need to keep iterators over a long period of time, we recommend-
1975 that you use QMap rather than QHash.-
1976-
1977 \warning Iterators on implicitly shared containers do not work-
1978 exactly like STL-iterators. You should avoid copying a container-
1979 while iterators are active on that container. For more information,-
1980 read \l{Implicit sharing iterator problem}.-
1981-
1982 \sa QHash::const_iterator, QHash::key_iterator, QMutableHashIterator-
1983*/-
1984-
1985/*! \fn QHash::iterator::iterator()-
1986-
1987 Constructs an uninitialized iterator.-
1988-
1989 Functions like key(), value(), and operator++() must not be-
1990 called on an uninitialized iterator. Use operator=() to assign a-
1991 value to it before using it.-
1992-
1993 \sa QHash::begin(), QHash::end()-
1994*/-
1995-
1996/*! \fn QHash::iterator::iterator(void *node)-
1997-
1998 \internal-
1999*/-
2000-
2001/*! \fn const Key &QHash::iterator::key() const-
2002-
2003 Returns the current item's key as a const reference.-
2004-
2005 There is no direct way of changing an item's key through an-
2006 iterator, although it can be done by calling QHash::erase()-
2007 followed by QHash::insert() or QHash::insertMulti().-
2008-
2009 \sa value()-
2010*/-
2011-
2012/*! \fn T &QHash::iterator::value() const-
2013-
2014 Returns a modifiable reference to the current item's value.-
2015-
2016 You can change the value of an item by using value() on-
2017 the left side of an assignment, for example:-
2018-
2019 \snippet code/src_corelib_tools_qhash.cpp 22-
2020-
2021 \sa key(), operator*()-
2022*/-
2023-
2024/*! \fn T &QHash::iterator::operator*() const-
2025-
2026 Returns a modifiable reference to the current item's value.-
2027-
2028 Same as value().-
2029-
2030 \sa key()-
2031*/-
2032-
2033/*! \fn T *QHash::iterator::operator->() const-
2034-
2035 Returns a pointer to the current item's value.-
2036-
2037 \sa value()-
2038*/-
2039-
2040/*!-
2041 \fn bool QHash::iterator::operator==(const iterator &other) const-
2042 \fn bool QHash::iterator::operator==(const const_iterator &other) const-
2043-
2044 Returns \c true if \a other points to the same item as this-
2045 iterator; otherwise returns \c false.-
2046-
2047 \sa operator!=()-
2048*/-
2049-
2050/*!-
2051 \fn bool QHash::iterator::operator!=(const iterator &other) const-
2052 \fn bool QHash::iterator::operator!=(const const_iterator &other) const-
2053-
2054 Returns \c true if \a other points to a different item than this-
2055 iterator; otherwise returns \c false.-
2056-
2057 \sa operator==()-
2058*/-
2059-
2060/*!-
2061 \fn QHash::iterator &QHash::iterator::operator++()-
2062-
2063 The prefix ++ operator (\c{++i}) advances the iterator to the-
2064 next item in the hash and returns an iterator to the new current-
2065 item.-
2066-
2067 Calling this function on QHash::end() leads to undefined results.-
2068-
2069 \sa operator--()-
2070*/-
2071-
2072/*! \fn QHash::iterator QHash::iterator::operator++(int)-
2073-
2074 \overload-
2075-
2076 The postfix ++ operator (\c{i++}) advances the iterator to the-
2077 next item in the hash and returns an iterator to the previously-
2078 current item.-
2079*/-
2080-
2081/*!-
2082 \fn QHash::iterator &QHash::iterator::operator--()-
2083-
2084 The prefix -- operator (\c{--i}) makes the preceding item-
2085 current and returns an iterator pointing to the new current item.-
2086-
2087 Calling this function on QHash::begin() leads to undefined-
2088 results.-
2089-
2090 \sa operator++()-
2091*/-
2092-
2093/*!-
2094 \fn QHash::iterator QHash::iterator::operator--(int)-
2095-
2096 \overload-
2097-
2098 The postfix -- operator (\c{i--}) makes the preceding item-
2099 current and returns an iterator pointing to the previously-
2100 current item.-
2101*/-
2102-
2103/*! \fn QHash::iterator QHash::iterator::operator+(int j) const-
2104-
2105 Returns an iterator to the item at \a j positions forward from-
2106 this iterator. (If \a j is negative, the iterator goes backward.)-
2107-
2108 This operation can be slow for large \a j values.-
2109-
2110 \sa operator-()-
2111-
2112*/-
2113-
2114/*! \fn QHash::iterator QHash::iterator::operator-(int j) const-
2115-
2116 Returns an iterator to the item at \a j positions backward from-
2117 this iterator. (If \a j is negative, the iterator goes forward.)-
2118-
2119 This operation can be slow for large \a j values.-
2120-
2121 \sa operator+()-
2122*/-
2123-
2124/*! \fn QHash::iterator &QHash::iterator::operator+=(int j)-
2125-
2126 Advances the iterator by \a j items. (If \a j is negative, the-
2127 iterator goes backward.)-
2128-
2129 \sa operator-=(), operator+()-
2130*/-
2131-
2132/*! \fn QHash::iterator &QHash::iterator::operator-=(int j)-
2133-
2134 Makes the iterator go back by \a j items. (If \a j is negative,-
2135 the iterator goes forward.)-
2136-
2137 \sa operator+=(), operator-()-
2138*/-
2139-
2140/*! \class QHash::const_iterator-
2141 \inmodule QtCore-
2142 \brief The QHash::const_iterator class provides an STL-style const iterator for QHash and QMultiHash.-
2143-
2144 QHash features both \l{STL-style iterators} and \l{Java-style-
2145 iterators}. The STL-style iterators are more low-level and more-
2146 cumbersome to use; on the other hand, they are slightly faster-
2147 and, for developers who already know STL, have the advantage of-
2148 familiarity.-
2149-
2150 QHash\<Key, T\>::const_iterator allows you to iterate over a-
2151 QHash (or a QMultiHash). If you want to modify the QHash as you-
2152 iterate over it, you must use QHash::iterator instead. It is-
2153 generally good practice to use QHash::const_iterator on a-
2154 non-const QHash as well, unless you need to change the QHash-
2155 through the iterator. Const iterators are slightly faster, and-
2156 can improve code readability.-
2157-
2158 The default QHash::const_iterator constructor creates an-
2159 uninitialized iterator. You must initialize it using a QHash-
2160 function like QHash::constBegin(), QHash::constEnd(), or-
2161 QHash::find() before you can start iterating. Here's a typical-
2162 loop that prints all the (key, value) pairs stored in a hash:-
2163-
2164 \snippet code/src_corelib_tools_qhash.cpp 23-
2165-
2166 Unlike QMap, which orders its items by key, QHash stores its-
2167 items in an arbitrary order. The only guarantee is that items that-
2168 share the same key (because they were inserted using-
2169 QHash::insertMulti()) will appear consecutively, from the most-
2170 recently to the least recently inserted value.-
2171-
2172 Multiple iterators can be used on the same hash. However, be aware-
2173 that any modification performed directly on the QHash has the-
2174 potential of dramatically changing the order in which the items-
2175 are stored in the hash, as they might cause QHash to rehash its-
2176 internal data structure. If you need to keep iterators over a long-
2177 period of time, we recommend that you use QMap rather than QHash.-
2178-
2179 \warning Iterators on implicitly shared containers do not work-
2180 exactly like STL-iterators. You should avoid copying a container-
2181 while iterators are active on that container. For more information,-
2182 read \l{Implicit sharing iterator problem}.-
2183-
2184 \sa QHash::iterator, QHashIterator-
2185*/-
2186-
2187/*! \fn QHash::const_iterator::const_iterator()-
2188-
2189 Constructs an uninitialized iterator.-
2190-
2191 Functions like key(), value(), and operator++() must not be-
2192 called on an uninitialized iterator. Use operator=() to assign a-
2193 value to it before using it.-
2194-
2195 \sa QHash::constBegin(), QHash::constEnd()-
2196*/-
2197-
2198/*! \fn QHash::const_iterator::const_iterator(void *node)-
2199-
2200 \internal-
2201*/-
2202-
2203/*! \fn QHash::const_iterator::const_iterator(const iterator &other)-
2204-
2205 Constructs a copy of \a other.-
2206*/-
2207-
2208/*! \fn const Key &QHash::const_iterator::key() const-
2209-
2210 Returns the current item's key.-
2211-
2212 \sa value()-
2213*/-
2214-
2215/*! \fn const T &QHash::const_iterator::value() const-
2216-
2217 Returns the current item's value.-
2218-
2219 \sa key(), operator*()-
2220*/-
2221-
2222/*! \fn const T &QHash::const_iterator::operator*() const-
2223-
2224 Returns the current item's value.-
2225-
2226 Same as value().-
2227-
2228 \sa key()-
2229*/-
2230-
2231/*! \fn const T *QHash::const_iterator::operator->() const-
2232-
2233 Returns a pointer to the current item's value.-
2234-
2235 \sa value()-
2236*/-
2237-
2238/*! \fn bool QHash::const_iterator::operator==(const const_iterator &other) const-
2239-
2240 Returns \c true if \a other points to the same item as this-
2241 iterator; otherwise returns \c false.-
2242-
2243 \sa operator!=()-
2244*/-
2245-
2246/*! \fn bool QHash::const_iterator::operator!=(const const_iterator &other) const-
2247-
2248 Returns \c true if \a other points to a different item than this-
2249 iterator; otherwise returns \c false.-
2250-
2251 \sa operator==()-
2252*/-
2253-
2254/*!-
2255 \fn QHash::const_iterator &QHash::const_iterator::operator++()-
2256-
2257 The prefix ++ operator (\c{++i}) advances the iterator to the-
2258 next item in the hash and returns an iterator to the new current-
2259 item.-
2260-
2261 Calling this function on QHash::end() leads to undefined results.-
2262-
2263 \sa operator--()-
2264*/-
2265-
2266/*! \fn QHash::const_iterator QHash::const_iterator::operator++(int)-
2267-
2268 \overload-
2269-
2270 The postfix ++ operator (\c{i++}) advances the iterator to the-
2271 next item in the hash and returns an iterator to the previously-
2272 current item.-
2273*/-
2274-
2275/*! \fn QHash::const_iterator &QHash::const_iterator::operator--()-
2276-
2277 The prefix -- operator (\c{--i}) makes the preceding item-
2278 current and returns an iterator pointing to the new current item.-
2279-
2280 Calling this function on QHash::begin() leads to undefined-
2281 results.-
2282-
2283 \sa operator++()-
2284*/-
2285-
2286/*! \fn QHash::const_iterator QHash::const_iterator::operator--(int)-
2287-
2288 \overload-
2289-
2290 The postfix -- operator (\c{i--}) makes the preceding item-
2291 current and returns an iterator pointing to the previously-
2292 current item.-
2293*/-
2294-
2295/*! \fn QHash::const_iterator QHash::const_iterator::operator+(int j) const-
2296-
2297 Returns an iterator to the item at \a j positions forward from-
2298 this iterator. (If \a j is negative, the iterator goes backward.)-
2299-
2300 This operation can be slow for large \a j values.-
2301-
2302 \sa operator-()-
2303*/-
2304-
2305/*! \fn QHash::const_iterator QHash::const_iterator::operator-(int j) const-
2306-
2307 Returns an iterator to the item at \a j positions backward from-
2308 this iterator. (If \a j is negative, the iterator goes forward.)-
2309-
2310 This operation can be slow for large \a j values.-
2311-
2312 \sa operator+()-
2313*/-
2314-
2315/*! \fn QHash::const_iterator &QHash::const_iterator::operator+=(int j)-
2316-
2317 Advances the iterator by \a j items. (If \a j is negative, the-
2318 iterator goes backward.)-
2319-
2320 This operation can be slow for large \a j values.-
2321-
2322 \sa operator-=(), operator+()-
2323*/-
2324-
2325/*! \fn QHash::const_iterator &QHash::const_iterator::operator-=(int j)-
2326-
2327 Makes the iterator go back by \a j items. (If \a j is negative,-
2328 the iterator goes forward.)-
2329-
2330 This operation can be slow for large \a j values.-
2331-
2332 \sa operator+=(), operator-()-
2333*/-
2334-
2335/*! \class QHash::key_iterator-
2336 \inmodule QtCore-
2337 \since 5.6-
2338 \brief The QHash::key_iterator class provides an STL-style const iterator for QHash and QMultiHash keys.-
2339-
2340 QHash::key_iterator is essentially the same as QHash::const_iterator-
2341 with the difference that operator*() and operator->() return a key-
2342 instead of a value.-
2343-
2344 For most uses QHash::iterator and QHash::const_iterator should be used,-
2345 you can easily access the key by calling QHash::iterator::key():-
2346-
2347 \snippet code/src_corelib_tools_qhash.cpp 27-
2348-
2349 However, to have interoperability between QHash's keys and STL-style-
2350 algorithms we need an iterator that dereferences to a key instead-
2351 of a value. With QHash::key_iterator we can apply an algorithm to a-
2352 range of keys without having to call QHash::keys(), which is inefficient-
2353 as it costs one QHash iteration and memory allocation to create a temporary-
2354 QList.-
2355-
2356 \snippet code/src_corelib_tools_qhash.cpp 28-
2357-
2358 QHash::key_iterator is const, it's not possible to modify the key.-
2359-
2360 The default QHash::key_iterator constructor creates an uninitialized-
2361 iterator. You must initialize it using a QHash function like-
2362 QHash::keyBegin() or QHash::keyEnd().-
2363-
2364 \warning Iterators on implicitly shared containers do not work-
2365 exactly like STL-iterators. You should avoid copying a container-
2366 while iterators are active on that container. For more information,-
2367 read \l{Implicit sharing iterator problem}.-
2368-
2369 \sa QHash::const_iterator, QHash::iterator-
2370*/-
2371-
2372/*! \fn const T &QHash::key_iterator::operator*() const-
2373-
2374 Returns the current item's key.-
2375*/-
2376-
2377/*! \fn const T *QHash::key_iterator::operator->() const-
2378-
2379 Returns a pointer to the current item's key.-
2380*/-
2381-
2382/*! \fn bool QHash::key_iterator::operator==(key_iterator other) const-
2383-
2384 Returns \c true if \a other points to the same item as this-
2385 iterator; otherwise returns \c false.-
2386-
2387 \sa operator!=()-
2388*/-
2389-
2390/*! \fn bool QHash::key_iterator::operator!=(key_iterator other) const-
2391-
2392 Returns \c true if \a other points to a different item than this-
2393 iterator; otherwise returns \c false.-
2394-
2395 \sa operator==()-
2396*/-
2397-
2398/*!-
2399 \fn QHash::key_iterator &QHash::key_iterator::operator++()-
2400-
2401 The prefix ++ operator (\c{++i}) advances the iterator to the-
2402 next item in the hash and returns an iterator to the new current-
2403 item.-
2404-
2405 Calling this function on QHash::keyEnd() leads to undefined results.-
2406-
2407 \sa operator--()-
2408*/-
2409-
2410/*! \fn QHash::key_iterator QHash::key_iterator::operator++(int)-
2411-
2412 \overload-
2413-
2414 The postfix ++ operator (\c{i++}) advances the iterator to the-
2415 next item in the hash and returns an iterator to the previous-
2416 item.-
2417*/-
2418-
2419/*! \fn QHash::key_iterator &QHash::key_iterator::operator--()-
2420-
2421 The prefix -- operator (\c{--i}) makes the preceding item-
2422 current and returns an iterator pointing to the new current item.-
2423-
2424 Calling this function on QHash::keyBegin() leads to undefined-
2425 results.-
2426-
2427 \sa operator++()-
2428*/-
2429-
2430/*! \fn QHash::key_iterator QHash::key_iterator::operator--(int)-
2431-
2432 \overload-
2433-
2434 The postfix -- operator (\c{i--}) makes the preceding item-
2435 current and returns an iterator pointing to the previous-
2436 item.-
2437*/-
2438-
2439/*! \fn const_iterator QHash::key_iterator::base() const-
2440 Returns the underlying const_iterator this key_iterator is based on.-
2441*/-
2442-
2443/*! \fn QDataStream &operator<<(QDataStream &out, const QHash<Key, T>& hash)-
2444 \relates QHash-
2445-
2446 Writes the hash \a hash to stream \a out.-
2447-
2448 This function requires the key and value types to implement \c-
2449 operator<<().-
2450-
2451 \sa {Serializing Qt Data Types}-
2452*/-
2453-
2454/*! \fn QDataStream &operator>>(QDataStream &in, QHash<Key, T> &hash)-
2455 \relates QHash-
2456-
2457 Reads a hash from stream \a in into \a hash.-
2458-
2459 This function requires the key and value types to implement \c-
2460 operator>>().-
2461-
2462 \sa {Serializing Qt Data Types}-
2463*/-
2464-
2465/*! \class QMultiHash-
2466 \inmodule QtCore-
2467 \brief The QMultiHash class is a convenience QHash subclass that provides multi-valued hashes.-
2468-
2469 \ingroup tools-
2470 \ingroup shared-
2471-
2472 \reentrant-
2473-
2474 QMultiHash\<Key, T\> is one of Qt's generic \l{container classes}.-
2475 It inherits QHash and extends it with a few convenience functions-
2476 that make it more suitable than QHash for storing multi-valued-
2477 hashes. A multi-valued hash is a hash that allows multiple values-
2478 with the same key; QHash normally doesn't allow that, unless you-
2479 call QHash::insertMulti().-
2480-
2481 Because QMultiHash inherits QHash, all of QHash's functionality also-
2482 applies to QMultiHash. For example, you can use isEmpty() to test-
2483 whether the hash is empty, and you can traverse a QMultiHash using-
2484 QHash's iterator classes (for example, QHashIterator). But in-
2485 addition, it provides an insert() function that corresponds to-
2486 QHash::insertMulti(), and a replace() function that corresponds to-
2487 QHash::insert(). It also provides convenient operator+() and-
2488 operator+=().-
2489-
2490 Example:-
2491 \snippet code/src_corelib_tools_qhash.cpp 24-
2492-
2493 Unlike QHash, QMultiHash provides no operator[]. Use value() or-
2494 replace() if you want to access the most recently inserted item-
2495 with a certain key.-
2496-
2497 If you want to retrieve all the values for a single key, you can-
2498 use values(const Key &key), which returns a QList<T>:-
2499-
2500 \snippet code/src_corelib_tools_qhash.cpp 25-
2501-
2502 The items that share the same key are available from most-
2503 recently to least recently inserted.-
2504-
2505 A more efficient approach is to call find() to get-
2506 the STL-style iterator for the first item with a key and iterate from-
2507 there:-
2508-
2509 \snippet code/src_corelib_tools_qhash.cpp 26-
2510-
2511 QMultiHash's key and value data types must be \l{assignable data-
2512 types}. You cannot, for example, store a QWidget as a value;-
2513 instead, store a QWidget *. In addition, QMultiHash's key type-
2514 must provide operator==(), and there must also be a qHash() function-
2515 in the type's namespace that returns a hash value for an argument of the-
2516 key's type. See the QHash documentation for details.-
2517-
2518 \sa QHash, QHashIterator, QMutableHashIterator, QMultiMap-
2519*/-
2520-
2521/*! \fn QMultiHash::QMultiHash()-
2522-
2523 Constructs an empty hash.-
2524*/-
2525-
2526/*! \fn QMultiHash::QMultiHash(std::initializer_list<std::pair<Key,T> > list)-
2527 \since 5.1-
2528-
2529 Constructs a multi hash with a copy of each of the elements in the-
2530 initializer list \a list.-
2531-
2532 This function is only available if the program is being-
2533 compiled in C++11 mode.-
2534*/-
2535-
2536/*! \fn QMultiHash::QMultiHash(const QHash<Key, T> &other)-
2537-
2538 Constructs a copy of \a other (which can be a QHash or a-
2539 QMultiHash).-
2540-
2541 \sa operator=()-
2542*/-
2543-
2544/*! \fn QMultiHash::iterator QMultiHash::replace(const Key &key, const T &value)-
2545-
2546 Inserts a new item with the \a key and a value of \a value.-
2547-
2548 If there is already an item with the \a key, that item's value-
2549 is replaced with \a value.-
2550-
2551 If there are multiple items with the \a key, the most-
2552 recently inserted item's value is replaced with \a value.-
2553-
2554 \sa insert()-
2555*/-
2556-
2557/*! \fn QMultiHash::iterator QMultiHash::insert(const Key &key, const T &value)-
2558-
2559 Inserts a new item with the \a key and a value of \a value.-
2560-
2561 If there is already an item with the same key in the hash, this-
2562 function will simply create a new one. (This behavior is-
2563 different from replace(), which overwrites the value of an-
2564 existing item.)-
2565-
2566 \sa replace()-
2567*/-
2568-
2569/*! \fn QMultiHash &QMultiHash::operator+=(const QMultiHash &other)-
2570-
2571 Inserts all the items in the \a other hash into this hash-
2572 and returns a reference to this hash.-
2573-
2574 \sa insert()-
2575*/-
2576-
2577/*! \fn QMultiHash QMultiHash::operator+(const QMultiHash &other) const-
2578-
2579 Returns a hash that contains all the items in this hash in-
2580 addition to all the items in \a other. If a key is common to both-
2581 hashes, the resulting hash will contain the key multiple times.-
2582-
2583 \sa operator+=()-
2584*/-
2585-
2586/*!-
2587 \fn bool QMultiHash::contains(const Key &key, const T &value) const-
2588 \since 4.3-
2589-
2590 Returns \c true if the hash contains an item with the \a key and-
2591 \a value; otherwise returns \c false.-
2592-
2593 \sa QHash::contains()-
2594*/-
2595-
2596/*!-
2597 \fn int QMultiHash::remove(const Key &key, const T &value)-
2598 \since 4.3-
2599-
2600 Removes all the items that have the \a key and the value \a-
2601 value from the hash. Returns the number of items removed.-
2602-
2603 \sa QHash::remove()-
2604*/-
2605-
2606/*!-
2607 \fn int QMultiHash::count(const Key &key, const T &value) const-
2608 \since 4.3-
2609-
2610 Returns the number of items with the \a key and \a value.-
2611-
2612 \sa QHash::count()-
2613*/-
2614-
2615/*!-
2616 \fn typename QHash<Key, T>::iterator QMultiHash::find(const Key &key, const T &value)-
2617 \since 4.3-
2618-
2619 Returns an iterator pointing to the item with the \a key and \a value.-
2620 If the hash contains no such item, the function returns end().-
2621-
2622 If the hash contains multiple items with the \a key and \a value, the-
2623 iterator returned points to the most recently inserted item.-
2624-
2625 \sa QHash::find()-
2626*/-
2627-
2628/*!-
2629 \fn typename QHash<Key, T>::const_iterator QMultiHash::find(const Key &key, const T &value) const-
2630 \since 4.3-
2631 \overload-
2632*/-
2633-
2634/*!-
2635 \fn typename QHash<Key, T>::const_iterator QMultiHash::constFind(const Key &key, const T &value) const-
2636 \since 4.3-
2637-
2638 Returns an iterator pointing to the item with the \a key and the-
2639 \a value in the hash.-
2640-
2641 If the hash contains no such item, the function returns-
2642 constEnd().-
2643-
2644 \sa QHash::constFind()-
2645*/-
2646-
2647QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9