Fri, 12 Dec 2025 10:42:53 +0100
update ucx
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1 | /* |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
3 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
4 | * Copyright 2024 Mike Becker, Olaf Wintermann All rights reserved. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
5 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
8 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
11 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
15 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
27 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
28 | /** |
| 16 | 29 | * @file json.h |
| 30 | * @brief Interface for parsing data from JSON files. | |
| 31 | * @author Mike Becker | |
| 32 | * @author Olaf Wintermann | |
| 33 | * @copyright 2-Clause BSD License | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
34 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
35 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
36 | #ifndef UCX_JSON_H |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
37 | #define UCX_JSON_H |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
38 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
39 | #include "common.h" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
40 | #include "allocator.h" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
41 | #include "string.h" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
42 | #include "buffer.h" |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
43 | #include "array_list.h" |
| 30 | 44 | #include "map.h" |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
45 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
46 | #include <string.h> |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
47 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
48 | #ifdef __cplusplus |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
49 | extern "C" { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
50 | #endif |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
51 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
52 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
53 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
54 | * The type of the parsed token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
55 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
56 | enum cx_json_token_type { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
57 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
58 | * No complete token parsed, yet. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
59 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
60 | CX_JSON_NO_TOKEN, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
61 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
62 | * The presumed token contains syntactical errors. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
63 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
64 | CX_JSON_TOKEN_ERROR, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
65 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
66 | * A "begin of array" '[' token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
67 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
68 | CX_JSON_TOKEN_BEGIN_ARRAY, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
69 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
70 | * A "begin of object" '{' token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
71 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
72 | CX_JSON_TOKEN_BEGIN_OBJECT, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
73 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
74 | * An "end of array" ']' token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
75 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
76 | CX_JSON_TOKEN_END_ARRAY, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
77 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
78 | * An "end of object" '}' token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
79 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
80 | CX_JSON_TOKEN_END_OBJECT, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
81 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
82 | * A colon ':' token separating names and values. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
83 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
84 | CX_JSON_TOKEN_NAME_SEPARATOR, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
85 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
86 | * A comma ',' token separating object entries or array elements. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
87 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
88 | CX_JSON_TOKEN_VALUE_SEPARATOR, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
89 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
90 | * A string token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
91 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
92 | CX_JSON_TOKEN_STRING, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
93 | /** |
| 22 | 94 | * A number token that can be represented as an integer. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
95 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
96 | CX_JSON_TOKEN_INTEGER, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
97 | /** |
| 22 | 98 | * A number token that cannot be represented as an integer. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
99 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
100 | CX_JSON_TOKEN_NUMBER, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
101 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
102 | * A literal token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
103 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
104 | CX_JSON_TOKEN_LITERAL, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
105 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
106 | * A white-space token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
107 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
108 | CX_JSON_TOKEN_SPACE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
109 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
110 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
111 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
112 | * The type of some JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
113 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
114 | enum cx_json_value_type { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
115 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
116 | * Reserved. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
117 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
118 | CX_JSON_NOTHING, // this allows us to always return non-NULL values |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
119 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
120 | * A JSON object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
121 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
122 | CX_JSON_OBJECT, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
123 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
124 | * A JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
125 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
126 | CX_JSON_ARRAY, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
127 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
128 | * A string. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
129 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
130 | CX_JSON_STRING, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
131 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
132 | * A number that contains an integer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
133 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
134 | CX_JSON_INTEGER, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
135 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
136 | * A number, not necessarily an integer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
137 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
138 | CX_JSON_NUMBER, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
139 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
140 | * A literal (true, false, null). |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
141 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
142 | CX_JSON_LITERAL |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
143 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
144 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
145 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
146 | * JSON literal types. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
147 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
148 | enum cx_json_literal { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
149 | /** |
| 16 | 150 | * The @c null literal. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
151 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
152 | CX_JSON_NULL, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
153 | /** |
| 16 | 154 | * The @c true literal. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
155 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
156 | CX_JSON_TRUE, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
157 | /** |
| 16 | 158 | * The @c false literal. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
159 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
160 | CX_JSON_FALSE |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
161 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
162 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
163 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
164 | * Type alias for the token type enum. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
165 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
166 | typedef enum cx_json_token_type CxJsonTokenType; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
167 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
168 | * Type alias for the value type enum. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
169 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
170 | typedef enum cx_json_value_type CxJsonValueType; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
171 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
172 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
173 | * Type alias for the JSON parser interface. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
174 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
175 | typedef struct cx_json_s CxJson; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
176 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
177 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
178 | * Type alias for the token struct. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
179 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
180 | typedef struct cx_json_token_s CxJsonToken; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
181 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
182 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
183 | * Type alias for the JSON value struct. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
184 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
185 | typedef struct cx_json_value_s CxJsonValue; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
186 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
187 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
188 | * Type alias for the JSON array struct. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
189 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
190 | typedef struct cx_json_array_s CxJsonArray; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
191 | /** |
| 30 | 192 | * Type alias for the map representing a JSON object. |
| 193 | * The map contains pointers of type @c CxJsonValue. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
194 | */ |
| 30 | 195 | typedef CxMap* CxJsonObject; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
196 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
197 | * Type alias for a JSON string. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
198 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
199 | typedef struct cx_mutstr_s CxJsonString; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
200 | /** |
| 22 | 201 | * Type alias for a number that can be represented as a 64-bit signed integer. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
202 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
203 | typedef int64_t CxJsonInteger; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
204 | /** |
| 22 | 205 | * Type alias for a number that is not an integer. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
206 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
207 | typedef double CxJsonNumber; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
208 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
209 | * Type alias for a JSON literal. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
210 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
211 | typedef enum cx_json_literal CxJsonLiteral; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
212 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
213 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
214 | * JSON array structure. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
215 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
216 | struct cx_json_array_s { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
217 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
218 | * The array data. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
219 | */ |
| 30 | 220 | CX_ARRAY_DECLARE(CxJsonValue*, data); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
221 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
222 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
223 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
224 | * Structure for a JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
225 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
226 | struct cx_json_value_s { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
227 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
228 | * The allocator with which the value was allocated. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
229 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
230 | * Required for recursively deallocating memory of objects and arrays. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
231 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
232 | const CxAllocator *allocator; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
233 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
234 | * The type of this value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
235 | * |
| 16 | 236 | * Specifies how the @c value union shall be resolved. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
237 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
238 | CxJsonValueType type; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
239 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
240 | * The value data. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
241 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
242 | union { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
243 | /** |
| 22 | 244 | * The array data if the type is #CX_JSON_ARRAY. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
245 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
246 | CxJsonArray array; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
247 | /** |
| 22 | 248 | * The object data if the type is #CX_JSON_OBJECT. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
249 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
250 | CxJsonObject object; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
251 | /** |
| 22 | 252 | * The string data if the type is #CX_JSON_STRING. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
253 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
254 | CxJsonString string; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
255 | /** |
| 22 | 256 | * The integer if the type is #CX_JSON_INTEGER. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
257 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
258 | CxJsonInteger integer; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
259 | /** |
| 22 | 260 | * The number if the type is #CX_JSON_NUMBER. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
261 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
262 | CxJsonNumber number; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
263 | /** |
| 22 | 264 | * The literal type if the type is #CX_JSON_LITERAL. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
265 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
266 | CxJsonLiteral literal; |
| 30 | 267 | }; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
268 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
269 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
270 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
271 | * Internally used structure for a parsed token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
272 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
273 | * You should never need to use this in your code. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
274 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
275 | struct cx_json_token_s { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
276 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
277 | * The token type. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
278 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
279 | CxJsonTokenType tokentype; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
280 | /** |
| 16 | 281 | * True, if the @c content must be passed to cx_strfree(). |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
282 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
283 | bool allocated; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
284 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
285 | * The token text, if any. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
286 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
287 | * This is not necessarily set when the token type already |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
288 | * uniquely identifies the content. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
289 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
290 | cxmutstr content; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
291 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
292 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
293 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
294 | * The JSON parser interface. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
295 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
296 | struct cx_json_s { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
297 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
298 | * The allocator used for produced JSON values. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
299 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
300 | const CxAllocator *allocator; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
301 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
302 | * The input buffer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
303 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
304 | CxBuffer buffer; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
305 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
306 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
307 | * Used internally. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
308 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
309 | * Remembers the prefix of the last uncompleted token. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
310 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
311 | CxJsonToken uncompleted; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
312 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
313 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
314 | * A pointer to an intermediate state of the currently parsed value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
315 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
316 | * Never access this value manually. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
317 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
318 | CxJsonValue *parsed; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
319 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
320 | /** |
| 30 | 321 | * The name of a not yet completely parsed object member. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
322 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
323 | * Never access this value manually. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
324 | */ |
| 30 | 325 | cxmutstr uncompleted_member_name; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
326 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
327 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
328 | * State stack. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
329 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
330 | CX_ARRAY_DECLARE_SIZED(int, states, unsigned); |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
331 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
332 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
333 | * Value buffer stack. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
334 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
335 | CX_ARRAY_DECLARE_SIZED(CxJsonValue*, vbuf, unsigned); |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
336 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
337 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
338 | * Internally reserved memory for the state stack. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
339 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
340 | int states_internal[8]; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
341 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
342 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
343 | * Internally reserved memory for the value buffer stack. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
344 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
345 | CxJsonValue* vbuf_internal[8]; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
346 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
347 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
348 | /** |
| 22 | 349 | * Status codes for the JSON interface. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
350 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
351 | enum cx_json_status { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
352 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
353 | * Everything is fine. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
354 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
355 | CX_JSON_NO_ERROR, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
356 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
357 | * The input buffer does not contain more data. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
358 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
359 | CX_JSON_NO_DATA, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
360 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
361 | * The input ends unexpectedly. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
362 | * |
| 22 | 363 | * Refill the buffer with cxJsonFill() to complete the JSON data. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
364 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
365 | CX_JSON_INCOMPLETE_DATA, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
366 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
367 | * Not used as a status and never returned by any function. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
368 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
369 | * You can use this enumerator to check for all "good" status results |
| 16 | 370 | * by checking if the status is less than @c CX_JSON_OK. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
371 | * |
| 22 | 372 | * A "good" status means that you can refill data and continue parsing. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
373 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
374 | CX_JSON_OK, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
375 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
376 | * The input buffer has never been filled. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
377 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
378 | CX_JSON_NULL_DATA, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
379 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
380 | * Allocating memory for the internal buffer failed. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
381 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
382 | CX_JSON_BUFFER_ALLOC_FAILED, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
383 | /** |
| 22 | 384 | * Allocating memory for a JSON value failed. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
385 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
386 | CX_JSON_VALUE_ALLOC_FAILED, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
387 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
388 | * A number value is incorrectly formatted. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
389 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
390 | CX_JSON_FORMAT_ERROR_NUMBER, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
391 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
392 | * The tokenizer found something unexpected. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
393 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
394 | CX_JSON_FORMAT_ERROR_UNEXPECTED_TOKEN |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
395 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
396 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
397 | /** |
| 22 | 398 | * Typedef for the JSON status enum. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
399 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
400 | typedef enum cx_json_status CxJsonStatus; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
401 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
402 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
403 | * The JSON writer settings. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
404 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
405 | struct cx_json_writer_s { |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
406 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
407 | * Set true to enable pretty output. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
408 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
409 | bool pretty; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
410 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
411 | * The maximum number of fractional digits in a number value. |
| 16 | 412 | * The default value is 6 and values larger than 15 are reduced to 15. |
| 22 | 413 | * Note that the actual number of digits may be lower, depending on the concrete number. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
414 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
415 | uint8_t frac_max_digits; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
416 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
417 | * Set true to use spaces instead of tab characters. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
418 | * Indentation is only used in pretty output. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
419 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
420 | bool indent_space; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
421 | /** |
| 16 | 422 | * If @c indent_space is true, this is the number of spaces per tab. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
423 | * Indentation is only used in pretty output. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
424 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
425 | uint8_t indent; |
| 16 | 426 | /** |
| 427 | * Set true to enable escaping of the slash character (solidus). | |
| 428 | */ | |
| 429 | bool escape_slash; | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
430 | }; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
431 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
432 | /** |
| 22 | 433 | * Typedef for the JSON writer. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
434 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
435 | typedef struct cx_json_writer_s CxJsonWriter; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
436 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
437 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
438 | * Creates a default writer configuration for compact output. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
439 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
440 | * @return new JSON writer settings |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
441 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
442 | cx_attr_nodiscard |
| 22 | 443 | CX_EXPORT CxJsonWriter cxJsonWriterCompact(void); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
444 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
445 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
446 | * Creates a default writer configuration for pretty output. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
447 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
448 | * @param use_spaces false if you want tabs, true if you want four spaces instead |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
449 | * @return new JSON writer settings |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
450 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
451 | cx_attr_nodiscard |
| 22 | 452 | CX_EXPORT CxJsonWriter cxJsonWriterPretty(bool use_spaces); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
453 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
454 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
455 | * Writes a JSON value to a buffer or stream. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
456 | * |
| 16 | 457 | * This function blocks until either all data is written, or an error occurs. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
458 | * The write operation is not atomic in the sense that it might happen |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
459 | * that the data is only partially written when an error occurs with no |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
460 | * way to indicate how much data was written. |
| 16 | 461 | * To avoid this problem, you can use a CxBuffer as @p target which is |
| 22 | 462 | * unlikely to fail a write operation. You can, for example, use the buffer's flush |
| 463 | * feature to relay the data. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
464 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
465 | * @param target the buffer or stream where to write to |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
466 | * @param value the value that shall be written |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
467 | * @param wfunc the write function to use |
| 16 | 468 | * @param settings formatting settings (or @c NULL to use a compact default) |
| 469 | * @retval zero success | |
| 470 | * @retval non-zero when no or not all data could be written | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
471 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
472 | cx_attr_nonnull_arg(1, 2, 3) |
| 22 | 473 | CX_EXPORT int cxJsonWrite(void* target, const CxJsonValue* value, |
| 474 | cx_write_func wfunc, const CxJsonWriter* settings); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
475 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
476 | /** |
| 22 | 477 | * Initializes the JSON interface. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
478 | * |
| 22 | 479 | * @param json the JSON interface |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
480 | * @param allocator the allocator that shall be used for the produced values |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
481 | * @see cxJsonDestroy() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
482 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
483 | cx_attr_nonnull_arg(1) |
| 22 | 484 | CX_EXPORT void cxJsonInit(CxJson *json, const CxAllocator *allocator); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
485 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
486 | /** |
| 22 | 487 | * Destroys the JSON interface. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
488 | * |
| 22 | 489 | * @param json the JSON interface |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
490 | * @see cxJsonInit() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
491 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
492 | cx_attr_nonnull |
| 22 | 493 | CX_EXPORT void cxJsonDestroy(CxJson *json); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
494 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
495 | /** |
| 22 | 496 | * Destroys and re-initializes the JSON interface. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
497 | * |
| 30 | 498 | * You must use this to reset the parser after encountering a syntax error |
| 499 | * if you want to continue using it. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
500 | * |
| 22 | 501 | * @param json the JSON interface |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
502 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
503 | cx_attr_nonnull |
| 22 | 504 | CX_EXPORT void cxJsonReset(CxJson *json); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
505 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
506 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
507 | * Fills the input buffer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
508 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
509 | * @remark The JSON interface tries to avoid copying the input data. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
510 | * When you use this function and cxJsonNext() interleaving, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
511 | * no copies are performed. However, you must not free the |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
512 | * pointer to the data in that case. When you invoke the fill |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
513 | * function more than once before calling cxJsonNext(), |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
514 | * the additional data is appended - inevitably leading to |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
515 | * an allocation of a new buffer and copying the previous contents. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
516 | * |
| 22 | 517 | * @param json the JSON interface |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
518 | * @param buf the source buffer |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
519 | * @param len the length of the source buffer |
| 16 | 520 | * @retval zero success |
| 521 | * @retval non-zero internal allocation error | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
522 | * @see cxJsonFill() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
523 | */ |
| 23 | 524 | cx_attr_nonnull_arg(1) cx_attr_access_r(2, 3) |
| 22 | 525 | CX_EXPORT int cxJsonFilln(CxJson *json, const char *buf, size_t len); |
| 526 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
527 | |
| 22 | 528 | /** |
| 529 | * Internal function, do not use. | |
| 530 | * | |
| 531 | * @param json the JSON interface | |
| 532 | * @param str the string | |
| 533 | * @retval zero success | |
| 534 | * @retval non-zero internal allocation error | |
| 535 | */ | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
536 | cx_attr_nonnull |
| 22 | 537 | CX_INLINE int cx_json_fill(CxJson *json, cxstring str) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
538 | return cxJsonFilln(json, str.ptr, str.length); |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
539 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
540 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
541 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
542 | * Fills the input buffer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
543 | * |
| 16 | 544 | * The JSON interface tries to avoid copying the input data. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
545 | * When you use this function and cxJsonNext() interleaving, |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
546 | * no copies are performed. However, you must not free the |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
547 | * pointer to the data in that case. When you invoke the fill |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
548 | * function more than once before calling cxJsonNext(), |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
549 | * the additional data is appended - inevitably leading to |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
550 | * an allocation of a new buffer and copying the previous contents. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
551 | * |
| 22 | 552 | * @param json the JSON interface |
| 16 | 553 | * @param str the source string |
| 554 | * @retval zero success | |
| 555 | * @retval non-zero internal allocation error | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
556 | * @see cxJsonFilln() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
557 | */ |
| 22 | 558 | #define cxJsonFill(json, str) cx_json_fill(json, cx_strcast(str)) |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
559 | |
| 30 | 560 | |
| 561 | /** | |
| 562 | * Internal function - use cxJsonFromString() instead. | |
| 563 | * | |
| 564 | * @param allocator the allocator for the JSON value | |
| 565 | * @param str the string to parse | |
| 566 | * @param value a pointer where the JSON value shall be stored to | |
| 567 | * @return status code | |
| 568 | */ | |
| 569 | cx_attr_nonnull_arg(3) | |
| 570 | CX_EXPORT CxJsonStatus cx_json_from_string(const CxAllocator *allocator, | |
| 571 | cxstring str, CxJsonValue **value); | |
| 572 | ||
| 573 | /** | |
| 574 | * Parses a string into a JSON value. | |
| 575 | * | |
| 576 | * @param allocator (@c CxAllocator*) the allocator for the JSON value | |
| 577 | * @param str (any string) the string to parse | |
| 578 | * @param value (@c CxJsonValue**) a pointer where the JSON value shall be stored to | |
| 579 | * @retval CX_JSON_NO_ERROR success | |
| 580 | * @retval CX_JSON_NO_DATA the string was empty or blank | |
| 581 | * @retval CX_JSON_INCOMPLETE_DATA the string unexpectedly ended | |
| 582 | * @retval CX_JSON_BUFFER_ALLOC_FAILED allocating internal buffer space failed | |
| 583 | * @retval CX_JSON_VALUE_ALLOC_FAILED allocating memory for the CxJsonValue failed | |
| 584 | * @retval CX_JSON_FORMAT_ERROR_NUMBER the JSON text contains an illegally formatted number | |
| 585 | * @retval CX_JSON_FORMAT_ERROR_UNEXPECTED_TOKEN JSON syntax error | |
| 586 | */ | |
| 587 | #define cxJsonFromString(allocator, str, value) \ | |
| 588 | cx_json_from_string(allocator, cx_strcast(str), value) | |
| 589 | ||
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
590 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
591 | * Creates a new (empty) JSON object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
592 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
593 | * @param allocator the allocator to use |
| 16 | 594 | * @return the new JSON object or @c NULL if allocation fails |
| 595 | * @see cxJsonObjPutObj() | |
| 596 | * @see cxJsonArrAddValues() | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
597 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
598 | cx_attr_nodiscard |
| 22 | 599 | CX_EXPORT CxJsonValue* cxJsonCreateObj(const CxAllocator* allocator); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
600 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
601 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
602 | * Creates a new (empty) JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
603 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
604 | * @param allocator the allocator to use |
| 16 | 605 | * @return the new JSON array or @c NULL if allocation fails |
| 606 | * @see cxJsonObjPutArr() | |
| 607 | * @see cxJsonArrAddValues() | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
608 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
609 | cx_attr_nodiscard |
| 22 | 610 | CX_EXPORT CxJsonValue* cxJsonCreateArr(const CxAllocator* allocator); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
611 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
612 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
613 | * Creates a new JSON number value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
614 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
615 | * @param allocator the allocator to use |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
616 | * @param num the numeric value |
| 16 | 617 | * @return the new JSON value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
618 | * @see cxJsonObjPutNumber() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
619 | * @see cxJsonArrAddNumbers() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
620 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
621 | cx_attr_nodiscard |
| 22 | 622 | CX_EXPORT CxJsonValue* cxJsonCreateNumber(const CxAllocator* allocator, double num); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
623 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
624 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
625 | * Creates a new JSON number value based on an integer. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
626 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
627 | * @param allocator the allocator to use |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
628 | * @param num the numeric value |
| 16 | 629 | * @return the new JSON value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
630 | * @see cxJsonObjPutInteger() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
631 | * @see cxJsonArrAddIntegers() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
632 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
633 | cx_attr_nodiscard |
| 22 | 634 | CX_EXPORT CxJsonValue* cxJsonCreateInteger(const CxAllocator* allocator, int64_t num); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
635 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
636 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
637 | * Creates a new JSON string. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
638 | * |
| 23 | 639 | * Internal function - use cxJsonCreateString() instead. |
| 640 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
641 | * @param allocator the allocator to use |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
642 | * @param str the string data |
| 16 | 643 | * @return the new JSON value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
644 | * @see cxJsonObjPutString() |
| 23 | 645 | * @see cxJsonArrAddCxStrings() |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
646 | */ |
| 23 | 647 | cx_attr_nodiscard |
| 648 | CX_EXPORT CxJsonValue* cx_json_create_string(const CxAllocator* allocator, cxstring str); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
649 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
650 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
651 | * Creates a new JSON string. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
652 | * |
| 23 | 653 | * @param allocator (@c CxAllocator*) the allocator to use |
| 654 | * @param str the string | |
| 655 | * @return (@c CxJsonValue*) the new JSON value or @c NULL if allocation fails | |
| 656 | * @see cxJsonObjPutString() | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
657 | * @see cxJsonArrAddCxStrings() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
658 | */ |
| 23 | 659 | #define cxJsonCreateString(allocator, str) cx_json_create_string(allocator, cx_strcast(str)) |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
660 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
661 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
662 | * Creates a new JSON literal. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
663 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
664 | * @param allocator the allocator to use |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
665 | * @param lit the type of literal |
| 16 | 666 | * @return the new JSON value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
667 | * @see cxJsonObjPutLiteral() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
668 | * @see cxJsonArrAddLiterals() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
669 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
670 | cx_attr_nodiscard |
| 22 | 671 | CX_EXPORT CxJsonValue* cxJsonCreateLiteral(const CxAllocator* allocator, CxJsonLiteral lit); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
672 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
673 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
674 | * Adds number values to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
675 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
676 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
677 | * @param num the array of values |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
678 | * @param count the number of elements |
| 16 | 679 | * @retval zero success |
| 680 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
681 | */ |
| 22 | 682 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 683 | CX_EXPORT int cxJsonArrAddNumbers(CxJsonValue* arr, const double* num, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
684 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
685 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
686 | * Adds number values, of which all are integers, to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
687 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
688 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
689 | * @param num the array of values |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
690 | * @param count the number of elements |
| 16 | 691 | * @retval zero success |
| 692 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
693 | */ |
| 22 | 694 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 695 | CX_EXPORT int cxJsonArrAddIntegers(CxJsonValue* arr, const int64_t* num, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
696 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
697 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
698 | * Adds strings to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
699 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
700 | * The strings will be copied with the allocator of the array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
701 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
702 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
703 | * @param str the array of strings |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
704 | * @param count the number of elements |
| 16 | 705 | * @retval zero success |
| 706 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
707 | * @see cxJsonArrAddCxStrings() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
708 | */ |
| 22 | 709 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 710 | CX_EXPORT int cxJsonArrAddStrings(CxJsonValue* arr, const char* const* str, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
711 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
712 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
713 | * Adds strings to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
714 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
715 | * The strings will be copied with the allocator of the array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
716 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
717 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
718 | * @param str the array of strings |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
719 | * @param count the number of elements |
| 16 | 720 | * @retval zero success |
| 721 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
722 | * @see cxJsonArrAddStrings() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
723 | */ |
| 22 | 724 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 725 | CX_EXPORT int cxJsonArrAddCxStrings(CxJsonValue* arr, const cxstring* str, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
726 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
727 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
728 | * Adds literals to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
729 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
730 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
731 | * @param lit the array of literal types |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
732 | * @param count the number of elements |
| 16 | 733 | * @retval zero success |
| 734 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
735 | */ |
| 22 | 736 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 737 | CX_EXPORT int cxJsonArrAddLiterals(CxJsonValue* arr, const CxJsonLiteral* lit, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
738 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
739 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
740 | * Add arbitrary values to a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
741 | * |
| 16 | 742 | * @attention In contrast to all other add functions, this function adds the values |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
743 | * directly to the array instead of copying them. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
744 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
745 | * @param arr the JSON array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
746 | * @param val the values |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
747 | * @param count the number of elements |
| 16 | 748 | * @retval zero success |
| 749 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
750 | */ |
| 22 | 751 | cx_attr_nonnull cx_attr_access_r(2, 3) |
| 752 | CX_EXPORT int cxJsonArrAddValues(CxJsonValue* arr, CxJsonValue* const* val, size_t count); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
753 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
754 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
755 | * Adds or replaces a value within a JSON object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
756 | * |
| 23 | 757 | * Internal function - use cxJsonObjPut(). |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
758 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
759 | * @param obj the JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
760 | * @param name the name of the value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
761 | * @param child the value |
| 16 | 762 | * @retval zero success |
| 763 | * @retval non-zero allocation failure | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
764 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
765 | cx_attr_nonnull |
| 23 | 766 | CX_EXPORT int cx_json_obj_put(CxJsonValue* obj, cxstring name, CxJsonValue* child); |
| 767 | ||
| 768 | /** | |
| 769 | * Adds or replaces a value within a JSON object. | |
| 770 | * | |
| 771 | * The value will be directly added and not copied. | |
| 772 | * | |
| 773 | * @note If a value with the specified @p name already exists, | |
| 774 | * it will be (recursively) freed with its own allocator. | |
| 775 | * | |
| 776 | * @param obj (@c CxJsonValue*) the JSON object | |
| 777 | * @param name (any string) the name of the value | |
| 778 | * @param child (@c CxJsonValue*) the value | |
| 779 | * @retval zero success | |
| 780 | * @retval non-zero allocation failure | |
| 781 | */ | |
| 782 | #define cxJsonObjPut(obj, name, child) cx_json_obj_put(obj, cx_strcast(name), child) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
783 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
784 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
785 | * Creates a new JSON object and adds it to an existing object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
786 | * |
| 23 | 787 | * Internal function - use cxJsonObjPutObj(). |
| 788 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
789 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
790 | * @param name the name of the new value |
| 16 | 791 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
792 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
793 | * @see cxJsonCreateObj() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
794 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
795 | cx_attr_nonnull |
| 23 | 796 | CX_EXPORT CxJsonValue* cx_json_obj_put_obj(CxJsonValue* obj, cxstring name); |
| 797 | ||
| 798 | /** | |
| 799 | * Creates a new JSON object and adds it to an existing object. | |
| 800 | * | |
| 801 | * @param obj (@c CxJsonValue*) the target JSON object | |
| 802 | * @param name (any string) the name of the new value | |
| 803 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
| 804 | * @see cxJsonObjPut() | |
| 805 | * @see cxJsonCreateObj() | |
| 806 | */ | |
| 807 | #define cxJsonObjPutObj(obj, name) cx_json_obj_put_obj(obj, cx_strcast(name)) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
808 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
809 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
810 | * Creates a new JSON array and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
811 | * |
| 23 | 812 | * Internal function - use cxJsonObjPutArr(). |
| 813 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
814 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
815 | * @param name the name of the new value |
| 16 | 816 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
817 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
818 | * @see cxJsonCreateArr() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
819 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
820 | cx_attr_nonnull |
| 23 | 821 | CX_EXPORT CxJsonValue* cx_json_obj_put_arr(CxJsonValue* obj, cxstring name); |
| 822 | ||
| 823 | /** | |
| 824 | * Creates a new JSON array and adds it to an object. | |
| 825 | * | |
| 826 | * @param obj (@c CxJsonValue*) the target JSON object | |
| 827 | * @param name (any string) the name of the new value | |
| 828 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
| 829 | * @see cxJsonObjPut() | |
| 830 | * @see cxJsonCreateArr() | |
| 831 | */ | |
| 832 | #define cxJsonObjPutArr(obj, name) cx_json_obj_put_arr(obj, cx_strcast(name)) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
833 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
834 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
835 | * Creates a new JSON number and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
836 | * |
| 23 | 837 | * Internal function - use cxJsonObjPutNumber(). |
| 838 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
839 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
840 | * @param name the name of the new value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
841 | * @param num the numeric value |
| 16 | 842 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
843 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
844 | * @see cxJsonCreateNumber() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
845 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
846 | cx_attr_nonnull |
| 23 | 847 | CX_EXPORT CxJsonValue* cx_json_obj_put_number(CxJsonValue* obj, cxstring name, double num); |
| 848 | ||
| 849 | /** | |
| 850 | * Creates a new JSON number and adds it to an object. | |
| 851 | * | |
| 852 | * @param obj (@c CxJsonValue*) the target JSON object | |
| 853 | * @param name (any string) the name of the new value | |
| 854 | * @param num (@c double) the numeric value | |
| 855 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
| 856 | * @see cxJsonObjPut() | |
| 857 | * @see cxJsonCreateNumber() | |
| 858 | */ | |
| 859 | #define cxJsonObjPutNumber(obj, name, num) cx_json_obj_put_number(obj, cx_strcast(name), num) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
860 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
861 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
862 | * Creates a new JSON number, based on an integer, and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
863 | * |
| 23 | 864 | * Internal function - use cxJsonObjPutInteger(). |
| 865 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
866 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
867 | * @param name the name of the new value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
868 | * @param num the numeric value |
| 16 | 869 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
870 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
871 | * @see cxJsonCreateInteger() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
872 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
873 | cx_attr_nonnull |
| 23 | 874 | CX_EXPORT CxJsonValue* cx_json_obj_put_integer(CxJsonValue* obj, cxstring name, int64_t num); |
| 875 | ||
| 876 | /** | |
| 877 | * Creates a new JSON number, based on an integer, and adds it to an object. | |
| 878 | * | |
| 879 | * @param obj (@c CxJsonValue*) the target JSON object | |
| 880 | * @param name (any string) the name of the new value | |
| 881 | * @param num (@c int64_t) the numeric value | |
| 882 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
| 883 | * @see cxJsonObjPut() | |
| 884 | * @see cxJsonCreateInteger() | |
| 885 | */ | |
| 886 | #define cxJsonObjPutInteger(obj, name, num) cx_json_obj_put_integer(obj, cx_strcast(name), num) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
887 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
888 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
889 | * Creates a new JSON string and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
890 | * |
| 23 | 891 | * Internal function - use cxJsonObjPutString() |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
892 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
893 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
894 | * @param name the name of the new value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
895 | * @param str the string data |
| 16 | 896 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
897 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
898 | * @see cxJsonCreateString() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
899 | */ |
| 23 | 900 | cx_attr_nonnull |
| 901 | CX_EXPORT CxJsonValue* cx_json_obj_put_string(CxJsonValue* obj, cxstring name, cxstring str); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
902 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
903 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
904 | * Creates a new JSON string and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
905 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
906 | * The string data is copied. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
907 | * |
| 23 | 908 | * @param obj (@c CxJsonValue*) the target JSON object |
| 909 | * @param name (any string) the name of the new value | |
| 910 | * @param str (any string) the string data | |
| 911 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
912 | * @see cxJsonObjPut() |
| 23 | 913 | * @see cxJsonCreateString() |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
914 | */ |
| 23 | 915 | #define cxJsonObjPutString(obj, name, str) cx_json_obj_put_string(obj, cx_strcast(name), cx_strcast(str)) |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
916 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
917 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
918 | * Creates a new JSON literal and adds it to an object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
919 | * |
| 23 | 920 | * Internal function - use cxJsonObjPutLiteral(). |
| 921 | * | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
922 | * @param obj the target JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
923 | * @param name the name of the new value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
924 | * @param lit the type of literal |
| 16 | 925 | * @return the new value or @c NULL if allocation fails |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
926 | * @see cxJsonObjPut() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
927 | * @see cxJsonCreateLiteral() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
928 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
929 | cx_attr_nonnull |
| 23 | 930 | CX_EXPORT CxJsonValue* cx_json_obj_put_literal(CxJsonValue* obj, cxstring name, CxJsonLiteral lit); |
| 931 | ||
| 932 | /** | |
| 933 | * Creates a new JSON literal and adds it to an object. | |
| 934 | * | |
| 935 | * @param obj (@c CxJsonValue*) the target JSON object | |
| 936 | * @param name (any string) the name of the new value | |
| 937 | * @param lit (@c CxJsonLiteral) the type of literal | |
| 938 | * @return (@c CxJsonValue*) the new value or @c NULL if allocation fails | |
| 939 | * @see cxJsonObjPut() | |
| 940 | * @see cxJsonCreateLiteral() | |
| 941 | */ | |
| 942 | #define cxJsonObjPutLiteral(obj, name, lit) cx_json_obj_put_literal(obj, cx_strcast(name), lit) | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
943 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
944 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
945 | * Recursively deallocates the memory of a JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
946 | * |
| 16 | 947 | * @remark The type of each deallocated value will be changed |
| 22 | 948 | * to #CX_JSON_NOTHING, and values of such a type will be skipped |
| 949 | * by the deallocation. That means this function protects | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
950 | * you from double-frees when you are accidentally freeing |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
951 | * a nested value and then the parent value (or vice versa). |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
952 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
953 | * @param value the value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
954 | */ |
| 22 | 955 | CX_EXPORT void cxJsonValueFree(CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
956 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
957 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
958 | * Tries to obtain the next JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
959 | * |
| 16 | 960 | * Before this function can be called, the input buffer needs |
| 961 | * to be filled with cxJsonFill(). | |
| 962 | * | |
| 963 | * When this function returns #CX_JSON_INCOMPLETE_DATA, you can | |
| 964 | * add the missing data with another invocation of cxJsonFill() | |
| 965 | * and then repeat the call to cxJsonNext(). | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
966 | * |
| 22 | 967 | * @param json the JSON interface |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
968 | * @param value a pointer where the next value shall be stored |
| 16 | 969 | * @retval CX_JSON_NO_ERROR successfully retrieve the @p value |
| 970 | * @retval CX_JSON_NO_DATA there is no (more) data in the buffer to read from | |
| 971 | * @retval CX_JSON_INCOMPLETE_DATA an incomplete value was read | |
| 972 | * and more data needs to be filled | |
| 973 | * @retval CX_JSON_NULL_DATA the buffer was never initialized | |
| 974 | * @retval CX_JSON_BUFFER_ALLOC_FAILED allocating internal buffer space failed | |
| 975 | * @retval CX_JSON_VALUE_ALLOC_FAILED allocating memory for a CxJsonValue failed | |
| 976 | * @retval CX_JSON_FORMAT_ERROR_NUMBER the JSON text contains an illegally formatted number | |
| 977 | * @retval CX_JSON_FORMAT_ERROR_UNEXPECTED_TOKEN JSON syntax error | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
978 | */ |
| 22 | 979 | cx_attr_nonnull cx_attr_access_w(2) |
| 980 | CX_EXPORT CxJsonStatus cxJsonNext(CxJson *json, CxJsonValue **value); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
981 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
982 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
983 | * Checks if the specified value is a JSON object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
984 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
985 | * @param value a pointer to the value |
| 16 | 986 | * @retval true the value is a JSON object |
| 987 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
988 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
989 | cx_attr_nonnull |
| 22 | 990 | CX_INLINE bool cxJsonIsObject(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
991 | return value->type == CX_JSON_OBJECT; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
992 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
993 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
994 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
995 | * Checks if the specified value is a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
996 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
997 | * @param value a pointer to the value |
| 16 | 998 | * @retval true the value is a JSON array |
| 999 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1000 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1001 | cx_attr_nonnull |
| 22 | 1002 | CX_INLINE bool cxJsonIsArray(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1003 | return value->type == CX_JSON_ARRAY; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1004 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1005 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1006 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1007 | * Checks if the specified value is a string. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1008 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1009 | * @param value a pointer to the value |
| 16 | 1010 | * @retval true the value is a string |
| 1011 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1012 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1013 | cx_attr_nonnull |
| 22 | 1014 | CX_INLINE bool cxJsonIsString(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1015 | return value->type == CX_JSON_STRING; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1016 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1017 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1018 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1019 | * Checks if the specified value is a JSON number. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1020 | * |
| 22 | 1021 | * This function will return true for both floating-point and |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1022 | * integer numbers. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1023 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1024 | * @param value a pointer to the value |
| 16 | 1025 | * @retval true the value is a JSON number |
| 1026 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1027 | * @see cxJsonIsInteger() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1028 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1029 | cx_attr_nonnull |
| 22 | 1030 | CX_INLINE bool cxJsonIsNumber(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1031 | return value->type == CX_JSON_NUMBER || value->type == CX_JSON_INTEGER; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1032 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1033 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1034 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1035 | * Checks if the specified value is an integer number. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1036 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1037 | * @param value a pointer to the value |
| 16 | 1038 | * @retval true the value is an integer number |
| 1039 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1040 | * @see cxJsonIsNumber() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1041 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1042 | cx_attr_nonnull |
| 22 | 1043 | CX_INLINE bool cxJsonIsInteger(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1044 | return value->type == CX_JSON_INTEGER; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1045 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1046 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1047 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1048 | * Checks if the specified value is a JSON literal. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1049 | * |
| 16 | 1050 | * JSON literals are @c true, @c false, and @c null. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1051 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1052 | * @param value a pointer to the value |
| 16 | 1053 | * @retval true the value is a JSON literal |
| 1054 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1055 | * @see cxJsonIsTrue() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1056 | * @see cxJsonIsFalse() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1057 | * @see cxJsonIsNull() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1058 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1059 | cx_attr_nonnull |
| 22 | 1060 | CX_INLINE bool cxJsonIsLiteral(const CxJsonValue *value) { |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1061 | return value->type == CX_JSON_LITERAL; |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1062 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1063 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1064 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1065 | * Checks if the specified value is a Boolean literal. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1066 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1067 | * @param value a pointer to the value |
| 16 | 1068 | * @retval true the value is either @c true or @c false |
| 1069 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1070 | * @see cxJsonIsTrue() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1071 | * @see cxJsonIsFalse() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1072 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1073 | cx_attr_nonnull |
| 22 | 1074 | CX_INLINE bool cxJsonIsBool(const CxJsonValue *value) { |
| 30 | 1075 | return cxJsonIsLiteral(value) && value->literal != CX_JSON_NULL; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1076 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1077 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1078 | /** |
| 16 | 1079 | * Checks if the specified value is @c true. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1080 | * |
| 22 | 1081 | * @remark Be advised that this is different from |
| 16 | 1082 | * testing @c !cxJsonIsFalse(v). |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1083 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1084 | * @param value a pointer to the value |
| 16 | 1085 | * @retval true the value is @c true |
| 1086 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1087 | * @see cxJsonIsBool() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1088 | * @see cxJsonIsFalse() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1089 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1090 | cx_attr_nonnull |
| 22 | 1091 | CX_INLINE bool cxJsonIsTrue(const CxJsonValue *value) { |
| 30 | 1092 | return cxJsonIsLiteral(value) && value->literal == CX_JSON_TRUE; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1093 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1094 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1095 | /** |
| 16 | 1096 | * Checks if the specified value is @c false. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1097 | * |
| 22 | 1098 | * @remark Be advised that this is different from |
| 16 | 1099 | * testing @c !cxJsonIsTrue(v). |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1100 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1101 | * @param value a pointer to the value |
| 16 | 1102 | * @retval true the value is @c false |
| 1103 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1104 | * @see cxJsonIsBool() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1105 | * @see cxJsonIsTrue() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1106 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1107 | cx_attr_nonnull |
| 22 | 1108 | CX_INLINE bool cxJsonIsFalse(const CxJsonValue *value) { |
| 30 | 1109 | return cxJsonIsLiteral(value) && value->literal == CX_JSON_FALSE; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1110 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1111 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1112 | /** |
| 16 | 1113 | * Checks if the specified value is @c null. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1114 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1115 | * @param value a pointer to the value |
| 16 | 1116 | * @retval true the value is @c null |
| 1117 | * @retval false otherwise | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1118 | * @see cxJsonIsLiteral() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1119 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1120 | cx_attr_nonnull |
| 22 | 1121 | CX_INLINE bool cxJsonIsNull(const CxJsonValue *value) { |
| 30 | 1122 | return cxJsonIsLiteral(value) && value->literal == CX_JSON_NULL; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1123 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1124 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1125 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1126 | * Obtains a C string from the given JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1127 | * |
| 16 | 1128 | * If the @p value is not a string, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1129 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1130 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1131 | * @return the value represented as C string |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1132 | * @see cxJsonIsString() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1133 | */ |
| 22 | 1134 | cx_attr_nonnull cx_attr_returns_nonnull |
| 1135 | CX_EXPORT char *cxJsonAsString(const CxJsonValue *value); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1136 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1137 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1138 | * Obtains a UCX string from the given JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1139 | * |
| 16 | 1140 | * If the @p value is not a string, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1141 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1142 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1143 | * @return the value represented as UCX string |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1144 | * @see cxJsonIsString() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1145 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1146 | cx_attr_nonnull |
| 22 | 1147 | CX_EXPORT cxstring cxJsonAsCxString(const CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1148 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1149 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1150 | * Obtains a mutable UCX string from the given JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1151 | * |
| 16 | 1152 | * If the @p value is not a string, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1153 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1154 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1155 | * @return the value represented as mutable UCX string |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1156 | * @see cxJsonIsString() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1157 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1158 | cx_attr_nonnull |
| 22 | 1159 | CX_EXPORT cxmutstr cxJsonAsCxMutStr(const CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1160 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1161 | /** |
| 22 | 1162 | * Obtains a double-precision floating-point value from the given JSON value. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1163 | * |
| 16 | 1164 | * If the @p value is not a JSON number, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1165 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1166 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1167 | * @return the value represented as double |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1168 | * @see cxJsonIsNumber() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1169 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1170 | cx_attr_nonnull |
| 22 | 1171 | CX_EXPORT double cxJsonAsDouble(const CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1172 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1173 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1174 | * Obtains a 64-bit signed integer from the given JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1175 | * |
| 16 | 1176 | * If the @p value is not a JSON number, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1177 | * If it is a JSON number, but not an integer, the value will be |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1178 | * converted to an integer, possibly losing precision. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1179 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1180 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1181 | * @return the value represented as double |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1182 | * @see cxJsonIsNumber() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1183 | * @see cxJsonIsInteger() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1184 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1185 | cx_attr_nonnull |
| 22 | 1186 | CX_EXPORT int64_t cxJsonAsInteger(const CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1187 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1188 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1189 | * Obtains a Boolean value from the given JSON value. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1190 | * |
| 16 | 1191 | * If the @p value is not a JSON literal, the behavior is undefined. |
| 1192 | * The @c null literal is interpreted as @c false. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1193 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1194 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1195 | * @return the value represented as double |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1196 | * @see cxJsonIsLiteral() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1197 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1198 | cx_attr_nonnull |
| 22 | 1199 | CX_INLINE bool cxJsonAsBool(const CxJsonValue *value) { |
| 30 | 1200 | return value->literal == CX_JSON_TRUE; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1201 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1202 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1203 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1204 | * Returns the size of a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1205 | * |
| 16 | 1206 | * If the @p value is not a JSON array, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1207 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1208 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1209 | * @return the size of the array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1210 | * @see cxJsonIsArray() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1211 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1212 | cx_attr_nonnull |
| 22 | 1213 | CX_INLINE size_t cxJsonArrSize(const CxJsonValue *value) { |
| 30 | 1214 | return value->array.data_size; |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1215 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1216 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1217 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1218 | * Returns an element from a JSON array. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1219 | * |
| 16 | 1220 | * If the @p value is not a JSON array, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1221 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1222 | * This function guarantees to return a value. If the index is |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1223 | * out of bounds, the returned value will be of type |
| 16 | 1224 | * #CX_JSON_NOTHING, but never @c NULL. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1225 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1226 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1227 | * @param index the index in the array |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1228 | * @return the value at the specified index |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1229 | * @see cxJsonIsArray() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1230 | */ |
| 22 | 1231 | cx_attr_nonnull cx_attr_returns_nonnull |
| 1232 | CX_EXPORT CxJsonValue *cxJsonArrGet(const CxJsonValue *value, size_t index); | |
| 1233 | ||
| 1234 | /** | |
| 1235 | * Removes an element from a JSON array. | |
| 1236 | * | |
| 1237 | * If the @p value is not a JSON array, the behavior is undefined. | |
| 1238 | * | |
| 1239 | * This function, in contrast to cxJsonArrayGet(), returns @c NULL | |
| 1240 | * when the index is out of bounds. | |
| 1241 | * | |
| 1242 | * @param value the JSON value | |
| 1243 | * @param index the index in the array | |
| 1244 | * @return the removed value from the specified index or @c NULL when the index was out of bounds | |
| 1245 | * @see cxJsonIsArray() | |
| 1246 | */ | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1247 | cx_attr_nonnull |
| 22 | 1248 | CX_EXPORT CxJsonValue *cxJsonArrRemove(CxJsonValue *value, size_t index); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1249 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1250 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1251 | * Returns an iterator over the JSON array elements. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1252 | * |
| 16 | 1253 | * The iterator yields values of type @c CxJsonValue* . |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1254 | * |
| 16 | 1255 | * If the @p value is not a JSON array, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1256 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1257 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1258 | * @return an iterator over the array elements |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1259 | * @see cxJsonIsArray() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1260 | */ |
| 22 | 1261 | cx_attr_nonnull cx_attr_nodiscard |
| 1262 | CX_EXPORT CxIterator cxJsonArrIter(const CxJsonValue *value); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1263 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1264 | /** |
| 23 | 1265 | * Returns the size of a JSON object. |
| 1266 | * | |
| 1267 | * If the @p value is not a JSON object, the behavior is undefined. | |
| 1268 | * | |
| 1269 | * @param value the JSON value | |
| 1270 | * @return the size of the object, i.e., the number of key/value pairs | |
| 1271 | * @see cxJsonIsObject() | |
| 1272 | */ | |
| 1273 | cx_attr_nonnull | |
| 1274 | CX_INLINE size_t cxJsonObjSize(const CxJsonValue *value) { | |
| 30 | 1275 | return cxCollectionSize(value->object); |
| 23 | 1276 | } |
| 1277 | ||
| 1278 | /** | |
| 30 | 1279 | * Returns a map iterator over the JSON object members. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1280 | * |
| 30 | 1281 | * The iterator yields values of type @c CxMapEntry* which |
| 1282 | * contain the name and the @c CxJsonObjValue* of the member. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1283 | * |
| 16 | 1284 | * If the @p value is not a JSON object, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1285 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1286 | * @param value the JSON value |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1287 | * @return an iterator over the object members |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1288 | * @see cxJsonIsObject() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1289 | */ |
| 22 | 1290 | cx_attr_nonnull cx_attr_nodiscard |
| 30 | 1291 | CX_EXPORT CxMapIterator cxJsonObjIter(const CxJsonValue *value); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1292 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1293 | /** |
| 22 | 1294 | * Internal function, do not use. |
| 1295 | * @param value the JSON object | |
| 1296 | * @param name the key to look up | |
| 1297 | * @return the value corresponding to the key | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1298 | */ |
| 22 | 1299 | cx_attr_nonnull cx_attr_returns_nonnull |
| 1300 | CX_EXPORT CxJsonValue *cx_json_obj_get(const CxJsonValue *value, cxstring name); | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1301 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1302 | /** |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1303 | * Returns a value corresponding to a key in a JSON object. |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1304 | * |
| 16 | 1305 | * If the @p value is not a JSON object, the behavior is undefined. |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1306 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1307 | * This function guarantees to return a JSON value. If the |
| 16 | 1308 | * object does not contain @p name, the returned JSON value |
| 1309 | * will be of type #CX_JSON_NOTHING, but never @c NULL. | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1310 | * |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1311 | * @param value the JSON object |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1312 | * @param name the key to look up |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1313 | * @return the value corresponding to the key |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1314 | * @see cxJsonIsObject() |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1315 | */ |
| 22 | 1316 | #define cxJsonObjGet(value, name) cx_json_obj_get(value, cx_strcast(name)) |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1317 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1318 | /** |
| 22 | 1319 | * Internal function, do not use. |
| 1320 | * @param value the JSON object | |
| 1321 | * @param name the key to look up | |
| 1322 | * @return the value corresponding to the key or @c NULL when the key is not part of the object | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1323 | */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1324 | cx_attr_nonnull |
| 22 | 1325 | CX_EXPORT CxJsonValue *cx_json_obj_remove(CxJsonValue *value, cxstring name); |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1326 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1327 | /** |
| 22 | 1328 | * Removes and returns a value corresponding to a key in a JSON object. |
| 1329 | * | |
| 1330 | * If the @p value is not a JSON object, the behavior is undefined. | |
| 1331 | * | |
| 1332 | * This function, in contrast to cxJsonObjGet() returns @c NULL when the | |
| 1333 | * object does not contain @p name. | |
| 1334 | * | |
| 1335 | * @param value the JSON object | |
| 1336 | * @param name the key to look up | |
| 1337 | * @return the value corresponding to the key or @c NULL when the key is not part of the object | |
| 1338 | * @see cxJsonIsObject() | |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1339 | */ |
| 22 | 1340 | #define cxJsonObjRemove(value, name) cx_json_obj_remove(value, cx_strcast(name)) |
|
11
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1341 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1342 | #ifdef __cplusplus |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1343 | } |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1344 | #endif |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1345 | |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1346 | #endif /* UCX_JSON_H */ |
|
0aa8cbd7912e
refactor dbuObjectExecuteQuery: replace multiple lists with a single ll list
Olaf Wintermann <olaf.wintermann@gmail.com>
parents:
diff
changeset
|
1347 |