Added is_system header file property to JSON include diagram generator

This commit is contained in:
Bartek Kryza
2024-01-09 22:13:39 +01:00
parent 043c13affb
commit 66dcf1ed5d
5 changed files with 37 additions and 3 deletions

View File

@@ -67,10 +67,10 @@ TEST_CASE("t40001", "[test-case][include]")
REQUIRE(IsFolder(j, "include/lib1"));
REQUIRE(IsFolder(j, "src"));
REQUIRE(IsFile(j, "include/lib1/lib1.h"));
REQUIRE(IsFile(j, "include/t40001_include1.h"));
REQUIRE(IsHeader(j, "include/lib1/lib1.h"));
REQUIRE(IsHeader(j, "include/t40001_include1.h"));
REQUIRE(IsFile(j, "src/t40001.cc"));
REQUIRE(IsFile(j, "yaml-cpp/yaml.h"));
REQUIRE(IsSystemHeader(j, "yaml-cpp/yaml.h"));
REQUIRE(IsFile(j, "string"));

View File

@@ -1391,6 +1391,20 @@ bool IsFile(const nlohmann::json &j, const std::string &name)
return e && e->at("type") == "file";
}
bool IsSystemHeader(const nlohmann::json &j, const std::string &name)
{
auto e = get_element(j, name);
return e && e->at("type") == "file" && e->at("file_kind") == "header" &&
e->at("is_system");
}
bool IsHeader(const nlohmann::json &j, const std::string &name)
{
auto e = get_element(j, name);
return e && e->at("type") == "file" && e->at("file_kind") == "header" &&
!e->at("is_system");
}
bool IsDeprecated(const nlohmann::json &j, const std::string &name)
{
auto e = get_element(j, expand_name(j, name));