qversionnumber.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qversionnumber.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2015 The Qt Company Ltd.-
4** Copyright (C) 2014 Keith Gardner <kreios4004@gmail.com>-
5** Contact: http://www.qt.io/licensing/-
6**-
7** This file is part of the QtCore module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL21$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see http://www.qt.io/terms-conditions. For further-
16** information use the contact form at http://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 2.1 or version 3 as published by the Free-
21** Software Foundation and appearing in the file LICENSE.LGPLv21 and-
22** LICENSE.LGPLv3 included in the packaging of this file. Please review the-
23** following information to ensure the GNU Lesser General Public License-
24** requirements will be met: https://www.gnu.org/licenses/lgpl.html and-
25** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.-
26**-
27** As a special exception, The Qt Company gives you certain additional-
28** rights. These rights are described in The Qt Company LGPL Exception-
29** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.-
30**-
31** $QT_END_LICENSE$-
32**-
33****************************************************************************/-
34-
35#include <QtCore/qversionnumber.h>-
36#include <QtCore/qhash.h>-
37#include <QtCore/private/qlocale_tools_p.h>-
38#include <QtCore/qcollator.h>-
39-
40#ifndef QT_NO_DATASTREAM-
41# include <QtCore/qdatastream.h>-
42#endif-
43-
44#ifndef QT_NO_DEBUG_STREAM-
45# include <QtCore/qdebug.h>-
46#endif-
47-
48#include <algorithm>-
49#include <limits>-
50-
51QT_BEGIN_NAMESPACE-
52-
53/*!-
54 \class QVersionNumber-
55 \inmodule QtCore-
56 \since 5.6-
57 \brief The QVersionNumber class contains a version number with an arbitrary-
58 number of segments.-
59-
60 \snippet qversionnumber/main.cpp 0-
61*/-
62-
63/*!-
64 \fn QVersionNumber::QVersionNumber()-
65-
66 Produces a null version.-
67-
68 \sa isNull()-
69*/-
70-
71/*!-
72 \fn QVersionNumber::QVersionNumber(int maj)-
73-
74 Constructs a QVersionNumber consisting of just the major version number \a maj.-
75*/-
76-
77/*!-
78 \fn QVersionNumber::QVersionNumber(int maj, int min)-
79-
80 Constructs a QVersionNumber consisting of the major and minor-
81 version numbers \a maj and \a min, respectively.-
82*/-
83-
84/*!-
85 \fn QVersionNumber::QVersionNumber(int maj, int min, int mic)-
86-
87 Constructs a QVersionNumber consisting of the major, minor, and-
88 micro version numbers \a maj, \a min and \a mic, respectively.-
89*/-
90-
91/*!-
92 \fn QVersionNumber::QVersionNumber(const QVector<int> &seg)-
93-
94 Constructs a version number from the list of numbers contained in \a seg.-
95*/-
96-
97/*!-
98 \fn QVersionNumber::QVersionNumber(QVector<int> &&seg)-
99-
100 Move-constructs a version number from the list of numbers contained in \a seg.-
101-
102 This constructor is only enabled if the compiler supports C++11 move semantics.-
103*/-
104-
105/*!-
106 \fn QVersionNumber::QVersionNumber(std::initializer_list<int> args)-
107-
108 Construct a version number from the std::initializer_list specified by-
109 \a args.-
110-
111 This constructor is only enabled if the compiler supports C++11 initializer-
112 lists.-
113*/-
114-
115/*!-
116 \fn bool QVersionNumber::isNull() const-
117-
118 Returns \c true if there are zero numerical segments, otherwise returns-
119 \c false.-
120-
121 \sa segments()-
122*/-
123-
124/*!-
125 \fn bool QVersionNumber::isNormalized() const-
126-
127 Returns \c true if the version number does not contain any trailing zeros,-
128 otherwise returns \c false.-
129-
130 \sa normalized()-
131*/-
132-
133/*!-
134 \fn int QVersionNumber::majorVersion() const-
135-
136 Returns the major version number, that is, the first segment.-
137 This function is equivalent to segmentAt(0). If this QVersionNumber object-
138 is null, this function returns 0.-
139-
140 \sa isNull(), segmentAt()-
141*/-
142-
143/*!-
144 \fn int QVersionNumber::minorVersion() const-
145-
146 Returns the minor version number, that is, the second segment.-
147 This function is equivalent to segmentAt(1). If this QVersionNumber object-
148 does not contain a minor number, this function returns 0.-
149-
150 \sa isNull(), segmentAt()-
151*/-
152-
153/*!-
154 \fn int QVersionNumber::microVersion() const-
155-
156 Returns the micro version number, that is, the third segment.-
157 This function is equivalent to segmentAt(2). If this QVersionNumber object-
158 does not contain a micro number, this function returns 0.-
159-
160 \sa isNull(), segmentAt()-
161*/-
162-
163/*!-
164 \fn const QVector<int>& QVersionNumber::segments() const-
165-
166 Returns all of the numerical segments.-
167-
168 \sa majorVersion(), minorVersion(), microVersion()-
169*/-
170QVector<int> QVersionNumber::segments() const-
171{-
172 if (m_segments.isUsingPointer())
m_segments.isUsingPointer()Description
TRUEevaluated 135 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 311 times by 1 test
Evaluated by:
  • tst_QVersionNumber
135-311
173 return *m_segments.pointer_segments;
executed 135 times by 1 test: return *m_segments.pointer_segments;
Executed by:
  • tst_QVersionNumber
135
174-
175 QVector<int> result;-
176 result.resize(segmentCount());-
177 for (int i = 0; i < segmentCount(); ++i)
i < segmentCount()Description
TRUEevaluated 720 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 311 times by 1 test
Evaluated by:
  • tst_QVersionNumber
311-720
178 result[i] = segmentAt(i);
executed 720 times by 1 test: result[i] = segmentAt(i);
Executed by:
  • tst_QVersionNumber
720
179 return result;
executed 311 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
311
180}-
181-
182/*!-
183 \fn int QVersionNumber::segmentAt(int index) const-
184-
185 Returns the segement value at \a index. If the index does not exist,-
186 returns 0.-
187-
188 \sa segments(), segmentCount()-
189*/-
190-
191/*!-
192 \fn int QVersionNumber::segmentCount() const-
193-
194 Returns the number of integers stored in segments().-
195-
196 \sa segments()-
197*/-
198-
199/*!-
200 \fn QVersionNumber QVersionNumber::normalized() const-
201-
202 Returns an equivalent version number but with all trailing zeros removed.-
203-
204 To check if two numbers are equivalent, use normalized() on both version-
205 numbers before performing the compare.-
206-
207 \snippet qversionnumber/main.cpp 4-
208 */-
209QVersionNumber QVersionNumber::normalized() const-
210{-
211 int i;-
212 for (i = m_segments.size(); i; --i)
iDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QVersionNumber
2-32
213 if (m_segments.at(i - 1) != 0)
m_segments.at(i - 1) != 0Description
TRUEevaluated 16 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 16 times by 1 test
Evaluated by:
  • tst_QVersionNumber
16
214 break;
executed 16 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
16
215-
216 QVersionNumber result(*this);-
217 result.m_segments.resize(i);-
218 return result;
executed 18 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
18
219}-
220-
221/*!-
222 \fn bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const-
223-
224 Returns \c true if the current version number is contained in the \a other-
225 version number, otherwise returns \c false.-
226-
227 \snippet qversionnumber/main.cpp 2-
228-
229 \sa commonPrefix()-
230*/-
231bool QVersionNumber::isPrefixOf(const QVersionNumber &other) const Q_DECL_NOTHROW-
232{-
233 if (segmentCount() > other.segmentCount())
segmentCount()...segmentCount()Description
TRUEevaluated 10 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 41 times by 1 test
Evaluated by:
  • tst_QVersionNumber
10-41
234 return false;
executed 10 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
10
235 for (int i = 0; i < segmentCount(); ++i) {
i < segmentCount()Description
TRUEevaluated 123 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 17 times by 1 test
Evaluated by:
  • tst_QVersionNumber
17-123
236 if (segmentAt(i) != other.segmentAt(i))
segmentAt(i) !...r.segmentAt(i)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 99 times by 1 test
Evaluated by:
  • tst_QVersionNumber
24-99
237 return false;
executed 24 times by 1 test: return false;
Executed by:
  • tst_QVersionNumber
24
238 }
executed 99 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
99
239 return true;
executed 17 times by 1 test: return true;
Executed by:
  • tst_QVersionNumber
17
240}-
241-
242/*!-
243 \fn int QVersionNumber::compare(const QVersionNumber &v1,-
244 const QVersionNumber &v2)-
245-
246 Compares \a v1 with \a v2 and returns an integer less than, equal to, or-
247 greater than zero, depending on whether \a v1 is less than, equal to, or-
248 greater than \a v2, respectively.-
249-
250 Comparisons are performed by comparing the segments of \a v1 and \a v2-
251 starting at index 0 and working towards the end of the longer list.-
252-
253 \snippet qversionnumber/main.cpp 1-
254*/-
255int QVersionNumber::compare(const QVersionNumber &v1, const QVersionNumber &v2) Q_DECL_NOTHROW-
256{-
257 int commonlen;-
258-
259 if (Q_LIKELY(!v1.m_segments.isUsingPointer() && !v2.m_segments.isUsingPointer())) {
__builtin_expe...nter()), true)Description
TRUEevaluated 324 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 190 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
190-324
260 // we can't use memcmp because it interprets the data as unsigned bytes-
261 const qint8 *ptr1 = v1.m_segments.inline_segments + InlineSegmentStartIdx;-
262 const qint8 *ptr2 = v2.m_segments.inline_segments + InlineSegmentStartIdx;-
263 commonlen = qMin(v1.m_segments.size(),-
264 v2.m_segments.size());-
265 for (int i = 0; i < commonlen; ++i)
i < commonlenDescription
TRUEevaluated 498 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 237 times by 1 test
Evaluated by:
  • tst_QVersionNumber
237-498
266 if (int x = ptr1[i] - ptr2[i])
int x = ptr1[i] - ptr2[i]Description
TRUEevaluated 87 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 411 times by 1 test
Evaluated by:
  • tst_QVersionNumber
87-411
267 return x;
executed 87 times by 2 tests: return x;
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
87
268 } else {
executed 237 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
237
269 commonlen = qMin(v1.segmentCount(), v2.segmentCount());-
270 for (int i = 0; i < commonlen; ++i) {
i < commonlenDescription
TRUEevaluated 997 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 104 times by 1 test
Evaluated by:
  • tst_QVersionNumber
104-997
271 if (v1.segmentAt(i) != v2.segmentAt(i))
v1.segmentAt(i...2.segmentAt(i)Description
TRUEevaluated 86 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 911 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
86-911
272 return v1.segmentAt(i) - v2.segmentAt(i);
executed 86 times by 2 tests: return v1.segmentAt(i) - v2.segmentAt(i);
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
86
273 }
executed 911 times by 2 tests: end of block
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
911
274 }
executed 104 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
104
275-
276 // ran out of segments in v1 and/or v2 and need to check the first trailing-
277 // segment to finish the compare-
278 if (v1.segmentCount() > commonlen) {
v1.segmentCount() > commonlenDescription
TRUEevaluated 70 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 271 times by 1 test
Evaluated by:
  • tst_QVersionNumber
70-271
279 // v1 is longer-
280 if (v1.segmentAt(commonlen) != 0)
v1.segmentAt(commonlen) != 0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QVersionNumber
14-56
281 return v1.segmentAt(commonlen);
executed 56 times by 1 test: return v1.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
56
282 else-
283 return 1;
executed 14 times by 1 test: return 1;
Executed by:
  • tst_QVersionNumber
14
284 } else if (v2.segmentCount() > commonlen) {
v2.segmentCount() > commonlenDescription
TRUEevaluated 70 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 201 times by 1 test
Evaluated by:
  • tst_QVersionNumber
70-201
285 // v2 is longer-
286 if (v2.segmentAt(commonlen) != 0)
v2.segmentAt(commonlen) != 0Description
TRUEevaluated 56 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 14 times by 1 test
Evaluated by:
  • tst_QVersionNumber
14-56
287 return -v2.segmentAt(commonlen);
executed 56 times by 1 test: return -v2.segmentAt(commonlen);
Executed by:
  • tst_QVersionNumber
56
288 else-
289 return -1;
executed 14 times by 1 test: return -1;
Executed by:
  • tst_QVersionNumber
14
290 }-
291-
292 // the two version numbers are the same-
293 return 0;
executed 201 times by 1 test: return 0;
Executed by:
  • tst_QVersionNumber
201
294}-
295-
296/*!-
297 QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,-
298 const QVersionNumber &v2)-
299-
300 Returns a version number that is a parent version of both \a v1 and \a v2.-
301-
302 \sa isPrefixOf()-
303*/-
304QVersionNumber QVersionNumber::commonPrefix(const QVersionNumber &v1,-
305 const QVersionNumber &v2)-
306{-
307 int commonlen = qMin(v1.segmentCount(), v2.segmentCount());-
308 int i;-
309 for (i = 0; i < commonlen; ++i) {
i < commonlenDescription
TRUEevaluated 150 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QVersionNumber
27-150
310 if (v1.segmentAt(i) != v2.segmentAt(i))
v1.segmentAt(i...2.segmentAt(i)Description
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 126 times by 1 test
Evaluated by:
  • tst_QVersionNumber
24-126
311 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
24
312 }
executed 126 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
126
313-
314 if (i == 0)
i == 0Description
TRUEevaluated 15 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
15-36
315 return QVersionNumber();
executed 15 times by 1 test: return QVersionNumber();
Executed by:
  • tst_QVersionNumber
15
316-
317 // try to use the one with inline segments, if there's one-
318 QVersionNumber result(!v1.m_segments.isUsingPointer() ? v1 : v2);-
319 result.m_segments.resize(i);-
320 return result;
executed 36 times by 1 test: return result;
Executed by:
  • tst_QVersionNumber
36
321}-
322-
323/*!-
324 \fn bool operator<(const QVersionNumber &lhs, const QVersionNumber &rhs)-
325 \relates QVersionNumber-
326-
327 Returns \c true if \a lhs is less than \a rhs; otherwise returns \c false.-
328-
329 \sa QVersionNumber::compare()-
330*/-
331-
332/*!-
333 \fn bool operator<=(const QVersionNumber &lhs, const QVersionNumber &rhs)-
334 \relates QVersionNumber-
335-
336 Returns \c true if \a lhs is less than or equal to \a rhs; otherwise-
337 returns \c false.-
338-
339 \sa QVersionNumber::compare()-
340*/-
341-
342/*!-
343 \fn bool operator>(const QVersionNumber &lhs, const QVersionNumber &rhs)-
344 \relates QVersionNumber-
345-
346 Returns \c true if \a lhs is greater than \a rhs; otherwise returns \c-
347 false.-
348-
349 \sa QVersionNumber::compare()-
350*/-
351-
352/*!-
353 \fn bool operator>=(const QVersionNumber &lhs, const QVersionNumber &rhs)-
354 \relates QVersionNumber-
355-
356 Returns \c true if \a lhs is greater than or equal to \a rhs; otherwise-
357 returns \c false.-
358-
359 \sa QVersionNumber::compare()-
360*/-
361-
362/*!-
363 \fn bool operator==(const QVersionNumber &lhs, const QVersionNumber &rhs)-
364 \relates QVersionNumber-
365-
366 Returns \c true if \a lhs is equal to \a rhs; otherwise returns \c false.-
367-
368 \sa QVersionNumber::compare()-
369*/-
370-
371/*!-
372 \fn bool operator!=(const QVersionNumber &lhs, const QVersionNumber &rhs)-
373 \relates QVersionNumber-
374-
375 Returns \c true if \a lhs is not equal to \a rhs; otherwise returns-
376 \c false.-
377-
378 \sa QVersionNumber::compare()-
379*/-
380-
381/*!-
382 \fn QString QVersionNumber::toString() const-
383-
384 Returns a string with all of the segments delimited by a '.'.-
385-
386 \sa majorVersion(), minorVersion(), microVersion(), segments()-
387*/-
388QString QVersionNumber::toString() const-
389{-
390 QString version;-
391 version.reserve(qMax(segmentCount() * 2 - 1, 0));-
392 bool first = true;-
393 for (int i = 0; i < segmentCount(); ++i) {
i < segmentCount()Description
TRUEevaluated 140 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 40 times by 1 test
Evaluated by:
  • tst_QVersionNumber
40-140
394 if (!first)
!firstDescription
TRUEevaluated 105 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 35 times by 1 test
Evaluated by:
  • tst_QVersionNumber
35-105
395 version += QLatin1Char('.');
executed 105 times by 1 test: version += QLatin1Char('.');
Executed by:
  • tst_QVersionNumber
105
396 version += QString::number(segmentAt(i));-
397 first = false;-
398 }
executed 140 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
140
399 return version;
executed 40 times by 1 test: return version;
Executed by:
  • tst_QVersionNumber
40
400}-
401-
402/*!-
403 \fn QVersionNumber QVersionNumber::fromString(const QString &string,-
404 int *suffixIndex)-
405-
406 Constructs a QVersionNumber from a specially formatted \a string of-
407 non-negative decimal numbers delimited by '.'.-
408-
409 Once the numerical segments have been parsed, the remainder of the string-
410 is considered to be the suffix string. The start index of that string will be-
411 stored in \a suffixIndex if it is not null.-
412-
413 \snippet qversionnumber/main.cpp 3-
414-
415 \sa isNull()-
416*/-
417QVersionNumber QVersionNumber::fromString(const QString &string, int *suffixIndex)-
418{-
419 QVector<int> seg;-
420-
421 const QByteArray cString(string.toLatin1());-
422-
423 const char *start = cString.constData();-
424 const char *end = start;-
425 const char *lastGoodEnd = start;-
426 const char *endOfString = cString.constData() + cString.size();-
427-
428 do {-
429 bool ok = false;-
430 const qulonglong value = qstrtoull(start, &end, 10, &ok);-
431 if (!ok || value > qulonglong(std::numeric_limits<int>::max()))
!okDescription
TRUEevaluated 24 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 296 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
value > qulong...s<int>::max())Description
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 292 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
4-296
432 break;
executed 28 times by 1 test: break;
Executed by:
  • tst_QVersionNumber
28
433 seg.append(int(value));-
434 start = end + 1;-
435 lastGoodEnd = end;-
436 } while (start < endOfString && (end < endOfString && *end == '.'));
executed 292 times by 2 tests: end of block
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
start < endOfStringDescription
TRUEevaluated 267 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 25 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
end < endOfStringDescription
TRUEevaluated 267 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEnever evaluated
*end == '.'Description
TRUEevaluated 231 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
0-292
437-
438 if (suffixIndex)
suffixIndexDescription
TRUEevaluated 41 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 48 times by 2 tests
Evaluated by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
41-48
439 *suffixIndex = int(lastGoodEnd - cString.constData());
executed 41 times by 1 test: *suffixIndex = int(lastGoodEnd - cString.constData());
Executed by:
  • tst_QVersionNumber
41
440-
441 return QVersionNumber(qMove(seg));
executed 89 times by 2 tests: return QVersionNumber(std::move(seg));
Executed by:
  • tst_QOpenGlConfig
  • tst_QVersionNumber
89
442}-
443-
444void QVersionNumber::SegmentStorage::setVector(int len, int maj, int min, int mic)-
445{-
446 pointer_segments = new QVector<int>;-
447 pointer_segments->resize(len);-
448 pointer_segments->data()[0] = maj;-
449 if (len > 1) {
len > 1Description
TRUEevaluated 171 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 36 times by 1 test
Evaluated by:
  • tst_QVersionNumber
36-171
450 pointer_segments->data()[1] = min;-
451 if (len > 2) {
len > 2Description
TRUEevaluated 81 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEevaluated 90 times by 1 test
Evaluated by:
  • tst_QVersionNumber
81-90
452 pointer_segments->data()[2] = mic;-
453 }
executed 81 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
81
454 }
executed 171 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
171
455}
executed 207 times by 1 test: end of block
Executed by:
  • tst_QVersionNumber
207
456-
457#ifndef QT_NO_DATASTREAM-
458/*!-
459 \fn QDataStream& operator<<(QDataStream &out,-
460 const QVersionNumber &version)-
461 \relates QVersionNumber-
462-
463 Writes the version number \a version to stream \a out.-
464-
465 Note that this has nothing to do with QDataStream::version().-
466 */-
467QDataStream& operator<<(QDataStream &out, const QVersionNumber &version)-
468{-
469 out << version.segments();-
470 return out;
executed 37 times by 1 test: return out;
Executed by:
  • tst_QVersionNumber
37
471}-
472-
473/*!-
474 \fn QDataStream& operator>>(QDataStream &in, QVersionNumber &version)-
475 \relates QVersionNumber-
476-
477 Reads a version number from stream \a in and stores it in \a version.-
478-
479 Note that this has nothing to do with QDataStream::version().-
480 */-
481QDataStream& operator>>(QDataStream &in, QVersionNumber &version)-
482{-
483 if (!version.m_segments.isUsingPointer())
!version.m_seg...UsingPointer()Description
TRUEevaluated 37 times by 1 test
Evaluated by:
  • tst_QVersionNumber
FALSEnever evaluated
0-37
484 version.m_segments.pointer_segments = new QVector<int>;
executed 37 times by 1 test: version.m_segments.pointer_segments = new QVector<int>;
Executed by:
  • tst_QVersionNumber
37
485 in >> *version.m_segments.pointer_segments;-
486 return in;
executed 37 times by 1 test: return in;
Executed by:
  • tst_QVersionNumber
37
487}-
488#endif-
489-
490#ifndef QT_NO_DEBUG_STREAM-
491QDebug operator<<(QDebug debug, const QVersionNumber &version)-
492{-
493 QDebugStateSaver saver(debug);-
494 debug.noquote() << version.toString();-
495 return debug;
never executed: return debug;
0
496}-
497#endif-
498-
499/*!-
500 \fn uint qHash(const QVersionNumber &key, uint seed)-
501 \relates QHash-
502 \since 5.6-
503-
504 Returns the hash value for the \a key, using \a seed to seed the-
505 calculation.-
506*/-
507uint qHash(const QVersionNumber &key, uint seed)-
508{-
509 QtPrivate::QHashCombine hash;-
510 for (int i = 0; i < key.segmentCount(); ++i)
i < key.segmentCount()Description
TRUEnever evaluated
FALSEnever evaluated
0
511 seed = hash(seed, key.segmentAt(i));
never executed: seed = hash(seed, key.segmentAt(i));
0
512 return seed;
never executed: return seed;
0
513}-
514-
515QT_END_NAMESPACE-
516-
Source codeSwitch to Preprocessed file

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