JsonBuffer.cpp 499 B

1234567891011121314151617181920212223242526
  1. #include "JsonBuffer.h"
  2. #include <new>
  3. #include "JsonValue.h"
  4. #include "Internals/JsonParser.h"
  5. #include "Internals/JsonNode.h"
  6. JsonValue JsonBuffer::createValue()
  7. {
  8. return JsonValue(createNode());
  9. }
  10. JsonNode* JsonBuffer::createNode()
  11. {
  12. void* node = allocateNode();
  13. if (!node) return 0;
  14. return new (node) JsonNode();
  15. }
  16. JsonArray JsonBuffer::parseArray(char* json)
  17. {
  18. JsonParser parser(this, json);
  19. return JsonArray(parser.parseNode());
  20. }