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_types.h 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2020 Eric Hawicz
  3. *
  4. * This library is free software; you can redistribute it and/or modify
  5. * it under the terms of the MIT license. See COPYING for details.
  6. */
  7. #ifndef _json_types_h_
  8. #define _json_types_h_
  9. /**
  10. * @file
  11. * @brief Basic types used in a few places in json-c, but you should include "json_object.h" instead.
  12. */
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. #ifndef JSON_EXPORT
  17. #if defined(_MSC_VER) && defined(JSON_C_DLL)
  18. #define JSON_EXPORT __declspec(dllexport)
  19. #else
  20. #define JSON_EXPORT extern
  21. #endif
  22. #endif
  23. struct printbuf;
  24. /**
  25. * A structure to use with json_object_object_foreachC() loops.
  26. * Contains key, val and entry members.
  27. */
  28. struct json_object_iter
  29. {
  30. char *key;
  31. struct json_object *val;
  32. struct lh_entry *entry;
  33. };
  34. typedef struct json_object_iter json_object_iter;
  35. typedef int json_bool;
  36. /**
  37. * @brief The core type for all type of JSON objects handled by json-c
  38. */
  39. typedef struct json_object json_object;
  40. /**
  41. * Type of custom user delete functions. See json_object_set_serializer.
  42. */
  43. typedef void(json_object_delete_fn)(struct json_object *jso, void *userdata);
  44. /**
  45. * Type of a custom serialization function. See json_object_set_serializer.
  46. */
  47. typedef int(json_object_to_json_string_fn)(struct json_object *jso, struct printbuf *pb, int level,
  48. int flags);
  49. /* supported object types */
  50. typedef enum json_type
  51. {
  52. /* If you change this, be sure to update json_type_to_name() too */
  53. json_type_null,
  54. json_type_boolean,
  55. json_type_double,
  56. json_type_int,
  57. json_type_object,
  58. json_type_array,
  59. json_type_string
  60. } json_type;
  61. #ifdef __cplusplus
  62. }
  63. #endif
  64. #endif