From 89ef515177fd5a0b5d95dcffd5fd0b0669e3625a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 5 Sep 2013 07:55:49 +0200 Subject: Add JSON parsing support to qmake. 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 --- qmake/qmake.pri | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'qmake/qmake.pri') diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 39959efe7b..5012bd0206 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -83,7 +83,13 @@ bootstrap { #Qt code qvsnprintf.cpp \ qxmlstream.cpp \ qxmlutils.cpp \ - qlogging.cpp + qlogging.cpp \ + qjson.cpp \ + qjsondocument.cpp \ + qjsonparser.cpp \ + qjsonarray.cpp \ + qjsonobject.cpp \ + qjsonvalue.cpp HEADERS+= \ qbitarray.h \ @@ -126,7 +132,14 @@ bootstrap { #Qt code quuid.h \ qvector.h \ qxmlstream.h \ - qxmlutils.h + qxmlutils.h \ + qjson.h \ + qjsondocument.h \ + qjsonparser.h \ + qjsonwriter.h \ + qjsonarray.h \ + qjsonobject.h \ + qjsonvalue.h unix { SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp -- cgit v1.2.3