\n" \
46 |
--------------------------------------------------------------------------------
/examples/capabilities/UserCapability.json:
--------------------------------------------------------------------------------
1 | {
2 | "_type": "Capability",
3 | "name": "user",
4 | "partition": "com.example.System",
5 | "accessRules": {
6 | "rw": {
7 | "read": ["[?_type = \"Partition\"]"]
8 | }
9 | }
10 | }
11 | {
12 | "_type": "Capability",
13 | "name": "user",
14 | "partition": "com.example.User",
15 | "accessRules": {
16 | "rw": {
17 | "read": [".*"],
18 | "write": ["[?_type startsWith \"public.\"]",
19 | "[?%owner startsWith %typeDomain]"]
20 | },
21 | "setOwner": {
22 | "setOwner": ["[?_type startsWith \"public.\"]",
23 | "[?%owner startsWith %typeDomain]"]
24 | }
25 | }
26 | }
27 | {
28 | "_type": "Capability",
29 | "name": "system",
30 | "partition": "com.example.Public",
31 | "accessRules": {
32 | "rw": {
33 | "read": [".*"],
34 | "write": [".*"]
35 | },
36 | "setOwner": {
37 | "setOwner": [".*"]
38 | }
39 | }
40 | }
41 | {
42 | "_type": "Capability",
43 | "name": "user",
44 | "partition": "com.example.Ephemeral",
45 | "accessRules": {
46 | "rw": {
47 | "read": [".*"],
48 | "write": [".*"]
49 | },
50 | "setOwner": {
51 | "setOwner": [".*"]
52 | }
53 | }
54 | }
55 | {
56 | "_type": "Capability",
57 | "name": "user",
58 | "partition": "com.example.Card",
59 | "accessRules": {
60 | "rw": {
61 | "read": [".*"],
62 | "write": ["[?_type startsWith \"public.\"]",
63 | "[?%owner startsWith %typeDomain]"]
64 | },
65 | "setOwner": {
66 | "setOwner": ["[?_type startsWith \"public.\"]",
67 | "[?%owner startsWith %typeDomain]"]
68 | }
69 | }
70 | }
71 | {
72 | "_type": "Capability",
73 | "name": "user",
74 | "partition": "%owner",
75 | "accessRules": {
76 | "rw": {
77 | "read": [".*"],
78 | "write": [".*"],
79 | "setOwner": [".*"]
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/doc/src/join-example.qdoc:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the documentation of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:FDL$
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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Free Documentation License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Free
19 | ** Documentation License version 1.3 as published by the Free Software
20 | ** Foundation and appearing in the file included in the packaging of
21 | ** this file. Please review the following information to ensure
22 | ** the GNU Free Documentation License version 1.3 requirements
23 | ** will be met: http://www.gnu.org/copyleft/fdl.html.
24 | ** $QT_END_LICENSE$
25 | **
26 | ****************************************************************************/
27 |
28 | /*!
29 |
30 | \page creating-a-join.html
31 | \title Creating a Join View
32 |
33 | (file source: examples/declarative/joinview/joinview.qml)
34 | \snippet declarative/joinview/joinview.qml Creating a Join Object
35 |
36 | \section3 Installing the Schema Object
37 | (file source: examples/declarative/joinview/joinview.qml)
38 | \snippet declarative/joinview/joinview.qml Installing the View Schema
39 |
40 | \section3 Installing the Join Object
41 | (file source: examples/declarative/joinview/joinview.qml)
42 | \snippet declarative/joinview/joinview.qml Installing the Join Object
43 |
44 | \example declarative/joinview
45 |
46 | */
47 |
--------------------------------------------------------------------------------
/src/partition/partition.pro:
--------------------------------------------------------------------------------
1 | MODULE = jsondbpartition
2 | TARGET = QtJsonDbPartition
3 | VERSION = 1.0.0
4 | QT = core qml
5 | CONFIG += internal_module
6 |
7 | load(qt_module)
8 |
9 | include(../3rdparty/btree/btree.pri)
10 | include(../hbtree/hbtree.pri)
11 |
12 | RESOURCES = jsondb.qrc
13 |
14 | HEADERS += \
15 | jsondbutils_p.h \
16 | jsondbowner.h \
17 | jsondbproxy.h \
18 | jsondbindex.h \
19 | jsondbindex_p.h \
20 | jsondbobject.h \
21 | jsondbpartition.h \
22 | jsondbquery.h \
23 | jsondbstat.h \
24 | jsondbview.h \
25 | jsondbmapdefinition.h \
26 | jsondbnotification.h \
27 | jsondbobjectkey.h \
28 | jsondbobjecttable.h \
29 | jsondbbtree.h \
30 | jsondbobjecttypes_impl_p.h \
31 | jsondbobjecttypes_p.h \
32 | jsondbreducedefinition.h \
33 | jsondbschemamanager_impl_p.h \
34 | jsondbschemamanager_p.h \
35 | jsondbscriptengine.h \
36 | jsondbsettings.h \
37 | jsondbindexquery.h \
38 | jsondberrors.h \
39 | jsondbstrings.h \
40 | jsondbpartitionglobal.h \
41 | jsondbcollator.h \
42 | jsondbcollator_p.h \
43 | jsondbpartition_p.h \
44 | jsondbpartitionspec.h \
45 | jsondbquerytokenizer_p.h \
46 | jsondbqueryparser.h \
47 | jsondbschema_p.h \
48 | jsondbcheckpoints_p.h
49 |
50 | SOURCES += \
51 | jsondbowner.cpp \
52 | jsondbproxy.cpp \
53 | jsondbindex.cpp \
54 | jsondbobject.cpp \
55 | jsondbpartition.cpp \
56 | jsondbquery.cpp \
57 | jsondbview.cpp \
58 | jsondbmapdefinition.cpp \
59 | jsondbnotification.cpp \
60 | jsondbobjecttable.cpp \
61 | jsondbbtree.cpp \
62 | jsondbreducedefinition.cpp \
63 | jsondbscriptengine.cpp \
64 | jsondbsettings.cpp \
65 | jsondbindexquery.cpp \
66 | jsondberrors.cpp \
67 | jsondbstrings.cpp \
68 | jsondbcollator.cpp \
69 | jsondbquerytokenizer.cpp \
70 | jsondbqueryparser.cpp
71 |
72 | config_icu {
73 | LIBS += -licuuc -licui18n
74 | } else {
75 | DEFINES += NO_COLLATION_SUPPORT
76 | }
77 |
--------------------------------------------------------------------------------
/doc/src/index-example.qdoc:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the documentation of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:FDL$
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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/contact-us.
16 | **
17 | ** GNU Free Documentation License Usage
18 | ** Alternatively, this file may be used under the terms of the GNU Free
19 | ** Documentation License version 1.3 as published by the Free Software
20 | ** Foundation and appearing in the file included in the packaging of
21 | ** this file. Please review the following information to ensure
22 | ** the GNU Free Documentation License version 1.3 requirements
23 | ** will be met: http://www.gnu.org/copyleft/fdl.html.
24 | ** $QT_END_LICENSE$
25 | **
26 | ****************************************************************************/
27 |
28 | /*!
29 |
30 | \page indexing-objects.html
31 | \title Creating an Index
32 |
33 | The following code snippet creates an index on the value of the
34 | "identifier" property of any object that contains the identifier
35 | property:
36 |
37 | (file source: examples/declarative/simpleindex/simpleindex.qml)
38 | \snippet declarative/simpleindex/simpleindex.qml Creating a Simple Index Object
39 |
40 | The following code snippet creates an index on the value of the
41 | "identifier" property converted to uppercase:
42 | (file source: examples/declarative/simpleindex/simpleindex.qml)
43 | \snippet declarative/simpleindex/simpleindex.qml Creating an Index Using a Property Function
44 |
45 | \example declarative/simpleindex
46 |
47 | */
48 |
--------------------------------------------------------------------------------
/tests/auto/partition/json/map-join.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "John",
4 | "_type": "Person"
5 | },
6 | {
7 | "name": "Robert",
8 | "_type": "Person"
9 | },
10 | {
11 | "name": "Ben",
12 | "_type": "Person"
13 | },
14 | {
15 | "name": "Sam",
16 | "_type": "Person"
17 | },
18 | {
19 | "name": "Frank",
20 | "_type": "Person"
21 | },
22 | {
23 | "name": "Steve",
24 | "_type": "Person"
25 | },
26 | {
27 | "name": "Gary",
28 | "_type": "Person"
29 | },
30 | {
31 | "name": "Bruce",
32 | "_type": "Person"
33 | },
34 | {
35 | "name": "Paul",
36 | "_type": "Person"
37 | },
38 | {
39 | "name": "George",
40 | "_type": "Person"
41 | },
42 | {
43 | "_type": "_schemaType",
44 | "name": "FoafPerson",
45 | "schema": {
46 | "_type": "object",
47 | "extends": "View",
48 | "properties": {
49 | "value" : {
50 | "type": "object",
51 | "properties": {
52 | "friend": {
53 | "type": "string"
54 | }
55 | }
56 | }
57 | }
58 | }
59 | },
60 | {
61 | "_type": "Map",
62 | "targetType": "FoafPerson",
63 | "join": {
64 | "Person": " \
65 | function map(p, context) { \
66 | //console.log('p: ' + JSON.stringify(p)); \
67 | //console.log('p.friend: ' + JSON.stringify(p.friend)); \
68 | //console.log('context: ' + JSON.stringify(context)); \
69 | if (!context) { \
70 | if (p.friend) { \
71 | jsondb.lookup({'index':'_uuid', 'value': p.friend, 'objectType': 'Person'}, { person: p }); \
72 | }; \
73 | jsondb.lookup({'index':'friend', 'value': p._uuid, 'objectType': 'Person'}, { friend: p }); \
74 | } else { \
75 | if (context.friend) \
76 | jsondb.emit({name: p.name, friend: p.friend, foaf: context.friend.friend, foo: null }); \
77 | else \
78 | jsondb.emit({name: context.person.name, friend: context.person.friend, foaf: p.friend, foo: undefined }); \
79 | } \
80 | }"
81 | }
82 | }
83 | ]
84 |
--------------------------------------------------------------------------------
/src/hbtree/orderedlist.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include "orderedlist_p.h"
43 |
--------------------------------------------------------------------------------
/tests/auto/partition/json/map-join-sourceuuids.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_type": "_schemaType",
4 | "name": "MagicView",
5 | "schema": {
6 | "type": "object",
7 | "extends": "View",
8 | "properties": {
9 | "key": {
10 | "type": "string"
11 | },
12 | "foo": {
13 | "type": "string"
14 | },
15 | "bar": {
16 | "type": "string"
17 | }
18 | }
19 | }
20 | },
21 | {
22 | "_type": "_schemaType",
23 | "name": "Foo",
24 | "schema": {
25 | "type": "object",
26 | "properties": {
27 | "magic": {
28 | "type": "string",
29 | "indexed": true
30 | }
31 | }
32 | }
33 | },
34 | {
35 | "_type": "_schemaType",
36 | "name": "Bar",
37 | "schema": {
38 | "type": "object",
39 | "extends": "Foo"
40 | }
41 | },
42 | {
43 | "_type": "Map",
44 | "targetType": "MagicView",
45 | "join": {
46 | "Foo": " \
47 | function map(obj, context) { \
48 | var foo, bar; \
49 | foo = obj; \
50 | if (!context) { \
51 | // callback to the Bar function below with foo as the context \
52 | jsondb.lookup({'index':'magic', 'value':foo.magic, 'objectType': 'Bar'}, foo); \
53 | } else { \
54 | bar = context; \
55 | jsondb.emit({ key: foo.magic, foo: foo._uuid, bar: bar._uuid, barExtra: bar.extra }); \
56 | } \
57 | } ",
58 | "Bar": " \
59 | function map(obj, context) { \
60 | var foo, bar; \
61 | bar = obj; \
62 | if (!context) { \
63 | // callback to the Foo function above with bar as the context \
64 | jsondb.lookup({'index':'magic', 'value':bar.magic, 'objectType': 'Foo'}, bar); \
65 | } else { \
66 | foo = context; \
67 | jsondb.emit({ key: foo.magic, foo: foo._uuid, bar: bar._uuid, barExtra: bar.extra }); \
68 | } \
69 | } "
70 | }
71 | },
72 | {
73 | "_type": "Bar",
74 | "magic": "xyzzy"
75 | },
76 | {
77 | "_type": "Foo",
78 | "magic": "xyzzy"
79 | }
80 | ]
81 |
--------------------------------------------------------------------------------
/config.tests/icu/main.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtJsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include
43 |
44 | int main()
45 | {
46 | return 0;
47 | }
48 |
--------------------------------------------------------------------------------
/tests/benchmarks/tests.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Client API performance 01
7 | cd /var/lib/qt5jsondb-tests/benchmarks/client; date && ./tst_bench_client && date
8 |
9 |
10 | Server-side performance
11 | cd /var/lib/qt5jsondb-tests/benchmarks/partition; date && ./tst_bench_partition && date
12 |
13 |
14 | JsonDbCachingListModel performance
15 | cd /var/lib/qt5jsondb-tests/benchmarks/jsondbcachinglistmodel; date && ./tst_bench_jsondbcachinglistmodel -platform minimal && date
16 |
17 |
18 | JsonDbCachingListModel performance
19 | cd /var/lib/qt5jsondb-tests/benchmarks/jsondbsortinglistmodel; date && ./tst_bench_jsondbsortinglistmodel -platform minimal && date
20 |
21 |
22 | JsonDbObject performance
23 | cd /var/lib/qt5jsondb-tests/benchmarks/jsondbobject; date && ./tst_bench_object && date
24 |
25 |
26 | Btrees performance
27 | cd /var/lib/qt5jsondb-tests/benchmarks/btrees; date && ./tst_bench_btrees && date
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/config.tests/libedit/libedit.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the config.tests 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include
43 |
44 | int main(int, char**)
45 | {
46 | History *hist = history_init();
47 | return 0;
48 | }
49 |
--------------------------------------------------------------------------------
/tests/auto/partition/json/map-reduce.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_type": "Contact",
4 | "displayName": "Joe Smith",
5 | "name": {
6 | "firstName": "joe",
7 | "lastName": "smith"
8 | },
9 | "preferredNumber": "+15555551212",
10 | "phoneNumbers": [
11 | {
12 | "type": "mobile",
13 | "number": "+15555551212"
14 | },
15 | {
16 | "type": "work",
17 | "number": "+17812232323"
18 | },
19 | {
20 | "type": "home",
21 | "number": "+16174532300"
22 | }
23 | ]
24 | },
25 | {
26 | "_type": "Contact",
27 | "displayName": "Nancy Doe",
28 | "name": {
29 | "firstName": "nancy",
30 | "lastName": "doe"
31 | },
32 | "preferredNumber": "+14567891234",
33 | "phoneNumbers": [
34 | {
35 | "type": "mobile",
36 | "number": "+14567891234"
37 | },
38 | {
39 | "type": "home",
40 | "number": "+16174532322"
41 | }
42 | ]
43 | },
44 | {
45 | "_type": "_schemaType",
46 | "name": "Phone",
47 | "schema": {
48 | "type": "object",
49 | "extends": {"$ref": "View"}
50 | }
51 | },
52 | {
53 | "_type": "_schemaType",
54 | "name": "PhoneCount",
55 | "schema": {
56 | "type": "object",
57 | "extends": {"$ref": "View"}
58 | }
59 | },
60 | {
61 | "_type": "Map",
62 | "targetType": "Phone",
63 | "map": {"Contact": "function (c) {\
64 | for (var i in c.phoneNumbers) {\
65 | var phone = c.phoneNumbers[i];\
66 | var id = c.displayName + ':' + phone.number; \
67 | var uuid = jsondb.createUuidFromString(id); \
68 | jsondb.emit({_uuid: uuid, key: phone.number, displayName: c.displayName});\
69 | }\
70 | }"}
71 | },
72 | {
73 | "_type": "Reduce",
74 | "targetType": "PhoneCount",
75 | "sourceType": "Phone",
76 | "sourceKeyName": "key",
77 | "add": "function add (k, z, c) { if (!z) {z = {count: 0}}; z.count += 1; return z;}",
78 | "subtract": "function subtract (k, z, c) { if (!z) {z = {count: 0}}; z.count -= 1; if (z.count) return z;}"
79 | }
80 | ]
81 |
--------------------------------------------------------------------------------
/tests/manual/outofspace/query.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #############################################################################
3 | ##
4 | ## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
5 | ## Contact: http://www.qt-project.org/legal
6 | ##
7 | ## This file is part of the QtAddOn.Jsondb module of the Qt Toolkit.
8 | ##
9 | ## $QT_BEGIN_LICENSE:LGPL$
10 | ## Commercial License Usage
11 | ## Licensees holding valid commercial Qt licenses may use this file in
12 | ## accordance with the commercial license agreement provided with the
13 | ## Software or, alternatively, in accordance with the terms contained in
14 | ## a written agreement between you and Digia. For licensing terms and
15 | ## conditions see http://qt.digia.com/licensing. For further information
16 | ## use the contact form at http://qt.digia.com/contact-us.
17 | ##
18 | ## GNU Lesser General Public License Usage
19 | ## Alternatively, this file may be used under the terms of the GNU Lesser
20 | ## General Public License version 2.1 as published by the Free Software
21 | ## Foundation and appearing in the file LICENSE.LGPL included in the
22 | ## packaging of this file. Please review the following information to
23 | ## ensure the GNU Lesser General Public License version 2.1 requirements
24 | ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 | ##
26 | ## In addition, as a special exception, Digia gives you certain additional
27 | ## rights. These rights are described in the Digia Qt LGPL Exception
28 | ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 | ##
30 | ## GNU General Public License Usage
31 | ## Alternatively, this file may be used under the terms of the GNU
32 | ## General Public License version 3.0 as published by the Free Software
33 | ## Foundation and appearing in the file LICENSE.GPL included in the
34 | ## packaging of this file. Please review the following information to
35 | ## ensure the GNU General Public License version 3.0 requirements will be
36 | ## met: http://www.gnu.org/copyleft/gpl.html.
37 | ##
38 | ##
39 | ## $QT_END_LICENSE$
40 | ##
41 | #############################################################################
42 |
43 | JSONDB_CLIENT=jsondb-client
44 |
45 | echo "Querying elements"
46 | $JSONDB_CLIENT -terminate query "[?_type=\"duck\"]"
47 |
48 | echo "Done"
49 |
50 |
--------------------------------------------------------------------------------
/src/3rdparty/zlib/crc32.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef ZLIB_CRC32_H
43 | #define ZLIB_CRC32_H
44 |
45 | extern "C"
46 | unsigned long crc32_little(unsigned long crc, const unsigned char *buf, unsigned len);
47 |
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/tests/manual/bits/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | #############################################################################
3 | ##
4 | ## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
5 | ## Contact: http://www.qt-project.org/legal
6 | ##
7 | ## This file is part of the QtAddOn.Jsondb module of the Qt Toolkit.
8 | ##
9 | ## $QT_BEGIN_LICENSE:LGPL$
10 | ## Commercial License Usage
11 | ## Licensees holding valid commercial Qt licenses may use this file in
12 | ## accordance with the commercial license agreement provided with the
13 | ## Software or, alternatively, in accordance with the terms contained in
14 | ## a written agreement between you and Digia. For licensing terms and
15 | ## conditions see http://qt.digia.com/licensing. For further information
16 | ## use the contact form at http://qt.digia.com/contact-us.
17 | ##
18 | ## GNU Lesser General Public License Usage
19 | ## Alternatively, this file may be used under the terms of the GNU Lesser
20 | ## General Public License version 2.1 as published by the Free Software
21 | ## Foundation and appearing in the file LICENSE.LGPL included in the
22 | ## packaging of this file. Please review the following information to
23 | ## ensure the GNU Lesser General Public License version 2.1 requirements
24 | ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 | ##
26 | ## In addition, as a special exception, Digia gives you certain additional
27 | ## rights. These rights are described in the Digia Qt LGPL Exception
28 | ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 | ##
30 | ## GNU General Public License Usage
31 | ## Alternatively, this file may be used under the terms of the GNU
32 | ## General Public License version 3.0 as published by the Free Software
33 | ## Foundation and appearing in the file LICENSE.GPL included in the
34 | ## packaging of this file. Please review the following information to
35 | ## ensure the GNU General Public License version 3.0 requirements will be
36 | ## met: http://www.gnu.org/copyleft/gpl.html.
37 | ##
38 | ##
39 | ## $QT_END_LICENSE$
40 | ##
41 | #############################################################################
42 |
43 | rm -f bin/bits32 bin/bits64
44 | rm -f btree.o main.o
45 | qmake TARGET=bits64 && make
46 | rm -f btree.o main.o
47 | qmake TARGET=bits32 -spec linux-g++-32 && make
48 |
--------------------------------------------------------------------------------
/tests/auto/cmake/test_modules/main.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the test suite 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #include
43 |
44 | int main(int argc, char **argv)
45 | {
46 | QtJsonDb::QJsonDbObject jsonDbObject;
47 |
48 | return 0;
49 | }
50 |
--------------------------------------------------------------------------------
/tests/manual/outofspace/create.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #############################################################################
3 | ##
4 | ## Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
5 | ## Contact: http://www.qt-project.org/legal
6 | ##
7 | ## This file is part of the QtAddOn.Jsondb module of the Qt Toolkit.
8 | ##
9 | ## $QT_BEGIN_LICENSE:LGPL$
10 | ## Commercial License Usage
11 | ## Licensees holding valid commercial Qt licenses may use this file in
12 | ## accordance with the commercial license agreement provided with the
13 | ## Software or, alternatively, in accordance with the terms contained in
14 | ## a written agreement between you and Digia. For licensing terms and
15 | ## conditions see http://qt.digia.com/licensing. For further information
16 | ## use the contact form at http://qt.digia.com/contact-us.
17 | ##
18 | ## GNU Lesser General Public License Usage
19 | ## Alternatively, this file may be used under the terms of the GNU Lesser
20 | ## General Public License version 2.1 as published by the Free Software
21 | ## Foundation and appearing in the file LICENSE.LGPL included in the
22 | ## packaging of this file. Please review the following information to
23 | ## ensure the GNU Lesser General Public License version 2.1 requirements
24 | ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 | ##
26 | ## In addition, as a special exception, Digia gives you certain additional
27 | ## rights. These rights are described in the Digia Qt LGPL Exception
28 | ## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 | ##
30 | ## GNU General Public License Usage
31 | ## Alternatively, this file may be used under the terms of the GNU
32 | ## General Public License version 3.0 as published by the Free Software
33 | ## Foundation and appearing in the file LICENSE.GPL included in the
34 | ## packaging of this file. Please review the following information to
35 | ## ensure the GNU General Public License version 3.0 requirements will be
36 | ## met: http://www.gnu.org/copyleft/gpl.html.
37 | ##
38 | ##
39 | ## $QT_END_LICENSE$
40 | ##
41 | #############################################################################
42 |
43 | COUNTER=0
44 | TOTAL=$1
45 | JSONDB_CLIENT=jsondb-client
46 |
47 | echo "Creating $TOTAL elements"
48 | while [ $COUNTER -lt $TOTAL ]; do
49 | echo "Creating $COUNTER element"
50 | $JSONDB_CLIENT -terminate create "{\"_type\": \"duck\", \"name\": \"$COUNTER\"}"
51 | let COUNTER=COUNTER+1
52 | done
53 |
54 | echo "Done"
55 |
56 |
--------------------------------------------------------------------------------
/src/common/jsondbsocketname_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDBSOCKETNAME_P_H
43 | #define JSONDBSOCKETNAME_P_H
44 |
45 | #define _stringify_socket_name(x) #x
46 | #define stringify_socket_name(x) _stringify_socket_name(x)
47 | #ifndef JSONDB_SOCKET_NAME
48 | #define JSONDB_SOCKET_NAME qt5jsondb
49 | #endif
50 |
51 | #define JSONDB_SOCKET_NAME_STRING stringify_socket_name(JSONDB_SOCKET_NAME)
52 |
53 | #endif // JSONDBSOCKETNAME_H
54 |
--------------------------------------------------------------------------------
/doc/JsonDB-CommandLine-Client.txt:
--------------------------------------------------------------------------------
1 | jclient is a thin wrapper for testing the jsondb database.
2 |
3 | You must specify fairly accurately formated JSON objects to get the
4 | database to respond.
5 |
6 | Here's a sample session:
7 |
8 | jclient> create {"name":"Fred", "type":"CONTACT"}
9 | Received message: {"error" : null,"id" : 0,"result" : {"id" : "{b2c9c712-1ba3-41fd-a454-51c120ce1c8c}"}}
10 |
11 | jclient> notify {"query":"[?type='CONTACT']","actions":["create"]}
12 | Received message: {"error" : null,"id" : 1,"result" : {"active" : true}}
13 |
14 | jclient> create {"name":"Wilma","type":"CONTACT"}
15 | Received message: {"error" : null,"id" : 2,"result" : {"id" : "{35275206-e875-4c5d-a7b9-6cfd1cac67c2}"}}
16 | Received message: {"id" : 1,"notify" : {"action" : "create","object" : {"id" : "{35275206-e875-4c5d-a7b9-6cfd1cac67c2}","name" : "Wilma","type" : "CONTACT"}}}
17 |
18 | jclient> create {"name":"Quarry", "type":"LOCATION"}
19 | Received message: {"error" : null,"id" : 3,"result" : {"id" : "{0eba3c55-48ac-433a-833c-ca1a8c5c395d}"}}
20 |
21 | jclient> find {"query":".*"}
22 | Received message: {"error" : null,"id" : 4,"result" : {"data" : [{"id" : "{b2c9c712-1ba3-41fd-a454-51c120ce1c8c}","name" : "Fred","type" : "CONTACT"},{"id" : "{35275206-e875-4c5d-a7b9-6cfd1cac67c2}","name" : "Wilma","type" : "CONTACT"},{"id" : "{0eba3c55-48ac-433a-833c-ca1a8c5c395d}","name" : "Quarry","type" : "LOCATION"}],"length" : 3,"offset" : 0}}
23 |
24 | jclient> find {"query":"[?type~'location']"}
25 | Received message: {"error" : null,"id" : 5,"result" : {"data" : [{"id" : "{0eba3c55-48ac-433a-833c-ca1a8c5c395d}","name" : "Quarry","type" : "LOCATION"}],"length" : 1,"offset" : 0}}
26 |
27 | jclient> update {"name":"Fred Flintstone", "type":"CONTACT", "id":"{b2c9c712-1ba3-41fd-a454-51c120ce1c8c}"}
28 | Received message: {"error" : null,"id" : 9,"result" : null}
29 |
30 | jclient> find {"query":"[?type='CONTACT']"}
31 | Received message: {"error" : null,"id" : 10,"result" : {"data" : [{"id" : "{b2c9c712-1ba3-41fd-a454-51c120ce1c8c}","name" : "Fred Flintstone","type" : "CONTACT"},{"id" : "{35275206-e875-4c5d-a7b9-6cfd1cac67c2}","name" : "Wilma","type" : "CONTACT"}],"length" : 2,"offset" : 0}}
32 |
33 | jclient> delete {"id":"{35275206-e875-4c5d-a7b9-6cfd1cac67c2}"}
34 | Received message: {"error" : null,"id" : 11,"result" : null}
35 |
36 | jclient> find {"query":".*"}
37 | Received message: {"error" : null,"id" : 13,"result" : {"data" : [{"id" : "{b2c9c712-1ba3-41fd-a454-51c120ce1c8c}","name" : "Fred Flintstone","type" : "CONTACT"},{"id" : "{0eba3c55-48ac-433a-833c-ca1a8c5c395d}","name" : "Quarry","type" : "LOCATION"}],"length" : 2,"offset" : 0}}
38 |
--------------------------------------------------------------------------------
/src/partition/jsondbscriptengine.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDB_SCRIPT_ENGINE_H
43 | #define JSONDB_SCRIPT_ENGINE_H
44 |
45 | #include
46 |
47 | #include "jsondbpartitionglobal.h"
48 |
49 | QT_BEGIN_HEADER
50 |
51 | QT_BEGIN_NAMESPACE_JSONDB_PARTITION
52 |
53 | class Q_JSONDB_PARTITION_EXPORT JsonDbScriptEngine
54 | {
55 | public:
56 | static QJSEngine *scriptEngine();
57 | static void releaseScriptEngine();
58 | };
59 |
60 | QT_END_NAMESPACE_JSONDB_PARTITION
61 |
62 | QT_END_HEADER
63 |
64 | #endif // JSONDB_SCRIPT_ENGINE_H
65 |
--------------------------------------------------------------------------------
/src/imports/jsondb/plugin.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDB_PLUGIN_H
43 | #define JSONDB_PLUGIN_H
44 |
45 | #include
46 | #include
47 | #include
48 |
49 | extern QQmlEngine *g_declEngine;
50 |
51 | class JsonDbPlugin : public QQmlExtensionPlugin
52 | {
53 | Q_OBJECT
54 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface" FILE "jsondb.json")
55 | public:
56 | void initializeEngine(QQmlEngine *engine, const char *uri);
57 | void registerTypes(const char *uri);
58 | };
59 |
60 | #endif
61 |
--------------------------------------------------------------------------------
/tests/auto/partition/json/map-reduce-schema.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_type": "Contact",
4 | "displayName": "Joe Smith",
5 | "name": {
6 | "firstName": "joe",
7 | "lastName": "smith"
8 | },
9 | "preferredNumber": "+15555551212",
10 | "phoneNumbers": [
11 | {
12 | "type": "mobile",
13 | "number": "+15555551212"
14 | },
15 | {
16 | "type": "work",
17 | "number": "+17812232323"
18 | },
19 | {
20 | "type": "home",
21 | "number": "+16174532300"
22 | }
23 | ]
24 | },
25 | {
26 | "_type": "Contact",
27 | "displayName": "Nancy Doe",
28 | "name": {
29 | "firstName": "nancy",
30 | "lastName": "doe"
31 | },
32 | "preferredNumber": "+14567891234",
33 | "phoneNumbers": [
34 | {
35 | "type": "mobile",
36 | "number": "+14567891234"
37 | },
38 | {
39 | "type": "home",
40 | "number": "+16174532300"
41 | }
42 | ]
43 | },
44 | {
45 | "_type": "_schemaType",
46 | "name": "Phone",
47 | "schema": {
48 | "type": "object",
49 | "extends": {"$ref": "View"},
50 | "properties": {
51 | "key": { "type":"string", "required": true },
52 | "displayName": { "type":"string", "required": true }
53 | }
54 | }
55 | },
56 | {
57 | "_type": "_schemaType",
58 | "name": "PhoneCount",
59 | "schema": {
60 | "type": "object",
61 | "extends": {"$ref": "View"},
62 | "properties": {
63 | "value": {
64 | "type": "object",
65 | "properties": {
66 | "count": { "type":"integer", "required": true }
67 | }
68 | }
69 | }
70 | }
71 | },
72 | {
73 | "_type": "Map",
74 | "targetType": "Phone",
75 | "targetKeyName": "key",
76 | "brokenMap": {"Contact":"function map (c) { for (var i in c.phoneNumbers) { var phone = c.phoneNumbers[i]; jsondb.emit({key: phone.number, name: c.displayName }); }}"},
77 | "map": {"Contact":"function map (c) { for (var i in c.phoneNumbers) { var phone = c.phoneNumbers[i]; jsondb.emit({key: phone.number, displayName: c.displayName}); }}"}
78 | },
79 | {
80 | "_type": "Reduce",
81 | "targetType": "PhoneCount",
82 | "sourceType": "Phone",
83 | "sourceKeyName": "key",
84 | "brokenAdd": "function add (k, z, c) { if (!z) {z = { phoneCount: 0 }}; z.phoneCount += 1; return z;}",
85 | "add": "function add (k, z, c) { if (!z) {z = { count: 0 }}; z.count += 1; return z;}",
86 | "subtract": "function subtract (k, z, c) { if (!z) {z = { count: 0 }}; z.count -= 1; if (z.count > 0) return z;}"
87 | }
88 | ]
89 |
--------------------------------------------------------------------------------
/src/partition/jsondbpartitionspec.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDB_PARTITION_SPEC_H
43 | #define JSONDB_PARTITION_SPEC_H
44 |
45 | #include
46 |
47 | #include "jsondbpartitionglobal.h"
48 |
49 | QT_BEGIN_HEADER
50 |
51 | QT_BEGIN_NAMESPACE_JSONDB_PARTITION
52 |
53 | class Q_JSONDB_PARTITION_EXPORT JsonDbPartitionSpec
54 | {
55 | public:
56 | QString name;
57 | QString path;
58 | bool isRemovable;
59 | bool isDefault;
60 |
61 | inline JsonDbPartitionSpec()
62 | : isRemovable(false), isDefault(false) { }
63 | };
64 |
65 | QT_END_NAMESPACE_JSONDB_PARTITION
66 |
67 | QT_END_HEADER
68 |
69 | #endif // JSONDB_PARTITION_SPEC_H
70 |
--------------------------------------------------------------------------------
/doc/jsondb.qdocconf:
--------------------------------------------------------------------------------
1 | # Name of the project.
2 | project = QtJsonDb
3 |
4 | # Directories in which to search for files to document.
5 | # Paths are relative to the location of this file.
6 | exampledirs += ../examples
7 | headerdirs += ./src \
8 | ../src/client \
9 | ../src/imports/jsondb
10 | imagedirs += images
11 | sourcedirs += ./src \
12 | ../src/client \
13 | ../src/imports/jsondb
14 |
15 | Cpp.ignoretokens = \
16 | QT_BEGIN_HEADER \
17 | QT_END_HEADER \
18 | QT_BEGIN_NAMESPACE_JSONDB \
19 | QT_END_NAMESPACE_JSONDB \
20 | Q_ADDON_JSONDB_EXPORT
21 |
22 | # The following parameters are for creating a qhp file, the qhelpgenerator
23 | # program can convert the qhp file into a qch file which can be opened in
24 | # Qt Assistant and/or Qt Creator.
25 |
26 | # Defines the name of the project. You cannot use operators (+, =, -) in
27 | # the name. Properties for this project are set using a qhp..property
28 | # format.
29 | qhp.projects = QtJsonDb
30 |
31 | # Sets the name of the output qhp file.
32 | qhp.QtJsonDb.file = QtJsonDb.qhp
33 |
34 | # Namespace for the output file. This namespace is used to distinguish between
35 | # different documentation files in Creator/Assistant. The namespace ends with
36 | # a version being a number containing a major, minor and revision element.
37 | # E.g. version 1.0 becomes 100.
38 | qhp.QtJsonDb.namespace = com.nokia.qtjsondb.100
39 |
40 | # Title for the package, will be the main title for the package in
41 | # Assistant/Creator.
42 | qhp.QtJsonDb.indexTitle = Qt JsonDb Reference Documentation
43 |
44 | # Extra files to add to the output which are not linked to from anywhere
45 | # using a qdoc \l command.
46 | qhp.QtJsonDb.extraFiles = style/style.css \
47 | index.html
48 |
49 | # Only update the name of the project for the next variables.
50 | qhp.QtJsonDb.virtualFolder = qdoc
51 | qhp.QtJsonDb.subprojects = classes
52 | qhp.QtJsonDb.subprojects.classes.title = Classes
53 | qhp.QtJsonDb.subprojects.classes.selectors = class fake:headerfile
54 | qhp.QtJsonDb.subprojects.classes.sortPages = true
55 |
56 |
57 |
58 |
59 | # Do NOT change the variables after this line unless you know what you are doing.
60 |
61 | outputdir = html
62 | outputformats = HTML
63 |
64 | examples.fileextensions = "*.cpp *.h *.js *.svg *.xml *.ui *.qml"
65 | examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng"
66 | headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx"
67 | sources.fileextensions = "*.cpp *.qdoc *.mm *.qml"
68 |
69 | HTML.nobreadcrumbs = "true"
70 |
71 | HTML.templatedir = .
72 | HTML.stylesheets = style/style.css
73 |
74 | HTML.headerstyles = " \n"
75 | HTML.endheader = "\n"
76 |
--------------------------------------------------------------------------------
/tests/auto/partition/json/array.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_type": "ContactInArray",
4 | "displayName": "Joe Smith",
5 | "name": {
6 | "firstName": "joe",
7 | "lastName": "smith"
8 | },
9 | "test": {
10 | "45": "joe"
11 | },
12 | "test2": {
13 | "56": {
14 | "firstName": "joe"
15 | }
16 | },
17 | "preferredNumber": "+15555551212",
18 | "foo": [
19 | [
20 | { "bar": "val00" },
21 | { "bar": "val01" },
22 | { "bar": "val02" }
23 | ],
24 | [
25 | { "bar": "val10" },
26 | { "bar": "val11" },
27 | { "bar": "val12" }
28 | ]
29 | ],
30 | "phoneNumbers": [
31 | {
32 | "type": "mobile",
33 | "number": "+15555551212",
34 | "validTime": [
35 | {
36 | "timeFrom": "09:00",
37 | "timeTo": "13:00"
38 | },
39 | {
40 | "timeFrom": "16:00",
41 | "timeTo": "20:00"
42 | }
43 | ]
44 | },
45 | {
46 | "type": "work",
47 | "number": "+17812232323",
48 | "validTime": [
49 | {
50 | "timeFrom": "21:00",
51 | "timeTo": "23:00"
52 | }
53 | ]
54 | },
55 | {
56 | "type": "home",
57 | "number": "+16174532300"
58 | }
59 | ]
60 | },
61 | {
62 | "_type": "ContactInArray",
63 | "displayName": "Nancy Doe",
64 | "name": {
65 | "firstName": "nancy",
66 | "lastName": "doe"
67 | },
68 | "test": {
69 | "45": "nancy"
70 | },
71 | "test2": {
72 | "56": {
73 | "firstName": "nancy"
74 | }
75 | },
76 | "preferredNumber": "+14567891234",
77 | "foo": [
78 | [
79 | { "bar": "val00" },
80 | { "bar": "val01" },
81 | { "bar": "val02" }
82 | ],
83 | [
84 | { "bar": "val10" },
85 | { "bar": "val11" },
86 | { "bar": "val12" }
87 | ]
88 | ],
89 | "phoneNumbers": [
90 | {
91 | "type": "mobile",
92 | "number": "+14567891234",
93 | "validTime": [
94 | {
95 | "timeFrom": "10:00",
96 | "timeTo": "13:00"
97 | },
98 | {
99 | "timeFrom": "16:00",
100 | "timeTo": "20:00"
101 | }
102 | ]
103 | },
104 | {
105 | "type": "home",
106 | "number": "+16174532300",
107 | "validTime": [
108 | {
109 | "timeFrom": "21:00",
110 | "timeTo": "23:00"
111 | }
112 | ]
113 | }
114 | ]
115 | }
116 | ]
117 |
--------------------------------------------------------------------------------
/src/partition/jsondbutils_p.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDB_UTILS_P_H
43 | #define JSONDB_UTILS_P_H
44 |
45 | #include "jsondbpartitionglobal.h"
46 |
47 | #include
48 | #include
49 |
50 | #define JSONDB_INFO "[+" << __FUNCTION__ << "]"
51 | #define JSONDB_WARN "[-" << __FUNCTION__ << "]"
52 | #define JSONDB_ERROR "[!" << __FUNCTION__ << "]"
53 |
54 | QT_BEGIN_NAMESPACE_JSONDB_PARTITION
55 |
56 | inline bool operator==(const QString &str, QChar c)
57 | {
58 | return str.size() == 1 && str.at(0) == c;
59 | }
60 |
61 | inline bool operator!=(const QString &str, QChar c)
62 | {
63 | return !operator==(str, c);
64 | }
65 |
66 | QT_END_NAMESPACE_JSONDB_PARTITION
67 |
68 | #endif // JSONDB_UTILS_P_H
69 |
--------------------------------------------------------------------------------
/examples/jsondb-client/example.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 | import QtJsonDb 1.0 as JsonDb
43 |
44 | Item {
45 |
46 | JsonDb.Partition {
47 | id: partition
48 | }
49 |
50 | function createCallback(error, response) {
51 | if (error)
52 | console.debug("Error: " + JSON.stringify(error));
53 | Qt.quit();
54 | }
55 |
56 | Component.onCompleted: {
57 | var filename = "/home/user/Pictures/test000.jpeg";
58 | var uuid = JsonDb.uuidFromString(filename);
59 | console.debug("Creating object with _uuid: " + uuid);
60 |
61 | partition.create({
62 | "_uuid" : uuid,
63 | "_type" : "Image",
64 | "filename" : filename
65 | }, {}, createCallback);
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/examples/declarative/desktop-inspector/content/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | width: 120
46 | height: 40
47 | radius: 10
48 | color: ma.pressed?'silver': '#3ba5ff'
49 | property alias text:lb.text
50 | signal clicked()
51 | Text {
52 | id: lb
53 | anchors.fill:parent
54 | horizontalAlignment: Text.AlignHCenter
55 | verticalAlignment: Text.AlignVCenter
56 | elide:Text.ElideMiddle
57 | text:'button'
58 | color:'white'
59 | font.pixelSize: 12
60 | }
61 | MouseArea {
62 | id: ma
63 | anchors.fill:parent
64 | onClicked: {
65 | bt.clicked();
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/examples/declarative/cachingmodel/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 100
47 | height: 50
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/examples/declarative/contactsmodel/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 100
47 | height: 50
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/examples/declarative/desktop-inspector/content/Header.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | // Generic item with no real data
42 |
43 | import QtQuick 2.0
44 |
45 | Rectangle {
46 | id: container
47 | width: parent.width
48 | height: myHeader.height
49 | border.color: "green"
50 | color: "#ccc"
51 |
52 | property string title : "Unknown"
53 | property int count: 0
54 | signal clicked(string title)
55 |
56 | Text {
57 | id: myHeader
58 | anchors { horizontalCenter: parent.horizontalCenter }
59 | text: title + " [" + count + "]";
60 | font.pixelSize: 14
61 | }
62 |
63 | MouseArea {
64 | id: clickRegion
65 | anchors.fill: parent
66 | onClicked: { container.clicked(title); }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/examples/declarative/notifications/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 100
47 | height: 40
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/examples/declarative/collationindex/content/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 100
47 | height: 50
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/examples/declarative/simplelistmodel/content/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 100
47 | height: 50
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/examples/declarative/streamingquery/content/Button.qml:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the examples of the Qt Toolkit.
7 | **
8 | ** $QT_BEGIN_LICENSE:BSD$
9 | ** You may use this file under the terms of the BSD license as follows:
10 | **
11 | ** "Redistribution and use in source and binary forms, with or without
12 | ** modification, are permitted provided that the following conditions are
13 | ** met:
14 | ** * Redistributions of source code must retain the above copyright
15 | ** notice, this list of conditions and the following disclaimer.
16 | ** * Redistributions in binary form must reproduce the above copyright
17 | ** notice, this list of conditions and the following disclaimer in
18 | ** the documentation and/or other materials provided with the
19 | ** distribution.
20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
21 | ** of its contributors may be used to endorse or promote products derived
22 | ** from this software without specific prior written permission.
23 | **
24 | **
25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
36 | **
37 | ** $QT_END_LICENSE$
38 | **
39 | ****************************************************************************/
40 |
41 | import QtQuick 2.0
42 |
43 | Rectangle {
44 | id: bt
45 | anchors.margins : 2
46 | width: 150
47 | height: 50
48 | color: ma.pressed?'#cccccc':'#dddddd'
49 | border.color: "black"
50 | border.width: 5
51 | radius: 10
52 | property alias text:lb.text
53 | signal clicked()
54 | Text {
55 | id: lb
56 | anchors.centerIn: parent
57 | horizontalAlignment: Text.AlignHCenter
58 | verticalAlignment: Text.AlignVCenter
59 | text: "Button"
60 | font.pointSize: 10
61 | }
62 | MouseArea {
63 | id: ma
64 | anchors.fill: parent
65 | onClicked: {
66 | bt.clicked();
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/daemon/jsondbsignals.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************
2 | **
3 | ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
4 | ** Contact: http://www.qt-project.org/legal
5 | **
6 | ** This file is part of the QtAddOn.JsonDb 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 Digia. For licensing terms and
14 | ** conditions see http://qt.digia.com/licensing. For further information
15 | ** use the contact form at http://qt.digia.com/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 2.1 as published by the Free Software
20 | ** Foundation and appearing in the file LICENSE.LGPL included in the
21 | ** packaging of this file. Please review the following information to
22 | ** ensure the GNU Lesser General Public License version 2.1 requirements
23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 | **
25 | ** In addition, as a special exception, Digia gives you certain additional
26 | ** rights. These rights are described in the Digia Qt LGPL Exception
27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 | **
29 | ** GNU General Public License Usage
30 | ** Alternatively, this file may be used under the terms of the GNU
31 | ** General Public License version 3.0 as published by the Free Software
32 | ** Foundation and appearing in the file LICENSE.GPL included in the
33 | ** packaging of this file. Please review the following information to
34 | ** ensure the GNU General Public License version 3.0 requirements will be
35 | ** met: http://www.gnu.org/copyleft/gpl.html.
36 | **
37 | **
38 | ** $QT_END_LICENSE$
39 | **
40 | ****************************************************************************/
41 |
42 | #ifndef JSONDB_SIGNALS_H
43 | #define JSONDB_SIGNALS_H
44 |
45 | #include
46 |
47 | QT_BEGIN_HEADER
48 |
49 | QT_BEGIN_NAMESPACE
50 | class QSocketNotifier;
51 | QT_END_NAMESPACE
52 |
53 |
54 | class JsonDbSignals : public QObject
55 | {
56 | Q_OBJECT
57 | public:
58 | JsonDbSignals( QObject *parent = 0);
59 | void start();
60 |
61 | static void signalHandler(int unused);
62 |
63 | Q_SIGNALS:
64 | void sigTERM();
65 | void sigHUP();
66 | void sigINT();
67 | void sigUSR1();
68 | void sigUSR2();
69 |
70 | private slots:
71 | void handleSig();
72 |
73 | private:
74 | static int sSigFD[2];
75 | QSocketNotifier *mNotifier;
76 | void listen(int sig);
77 | };
78 |
79 | QT_END_HEADER
80 |
81 | #endif // JSONDB_SIGNALS_H
82 |
--------------------------------------------------------------------------------