JsonValue.cpp 534 B

12345678910111213141516171819202122232425262728
  1. #include "JsonObject.h"
  2. #include "JsonNode.h"
  3. #include "JsonValue.h"
  4. //void JsonValue::operator=(JsonObject const& object)
  5. //{
  6. // _node = object._node;
  7. //}
  8. void JsonValue::operator=(int value)
  9. {
  10. if (!_node) return;
  11. _node->type = JSON_INTEGER;
  12. _node->content.asInteger = value;
  13. }
  14. //JsonValue::operator JsonObject()
  15. //{
  16. // return JsonObject(_buffer, _node);
  17. //}
  18. JsonValue::operator int()
  19. {
  20. if (!_node || _node->type != JSON_INTEGER) return 0;
  21. return _node->content.asInteger;
  22. }