MCPcopy Create free account
hub / github.com/Samsung/UTopia / fromJson

Method fromJson

lib/sourceloader/BuildDB.cpp:17–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 ProjectDir(std::move(ProjectDir)) {}
16
17std::unique_ptr<BuildDB> BuildDB::fromJson(const std::string &Path) {
18 if (!fs::is_regular_file(Path))
19 return nullptr;
20
21 try {
22 auto JsonRoot = util::parseJsonFileToJsonValue(Path.c_str());
23 std::vector<std::string> ASTFiles;
24 for (auto AST : JsonRoot["ast"]) {
25 ASTFiles.emplace_back(AST.asString());
26 }
27 return std::make_unique<BuildDB>(JsonRoot["bc"].asString(), ASTFiles,
28 JsonRoot["project_dir"].asString());
29 } catch (...) {
30 return nullptr;
31 }
32}
33
34std::string BuildDB::getBCPath() const { return BCPath; }
35std::vector<std::string> BuildDB::getASTPaths() const { return ASTPaths; }

Callers

nothing calls this directly

Calls 2

parseJsonFileToJsonValueFunction · 0.85
asStringMethod · 0.80

Tested by

no test coverage detected