qjsonvalue.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/json/qjsonvalue.cpp
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 QtCore 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 <qjsonobject.h>-
41#include <qjsonvalue.h>-
42#include <qjsonarray.h>-
43#include <qvariant.h>-
44#include <qstringlist.h>-
45#include <qdebug.h>-
46-
47#include "qjson_p.h"-
48-
49QT_BEGIN_NAMESPACE-
50-
51/*!-
52 \class QJsonValue-
53 \inmodule QtCore-
54 \ingroup json-
55 \ingroup shared-
56 \reentrant-
57 \since 5.0-
58-
59 \brief The QJsonValue class encapsulates a value in JSON.-
60-
61 A value in JSON can be one of 6 basic types:-
62-
63 JSON is a format to store structured data. It has 6 basic data types:-
64-
65 \list-
66 \li bool QJsonValue::Bool-
67 \li double QJsonValue::Double-
68 \li string QJsonValue::String-
69 \li array QJsonValue::Array-
70 \li object QJsonValue::Object-
71 \li null QJsonValue::Null-
72 \endlist-
73-
74 A value can represent any of the above data types. In addition, QJsonValue has one special-
75 flag to represent undefined values. This can be queried with isUndefined().-
76-
77 The type of the value can be queried with type() or accessors like isBool(), isString(), and so on.-
78 Likewise, the value can be converted to the type stored in it using the toBool(), toString() and so on.-
79-
80 Values are strictly typed internally and contrary to QVariant will not attempt to do any implicit type-
81 conversions. This implies that converting to a type that is not stored in the value will return a default-
82 constructed return value.-
83-
84 \section1 QJsonValueRef-
85-
86 QJsonValueRef is a helper class for QJsonArray and QJsonObject.-
87 When you get an object of type QJsonValueRef, you can-
88 use it as if it were a reference to a QJsonValue. If you assign to it,-
89 the assignment will apply to the element in the QJsonArray or QJsonObject-
90 from which you got the reference.-
91-
92 The following methods return QJsonValueRef:-
93 \list-
94 \li \l {QJsonArray}::operator[](int i)-
95 \li \l {QJsonObject}::operator[](const QString & key) const-
96 \endlist-
97-
98 \sa {JSON Support in Qt}, {JSON Save Game Example}-
99*/-
100-
101/*!-
102 Creates a QJsonValue of type \a type.-
103-
104 The default is to create a Null value.-
105 */-
106QJsonValue::QJsonValue(Type type)-
107 : ui(0), d(0), t(type)-
108{-
109}-
110-
111/*!-
112 \internal-
113 */-
114QJsonValue::QJsonValue(QJsonPrivate::Data *data, QJsonPrivate::Base *base, const QJsonPrivate::Value &v)-
115 : d(0)-
116{-
117 t = (Type)(uint)v.type;-
118 switch (t) {-
119 case Undefined:-
120 case Null:-
121 dbl = 0;-
122 break;-
123 case Bool:-
124 b = v.toBoolean();-
125 break;-
126 case Double:-
127 dbl = v.toDouble(base);-
128 break;-
129 case String: {-
130 QString s = v.toString(base);-
131 stringData = s.data_ptr();-
132 stringData->ref.ref();-
133 break;-
134 }-
135 case Array:-
136 case Object:-
137 d = data;-
138 this->base = v.base(base);-
139 break;-
140 }-
141 if (d)-
142 d->ref.ref();-
143}-
144-
145/*!-
146 Creates a value of type Bool, with value \a b.-
147 */-
148QJsonValue::QJsonValue(bool b)-
149 : d(0), t(Bool)-
150{-
151 this->b = b;-
152}-
153-
154/*!-
155 Creates a value of type Double, with value \a n.-
156 */-
157QJsonValue::QJsonValue(double n)-
158 : d(0), t(Double)-
159{-
160 this->dbl = n;-
161}-
162-
163/*!-
164 \overload-
165 Creates a value of type Double, with value \a n.-
166 */-
167QJsonValue::QJsonValue(int n)-
168 : d(0), t(Double)-
169{-
170 this->dbl = n;-
171}-
172-
173/*!-
174 \overload-
175 Creates a value of type Double, with value \a n.-
176 NOTE: the integer limits for IEEE 754 double precision data is 2^53 (-9007199254740992 to +9007199254740992).-
177 If you pass in values outside this range expect a loss of precision to occur.-
178 */-
179QJsonValue::QJsonValue(qint64 n)-
180 : d(0), t(Double)-
181{-
182 this->dbl = double(n);-
183}-
184-
185/*!-
186 Creates a value of type String, with value \a s.-
187 */-
188QJsonValue::QJsonValue(const QString &s)-
189 : d(0), t(String)-
190{-
191 stringDataFromQStringHelper(s);-
192}-
193-
194/*!-
195 \fn QJsonValue::QJsonValue(const char *s)-
196-
197 Creates a value of type String with value \a s, assuming-
198 UTF-8 encoding of the input.-
199-
200 You can disable this constructor by defining \c-
201 QT_NO_CAST_FROM_ASCII when you compile your applications.-
202-
203 \since 5.3-
204 */-
205-
206void QJsonValue::stringDataFromQStringHelper(const QString &string)-
207{-
208 stringData = *(QStringData **)(&string);-
209 stringData->ref.ref();-
210}-
211-
212/*!-
213 Creates a value of type String, with value \a s.-
214 */-
215QJsonValue::QJsonValue(QLatin1String s)-
216 : d(0), t(String)-
217{-
218 // ### FIXME: Avoid creating the temp QString below-
219 QString str(s);-
220 stringDataFromQStringHelper(str);-
221}-
222-
223/*!-
224 Creates a value of type Array, with value \a a.-
225 */-
226QJsonValue::QJsonValue(const QJsonArray &a)-
227 : d(a.d), t(Array)-
228{-
229 base = a.a;-
230 if (d)-
231 d->ref.ref();-
232}-
233-
234/*!-
235 Creates a value of type Object, with value \a o.-
236 */-
237QJsonValue::QJsonValue(const QJsonObject &o)-
238 : d(o.d), t(Object)-
239{-
240 base = o.o;-
241 if (d)-
242 d->ref.ref();-
243}-
244-
245-
246/*!-
247 Destroys the value.-
248 */-
249QJsonValue::~QJsonValue()-
250{-
251 if (t == String && stringData && !stringData->ref.deref())-
252 free(stringData);-
253-
254 if (d && !d->ref.deref())-
255 delete d;-
256}-
257-
258/*!-
259 Creates a copy of \a other.-
260 */-
261QJsonValue::QJsonValue(const QJsonValue &other)-
262{-
263 t = other.t;-
264 d = other.d;-
265 ui = other.ui;-
266 if (d)-
267 d->ref.ref();-
268-
269 if (t == String && stringData)-
270 stringData->ref.ref();-
271}-
272-
273/*!-
274 Assigns the value stored in \a other to this object.-
275 */-
276QJsonValue &QJsonValue::operator =(const QJsonValue &other)-
277{-
278 QJsonValue copy(other);-
279 // swap(copy);-
280 qSwap(dbl, copy.dbl);-
281 qSwap(d, copy.d);-
282 qSwap(t, copy.t);-
283 return *this;-
284}-
285-
286/*!-
287 \fn bool QJsonValue::isNull() const-
288-
289 Returns \c true if the value is null.-
290*/-
291-
292/*!-
293 \fn bool QJsonValue::isBool() const-
294-
295 Returns \c true if the value contains a boolean.-
296-
297 \sa toBool()-
298 */-
299-
300/*!-
301 \fn bool QJsonValue::isDouble() const-
302-
303 Returns \c true if the value contains a double.-
304-
305 \sa toDouble()-
306 */-
307-
308/*!-
309 \fn bool QJsonValue::isString() const-
310-
311 Returns \c true if the value contains a string.-
312-
313 \sa toString()-
314 */-
315-
316/*!-
317 \fn bool QJsonValue::isArray() const-
318-
319 Returns \c true if the value contains an array.-
320-
321 \sa toArray()-
322 */-
323-
324/*!-
325 \fn bool QJsonValue::isObject() const-
326-
327 Returns \c true if the value contains an object.-
328-
329 \sa toObject()-
330 */-
331-
332/*!-
333 \fn bool QJsonValue::isUndefined() const-
334-
335 Returns \c true if the value is undefined. This can happen in certain-
336 error cases as e.g. accessing a non existing key in a QJsonObject.-
337 */-
338-
339-
340/*!-
341 Converts \a variant to a QJsonValue and returns it.-
342-
343 The conversion will convert QVariant types as follows:-
344-
345 \table-
346 \header-
347 \li Source type-
348 \li Destination type-
349 \row-
350 \li-
351 \list-
352 \li QMetaType::Bool-
353 \endlist-
354 \li QJsonValue::Bool-
355 \row-
356 \li-
357 \list-
358 \li QMetaType::Int-
359 \li QMetaType::UInt-
360 \li QMetaType::LongLong-
361 \li QMetaType::ULongLong-
362 \li QMetaType::Float-
363 \li QMetaType::Double-
364 \endlist-
365 \li QJsonValue::Double-
366 \row-
367 \li-
368 \list-
369 \li QMetaType::QString-
370 \endlist-
371 \li QJsonValue::String-
372 \row-
373 \li-
374 \list-
375 \li QMetaType::QStringList-
376 \li QMetaType::QVariantList-
377 \endlist-
378 \li QJsonValue::Array-
379 \row-
380 \li-
381 \list-
382 \li QMetaType::QVariantMap-
383 \li QMetaType::QVariantHash-
384 \endlist-
385 \li QJsonValue::Object-
386 \endtable-
387-
388 For all other QVariant types a conversion to a QString will be attempted. If the returned string-
389 is empty, a Null QJsonValue will be stored, otherwise a String value using the returned QString.-
390-
391 \sa toVariant()-
392 */-
393QJsonValue QJsonValue::fromVariant(const QVariant &variant)-
394{-
395 switch (variant.userType()) {-
396 case QVariant::Bool:-
397 return QJsonValue(variant.toBool());-
398 case QVariant::Int:-
399 case QMetaType::Float:-
400 case QVariant::Double:-
401 case QVariant::LongLong:-
402 case QVariant::ULongLong:-
403 case QVariant::UInt:-
404 return QJsonValue(variant.toDouble());-
405 case QVariant::String:-
406 return QJsonValue(variant.toString());-
407 case QVariant::StringList:-
408 return QJsonValue(QJsonArray::fromStringList(variant.toStringList()));-
409 case QVariant::List:-
410 return QJsonValue(QJsonArray::fromVariantList(variant.toList()));-
411 case QVariant::Map:-
412 return QJsonValue(QJsonObject::fromVariantMap(variant.toMap()));-
413 case QVariant::Hash:-
414 return QJsonValue(QJsonObject::fromVariantHash(variant.toHash()));-
415#ifndef QT_BOOTSTRAPPED-
416 case QMetaType::QJsonValue:-
417 return variant.toJsonValue();-
418 case QMetaType::QJsonObject:-
419 return variant.toJsonObject();-
420 case QMetaType::QJsonArray:-
421 return variant.toJsonArray();-
422 case QMetaType::QJsonDocument: {-
423 QJsonDocument doc = variant.toJsonDocument();-
424 return doc.isArray() ? QJsonValue(doc.array()) : QJsonValue(doc.object());-
425 }-
426#endif-
427 default:-
428 break;-
429 }-
430 QString string = variant.toString();-
431 if (string.isEmpty())-
432 return QJsonValue();-
433 return QJsonValue(string);-
434}-
435-
436/*!-
437 Converts the value to a \l {QVariant::}{QVariant()}.-
438-
439 The QJsonValue types will be converted as follows:-
440-
441 \value Null \l {QVariant::}{QVariant()}-
442 \value Bool QMetaType::Bool-
443 \value Double QMetaType::Double-
444 \value String QString-
445 \value Array QVariantList-
446 \value Object QVariantMap-
447 \value Undefined \l {QVariant::}{QVariant()}-
448-
449 \sa fromVariant()-
450 */-
451QVariant QJsonValue::toVariant() const-
452{-
453 switch (t) {-
454 case Bool:-
455 return b;-
456 case Double:-
457 return dbl;-
458 case String:-
459 return toString();-
460 case Array:-
461 return d ?-
462 QJsonArray(d, static_cast<QJsonPrivate::Array *>(base)).toVariantList() :-
463 QVariantList();-
464 case Object:-
465 return d ?-
466 QJsonObject(d, static_cast<QJsonPrivate::Object *>(base)).toVariantMap() :-
467 QVariantMap();-
468 case Null:-
469 case Undefined:-
470 break;-
471 }-
472 return QVariant();-
473}-
474-
475/*!-
476 \enum QJsonValue::Type-
477-
478 This enum describes the type of the JSON value.-
479-
480 \value Null A Null value-
481 \value Bool A boolean value. Use toBool() to convert to a bool.-
482 \value Double A double. Use toDouble() to convert to a double.-
483 \value String A string. Use toString() to convert to a QString.-
484 \value Array An array. Use toArray() to convert to a QJsonArray.-
485 \value Object An object. Use toObject() to convert to a QJsonObject.-
486 \value Undefined The value is undefined. This is usually returned as an-
487 error condition, when trying to read an out of bounds value-
488 in an array or a non existent key in an object.-
489*/-
490-
491/*!-
492 Returns the type of the value.-
493-
494 \sa QJsonValue::Type-
495 */-
496QJsonValue::Type QJsonValue::type() const-
497{-
498 return t;-
499}-
500-
501/*!-
502 Converts the value to a bool and returns it.-
503-
504 If type() is not bool, the \a defaultValue will be returned.-
505 */-
506bool QJsonValue::toBool(bool defaultValue) const-
507{-
508 if (t != Bool)-
509 return defaultValue;-
510 return b;-
511}-
512-
513/*!-
514 Converts the value to an int and returns it.-
515-
516 If type() is not Double or the value is not a whole number,-
517 the \a defaultValue will be returned.-
518 */-
519int QJsonValue::toInt(int defaultValue) const-
520{-
521 if (t == Double && int(dbl) == dbl)-
522 return int(dbl);-
523 return defaultValue;-
524}-
525-
526/*!-
527 Converts the value to a double and returns it.-
528-
529 If type() is not Double, the \a defaultValue will be returned.-
530 */-
531double QJsonValue::toDouble(double defaultValue) const-
532{-
533 if (t != Double)-
534 return defaultValue;-
535 return dbl;-
536}-
537-
538/*!-
539 Converts the value to a QString and returns it.-
540-
541 If type() is not String, the \a defaultValue will be returned.-
542 */-
543QString QJsonValue::toString(const QString &defaultValue) const-
544{-
545 if (t != String)-
546 return defaultValue;-
547 stringData->ref.ref(); // the constructor below doesn't add a ref.-
548 QStringDataPtr holder = { stringData };-
549 return QString(holder);-
550}-
551-
552/*!-
553 Converts the value to a QString and returns it.-
554-
555 If type() is not String, a null QString will be returned.-
556-
557 \sa QString::isNull()-
558 */-
559QString QJsonValue::toString() const-
560{-
561 if (t != String)
t != StringDescription
TRUEevaluated 157 times by 3 tests
Evaluated by:
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QNetworkCookieJar
FALSEevaluated 69808 times by 117 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
  • ...
157-69808
562 return QString();
executed 157 times by 3 tests: return QString();
Executed by:
  • tst_QImageReader
  • tst_QImageWriter
  • tst_QNetworkCookieJar
157
563 stringData->ref.ref(); // the constructor below doesn't add a ref.-
564 QStringDataPtr holder = { stringData };-
565 return QString(holder);
executed 69808 times by 117 tests: return QString(holder);
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
  • ...
69808
566}-
567-
568/*!-
569 Converts the value to an array and returns it.-
570-
571 If type() is not Array, the \a defaultValue will be returned.-
572 */-
573QJsonArray QJsonValue::toArray(const QJsonArray &defaultValue) const-
574{-
575 if (!d || t != Array)-
576 return defaultValue;-
577-
578 return QJsonArray(d, static_cast<QJsonPrivate::Array *>(base));-
579}-
580-
581/*!-
582 \overload-
583-
584 Converts the value to an array and returns it.-
585-
586 If type() is not Array, a \l{QJsonArray::}{QJsonArray()} will be returned.-
587 */-
588QJsonArray QJsonValue::toArray() const-
589{-
590 return toArray(QJsonArray());-
591}-
592-
593/*!-
594 Converts the value to an object and returns it.-
595-
596 If type() is not Object, the \a defaultValue will be returned.-
597 */-
598QJsonObject QJsonValue::toObject(const QJsonObject &defaultValue) const-
599{-
600 if (!d || t != Object)-
601 return defaultValue;-
602-
603 return QJsonObject(d, static_cast<QJsonPrivate::Object *>(base));-
604}-
605-
606/*!-
607 \overload-
608-
609 Converts the value to an object and returns it.-
610-
611 If type() is not Object, the \l {QJsonObject::}{QJsonObject()} will be returned.-
612*/-
613QJsonObject QJsonValue::toObject() const-
614{-
615 return toObject(QJsonObject());-
616}-
617-
618/*!-
619 Returns \c true if the value is equal to \a other.-
620 */-
621bool QJsonValue::operator==(const QJsonValue &other) const-
622{-
623 if (t != other.t)-
624 return false;-
625-
626 switch (t) {-
627 case Undefined:-
628 case Null:-
629 break;-
630 case Bool:-
631 return b == other.b;-
632 case Double:-
633 return dbl == other.dbl;-
634 case String:-
635 return toString() == other.toString();-
636 case Array:-
637 if (base == other.base)-
638 return true;-
639 if (!base)-
640 return !other.base->length;-
641 if (!other.base)-
642 return !base->length;-
643 return QJsonArray(d, static_cast<QJsonPrivate::Array *>(base))-
644 == QJsonArray(other.d, static_cast<QJsonPrivate::Array *>(other.base));-
645 case Object:-
646 if (base == other.base)-
647 return true;-
648 if (!base)-
649 return !other.base->length;-
650 if (!other.base)-
651 return !base->length;-
652 return QJsonObject(d, static_cast<QJsonPrivate::Object *>(base))-
653 == QJsonObject(other.d, static_cast<QJsonPrivate::Object *>(other.base));-
654 }-
655 return true;-
656}-
657-
658/*!-
659 Returns \c true if the value is not equal to \a other.-
660 */-
661bool QJsonValue::operator!=(const QJsonValue &other) const-
662{-
663 return !(*this == other);-
664}-
665-
666/*!-
667 \internal-
668 */-
669void QJsonValue::detach()-
670{-
671 if (!d)-
672 return;-
673-
674 QJsonPrivate::Data *x = d->clone(base);-
675 x->ref.ref();-
676 if (!d->ref.deref())-
677 delete d;-
678 d = x;-
679 base = static_cast<QJsonPrivate::Object *>(d->header->root());-
680}-
681-
682-
683/*!-
684 \class QJsonValueRef-
685 \inmodule QtCore-
686 \reentrant-
687 \brief The QJsonValueRef class is a helper class for QJsonValue.-
688-
689 \internal-
690-
691 \ingroup json-
692-
693 When you get an object of type QJsonValueRef, if you can assign to it,-
694 the assignment will apply to the character in the string from-
695 which you got the reference. That is its whole purpose in life.-
696-
697 You can use it exactly in the same way as a reference to a QJsonValue.-
698-
699 The QJsonValueRef becomes invalid once modifications are made to the-
700 string: if you want to keep the character, copy it into a QJsonValue.-
701-
702 Most of the QJsonValue member functions also exist in QJsonValueRef.-
703 However, they are not explicitly documented here.-
704*/-
705-
706-
707QJsonValueRef &QJsonValueRef::operator =(const QJsonValue &val)-
708{-
709 if (is_object)-
710 o->setValueAt(index, val);-
711 else-
712 a->replace(index, val);-
713-
714 return *this;-
715}-
716-
717QJsonValueRef &QJsonValueRef::operator =(const QJsonValueRef &ref)-
718{-
719 if (is_object)-
720 o->setValueAt(index, ref);-
721 else-
722 a->replace(index, ref);-
723-
724 return *this;-
725}-
726-
727QVariant QJsonValueRef::toVariant() const-
728{-
729 return toValue().toVariant();-
730}-
731-
732QJsonArray QJsonValueRef::toArray() const-
733{-
734 return toValue().toArray();-
735}-
736-
737QJsonObject QJsonValueRef::toObject() const-
738{-
739 return toValue().toObject();-
740}-
741-
742QJsonValue QJsonValueRef::toValue() const-
743{-
744 if (!is_object)-
745 return a->at(index);-
746 return o->valueAt(index);-
747}-
748-
749#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)-
750QDebug operator<<(QDebug dbg, const QJsonValue &o)-
751{-
752 QDebugStateSaver saver(dbg);-
753 switch (o.t) {-
754 case QJsonValue::Undefined:-
755 dbg << "QJsonValue(undefined)";-
756 break;-
757 case QJsonValue::Null:-
758 dbg << "QJsonValue(null)";-
759 break;-
760 case QJsonValue::Bool:-
761 dbg.nospace() << "QJsonValue(bool, " << o.toBool() << ')';-
762 break;-
763 case QJsonValue::Double:-
764 dbg.nospace() << "QJsonValue(double, " << o.toDouble() << ')';-
765 break;-
766 case QJsonValue::String:-
767 dbg.nospace() << "QJsonValue(string, " << o.toString() << ')';-
768 break;-
769 case QJsonValue::Array:-
770 dbg.nospace() << "QJsonValue(array, ";-
771 dbg << o.toArray();-
772 dbg << ')';-
773 break;-
774 case QJsonValue::Object:-
775 dbg.nospace() << "QJsonValue(object, ";-
776 dbg << o.toObject();-
777 dbg << ')';-
778 break;-
779 }-
780 return dbg;-
781}-
782#endif-
783-
784QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

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