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.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #ifndef _json_object_private_h_
  12. #define _json_object_private_h_
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #define LEN_DIRECT_STRING_DATA 32 /**< how many bytes are directly stored in json_object for strings? */
  17. typedef void (json_object_private_delete_fn)(struct json_object *o);
  18. struct json_object
  19. {
  20. enum json_type o_type;
  21. json_object_private_delete_fn *_delete;
  22. json_object_to_json_string_fn *_to_json_string;
  23. int _ref_count;
  24. struct printbuf *_pb;
  25. union data {
  26. json_bool c_boolean;
  27. double c_double;
  28. int64_t c_int64;
  29. struct lh_table *c_object;
  30. struct array_list *c_array;
  31. struct {
  32. union {
  33. /* optimize: if we have small strings, we can store them
  34. * directly. This saves considerable CPU cycles AND memory.
  35. */
  36. char *ptr;
  37. char data[LEN_DIRECT_STRING_DATA];
  38. } str;
  39. int len;
  40. } c_string;
  41. } o;
  42. json_object_delete_fn *_user_delete;
  43. void *_userdata;
  44. };
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif