You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

json_object_private.h 1.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. * @file
  13. * @brief Do not use, json-c internal, may be changed or removed at any time.
  14. */
  15. #ifndef _json_object_private_h_
  16. #define _json_object_private_h_
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /**< how many bytes are directly stored in json_object for strings? */
  21. #define LEN_DIRECT_STRING_DATA 32
  22. struct json_object;
  23. #include "json_inttypes.h"
  24. #include "json_types.h"
  25. typedef void(json_object_private_delete_fn)(struct json_object *o);
  26. /* json object int type, support extension*/
  27. typedef enum json_object_int_type
  28. {
  29. json_object_int_type_int64,
  30. json_object_int_type_uint64
  31. } json_object_int_type;
  32. struct json_object
  33. {
  34. enum json_type o_type;
  35. uint32_t _ref_count;
  36. json_object_private_delete_fn *_delete;
  37. json_object_to_json_string_fn *_to_json_string;
  38. struct printbuf *_pb;
  39. union data
  40. {
  41. json_bool c_boolean;
  42. double c_double;
  43. struct
  44. {
  45. union
  46. {
  47. int64_t c_int64;
  48. uint64_t c_uint64;
  49. } cint;
  50. enum json_object_int_type cint_type;
  51. } c_int;
  52. struct lh_table *c_object;
  53. struct array_list *c_array;
  54. struct
  55. {
  56. union
  57. {
  58. /* optimize: if we have small strings, we can store them
  59. * directly. This saves considerable CPU cycles AND memory.
  60. */
  61. char *ptr;
  62. char data[LEN_DIRECT_STRING_DATA];
  63. } str;
  64. int len;
  65. } c_string;
  66. } o;
  67. json_object_delete_fn *_user_delete;
  68. void *_userdata;
  69. };
  70. void _json_c_set_last_err(const char *err_fmt, ...);
  71. extern const char *json_number_chars;
  72. extern const char *json_hex_chars;
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. #endif