1 /* 2 * $Id: json_object_private.h,v 1.4 2006/01/26 02:16:28 mclark Exp $ 3 * 4 * Copyright (c) 2004, 2005 Metaparadigm Pte. Ltd. 5 * Michael Clark <michael@metaparadigm.com> 6 * 7 * 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. 9 * 10 */ 11 12 /** 13 * @file 14 * @brief Do not use, json-c internal, may be changed or removed at any time. 15 */ 16 #ifndef _json_object_private_h_ 17 #define _json_object_private_h_ 18 19 #ifdef __cplusplus 20 extern "C" { 21 #endif 22 23 struct json_object; 24 #include "json_inttypes.h" 25 #include "json_types.h" 26 27 #ifdef HAVE_UNISTD_H 28 #include <unistd.h> 29 #endif /* HAVE_UNISTD_H */ 30 31 #ifdef _MSC_VER 32 #include <BaseTsd.h> 33 typedef SSIZE_T ssize_t; 34 #endif 35 36 /* json object int type, support extension*/ 37 typedef enum json_object_int_type 38 { 39 json_object_int_type_int64, 40 json_object_int_type_uint64 41 } json_object_int_type; 42 43 struct json_object 44 { 45 enum json_type o_type; 46 uint32_t _ref_count; 47 json_object_to_json_string_fn *_to_json_string; 48 struct printbuf *_pb; 49 json_object_delete_fn *_user_delete; 50 void *_userdata; 51 // Actually longer, always malloc'd as some more-specific type. 52 // The rest of a struct json_object_${o_type} follows 53 }; 54 55 struct json_object_object 56 { 57 struct json_object base; 58 struct lh_table *c_object; 59 }; 60 struct json_object_array 61 { 62 struct json_object base; 63 struct array_list *c_array; 64 }; 65 66 struct json_object_boolean 67 { 68 struct json_object base; 69 json_bool c_boolean; 70 }; 71 struct json_object_double 72 { 73 struct json_object base; 74 double c_double; 75 }; 76 struct json_object_int 77 { 78 struct json_object base; 79 enum json_object_int_type cint_type; 80 union 81 { 82 int64_t c_int64; 83 uint64_t c_uint64; 84 } cint; 85 }; 86 struct json_object_string 87 { 88 struct json_object base; 89 ssize_t len; // Signed b/c negative lengths indicate data is a pointer 90 // Consider adding an "alloc" field here, if json_object_set_string calls 91 // to expand the length of a string are common operations to perform. 92 union 93 { 94 char idata[1]; // Immediate data. Actually longer 95 char *pdata; // Only when len < 0 96 } c_string; 97 }; 98 99 void _json_c_set_last_err(const char *err_fmt, ...); 100 101 extern const char *json_hex_chars; 102 103 #ifdef __cplusplus 104 } 105 #endif 106 107 #endif 108
This page was automatically generated by LXR 0.3.1. • OpenWrt