File: json_pointer_private.h

package info (click to toggle)
json-c 0.18%2Bds-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,412 kB
  • sloc: ansic: 9,153; sh: 546; cpp: 18; makefile: 14
file content (43 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright (c) 2023 Eric Hawicz
 *
 * This library is free software; you can redistribute it and/or modify
 * it under the terms of the MIT license. See COPYING for details.
 */

/**
 * @file
 * @brief Do not use, json-c internal, may be changed or removed at any time.
 */
#ifndef _json_pointer_private_h_
#define _json_pointer_private_h_

#ifdef __cplusplus
extern "C" {
#endif

struct json_pointer_get_result {
	struct json_object *parent;
	struct json_object *obj;
	// The key of the found object; only valid when parent is json_type_object
	// Caution: re-uses tail end of the `path` argument to json_pointer_get_internal
	const char *key_in_parent;
	// the index of the found object; only valid when parent is json_type_array
	uint32_t index_in_parent;
};

int json_pointer_get_internal(struct json_object *obj, const char *path,
                              struct json_pointer_get_result *res);

typedef int(*json_pointer_array_set_cb)(json_object *parent, size_t idx,
                                        json_object *value, void *priv);

int json_pointer_set_with_array_cb(struct json_object **obj, const char *path,
                                   struct json_object *value,
                                   json_pointer_array_set_cb array_set_cb, void *priv);

#ifdef __cplusplus
}
#endif

#endif