blob: c7f604bf4b015a4297f72a82511c51e4f877b4a4 [file] [log] [blame]
Michael Clark4504df72007-03-13 08:26:20 +00001/*
Michael Clarkf6a6e482007-03-13 08:26:23 +00002 * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
Michael Clark4504df72007-03-13 08:26:20 +00003 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00004 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
Michael Clark4504df72007-03-13 08:26:20 +00005 * Michael Clark <michael@metaparadigm.com>
6 *
Michael Clarkf6a6e482007-03-13 08:26:23 +00007 * This library is free software; you can redistribute it and/or modify
8 * it under the terms of the MIT license. See COPYING for details.
Michael Clark4504df72007-03-13 08:26:20 +00009 *
10 */
11
Michael Clarkf0d08882007-03-13 08:26:18 +000012#ifndef _json_object_private_h_
13#define _json_object_private_h_
14
Michael Clarkaaec1ef2009-02-25 02:31:32 +000015#ifdef __cplusplus
16extern "C" {
17#endif
18
Michael Clarkf0d08882007-03-13 08:26:18 +000019typedef void (json_object_delete_fn)(struct json_object *o);
20typedef int (json_object_to_json_string_fn)(struct json_object *o,
21 struct printbuf *pb);
22
23struct json_object
24{
25 enum json_type o_type;
26 json_object_delete_fn *_delete;
27 json_object_to_json_string_fn *_to_json_string;
28 int _ref_count;
29 struct printbuf *_pb;
30 union data {
31 boolean c_boolean;
32 double c_double;
Michael Clarkc4dceae2010-10-06 16:39:20 +000033 int64_t c_int64;
Michael Clarkf0d08882007-03-13 08:26:18 +000034 struct lh_table *c_object;
35 struct array_list *c_array;
Jehiah Czebotarac601b52011-01-14 17:23:06 +000036 struct {
37 char *str;
38 int len;
39 } c_string;
Michael Clarkf0d08882007-03-13 08:26:18 +000040 } o;
41};
42
Michael Clark4504df72007-03-13 08:26:20 +000043/* CAW: added for ANSI C iteration correctness */
44struct json_object_iter
45{
46 char *key;
47 struct json_object *val;
48 struct lh_entry *entry;
49};
50
Michael Clarkaaec1ef2009-02-25 02:31:32 +000051#ifdef __cplusplus
52}
53#endif
54
Michael Clarkf0d08882007-03-13 08:26:18 +000055#endif