Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
apr_json.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
20 #ifndef APR_JSON_H
21 #define APR_JSON_H
22 
28 #include "apr.h"
29 #include "apr_pools.h"
30 #include "apr_tables.h"
31 #include "apr_hash.h"
32 #include "apr_strings.h"
33 #include "apr_buckets.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
68 #define APR_JSON_VALUE_STRING (-1)
69 
73 #define APR_JSON_FLAGS_NONE 0
74 
78 #define APR_JSON_FLAGS_WHITESPACE 1
79 
83 #define APR_JSON_FLAGS_STRICT 2
84 
89 
94 
98 typedef enum apr_json_type_e {
107 
111 typedef struct apr_json_string_t {
113  const char *p;
117 
123 typedef struct apr_json_value_t {
127  const char *pre;
129  const char *post;
133  union {
139  double dnumber;
145  int boolean;
146  } value;
148 
154 typedef struct apr_json_kv_t {
161 } apr_json_kv_t;
162 
170  APR_RING_HEAD(apr_json_object_list_t, apr_json_kv_t) list;
173 };
174 
182  APR_RING_HEAD(apr_json_array_list_t, apr_json_value_t) list;
185 };
186 
194  __attribute__((nonnull(1)));
195 
205  apr_json_string_create(apr_pool_t *pool, const char *val,
206  apr_ssize_t len) __attribute__((nonnull(1)));
207 
216  apr_json_array_create(apr_pool_t *pool, int nelts)
217  __attribute__((nonnull(1)));
218 
226  __attribute__((nonnull(1)));
227 
237  __attribute__((nonnull(1)));
238 
247  apr_json_double_create(apr_pool_t *pool, double dnumber)
248  __attribute__((nonnull(1)));
249 
258  apr_json_boolean_create(apr_pool_t *pool, int boolean)
259  __attribute__((nonnull(1)));
260 
269  __attribute__((nonnull(1)));
270 
284  const char *key, apr_ssize_t klen, apr_json_value_t *val,
285  apr_pool_t *pool) __attribute__((nonnull(1, 2, 5)));
286 
300  apr_pool_t *pool) __attribute__((nonnull(1, 2, 4)));
301 
311  apr_json_object_get(apr_json_value_t *obj, const char *key,
312  apr_ssize_t klen)
313  __attribute__((nonnull(1, 2)));
314 
324  __attribute__((nonnull(1)));;
325 
337  apr_json_kv_t *kv)
338  __attribute__((nonnull(1, 2)));;
339 
348  apr_json_value_t *val)
349  __attribute__((nonnull(1, 2)));
350 
358  apr_json_array_get(apr_json_value_t *arr, int index)
359  __attribute__((nonnull(1)));
360 
370  __attribute__((nonnull(1)));;
371 
383  const apr_json_value_t *val)
384  __attribute__((nonnull(1, 2)));;
385 
402  const char *injson, apr_ssize_t size, apr_off_t * offset,
403  int flags, int level, apr_pool_t * pool)
404  __attribute__((nonnull(1, 2, 7)));
405 
425  apr_brigade_flush flush, void *ctx, const apr_json_value_t * json,
426  int flags, apr_pool_t * pool) __attribute__((nonnull(1, 4, 6)));
427 
450  apr_json_value_t *overlay, apr_json_value_t *base,
451  int flags) __attribute__((nonnull(1)));;
452 
453 #ifdef __cplusplus
454 }
455 #endif
456 
457 #endif /* APR_JSON_H */
double dnumber
Definition: apr_json.h:139
Definition: apr_json.h:168
apr_json_value_t * apr_json_array_create(apr_pool_t *pool, int nelts) __attribute__((nonnull(1)))
apr_json_object_t * object
Definition: apr_json.h:135
Definition: apr_tables.h:62
apr_json_kv_t * apr_json_object_next(apr_json_value_t *obj, apr_json_kv_t *kv) __attribute__((nonnull(1
apr_status_t apr_status_t apr_json_kv_t apr_json_kv_t * apr_json_object_first(apr_json_value_t *obj) __attribute__((nonnull(1)))
apr_json_type_e type
Definition: apr_json.h:131
apr_json_kv_t apr_status_t apr_json_value_t * apr_json_array_get(apr_json_value_t *arr, int index) __attribute__((nonnull(1)))
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:552
int64_t apr_int64_t
Definition: apr.h:389
APR_RING_HEAD(apr_json_array_list_t, apr_json_value_t) list
apr_json_value_t apr_status_t apr_status_t apr_json_encode(apr_bucket_brigade *brigade, apr_brigade_flush flush, void *ctx, const apr_json_value_t *json, int flags, apr_pool_t *pool) __attribute__((nonnull(1
apr_json_value_t * apr_json_object_create(apr_pool_t *pool) __attribute__((nonnull(1)))
APR Hash Tables.
apr_json_value_t * apr_json_string_create(apr_pool_t *pool, const char *val, apr_ssize_t len) __attribute__((nonnull(1)))
const char * p
Definition: apr_json.h:113
apr_json_value_t * apr_json_array_first(const apr_json_value_t *arr) __attribute__((nonnull(1)))
int boolean
Definition: apr_json.h:145
struct apr_json_string_t apr_json_string_t
const char * pre
Definition: apr_json.h:127
Definition: apr_json.h:100
Definition: apr_buckets.h:258
apr_json_string_t string
Definition: apr_json.h:143
const char * post
Definition: apr_json.h:129
APR_RING_HEAD(apr_json_object_list_t, apr_json_kv_t) list
apr_status_t apr_json_object_set(apr_json_value_t *obj, const char *key, apr_ssize_t klen, apr_json_value_t *val, apr_pool_t *pool) __attribute__((nonnull(1
apr_hash_t * hash
Definition: apr_json.h:172
dav_buffer apr_size_t size
Definition: mod_dav.h:457
apr_status_t(* apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx)
Definition: apr_buckets.h:282
apr_status_t apr_status_t apr_json_kv_t * apr_json_object_get(apr_json_value_t *obj, const char *key, apr_ssize_t klen) __attribute__((nonnull(1
apr_json_kv_t apr_status_t apr_json_array_add(apr_json_value_t *arr, apr_json_value_t *val) __attribute__((nonnull(1
Definition: apr_json.h:99
apr_json_value_t * apr_json_null_create(apr_pool_t *pool) __attribute__((nonnull(1)))
APR memory allocation.
Definition: apr_json.h:123
Definition: apr_json.h:103
APR Table library.
apr_json_value_t * apr_json_value_create(apr_pool_t *pool) __attribute__((nonnull(1)))
Definition: apr_json.h:101
APR-UTIL Buckets/Bucket Brigades.
apr_int64_t lnumber
Definition: apr_json.h:141
APR Platform Definitions.
apr_json_value_t * k
Definition: apr_json.h:158
apr_json_value_t * apr_json_double_create(apr_pool_t *pool, double dnumber) __attribute__((nonnull(1)))
apr_json_value_t * apr_json_boolean_create(apr_pool_t *pool, int boolean) __attribute__((nonnull(1)))
apr_array_header_t * array
Definition: apr_json.h:184
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
apr_ssize_t len
Definition: apr_json.h:115
apr_json_type_e
Definition: apr_json.h:98
apr_pool_t * p
apr_status_t apr_status_t apr_json_object_set_ex(apr_json_value_t *obj, apr_json_value_t *key, apr_json_value_t *val, apr_pool_t *pool) __attribute__((nonnull(1
apr_json_value_t * apr_json_array_next(const apr_json_value_t *arr, const apr_json_value_t *val) __attribute__((nonnull(1
APR_RING_ENTRY(apr_json_value_t) link
union apr_json_value_t::@19 value
#define APR_DECLARE(x)
Definition: macros.h:6
APR Strings library.
ssize_t apr_ssize_t
Definition: apr.h:398
struct apr_json_kv_t apr_json_kv_t
Definition: apr_json.h:105
#define __attribute__(__x)
Definition: apr.h:63
apr_json_value_t * apr_json_long_create(apr_pool_t *pool, apr_int64_t lnumber) __attribute__((nonnull(1)))
Definition: apr_json.h:154
Definition: apr_json.h:104
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: apr_json.h:180
int apr_status_t
Definition: apr_errno.h:44
apr_json_value_t apr_status_t apr_json_decode(apr_json_value_t **retval, const char *injson, apr_ssize_t size, apr_off_t *offset, int flags, int level, apr_pool_t *pool) __attribute__((nonnull(1
apr_json_array_t * array
Definition: apr_json.h:137
struct apr_json_value_t apr_json_value_t
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1346
Definition: apr_json.h:111
Definition: apr_json.h:102
off_t apr_off_t
Definition: apr.h:399
apr_json_value_t * v
Definition: apr_json.h:160
APR_RING_ENTRY(apr_json_kv_t) link
apr_json_value_t apr_status_t apr_status_t apr_json_value_t * apr_json_overlay(apr_pool_t *p, apr_json_value_t *overlay, apr_json_value_t *base, int flags) __attribute__((nonnull(1)))