JsonObject.h 635 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #pragma once
  2. #include "Printable.h"
  3. class JsonValue;
  4. struct JsonNode;
  5. class JsonObject : public Printable
  6. {
  7. friend JsonValue;
  8. public:
  9. JsonObject()
  10. : _node(0)
  11. {
  12. }
  13. JsonObject(JsonNode* node)
  14. : _node(node)
  15. {
  16. }
  17. size_t size();
  18. JsonValue operator[](const char* key);
  19. void remove(const char* key);
  20. bool operator==(const JsonObject& other) const;
  21. size_t printTo(char* buffer, size_t bufferSize) const;
  22. virtual size_t printTo(Print& print) const;
  23. private:
  24. JsonNode* _node;
  25. JsonNode* getOrCreateNodeAt(char const* key);
  26. };