OpenCoverage

qqmlchangeset_p.h

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/util/qqmlchangeset_p.h
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtQml module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#ifndef QQMLCHANGESET_P_H-
41#define QQMLCHANGESET_P_H-
42-
43//-
44// W A R N I N G-
45// --------------
46//-
47// This file is not part of the Qt API. It exists purely as an-
48// implementation detail. This header file may change from version to-
49// version without notice, or even be removed.-
50//-
51// We mean it.-
52//-
53-
54#include <QtCore/qdebug.h>-
55#include <QtCore/qvector.h>-
56#include <QtQml/private/qtqmlglobal_p.h>-
57-
58QT_BEGIN_NAMESPACE-
59-
60class Q_QML_PRIVATE_EXPORT QQmlChangeSet-
61{-
62public:-
63 struct MoveKey-
64 {-
65 MoveKey() {}-
66 MoveKey(int moveId, int offset) : moveId(moveId), offset(offset) {}
executed 4000 times by 2 tests: end of block
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
4000
67 int moveId = -1;-
68 int offset = 0;-
69 };-
70-
71 // The storrage for Change (below). This struct is trivial, which it has to be in order to store-
72 // it in a QV4::Heap::Base object. The Change struct doesn't add any storage fields, so it is-
73 // safe to cast ChangeData to/from Change.-
74 struct ChangeData-
75 {-
76 int index;-
77 int count;-
78 int moveId;-
79 int offset;-
80 };-
81-
82 struct Change: ChangeData-
83 {-
84 Change() {-
85 index = 0;-
86 count = 0;-
87 moveId = -1;-
88 offset = 0;-
89 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_qquickgridview
6
90 Change(int index, int count, int moveId = -1, int offset = 0) {-
91 this->index = index;-
92 this->count = count;-
93 this->moveId = moveId;-
94 this->offset = offset;-
95 }
executed 39582 times by 30 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlhangeset
  • tst_qqmlinstantiator
  • tst_qqmllistcompositor
  • tst_qqmllistmodel
  • tst_qqmlobjectmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • ...
39582
96-
97 bool isMove() const { return moveId >= 0; }
executed 92619 times by 15 tests: return moveId >= 0;
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmlinstantiator
  • tst_qqmllistcompositor
  • tst_qqmlobjectmodel
  • tst_qqmlqt
  • tst_qquickgridview
  • tst_qquickitem2
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickvisualdatamodel
92619
98-
99 MoveKey moveKey(int index) const {-
100 return MoveKey(moveId, index - Change::index + offset); }
executed 4000 times by 2 tests: return MoveKey(moveId, index - Change::index + offset);
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
4000
101-
102 int start() const { return index; }
never executed: return index;
0
103 int end() const { return index + count; }
executed 3290 times by 5 tests: return index + count;
Executed by:
  • tst_examples
  • tst_qqmlhangeset
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
3290
104 };-
105-
106 QQmlChangeSet();-
107 QQmlChangeSet(const QQmlChangeSet &changeSet);-
108 ~QQmlChangeSet();-
109-
110 QQmlChangeSet &operator =(const QQmlChangeSet &changeSet);-
111-
112 const QVector<Change> &removes() const { return m_removes; }
executed 27894 times by 17 tests: return m_removes;
Executed by:
  • tst_examples
  • tst_qqmlhangeset
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlobjectmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
27894
113 const QVector<Change> &inserts() const { return m_inserts; }
executed 25562 times by 17 tests: return m_inserts;
Executed by:
  • tst_examples
  • tst_qqmlhangeset
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlobjectmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
25562
114 const QVector<Change> &changes() const { return m_changes; }
executed 826 times by 4 tests: return m_changes;
Executed by:
  • tst_qqmlhangeset
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
826
115-
116 void insert(int index, int count);-
117 void remove(int index, int count);-
118 void move(int from, int to, int count, int moveId);-
119 void change(int index, int count);-
120-
121 void insert(const QVector<Change> &inserts);-
122 void remove(const QVector<Change> &removes, QVector<Change> *inserts = nullptr);-
123 void move(const QVector<Change> &removes, const QVector<Change> &inserts);-
124 void change(const QVector<Change> &changes);-
125 void apply(const QQmlChangeSet &changeSet);-
126-
127 bool isEmpty() const { return m_removes.empty() && m_inserts.empty() && m_changes.isEmpty(); }
executed 242628 times by 14 tests: return m_removes.empty() && m_inserts.empty() && m_changes.isEmpty();
Executed by:
  • tst_examples
  • tst_qqmlecmascript
  • tst_qqmllistmodel
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickrepeater
  • tst_qquickspringanimation
  • tst_qquickvisualdatamodel
242628
128-
129 void clear()-
130 {-
131 m_removes.clear();-
132 m_inserts.clear();-
133 m_changes.clear();-
134 m_difference = 0;-
135 }
executed 82903 times by 28 tests: end of block
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlhangeset
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquicktableview
  • ...
82903
136-
137 int difference() const { return m_difference; }
executed 67492 times by 28 tests: return m_difference;
Executed by:
  • tst_examples
  • tst_multipointtoucharea_interop
  • tst_qqmlecmascript
  • tst_qqmlhangeset
  • tst_qqmlinstantiator
  • tst_qqmllistmodel
  • tst_qqmlqt
  • tst_qqmltypeloader
  • tst_qqmlvaluetypes
  • tst_qquickanimations
  • tst_qquickdraghandler
  • tst_qquickflickable
  • tst_qquickgridview
  • tst_qquickimage
  • tst_qquickitem2
  • tst_qquickitemparticle
  • tst_qquicklayouts
  • tst_qquicklistview
  • tst_qquickmousearea
  • tst_qquickpathview
  • tst_qquickpositioners
  • tst_qquickrepeater
  • tst_qquickshortcut
  • tst_qquickspringanimation
  • tst_qquicktableview
  • ...
67492
138-
139private:-
140 void remove(QVector<Change> *removes, QVector<Change> *inserts);-
141 void change(QVector<Change> *changes);-
142-
143 QVector<Change> m_removes;-
144 QVector<Change> m_inserts;-
145 QVector<Change> m_changes;-
146 int m_difference;-
147};-
148-
149Q_DECLARE_TYPEINFO(QQmlChangeSet::Change, Q_PRIMITIVE_TYPE);-
150Q_DECLARE_TYPEINFO(QQmlChangeSet::MoveKey, Q_PRIMITIVE_TYPE);-
151-
152inline uint qHash(const QQmlChangeSet::MoveKey &key) { return qHash(qMakePair(key.moveId, key.offset)); }
executed 7237 times by 3 tests: return qHash(qMakePair(key.moveId, key.offset));
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
7237
153inline bool operator ==(const QQmlChangeSet::MoveKey &l, const QQmlChangeSet::MoveKey &r) {-
154 return l.moveId == r.moveId && l.offset == r.offset; }
executed 4298 times by 3 tests: return l.moveId == r.moveId && l.offset == r.offset;
Executed by:
  • tst_qquickgridview
  • tst_qquicklistview
  • tst_qquickvisualdatamodel
4298
155-
156Q_QML_PRIVATE_EXPORT QDebug operator <<(QDebug debug, const QQmlChangeSet::Change &change);-
157Q_QML_PRIVATE_EXPORT QDebug operator <<(QDebug debug, const QQmlChangeSet &change);-
158-
159QT_END_NAMESPACE-
160-
161#endif-
Source codeSwitch to Preprocessed file

Generated by Squish Coco 4.2.0