summaryrefslogtreecommitdiffstats
path: root/src/corelib/json/qjsonvalue.h
Commit message (Collapse)AuthorAgeFilesLines
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Add QJsonValueRef::toVariant()Lars Knoll2015-03-181-0/+1
| | | | | | | | to better mirror the API of QJsonValue Task-number: QTBUG-43686 Change-Id: I83edecf5226d44980a8a442a512a13ab9b2ac6a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Revert "Reading QJsonObject property should not modify the object itself."Jędrzej Nowacki2014-09-111-2/+0
| | | | | | | | | | 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>
* Add operator-> to QJson iteratorsAllan Sandfeld Jensen2014-08-251-0/+27
| | | | | | | | | | | | | 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>
* Reading QJsonObject property should not modify the object itself.Jędrzej Nowacki2014-07-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* 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>
* Added constructor to QJsonValue for const char *Matt Broadstone2014-01-161-0/+5
| | | | | | | | | | | | | | | | 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>
* Add JSON parsing support to qmake.Morten Johan Sørvig2013-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add QJsonValue::toInt().Mitch Curtis2013-08-271-0/+2
| | | | | | | | | | | | | | | 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>
* Json writer, support larger signed integers upto 2^53Darryl L. Miles2013-04-121-0/+1
| | | | | | | | | | | | 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>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-291-4/+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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Replace `const QLatin1String &` with `QLatin1String` where appropriateKonstantin Ritt2012-05-251-1/+1
| | | | | | | Task-Id: QTBUG-24502 Change-Id: I360dee4dc68c165de0631ce4cf34e76fd873080e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add assignment operator for QJsonValueRefAli Akhtarzada2012-05-081-0/+1
| | | | | | | | | The implicit cast to QJsonValue was being ignored probably because the compiler was generating a default QJsonValueRef assignment operator Change-Id: I3a041595497308868dd7e4aab71027ce21bf8f0b Reviewed-by: Denis Dzyubenko <denis.dzyubenko@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Add default value for getters in QJsonValueLiang Qi2012-05-061-3/+5
| | | | | | | Done-with: Debao Zhang <dbzhang800@gmail.com> Change-Id: I3ddd8dd89dc75d91ac9977bf9b6eb3174d7669e4 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact address in license headers.Jason McDonald2012-01-311-1/+1
| | | | | Change-Id: I35bf916087511f26bfeb49ceb3256d9a20fbc1c0 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fix compilation problem in qjsonvalue.hJani Uusi-Rantala2012-01-281-1/+1
| | | | | | | Extra ; after namespace was causing build failures with -pedantic. Change-Id: I340252810a04815820964c625377a1dc0635783f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fixed includes in public headersDenis Dzyubenko2012-01-271-2/+2
| | | | | Change-Id: I360c94d41691a618f1bec97da8317c9dcee658c0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Import json support from playground/qtbinaryjsonLars Knoll2012-01-241-0/+186
This imports the JSON support for Qt 5 from playground/qtbinaryjson. It adds a fast, fully compliant json parser, a convenient C++ API, conversion to and from QVariants and a binary format for JSON that is extremely fast to use together with the C++ API. Change-Id: If9e3a21a4241d388d0abaa446b6824f9cc6edb1c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>