Debian Codegraph @

src/scripttools/debugging/qscriptobjectsnapshot.cpp

raw symbols SCIP
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the QtSCriptTools 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 #include "qscriptobjectsnapshot_p.h"cxx . . $ `<file>/src/scripttools/debugging/qscriptobjectsnapshot_p.h`/
41
42 #include <QtCore/qmap.h>
43 #include <QtCore/qset.h>
44 #include <QtCore/qvector.h>
45 #include <QtCore/qnumeric.h>
46 #include <QtScript/qscriptvalueiterator.h>cxx . . $ `<file>/include/QtScript/qscriptvalueiterator.h`/
47
48 QT_BEGIN_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:148:10`!
49
50 QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#QScriptObjectSnapshot(49f6e7a06ebc5aa8).()
51 {
52 }
53
54 QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::~cxx . . $ QScriptObjectSnapshot#`~QScriptObjectSnapshot`(ced63f7c635d850d).QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#()
55 {
56 }
57
58 static bool _q_equalcxx . . $ _q_equal(c86ef7ff4ed6d10c).(const QScriptValuecxx . . $ QScriptValue# &v1, const QScriptValuecxx . . $ QScriptValue# &v2)
59 {
60 if (v1.strictlyEqualscxx . . $ QScriptValue#strictlyEquals(f1859bb82f79d140).(v2))
61 return true;
62 if (v1.isNumbercxx . . $ QScriptValue#isNumber(50ce9a9e25b4a850).() && v2.isNumbercxx . . $ QScriptValue#isNumber(50ce9a9e25b4a850).() && qIsNaNcxx . . $ qIsNaN(f8197d536af80c96).(v1.toNumbercxx . . $ QScriptValue#toNumber(21b6c25e127938e2).()) && qIsNaNcxx . . $ qIsNaN(f8197d536af80c96).(v2.toNumbercxx . . $ QScriptValue#toNumber(21b6c25e127938e2).()))
63 return true;
64 return false;
65 }
66
67 QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::Deltacxx . . $ QScriptObjectSnapshot#Delta# QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::capturecxx . . $ QScriptObjectSnapshot#capture(a4cf1dcc18433a51).(const QScriptValuecxx . . $ QScriptValue# &object)
68 {
69 Deltacxx . . $ QScriptObjectSnapshot#Delta# result;
70 QMapcxx . . $ QMap#<QStringcxx . . $ QString#, QScriptValuePropertycxx . . $ QScriptValueProperty#> currProps;
71 QHashcxx . . $ QHash#<QStringcxx . . $ QString#, int> propertyNameToIndex;
72 {
73 int i = 0;
74 QScriptValueIteratorcxx . . $ QScriptValueIterator# itcxx . . $ QScriptValueIterator#QScriptValueIterator(6b35c8bde2804237).(object);
75 while (it.hasNextcxx . . $ QScriptValueIterator#hasNext(50ce9a9e25b4a850).()) {
76 it.nextcxx . . $ QScriptValueIterator#next(49f6e7a06ebc5aa8).();
77 QScriptValuePropertycxx . . $ QScriptValueProperty# prop(it.namecxx . . $ QScriptValueIterator#name(6ef7b6c27b00b43d).(), it.valuecxx . . $ QScriptValueIterator#value(73013aefd0020d47).(), it.flagscxx . . $ QScriptValueIterator#flags(97d37d1154f9e612).());
78 currProps.insert(it.namecxx . . $ QScriptValueIterator#name(6ef7b6c27b00b43d).(), prop);
79 propertyNameToIndex.insert(it.namecxx . . $ QScriptValueIterator#name(6ef7b6c27b00b43d).(), i);
80 ++i;
81 }
82 if (object.prototypecxx . . $ QScriptValue#prototype(73013aefd0020d47).().isValidcxx . . $ QScriptValue#isValid(50ce9a9e25b4a850).()) {
83 QStringcxx . . $ QString# __proto__ = QStringcxx . . $ QString#::fromLatin1cxx . . $ QString#fromLatin1(5ac70cc0fa2a874e).("__proto__");
84 QScriptValuePropertycxx . . $ QScriptValueProperty# protoProp(
85 __proto__, object.prototypecxx . . $ QScriptValue#prototype(73013aefd0020d47).(),
86 QScriptValuecxx . . $ QScriptValue#::Undeletablecxx . . $ QScriptValue#Undeletable. | QScriptValuecxx . . $ QScriptValue#::ReadOnlycxx . . $ QScriptValue#ReadOnly.);
87 currProps.insert(__proto__, protoProp);
88 propertyNameToIndex.insert(__proto__, i);
89 ++i;
90 }
91 }
92
93 QSetcxx . . $ QSet#<QStringcxx . . $ QString#> prevSet;
94 for (int i = 0; i < m_properties.size(); ++i)
95 prevSet.insert(m_properties.at(i).name());
96 QSetcxx . . $ QSet#<QStringcxx . . $ QString#> currSet = currProps.keys().toSet();
97 QSetcxx . . $ QSet#<QStringcxx . . $ QString#> removedProperties = prevSet - currSet;
98 QSetcxx . . $ QSet#<QStringcxx . . $ QString#> addedProperties = currSet - prevSet;
99 QSetcxx . . $ QSet#<QStringcxx . . $ QString#> maybeChangedProperties = currSet & prevSet;
100
101 {
102 QMapcxx . . $ QMap#<int, QScriptValuePropertycxx . . $ QScriptValueProperty#> am;
103 QSet<QString>::const_iterator it;
104 for (it = addedProperties.constBegin(); it != addedProperties.constEnd(); ++it) {
105 int idx = propertyNameToIndex[*it];
106 am[idx] = currProps[*it];
107 }
108 result.addedProperties = am.values();
109 }
110
111 {
112 QSet<QString>::const_iterator it;
113 for (it = maybeChangedProperties.constBegin(); it != maybeChangedProperties.constEnd(); ++it) {
114 const QScriptValuePropertycxx . . $ QScriptValueProperty# &p1 = currProps[*it];
115 const QScriptValuePropertycxx . . $ QScriptValueProperty# &p2 = findPropertycxx . . $ QScriptObjectSnapshot#findProperty(c7657c8571bc4f06).(*it);
116 if (!_q_equalcxx . . $ _q_equal(c86ef7ff4ed6d10c).(p1.valuecxx . . $ QScriptValueProperty#value(73013aefd0020d47).(), p2.valuecxx . . $ QScriptValueProperty#value(73013aefd0020d47).())
117 || (p1.flagscxx . . $ QScriptValueProperty#flags(97d37d1154f9e612).() != p2.flagscxx . . $ QScriptValueProperty#flags(97d37d1154f9e612).())) {
118 result.changedProperties.append(p1);
119 }
120 }
121 }
122
123 result.removedProperties = removedProperties.toList();
124
125 m_properties = currProps.values();
126
127 return result;
128 }
129
130 QScriptValuePropertycxx . . $ QScriptValueProperty# QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::findPropertycxx . . $ QScriptObjectSnapshot#findProperty(c7657c8571bc4f06).(const QStringcxx . . $ QString# &name) const
131 {
132 for (int i = 0; i < m_properties.size(); ++i) {
133 if (m_properties.at(i).name() == name)
134 return m_properties.at(i);
135 }
136 return QScriptValuePropertycxx . . $ QScriptValueProperty#QScriptValueProperty(49f6e7a06ebc5aa8).();
137 }
138
139 QScriptValuePropertyListcxx . . $ QScriptValuePropertyList# QScriptObjectSnapshotcxx . . $ QScriptObjectSnapshot#::propertiescxx . . $ QScriptObjectSnapshot#properties(7af6260ef13ec6e1).() const
140 {
141 return m_properties;
142 }
143
144 QT_END_NAMESPACEcxx . . $ `<external>/15045578679651060896/qglobal.h:149:10`!