qjsondocument.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/json/qjsondocument.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3QJsonDocument::QJsonDocument()-
4 : d(0)-
5{-
6}
executed 331 times by 5 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QNetworkCookieJar
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
  • tst_qmakelib
331
7-
8-
9-
10-
11QJsonDocument::QJsonDocument(const QJsonObject &object)-
12 : d(0)-
13{-
14 setObject(object);-
15}
never executed: end of block
0
16-
17-
18-
19-
20QJsonDocument::QJsonDocument(const QJsonArray &array)-
21 : d(0)-
22{-
23 setArray(array);-
24}
never executed: end of block
0
25-
26-
27-
28-
29QJsonDocument::QJsonDocument(QJsonPrivate::Data *data)-
30 : d(data)-
31{-
32 ((!(d)) ? qt_assert("d",__FILE__,108) : qt_noop());-
33 d->ref.ref();-
34}
executed 686 times by 113 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
686
35-
36-
37-
38-
39-
40-
41QJsonDocument::~QJsonDocument()-
42{-
43 if (d
dDescription
TRUEevaluated 687 times by 113 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
FALSEevaluated 416 times by 4 tests
Evaluated by:
  • tst_QMetaType
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
  • tst_qmakelib
&& !d->ref.deref()
!d->ref.deref()Description
TRUEevaluated 7 times by 3 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_QOpenGlConfig
  • tst_qmakelib
FALSEevaluated 680 times by 111 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
)
7-687
44 delete d;
executed 7 times by 3 tests: delete d;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QOpenGlConfig
  • tst_qmakelib
7
45}
executed 1103 times by 116 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
1103
46-
47-
48-
49-
50QJsonDocument::QJsonDocument(const QJsonDocument &other)-
51{-
52 d = other.d;-
53 if (d
dDescription
TRUEnever evaluated
FALSEevaluated 86 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
)
0-86
54 d->ref.ref();
never executed: d->ref.ref();
0
55}
executed 86 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
86
56-
57-
58-
59-
60-
61QJsonDocument &QJsonDocument::operator =(const QJsonDocument &other)-
62{-
63 if (d != other.d
d != other.dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QVariant
) {
1
64 if (d
dDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0-1
65 delete d;
never executed: delete d;
0
66 d = other.d;-
67 if (d
dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEnever evaluated
)
0-1
68 d->ref.ref();
executed 1 time by 1 test: d->ref.ref();
Executed by:
  • tst_QNetworkCookieJar
1
69 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkCookieJar
1
70-
71 return
executed 2 times by 2 tests: return *this;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QVariant
*this;
executed 2 times by 2 tests: return *this;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QVariant
2
72}-
73QJsonDocument QJsonDocument::fromRawData(const char *data, int size, DataValidation validation)-
74{-
75 if (quintptr(data) & 3
quintptr(data) & 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
76 QMessageLogger(__FILE__, 181, __PRETTY_FUNCTION__).warning() <<"QJsonDocument::fromRawData: data has to have 4 byte alignment";-
77 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
78 }-
79-
80 if (size < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base))
size < (int)(s...rivate::Base))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
81 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
82-
83 QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size);-
84 d->ownsData = false;-
85-
86 if (validation != BypassValidation
validation != BypassValidationDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->valid()
!d->valid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
87 delete d;-
88 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
89 }-
90-
91 return
never executed: return QJsonDocument(d);
QJsonDocument(d);
never executed: return QJsonDocument(d);
0
92}-
93const char *QJsonDocument::rawData(int *size) const-
94{-
95 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
96 *size = 0;-
97 return
never executed: return 0;
0;
never executed: return 0;
0
98 }-
99 *size = d->alloc;-
100 return
never executed: return d->rawData;
d->rawData;
never executed: return d->rawData;
0
101}-
102QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation)-
103{-
104 if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base))
data.size() < ...rivate::Base))Description
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
)
0-679
105 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
106-
107 QJsonPrivate::Header h;-
108 memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header));-
109 QJsonPrivate::Base root;-
110 memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base));-
111-
112-
113 if (h.tag != QJsonDocument::BinaryFormatTag
h.tag != QJson...inaryFormatTagDescription
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
|| h.version != 1u
h.version != 1uDescription
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
||
0-679
114 sizeof(QJsonPrivate::Header) + root.size > (uint)data.size()
sizeof(QJsonPr...nt)data.size()Description
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
)
0-679
115 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
116-
117 const uint size = sizeof(QJsonPrivate::Header) + root.size;-
118 char *raw = (char *)malloc(size);-
119 if (!raw
!rawDescription
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
)
0-679
120 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
121-
122 memcpy(raw, data.constData(), size);-
123 QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, size);-
124-
125 if (validation != BypassValidation
validation != BypassValidationDescription
TRUEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
FALSEnever evaluated
&& !d->valid()
!d->valid()Description
TRUEnever evaluated
FALSEevaluated 679 times by 110 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
) {
0-679
126 delete d;-
127 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
128 }-
129-
130 return
executed 679 times by 110 tests: return QJsonDocument(d);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
QJsonDocument(d);
executed 679 times by 110 tests: return QJsonDocument(d);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
679
131}-
132QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)-
133{-
134 QJsonDocument doc;-
135 if (variant.type() == QVariant::Map
variant.type()... QVariant::MapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
136 doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));-
137 }
never executed: end of block
else if (variant.type() == QVariant::List
variant.type()...QVariant::ListDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
138 doc.setArray(QJsonArray::fromVariantList(variant.toList()));-
139 }
never executed: end of block
else if (variant.type() == QVariant::StringList
variant.type()...nt::StringListDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
140 doc.setArray(QJsonArray::fromStringList(variant.toStringList()));-
141 }
never executed: end of block
0
142 return
never executed: return doc;
doc;
never executed: return doc;
0
143}-
144QVariant QJsonDocument::toVariant() const-
145{-
146 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
147 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
148-
149 if (d->header->root()->isArray()
d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
150 return
never executed: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())).toVariantList();
QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())).toVariantList();
never executed: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())).toVariantList();
0
151 else-
152 return
never executed: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())).toVariantMap();
QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())).toVariantMap();
never executed: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())).toVariantMap();
0
153}-
154-
155-
156-
157-
158-
159-
160-
161QByteArray QJsonDocument::toJson() const-
162{-
163 return
never executed: return toJson(Indented);
toJson(Indented);
never executed: return toJson(Indented);
0
164}-
165QByteArray QJsonDocument::toJson(JsonFormat format) const-
166{-
167 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
168 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
169-
170 QByteArray json;-
171-
172 if (d->header->root()->isArray()
d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
173 QJsonPrivate::Writer::arrayToJson(static_cast<QJsonPrivate::Array *>(d->header->root()), json, 0, (format == Compact));
never executed: QJsonPrivate::Writer::arrayToJson(static_cast<QJsonPrivate::Array *>(d->header->root()), json, 0, (format == Compact));
0
174 else-
175 QJsonPrivate::Writer::objectToJson(static_cast<QJsonPrivate::Object *>(d->header->root()), json, 0, (format == Compact));
never executed: QJsonPrivate::Writer::objectToJson(static_cast<QJsonPrivate::Object *>(d->header->root()), json, 0, (format == Compact));
0
176-
177 return
never executed: return json;
json;
never executed: return json;
0
178}-
179QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error)-
180{-
181 QJsonPrivate::Parser parser(json.constData(), json.length());-
182 return
executed 10 times by 4 tests: return parser.parse(error);
Executed by:
  • tst_QMetaType
  • tst_QNetworkCookieJar
  • tst_QOpenGlConfig
  • tst_qmakelib
parser.parse(error);
executed 10 times by 4 tests: return parser.parse(error);
Executed by:
  • tst_QMetaType
  • tst_QNetworkCookieJar
  • tst_QOpenGlConfig
  • tst_qmakelib
10
183}-
184-
185-
186-
187-
188bool QJsonDocument::isEmpty() const-
189{-
190 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
191 return
never executed: return true;
true;
never executed: return true;
0
192-
193 return
never executed: return false;
false;
never executed: return false;
0
194}-
195QByteArray QJsonDocument::toBinaryData() const-
196{-
197 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d->rawData
!d->rawDataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
198 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
199-
200 return
never executed: return QByteArray(d->rawData, d->header->root()->size + sizeof(QJsonPrivate::Header));
QByteArray(d->rawData, d->header->root()->size + sizeof(QJsonPrivate::Header));
never executed: return QByteArray(d->rawData, d->header->root()->size + sizeof(QJsonPrivate::Header));
0
201}-
202-
203-
204-
205-
206-
207-
208bool QJsonDocument::isArray() const-
209{-
210 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_qmakelib
)
0-2
211 return
never executed: return false;
false;
never executed: return false;
0
212-
213 QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData;-
214 return
executed 2 times by 2 tests: return h->root()->isArray();
Executed by:
  • tst_QNetworkCookieJar
  • tst_qmakelib
h->root()->isArray();
executed 2 times by 2 tests: return h->root()->isArray();
Executed by:
  • tst_QNetworkCookieJar
  • tst_qmakelib
2
215}-
216-
217-
218-
219-
220-
221-
222bool QJsonDocument::isObject() const-
223{-
224 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmakelib
)
0-1
225 return
never executed: return false;
false;
never executed: return false;
0
226-
227 QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData;-
228 return
executed 1 time by 1 test: return h->root()->isObject();
Executed by:
  • tst_qmakelib
h->root()->isObject();
executed 1 time by 1 test: return h->root()->isObject();
Executed by:
  • tst_qmakelib
1
229}-
230QJsonObject QJsonDocument::object() const-
231{-
232 if (d
dDescription
TRUEevaluated 685 times by 112 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
FALSEnever evaluated
) {
0-685
233 QJsonPrivate::Base *b = d->header->root();-
234 if (b->isObject()
b->isObject()Description
TRUEevaluated 685 times by 112 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
FALSEnever evaluated
)
0-685
235 return
executed 685 times by 112 tests: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(b));
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
QJsonObject(d, static_cast<QJsonPrivate::Object *>(b));
executed 685 times by 112 tests: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(b));
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
685
236 }
never executed: end of block
0
237 return
never executed: return QJsonObject();
QJsonObject();
never executed: return QJsonObject();
0
238}-
239QJsonArray QJsonDocument::array() const-
240{-
241 if (d
dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEnever evaluated
) {
0-1
242 QJsonPrivate::Base *b = d->header->root();-
243 if (b->isArray()
b->isArray()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEnever evaluated
)
0-1
244 return
executed 1 time by 1 test: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(b));
Executed by:
  • tst_QNetworkCookieJar
QJsonArray(d, static_cast<QJsonPrivate::Array *>(b));
executed 1 time by 1 test: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(b));
Executed by:
  • tst_QNetworkCookieJar
1
245 }
never executed: end of block
0
246 return
never executed: return QJsonArray();
QJsonArray();
never executed: return QJsonArray();
0
247}-
248-
249-
250-
251-
252-
253-
254void QJsonDocument::setObject(const QJsonObject &object)-
255{-
256 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
257 delete d;
never executed: delete d;
0
258-
259 d = object.d;-
260-
261 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
262 d = new QJsonPrivate::Data(0, QJsonValue::Object);-
263 }
never executed: end of block
else if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
|| object.o != d->header->root()
object.o != d->header->root()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
264 QJsonObject o(object);-
265 if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
266 o.compact();
never executed: o.compact();
0
267 else-
268 o.detach2();
never executed: o.detach2();
0
269 d = o.d;-
270 d->ref.ref();-
271 return;
never executed: return;
0
272 }-
273 d->ref.ref();-
274}
never executed: end of block
0
275-
276-
277-
278-
279-
280-
281void QJsonDocument::setArray(const QJsonArray &array)-
282{-
283 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
284 delete d;
never executed: delete d;
0
285-
286 d = array.d;-
287-
288 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
289 d = new QJsonPrivate::Data(0, QJsonValue::Array);-
290 }
never executed: end of block
else if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
|| array.a != d->header->root()
array.a != d->header->root()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
291 QJsonArray a(array);-
292 if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
293 a.compact();
never executed: a.compact();
0
294 else-
295 a.detach2();
never executed: a.detach2();
0
296 d = a.d;-
297 d->ref.ref();-
298 return;
never executed: return;
0
299 }-
300 d->ref.ref();-
301}
never executed: end of block
0
302-
303-
304-
305-
306bool QJsonDocument::operator==(const QJsonDocument &other) const-
307{-
308 if (d == other.d
d == other.dDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QMetaType
FALSEnever evaluated
)
0-8
309 return
executed 8 times by 1 test: return true;
Executed by:
  • tst_QMetaType
true;
executed 8 times by 1 test: return true;
Executed by:
  • tst_QMetaType
8
310-
311 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !other.d
!other.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
312 return
never executed: return false;
false;
never executed: return false;
0
313-
314 if (d->header->root()->isArray() != other.d->header->root()->isArray()
d->header->roo...t()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
315 return
never executed: return false;
false;
never executed: return false;
0
316-
317 if (d->header->root()->isObject()
d->header->root()->isObject()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
318 return
never executed: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())) == QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.d->header->root()));
QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root()))
never executed: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())) == QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.d->header->root()));
0
319 == QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.d->header->root()));
never executed: return QJsonObject(d, static_cast<QJsonPrivate::Object *>(d->header->root())) == QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.d->header->root()));
0
320 else-
321 return
never executed: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())) == QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.d->header->root()));
QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root()))
never executed: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())) == QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.d->header->root()));
0
322 == QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.d->header->root()));
never executed: return QJsonArray(d, static_cast<QJsonPrivate::Array *>(d->header->root())) == QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.d->header->root()));
0
323}-
324bool QJsonDocument::isNull() const-
325{-
326 return
executed 661 times by 113 tests: return (d == 0);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
(d == 0);
executed 661 times by 113 tests: return (d == 0);
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractItemView
  • tst_QAbstractNetworkCache
  • tst_QAbstractPrintDialog
  • tst_QAbstractScrollArea
  • tst_QAccessibility
  • tst_QApplication
  • tst_QBrush
  • tst_QButtonGroup
  • tst_QCalendarWidget
  • tst_QColorDialog
  • tst_QColumnView
  • tst_QComboBox
  • tst_QCommandLinkButton
  • tst_QCompleter
  • tst_QDataStream
  • tst_QDateTimeEdit
  • tst_QDialog
  • tst_QDoubleSpinBox
  • tst_QFactoryLoader
  • tst_QFileDialog2
  • tst_QFileIconProvider
  • tst_QFileSystemModel
  • tst_QFiledialog
  • tst_QFocusEvent
  • ...
661
327}-
328-
329-
330QDebug operator<<(QDebug dbg, const QJsonDocument &o)-
331{-
332 QDebugStateSaver saver(dbg);-
333 if (!o.d
!o.dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QVariant
FALSEnever evaluated
) {
0-1
334 dbg << "QJsonDocument()";-
335 return
executed 1 time by 1 test: return dbg;
Executed by:
  • tst_QVariant
dbg;
executed 1 time by 1 test: return dbg;
Executed by:
  • tst_QVariant
1
336 }-
337 QByteArray json;-
338 if (o.d->header->root()->isArray()
o.d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
339 QJsonPrivate::Writer::arrayToJson(static_cast<QJsonPrivate::Array *>(o.d->header->root()), json, 0, true);
never executed: QJsonPrivate::Writer::arrayToJson(static_cast<QJsonPrivate::Array *>(o.d->header->root()), json, 0, true);
0
340 else-
341 QJsonPrivate::Writer::objectToJson(static_cast<QJsonPrivate::Object *>(o.d->header->root()), json, 0, true);
never executed: QJsonPrivate::Writer::objectToJson(static_cast<QJsonPrivate::Object *>(o.d->header->root()), json, 0, true);
0
342 dbg.nospace() << "QJsonDocument("-
343 << json.constData()-
344 << ')';-
345 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
346}-
347-
348-
349-
Switch to Source codePreprocessed file

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