summaryrefslogtreecommitdiffstats
path: root/src/corelib/json
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-271-0/+10
|\ | | | | | | Change-Id: Id20053d261b4fbbcc0ac8ba49dd3ef2253fa4b95
| * QJsonArray::(const_)iterator: mark the pointer typedefs as internalGiuseppe D'Angelo2014-11-271-0/+10
| | | | | | | | | | | | | | | | | | Just like the other typedefs; removes the doc warnings. Change-Id: I61142b8db57f4e0cc44cb8c459b1e82e69da3413 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-11-242-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qiodevice.cpp src/plugins/bearer/linux_common/qofonoservice_linux.cpp src/plugins/bearer/linux_common/qofonoservice_linux_p.h src/plugins/platforms/android/qandroidplatformtheme.cpp src/tools/bootstrap/bootstrap.pro src/widgets/styles/qmacstyle_mac.mm Change-Id: Ia02aab6c4598ce74e9c30bb4666d5e2ef000f99b
| * Doc: corrected autolink issue jsonNico Vertriest2014-11-131-1/+1
| | | | | | | | | | | | | | Task-number: QTBUG-40362 Change-Id: I851670eea6af80b0bb463f00b147d7a6ef289046 Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
| * QJsonArray::(const_)iterator: add the typedef for the pointer typeGiuseppe D'Angelo2014-11-131-0/+2
| | | | | | | | | | | | | | | | | | Mandatory as per the standard iterator requirements, was causing compilation errors in the STL algorithms. Task-number: QTBUG-41628 Change-Id: Iee12a3b822383f63c07e270244fd0e145a486b95 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add conversion between QVariantHash and QJsonObjectAllan Sandfeld Jensen2014-10-303-1/+49
|/ | | | | | | | | | | Adds automatic conversion from QVariants with a QVariantHash to QJsonValue and explicit methods for conversion between QVariantHash and QJsonObject. [ChangeLog][QtCore][QJsonObject] Added conversion to and from QVariantHash Change-Id: I140ef881463acabaab2648e28209487d8ad18e0d Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-2414-266/+154
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/5.3' into 5.4Frederik Gladhorn2014-09-231-6/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The isAlwaysAskOption was removed in 38621713150b663355ebeb799a5a50d8e39a3c38 so manually removed code in src/plugins/bearer/connman/qconnmanengine.cpp Conflicts: src/corelib/global/qglobal.h src/corelib/tools/qcollator_macx.cpp src/corelib/tools/qstring.cpp src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow_p.h src/gui/text/qtextengine.cpp src/platformsupport/fontdatabases/fontconfig/qfontenginemultifontconfig_p.h src/plugins/platforms/android/qandroidinputcontext.cpp src/plugins/platforms/xcb/qglxintegration.cpp src/plugins/platforms/xcb/qglxintegration.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/testlib/qtestcase.cpp src/testlib/qtestlog.cpp src/widgets/dialogs/qfiledialog.cpp src/widgets/kernel/qwindowcontainer.cpp tests/auto/corelib/tools/qcollator/tst_qcollator.cpp tests/auto/gui/text/qtextscriptengine/tst_qtextscriptengine.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp Change-Id: Ic5d4187f682257a17509f6cd28d2836c6cfe2fc8
| * Doc: corrected autolink errors QjsonvalueNico Vertriest2014-08-251-6/+6
| | | | | | | | | | | | | | Task-number: QTBUG-40362 Change-Id: I2ae782ea606e8ee55ee0fcfbbb29db3216b0574b Reviewed-by: Martin Smith <martin.smith@digia.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* | Revert "Reading QJsonObject property should not modify the object itself."Jędrzej Nowacki2014-09-114-83/+11
| | | | | | | | | | | | | | | | | | | | This reverts commit 20cf632ad5f3ffe7b0fd231724c971f4e07304eb. The commit produced to many problems during statics destruction. For example causing QtCreator crash (QTBUG-40987). Change-Id: Ib52f6a449c2d84deab2de792559a6a065ca45e8d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Don't accept json strings with trailing garbageLars Knoll2014-09-102-1/+14
| | | | | | | | | | | | | | | | | | | | A well formed JSON document is not allowed to contain trailing garbage at the end. Don't accept this in the parser. Task-number: QTBUG-40062 Change-Id: I0a09dbd099a8c643f58023342546c4e67d026fec Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Fix bugs in internal comparison operatorsLars Knoll2014-09-101-3/+20
| | | | | | | | | | | | | | | | | | | | | | The comparison operators between QJsonPrivate::String and QJsonPrivate::Latin1String weren't all correct, leading to wrong sorting of keys in QJsonObjects when the keys were outside of the latin1 range and resulting lookup errors. Task-number: QTBUG-41100 Change-Id: Idceff615f85d7ab874ad2a8e4a6c1ce8c2aa0f65 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Add operator-> to QJson iteratorsAllan Sandfeld Jensen2014-08-255-7/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | The iterators for QJsonArray and QJsonObject are currently lacking an operator-> definition. Unfortunately it is not possible to do in clean way without redefining either the iterators or QJsonValueRef class. This patch instead adds two fake pointer classes that are only used to handle the operator-> return value. Task-number: QTBUG-29573 Change-Id: Ief785a6afbbedc9e89cf3b6f3958c2c755997a66 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add initializer list support in QJsonObject.Jędrzej Nowacki2014-07-302-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows to create a QJsonObject instance in C++ by using initializer list of pairs QString QJsonValue, for example: QJsonObject o = {{"property1", 1}, {"property2", 2}}; [ChangeLog][QtCore][QtJson] QJsonObject now supports C++11 initializer lists. Task-number: QTBUG-26606 Change-Id: I67af881e175f427e563e685336c48a5f8466b476 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Fix QJsonValue comparison.Jędrzej Nowacki2014-07-251-2/+4
| | | | | | | | | | | | | | | | | | QJsonValue, while comparing two QJsonArrays, should consult also length of the arrays, because a different than null base pointer doesn't mean that an array is not empty. Change-Id: If76739355a4e74b842e836289565f98d95c006d5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix QJsonValue comparison.Jędrzej Nowacki2014-07-251-2/+4
| | | | | | | | | | | | | | | | | | QJsonValue, while comparing two QJsonObjects, should consult also length of the objects, because a different than null base pointer doesn't mean that an object is not empty. Change-Id: Ibee1849ef9fed15d32f2c8f2aad9b053846e46b7 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Reading QJsonObject property should not modify the object itself.Jędrzej Nowacki2014-07-254-11/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this change such code: QJsonObject o; o["blah"]; would create property "blah" and assign null value to it, while this code: const QJsonObject o; o["blah"]; would not. The change unifies the confusing behavior. Now reading a non-existing property, is not causing a property to be added in any visible way. Internally QJsonObject stores a special hash of undefined, but referenced values. Such reference is supposed to not live long, only to the first compacting or assignment. Change-Id: Ib022acf74ff49bad88d45d65d7093c4281d468f1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Fix QJsonObject const index operatorJędrzej Nowacki2014-07-251-1/+1
| | | | | | | | | | | | | | | | | | The operator should always return an undefined values for an empty object Change-Id: Ic38f7660d77c64b2d001967bc5109df4185db74a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add initializer list support in QJsonArrayJędrzej Nowacki2014-07-042-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows to create a QJsonArray instance in C++ by using a similar expression to JSON. For example: QJsonArray a = {1, 2, 4}; [ChangeLog][QtCore][QtJson] QJsonArray now supports C++11 initializer lists. Task-number: QTBUG-26606 Change-Id: Icc352e518d9649d24176c89e7113d200d5c50b0d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Update doc: match actual compact JSON outputmlpo2014-06-261-1/+1
| | | | | | | | | | | | | | Task-number: QTBUG-36682 Change-Id: I0fca746a7838cce49efc243a242bb9bb7119bd9e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* | json: Add defaultValue to QJsonValueRef toInt/toBool/toDouble/toStringHolger Hans Peter Freyther2014-06-131-0/+6
|/ | | | | | | | | | | | | | | | | | Currently QJsonValue and QJsonValueRef behave differently in regard to the default values leading to confusion compile errors depending on which of the two types one is actually using. Before this change it was possible to write: QJsonValue value = jsonObject["item"]; QString name = value.toString(QStringLiteral("default")); but not: QString name = jsonObject["item"].toString(QStringLiteral("default")); Change-Id: Id1185acf339aa3a91e97848e85d068f84552df71 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Complete QJsonValue::fromVariant()Sze Howe Koh2014-03-061-1/+3
| | | | | | | | | | | | | | - QVariant can store (U)Int, (U)LongLong, Float and Double numbers. Previously, QJsonValue::fromVariant() converted Floats into Strings while converting the others to Doubles. - Add unit tests for QJsonValue::fromVariant() [ChangeLog][QtCore][JSON] QJsonValue::fromVariant() will now convert single-precision Floats into Doubles instead of Strings Change-Id: I457adbe29c37ada611d1c6d711c42866d63d4024 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* Doc: Clarify QJsonValue::fromVariant() type conversionsSze Howe Koh2014-03-041-12/+40
| | | | | | | | | | It wasn't obvious before that many QMetaType types get converted to the same QJsonValue type. Change-Id: I7bb02cb10b6c8a873e291cdf1e16c6c821d51208 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Replace obsolete types with their newer counterpartsSze Howe Koh2014-02-252-15/+15
| | | | | | | | | This patch ignores: - Docs for obsolete types themselves - Comparisons between new and obsolete types Change-Id: Id9b1e628255113e7c44520abe0f8a4e0db4a283d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Remove a not required whitespace when writing JSON in compact formatLars Knoll2014-02-161-1/+1
| | | | | | | Task-number: QTBUG-36682 Change-Id: I0c1c0de850504c8dff20a5ae724cc868d9f983f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Added constructor to QJsonValue for const char *Matt Broadstone2014-01-162-3/+24
| | | | | | | | | | | | | | | | For convenience, it reads more easily (and is somewhat expected) to be able to add a string to a QJsonArray like you might with a QVariantList: QJsonArray() << "string". Previously, QJsonValue provided a private void* ctor to explicitly deny this case because it would implicitly convert to a boolean. This ctor provides a const char* ctor (much like QVariant) that interprets the incoming text as utf8 and creates a String type QJsonValue. [ChangeLog][QtCore][QJsonValue] Added constructor to QJsonValue for const char * Change-Id: Icafa954d3da1fb264f9d0fd7cd1a1d2fbbe15095 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Added convenience methods to QJsonArray for appending QJsonValuesMatt Broadstone2014-01-162-0/+33
| | | | | | | | | | | operators for +, +=, and << were added to QJsonArray to make it easier to work with, and more closely resemble the Qt container classes [ChangeLog][QtCore][QJsonArray] Added convenience methods to QJsonArray for appending QJsonValues Change-Id: I96e0a43015f7c0f980cbbef7f20bd2085ee04795 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Use the new UTF-8 codec in QJsonDocumentThiago Macieira2014-01-092-79/+18
| | | | | | | | | | | | | The encoder is in qjsonwriter.cpp, which requires special handling for ASCII due to the use of escape sequences. The decoder is in qjsonparser.cpp, which only scan one character at a time. As a side-effect, the JSON parser now reports the UTF-8 error in the first character with error, instead of the last. This is probably what should have been expected. Change-Id: I52e5bc30d71466b6a36098b4150c61b2e385d8e9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add QJsonObject::const_iterator() to correct groupTopi Reinio2013-12-051-0/+2
| | | | | | | | | | | Make QJsonObject::const_iterator() part of the same doc group as the non-const variant. Also add a \since command with the correct value. Task-number: QTBUG-33052 Change-Id: I97fa2cc44dae93decf2b99a1384e37579b7dac46 Reviewed-by: Mitch Curtis <mitch.curtis@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Allow non-character codes in utf8 stringsKurt Pattyn2013-10-172-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | Changed the processing of non-character code handling in the UTF8 codec. Non-character codes are now accepted in QStrings, QUrls and QJson strings. Unit tests were adapted accordingly. For more info about non-character codes, see: http://www.unicode.org/versions/corrigendum9.html [ChangeLog][QtCore][QUtf8] UTF-8 now accepts non-character unicode points; these are not replaced by the replacement character anymore [ChangeLog][QtCore][QUrl] QUrl now fully accepts non-character unicode points; they are encoded as percent characters; they can also be pretty decoded [ChangeLog][QtCore][QJson] The Writer and the Parser now fully accept non-character unicode points. Change-Id: I77cf4f0e6210741eac8082912a0b6118eced4f77 Task-number: QTBUG-33229 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add JSON parsing support to qmake.Morten Johan Sørvig2013-10-178-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add qjson* implementation files from corelib/json to the qmake build. Add a read-only compile mode, enabled by defining QT_JSON_READONLY. Add qmake built-in function parseJson(file, into) which parses a json file into the given variable. qmake uses a flat key -> value-list implementation for storing variables, which means that some hackery is need to represent arbitrarily nested JSON. Use a special "_KEYS_" variable for arrays and objects: Arrays: ["item1", "item2"] $${array._KEYS_} -> 0 1 2 $${array.0} -> "item1" $${array.1} -> "item2" Objects: { "key1" : "value1", "key2" : "value2" } $${object._KEYS_} -> key1 key2 $${object.key1} -> value1 $${object.key2} -> value2 Change-Id: I0aa2e4e4ae14fa25be8242bc16d3cffce32504d2 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-082-13/+13
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-08-275-2/+12
|\ | | | | | | | | | | | | Conflicts: examples/widgets/doc/src/addressbook-fr.qdoc Change-Id: Id1196e8e0c6445f1616c3f29234c974d809f8e48
| * Add json/savegame example.Mitch Curtis2013-08-225-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | There wasn't any example documentation besides json.html, which doesn't actually describe usage of the various QJson* classes. This also makes each QJson* class page link back to json.html. Change-Id: If5ad6493d2728df0cec7bdbbc5790f0b755f816c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Add QJsonValue::toInt().Mitch Curtis2013-08-272-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a nice feature to have. MSVC also complains about using doubles to create enum values, so the ugly workaround is: enumValue = MyEnum(qRound(json["myEnumValue"].toDouble())); [ChangeLog][QtCore][QJsonValue]Added QJsonValue::toInt(). Change-Id: I1a200b912abf66b2e96390b1980caff26cfa2685 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-08-211-19/+19
|\| | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/src.pro Change-Id: I0a560826c420e46988da3776bd8f9160c365459a
| * Tidy up QJsonObject documentation.Mitch Curtis2013-08-201-19/+19
| | | | | | | | | | | | Change-Id: I445e0573c3c4fdb86ef535299a4eb299e225c15d Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-08-141-2/+6
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure mkspecs/macx-xcode/Info.plist.app mkspecs/macx-xcode/Info.plist.lib qmake/doc/qmake.qdocconf src/corelib/global/qglobal.h tests/auto/other/exceptionsafety/exceptionsafety.pro tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp Change-Id: I3c769a4a82dc2e99a12c69123fbf17613fd2ac2a
| * Fix crashes when invoking toVariant() on empty QJsonValue objects.Friedemann Kleint2013-07-241-2/+6
| | | | | | | | | | Change-Id: I51cd114e862c6fad564484e990348f324ad56ab9 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
| * QtCore: fix the number precision in QJsonDocument.toJson() againLiang Qi2013-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | Need to store 17 decimal digits for binary64, IEEE 754 double formats. Autotest is included. Test cases from TC39 test suite for ECMAScript. Task-number: QTBUG-31926 Change-Id: I546398f21ea7ff5e40e89fc9de8703f628f55df9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-06-041-1/+2
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.h src/plugins/platforms/cocoa/qnsview.mm Change-Id: I6fe345df5c417cb7a55a3f91285d9b47a22c04fa
| * Fix parsing of long latin strings in the json parserLars Knoll2013-05-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | Latin1 strings are usually stored as 8 bit data in the json binary format. But that data structure has a size limitation of 16bit, so we need to fall back to storing the string as 16 bit data if it is too long. Task-number: QTBUG-30946 Change-Id: I0069b1367030b0b2f819fd1f04e34c9e2534a2a3 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
* | Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2013-05-236-16/+64
|\| | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qdatastream.cpp src/corelib/io/qdatastream.h src/corelib/json/qjsonwriter.cpp src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/xcb/qxcbkeyboard.cpp Change-Id: I46fef1455f5a9f2ce1ec394a3c65881093c51b62
| * QtCore: fix the number precision in QJsonDocument.toJson()Liang Qi2013-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In JSON, any number is stored in double. We need to make sure we keep the maximum possible number precision for integer number. In IEEE 754 double format, the significand precision is 53 bits(52 explicityly stored). Autotest is included. qint64 and double work fine. Task-number: QTBUG-28467 Change-Id: I7f857671c50e4334e9329c778f9b4f090f490540 Reviewed-by: Sune Vuorela <sune@vuorela.dk> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * Fix crashes when creating large documentsLars Knoll2013-05-096-16/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | Compact an object in regular intervals when inserting data into it, to avoid the object becoming huge. Compact an object/array before inserting into another array or object. Check that the document doesn't get so big it's overflowing the internal data structures. Task-number: QTBUG-29288 Change-Id: Id39d80dac1e7d5a11f40819f41b4b336bce16947 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Json writer, support larger signed integers upto 2^53Darryl L. Miles2013-04-122-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | Previously only 32bit signed integers were ensured to be supported by JsonValue type via API but it is expected that a larger integer range should be supported by a JSON implementation. This commit brings the Qt implementation into parity with NodeJS JSON.stringify() in respect of the JavaScript Number type. Change-Id: If91153cb3b13ecc14c50da97055b35ce42f341e7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Json writer, emit full precision for floating point Number typesDarryl L. Miles2013-04-122-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Previously Qt JSON writer would only emit 6 digits of precision as this is the default with the formatter. However with testing against NodeJS JSON.stringify() this behavior is inconsistent with the defacto standard JSON implementation and conveys a loss of precision. Change-Id: Ie1845a6e0ee0b4c05f63ec0062f372e891855f0b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Json writer, only emit floating point finite numbers, ignore INF/NaNDarryl L. Miles2013-04-122-2/+8
|/ | | | | | | | | | | | | | | | | | | | | | | | My interpretation of RFC4627, Section 2.4 "Numbers" of: Numeric values that cannot be represented as sequences of digits (such as Infinity and NaN) are not permitted. I have also verified this matter with NodeJS JSON.stringify() that emitting a null is consistent behavior with a JSON implementation written in JavaScript. Previously Qt would emit: { plusInfinity: inf, minusInfinity: -inf, notANumber: nan } Which maybe turned into a string values of "inf", "-inf", "nan" by the receiving parser. Now it returns the JSON null value just like NodeJS JSON.stringify(). Change-Id: I9f9c17f12b2606280806c47a9d90465c4ba5f786 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-294-16/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Add toJson() formatting argument to QJsonDocument interfaceJean-Paul Delimat2013-01-262-3/+49
| | | | | | | | | | | | | | | | The writer delegate used by QJsonDocument to produce a Json QByteArray supports generating a human readable Json (with spaces and carriage returns that reflect the Json structure) and a less human readable (no spaces nor carriage returns) but more compact Json. The method toJson() was extended with a format argument to support the compact Json generation. Task-number: QTBUG-28815 Change-Id: I8d13849ab9ab6ed7c645011260251dc14a8629d2 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Debao Zhang <hello@debao.me>