2007-03-13 08:26:20 +00:00
|
|
|
/*
|
2007-03-13 08:26:23 +00:00
|
|
|
* $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $
|
2007-03-13 08:26:20 +00:00
|
|
|
*
|
2007-03-13 08:26:23 +00:00
|
|
|
* Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd.
|
2007-03-13 08:26:20 +00:00
|
|
|
* Michael Clark <michael@metaparadigm.com>
|
|
|
|
|
*
|
2007-03-13 08:26:23 +00:00
|
|
|
* This library is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the MIT license. See COPYING for details.
|
2007-03-13 08:26:20 +00:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2017-12-06 00:20:59 -05:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
|
|
|
|
*/
|
2007-03-13 08:26:18 +00:00
|
|
|
#ifndef _json_object_private_h_
|
|
|
|
|
#define _json_object_private_h_
|
|
|
|
|
|
2009-02-25 02:31:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-04-06 13:55:27 +00:00
|
|
|
struct json_object;
|
|
|
|
|
#include "json_inttypes.h"
|
|
|
|
|
#include "json_types.h"
|
|
|
|
|
|
2020-06-07 03:30:39 +00:00
|
|
|
typedef void (json_object_private_delete_fn)(struct json_object *o);
|
2007-03-13 08:26:18 +00:00
|
|
|
|
2020-02-27 15:01:06 +08:00
|
|
|
/* json object int type, support extension*/
|
2020-03-28 10:25:00 +08:00
|
|
|
typedef enum json_object_int_type
|
|
|
|
|
{
|
|
|
|
|
json_object_int_type_int64,
|
|
|
|
|
json_object_int_type_uint64
|
|
|
|
|
} json_object_int_type;
|
2020-02-27 15:01:06 +08:00
|
|
|
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object
|
2020-05-25 03:14:06 +00:00
|
|
|
{
|
|
|
|
|
enum json_type o_type;
|
|
|
|
|
uint32_t _ref_count;
|
|
|
|
|
json_object_private_delete_fn *_delete;
|
|
|
|
|
json_object_to_json_string_fn *_to_json_string;
|
|
|
|
|
struct printbuf *_pb;
|
|
|
|
|
json_object_delete_fn *_user_delete;
|
|
|
|
|
void *_userdata;
|
2020-06-07 02:42:58 +00:00
|
|
|
char data[1]; // Actually the rest of a struct json_object_${o_type}
|
2020-05-25 03:14:06 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct json_object_object
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-05-25 03:14:06 +00:00
|
|
|
struct lh_table *c_object;
|
|
|
|
|
};
|
|
|
|
|
struct json_object_array
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-05-25 03:14:06 +00:00
|
|
|
struct array_list *c_array;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct json_object_boolean
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-05-25 03:14:06 +00:00
|
|
|
json_bool c_boolean;
|
|
|
|
|
};
|
|
|
|
|
struct json_object_double
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-05-26 02:31:35 +00:00
|
|
|
double c_double;
|
2020-05-25 03:14:06 +00:00
|
|
|
};
|
|
|
|
|
struct json_object_int
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-05-25 03:14:06 +00:00
|
|
|
enum json_object_int_type cint_type;
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
int64_t c_int64;
|
|
|
|
|
uint64_t c_uint64;
|
|
|
|
|
} cint;
|
|
|
|
|
};
|
|
|
|
|
struct json_object_string
|
|
|
|
|
{
|
2020-06-07 03:30:39 +00:00
|
|
|
struct json_object base;
|
2020-06-07 02:42:58 +00:00
|
|
|
ssize_t len; // Signed b/c negative lengths indicate data is a pointer
|
|
|
|
|
// Consider adding an "alloc" field here, if json_object_set_string calls
|
|
|
|
|
// to expand the length of a string are common operations to perform.
|
|
|
|
|
union
|
|
|
|
|
{
|
|
|
|
|
char idata[1]; // Immediate data. Actually longer
|
|
|
|
|
char *pdata; // Only when len < 0
|
|
|
|
|
} c_string;
|
2020-05-25 03:14:06 +00:00
|
|
|
};
|
|
|
|
|
|
2017-11-29 09:25:11 -05:00
|
|
|
void _json_c_set_last_err(const char *err_fmt, ...);
|
2017-06-04 18:25:51 +00:00
|
|
|
|
2017-12-05 09:20:59 -05:00
|
|
|
extern const char *json_number_chars;
|
|
|
|
|
extern const char *json_hex_chars;
|
|
|
|
|
|
2009-02-25 02:31:32 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-03-13 08:26:18 +00:00
|
|
|
#endif
|