From 5aaacc6a0bea69530094645c875f107feb8ab5a6 Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Thu, 24 Jan 2019 22:45:26 -0500 Subject: [PATCH] undo changes testing rapidjson schema validation --- .gitmodules | 3 --- Makefile | 2 +- data/hashmap_scene.json | 3 +-- data/scene_schema.json | 1 - ext/rapidjson | 1 - src/scene_loader.cpp | 8 ++------ 6 files changed, 4 insertions(+), 14 deletions(-) delete mode 160000 ext/rapidjson diff --git a/.gitmodules b/.gitmodules index 234adc5..d26cc89 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "ext/stb_libs"] path = ext/stb_libs url = https://github.com/nothings/stb.git -[submodule "ext/rapidjson"] - path = ext/rapidjson - url = https://github.com/Tencent/rapidjson.git diff --git a/Makefile b/Makefile index 90510d5..eef3363 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CXX = g++ -CXXFLAGS = -std=c++11 -g -ggdb3 -Wall -I/usr/include/SDL2 -Iext/aixlog/include -Iext/stb_libs -Iext/rapidjson/include +CXXFLAGS = -std=c++11 -g -ggdb3 -Wall -I/usr/include/SDL2 -Iext/aixlog/include -Iext/stb_libs SRC_DIR = src OBJ_DIR = build diff --git a/data/hashmap_scene.json b/data/hashmap_scene.json index c622864..16cc330 100644 --- a/data/hashmap_scene.json +++ b/data/hashmap_scene.json @@ -38,8 +38,7 @@ "model_file" : "block2.dae", "position" : {"x":140,"y":-100,"z":0}, "rotation" : {"x":0,"y":0,"z":0,"w":0}, - "scale" : {"x":10,"y":10,"z":10}, - "potato": 2 + "scale" : {"x":10,"y":10,"z":10} }, { "name" : "ground", diff --git a/data/scene_schema.json b/data/scene_schema.json index 577ed37..554697b 100644 --- a/data/scene_schema.json +++ b/data/scene_schema.json @@ -82,7 +82,6 @@ "scale": { "$ref": "#/definitions/vector3" }, "grid_pos": { "$ref": "#/definitions/vector3" } }, - "additionalItems": false, "required" : ["name", "model_file", "position", "rotation", "scale", "grid_pos"] }, diff --git a/ext/rapidjson b/ext/rapidjson deleted file mode 160000 index bfdcf49..0000000 --- a/ext/rapidjson +++ /dev/null @@ -1 +0,0 @@ -Subproject commit bfdcf4911047688fec49014d575433e2e5eb05be diff --git a/src/scene_loader.cpp b/src/scene_loader.cpp index 7264c74..74d4620 100644 --- a/src/scene_loader.cpp +++ b/src/scene_loader.cpp @@ -2,7 +2,6 @@ #include #include -#include #include #include #include @@ -325,14 +324,11 @@ loadTextFile(char*& output, const char* data_dir, const char* file_name) bool parseFile(rapidjson::Document* doc, const char* file_contents, const char* file_name) { - rapidjson::StringStream ss(file_contents); - rapidjson::CursorStreamWrapper csw(ss); - rapidjson::ParseResult pr = doc->ParseStream(csw); + rapidjson::ParseResult pr = doc->Parse(file_contents); if (!pr || !doc->IsObject()) { LOG(ERROR) << "Error parrsing json file: " << file_name; - LOG(ERROR) << " at line " << csw.GetLine() << ", col " << csw.GetColumn() << "\n"; - LOG(ERROR) << "Error desscription: " << rapidjson::GetParseError_En(pr.Code()) + LOG(ERROR) << ". Error desscription: " << rapidjson::GetParseError_En(pr.Code()) << " (" << pr.Offset() << ")\n"; return false; }