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

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