JsonNode.h 836 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #pragma once
  2. class JsonBuffer;
  3. enum JsonNodeType
  4. {
  5. JSON_UNDEFINED,
  6. JSON_PROXY,
  7. JSON_NULL,
  8. JSON_ARRAY,
  9. JSON_OBJECT,
  10. JSON_KEY,
  11. JSON_BOOLEAN,
  12. JSON_STRING,
  13. JSON_INTEGER,
  14. JSON_DOUBLE_0_DECIMALS,
  15. JSON_DOUBLE_1_DECIMAL,
  16. JSON_DOUBLE_2_DECIMALS,
  17. // etc.
  18. };
  19. struct JsonNode
  20. {
  21. JsonNode* next;
  22. JsonNodeType type;
  23. union
  24. {
  25. bool asBoolean;
  26. double asDouble;
  27. int asInteger;
  28. const char* asString;
  29. struct
  30. {
  31. const char* key;
  32. JsonNode* value;
  33. } asKey;
  34. struct
  35. {
  36. JsonNode* child;
  37. JsonBuffer* buffer;
  38. } asObject;
  39. struct
  40. {
  41. JsonNode* target;
  42. } asProxy;
  43. } content;
  44. };