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 2.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. struct json_object;
  21. #include "json_inttypes.h"
  22. #include "json_types.h"
  23. #ifdef _MSC_VER
  24. #include <BaseTsd.h>
  25. typedef SSIZE_T ssize_t;
  26. #endif
  27. typedef void (json_object_private_delete_fn)(struct json_object *o);
  28. /* json object int type, support extension*/
  29. typedef enum json_object_int_type
  30. {
  31. json_object_int_type_int64,
  32. json_object_int_type_uint64
  33. } json_object_int_type;
  34. struct json_object
  35. {
  36. enum json_type o_type;
  37. uint32_t _ref_count;
  38. json_object_private_delete_fn *_delete;
  39. json_object_to_json_string_fn *_to_json_string;
  40. struct printbuf *_pb;
  41. json_object_delete_fn *_user_delete;
  42. void *_userdata;
  43. char data[1]; // Actually the rest of a struct json_object_${o_type}
  44. };
  45. struct json_object_object
  46. {
  47. struct json_object base;
  48. struct lh_table *c_object;
  49. };
  50. struct json_object_array
  51. {
  52. struct json_object base;
  53. struct array_list *c_array;
  54. };
  55. struct json_object_boolean
  56. {
  57. struct json_object base;
  58. json_bool c_boolean;
  59. };
  60. struct json_object_double
  61. {
  62. struct json_object base;
  63. double c_double;
  64. };
  65. struct json_object_int
  66. {
  67. struct json_object base;
  68. enum json_object_int_type cint_type;
  69. union
  70. {
  71. int64_t c_int64;
  72. uint64_t c_uint64;
  73. } cint;
  74. };
  75. struct json_object_string
  76. {
  77. struct json_object base;
  78. ssize_t len; // Signed b/c negative lengths indicate data is a pointer
  79. // Consider adding an "alloc" field here, if json_object_set_string calls
  80. // to expand the length of a string are common operations to perform.
  81. union
  82. {
  83. char idata[1]; // Immediate data. Actually longer
  84. char *pdata; // Only when len < 0
  85. } c_string;
  86. };
  87. void _json_c_set_last_err(const char *err_fmt, ...);
  88. extern const char *json_number_chars;
  89. extern const char *json_hex_chars;
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif