OpenCoverage

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__,114) : qt_noop());-
33 d->ref.ref();-
34}
executed 711 times by 114 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
  • ...
711
35-
36-
37-
38-
39-
40-
41QJsonDocument::~QJsonDocument()-
42{-
43 if (d
dDescription
TRUEevaluated 712 times by 114 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 495 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 705 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
  • ...
)
7-712
44 delete d;
executed 7 times by 3 tests: delete d;
Executed by:
  • tst_QNetworkCookieJar
  • tst_QOpenGlConfig
  • tst_qmakelib
7
45}
executed 1207 times by 117 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
  • ...
1207
46-
47-
48-
49-
50QJsonDocument::QJsonDocument(const QJsonDocument &other)-
51{-
52 d = other.d;-
53 if (d
dDescription
TRUEnever evaluated
FALSEevaluated 165 times by 3 tests
Evaluated by:
  • tst_QMetaType
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
)
0-165
54 d->ref.ref();
never executed: d->ref.ref();
0
55}
executed 165 times by 3 tests: end of block
Executed by:
  • tst_QMetaType
  • tst_QVariant
  • tst_qdbuscpp2xml - unknown status
165
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__, 187, __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 QJsonPrivate::Data *d = new QJsonPrivate::Data((char *)data, size);-
81 d->ownsData = false;-
82-
83 if (validation != BypassValidation
validation != BypassValidationDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->valid()
!d->valid()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
84 delete d;-
85 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
86 }-
87-
88 return
never executed: return QJsonDocument(d);
QJsonDocument(d);
never executed: return QJsonDocument(d);
0
89}-
90const char *QJsonDocument::rawData(int *size) const-
91{-
92 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
93 *size = 0;-
94 return
never executed: return 0;
0;
never executed: return 0;
0
95 }-
96 *size = d->alloc;-
97 return
never executed: return d->rawData;
d->rawData;
never executed: return d->rawData;
0
98}-
99QJsonDocument QJsonDocument::fromBinaryData(const QByteArray &data, DataValidation validation)-
100{-
101 if (data.size() < (int)(sizeof(QJsonPrivate::Header) + sizeof(QJsonPrivate::Base))
data.size() < ...rivate::Base))Description
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
)
0-704
102 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
103-
104 QJsonPrivate::Header h;-
105 memcpy(&h, data.constData(), sizeof(QJsonPrivate::Header));-
106 QJsonPrivate::Base root;-
107 memcpy(&root, data.constData() + sizeof(QJsonPrivate::Header), sizeof(QJsonPrivate::Base));-
108-
109-
110 if (h.tag != QJsonDocument::BinaryFormatTag
h.tag != QJson...inaryFormatTagDescription
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
|| h.version != 1u
h.version != 1uDescription
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
||
0-704
111 sizeof(QJsonPrivate::Header) + root.size > (uint)data.size()
sizeof(QJsonPr...nt)data.size()Description
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
)
0-704
112 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
113-
114 const uint size = sizeof(QJsonPrivate::Header) + root.size;-
115 char *raw = (char *)malloc(size);-
116 if (!raw
!rawDescription
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
)
0-704
117 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
118-
119 memcpy(raw, data.constData(), size);-
120 QJsonPrivate::Data *d = new QJsonPrivate::Data(raw, size);-
121-
122 if (validation != BypassValidation
validation != BypassValidationDescription
TRUEevaluated 704 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
  • ...
FALSEnever evaluated
&& !d->valid()
!d->valid()Description
TRUEnever evaluated
FALSEevaluated 704 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
  • ...
) {
0-704
123 delete d;-
124 return
never executed: return QJsonDocument();
QJsonDocument();
never executed: return QJsonDocument();
0
125 }-
126-
127 return
executed 704 times by 111 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 704 times by 111 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
  • ...
704
128}-
129QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)-
130{-
131 QJsonDocument doc;-
132 if (variant.type() == QVariant::Map
variant.type()... QVariant::MapDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
133 doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));-
134 }
never executed: end of block
else if (variant.type() == QVariant::List
variant.type()...QVariant::ListDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
135 doc.setArray(QJsonArray::fromVariantList(variant.toList()));-
136 }
never executed: end of block
else if (variant.type() == QVariant::StringList
variant.type()...nt::StringListDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
137 doc.setArray(QJsonArray::fromStringList(variant.toStringList()));-
138 }
never executed: end of block
0
139 return
never executed: return doc;
doc;
never executed: return doc;
0
140}-
141QVariant QJsonDocument::toVariant() const-
142{-
143 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
144 return
never executed: return QVariant();
QVariant();
never executed: return QVariant();
0
145-
146 if (d->header->root()->isArray()
d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
147 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
148 else-
149 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
150}-
151-
152-
153-
154-
155-
156-
157-
158QByteArray QJsonDocument::toJson() const-
159{-
160 return
never executed: return toJson(Indented);
toJson(Indented);
never executed: return toJson(Indented);
0
161}-
162QByteArray QJsonDocument::toJson(JsonFormat format) const-
163{-
164 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
165 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
166-
167 QByteArray json;-
168-
169 if (d->header->root()->isArray()
d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
170 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
171 else-
172 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
173-
174 return
never executed: return json;
json;
never executed: return json;
0
175}-
176QJsonDocument QJsonDocument::fromJson(const QByteArray &json, QJsonParseError *error)-
177{-
178 QJsonPrivate::Parser parser(json.constData(), json.length());-
179 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
180}-
181-
182-
183-
184-
185bool QJsonDocument::isEmpty() const-
186{-
187 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
188 return
never executed: return true;
true;
never executed: return true;
0
189-
190 return
never executed: return false;
false;
never executed: return false;
0
191}-
192QByteArray QJsonDocument::toBinaryData() const-
193{-
194 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !d->rawData
!d->rawDataDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
195 return
never executed: return QByteArray();
QByteArray();
never executed: return QByteArray();
0
196-
197 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
198}-
199-
200-
201-
202-
203-
204-
205bool QJsonDocument::isArray() const-
206{-
207 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 2 times by 2 tests
Evaluated by:
  • tst_QNetworkCookieJar
  • tst_qmakelib
)
0-2
208 return
never executed: return false;
false;
never executed: return false;
0
209-
210 QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData;-
211 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
212}-
213-
214-
215-
216-
217-
218-
219bool QJsonDocument::isObject() const-
220{-
221 if (!d
!dDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_qmakelib
)
0-1
222 return
never executed: return false;
false;
never executed: return false;
0
223-
224 QJsonPrivate::Header *h = (QJsonPrivate::Header *)d->rawData;-
225 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
226}-
227QJsonObject QJsonDocument::object() const-
228{-
229 if (d
dDescription
TRUEevaluated 710 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
  • ...
FALSEnever evaluated
) {
0-710
230 QJsonPrivate::Base *b = d->header->root();-
231 if (b->isObject()
b->isObject()Description
TRUEevaluated 710 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
  • ...
FALSEnever evaluated
)
0-710
232 return
executed 710 times by 113 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 710 times by 113 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
  • ...
710
233 }
never executed: end of block
0
234 return
never executed: return QJsonObject();
QJsonObject();
never executed: return QJsonObject();
0
235}-
236QJsonArray QJsonDocument::array() const-
237{-
238 if (d
dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEnever evaluated
) {
0-1
239 QJsonPrivate::Base *b = d->header->root();-
240 if (b->isArray()
b->isArray()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QNetworkCookieJar
FALSEnever evaluated
)
0-1
241 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
242 }
never executed: end of block
0
243 return
never executed: return QJsonArray();
QJsonArray();
never executed: return QJsonArray();
0
244}-
245-
246-
247-
248-
249-
250-
251void QJsonDocument::setObject(const QJsonObject &object)-
252{-
253 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
254 delete d;
never executed: delete d;
0
255-
256 d = object.d;-
257-
258 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
259 d = new QJsonPrivate::Data(0, QJsonValue::Object);-
260 }
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
261 QJsonObject o(object);-
262 if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
263 o.compact();
never executed: o.compact();
0
264 else-
265 o.detach2();
never executed: o.detach2();
0
266 d = o.d;-
267 d->ref.ref();-
268 return;
never executed: return;
0
269 }-
270 d->ref.ref();-
271}
never executed: end of block
0
272-
273-
274-
275-
276-
277-
278void QJsonDocument::setArray(const QJsonArray &array)-
279{-
280 if (d
dDescription
TRUEnever evaluated
FALSEnever evaluated
&& !d->ref.deref()
!d->ref.deref()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
281 delete d;
never executed: delete d;
0
282-
283 d = array.d;-
284-
285 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
286 d = new QJsonPrivate::Data(0, QJsonValue::Array);-
287 }
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
288 QJsonArray a(array);-
289 if (d->compactionCounter
d->compactionCounterDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
290 a.compact();
never executed: a.compact();
0
291 else-
292 a.detach2();
never executed: a.detach2();
0
293 d = a.d;-
294 d->ref.ref();-
295 return;
never executed: return;
0
296 }-
297 d->ref.ref();-
298}
never executed: end of block
0
299-
300-
301-
302-
303bool QJsonDocument::operator==(const QJsonDocument &other) const-
304{-
305 if (d == other.d
d == other.dDescription
TRUEevaluated 8 times by 1 test
Evaluated by:
  • tst_QMetaType
FALSEnever evaluated
)
0-8
306 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
307-
308 if (!d
!dDescription
TRUEnever evaluated
FALSEnever evaluated
|| !other.d
!other.dDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
309 return
never executed: return false;
false;
never executed: return false;
0
310-
311 if (d->header->root()->isArray() != other.d->header->root()->isArray()
d->header->roo...t()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
312 return
never executed: return false;
false;
never executed: return false;
0
313-
314 if (d->header->root()->isObject()
d->header->root()->isObject()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
315 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
316 == 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
317 else-
318 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
319 == 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
320}-
321bool QJsonDocument::isNull() const-
322{-
323 return
executed 686 times by 114 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 686 times by 114 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
  • ...
686
324}-
325-
326-
327QDebug operator<<(QDebug dbg, const QJsonDocument &o)-
328{-
329 QDebugStateSaver saver(dbg);-
330 if (!o.d
!o.dDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QVariant
FALSEnever evaluated
) {
0-1
331 dbg << "QJsonDocument()";-
332 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
333 }-
334 QByteArray json;-
335 if (o.d->header->root()->isArray()
o.d->header->root()->isArray()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
336 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
337 else-
338 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
339 dbg.nospace() << "QJsonDocument("-
340 << json.constData()-
341 << ')';-
342 return
never executed: return dbg;
dbg;
never executed: return dbg;
0
343}-
344-
345-
346-
Switch to Source codePreprocessed file

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