MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / load

Function load

src/benchmarks/json_render.cpp:77–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77json::Object load(const char *filename)
78{
79 // load file to std string
80 std::ifstream file(filename);
81 std::stringstream buffer;
82 buffer << file.rdbuf();
83 std::string json = buffer.str();
84
85 // load rapidjson document
86 rapidjson::Document document;
87 document.Parse(json.c_str());
88 if (document.HasParseError())
89 {
90 throw std::runtime_error("Failed to parse JSON");
91 }
92
93 json::Value result;
94 convert(document, result);
95 return std::get<json::Object>(result);
96}
97
98} // namespace
99

Callers 1

mainFunction · 0.85

Calls 1

convertFunction · 0.85

Tested by

no test coverage detected