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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. typedef void(json_object_private_delete_fn)(struct json_object *o);
  23. /* json object int type, support extension*/
  24. typedef enum json_object_int_type
  25. {
  26. json_object_int_type_int64,
  27. json_object_int_type_uint64
  28. } json_object_int_type;
  29. struct json_object
  30. {
  31. enum json_type o_type;
  32. uint32_t _ref_count;
  33. json_object_private_delete_fn *_delete;
  34. json_object_to_json_string_fn *_to_json_string;
  35. struct printbuf *_pb;
  36. union data
  37. {
  38. json_bool c_boolean;
  39. double c_double;
  40. struct
  41. {
  42. union
  43. {
  44. int64_t c_int64;
  45. uint64_t c_uint64;
  46. } cint;
  47. enum json_object_int_type cint_type;
  48. } c_int;
  49. struct lh_table *c_object;
  50. struct array_list *c_array;
  51. struct
  52. {
  53. union
  54. {
  55. /* optimize: if we have small strings, we can store them
  56. * directly. This saves considerable CPU cycles AND memory.
  57. */
  58. char *ptr;
  59. char data[LEN_DIRECT_STRING_DATA];
  60. } str;
  61. int len;
  62. } c_string;
  63. } o;
  64. json_object_delete_fn *_user_delete;
  65. void *_userdata;
  66. };
  67. void _json_c_set_last_err(const char *err_fmt, ...);
  68. extern const char *json_number_chars;
  69. extern const char *json_hex_chars;
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. #endif