Added is_system header file property to JSON include diagram generator
This commit is contained in:
@@ -117,6 +117,20 @@ public:
|
||||
*/
|
||||
source_file_t type() const { return type_; }
|
||||
|
||||
/**
|
||||
* Set whether the file is a system header
|
||||
*
|
||||
* @param is_system Whether the file is a system header
|
||||
*/
|
||||
void set_system_header(bool is_system) { is_system_header_ = is_system; }
|
||||
|
||||
/**
|
||||
* Is the file a system header?
|
||||
*
|
||||
* @return True, if the source file is a system header
|
||||
*/
|
||||
bool is_system_header() const { return is_system_header_; }
|
||||
|
||||
/**
|
||||
* Get the source file's parent path.
|
||||
*
|
||||
@@ -185,6 +199,7 @@ private:
|
||||
filesystem_path path_{path_type::kFilesystem};
|
||||
source_file_t type_{source_file_t::kDirectory};
|
||||
bool is_absolute_{false};
|
||||
bool is_system_header_{false};
|
||||
};
|
||||
} // namespace clanguml::common::model
|
||||
|
||||
|
||||
@@ -78,6 +78,9 @@ void generator::generate(const source_file &f, nlohmann::json &parent) const
|
||||
|
||||
j["type"] = "file";
|
||||
j["file_kind"] = to_string(f.type());
|
||||
if (f.type() == common::model::source_file_t::kHeader) {
|
||||
j["is_system"] = f.is_system_header();
|
||||
}
|
||||
|
||||
parent["elements"].push_back(std::move(j));
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ void translation_unit_visitor::include_visitor::process_internal_header(
|
||||
include_file.set_file(
|
||||
std::filesystem::absolute(include_path).lexically_normal().string());
|
||||
include_file.set_line(0);
|
||||
include_file.set_system_header(is_system);
|
||||
|
||||
// Add relationship from the currently parsed source file to this
|
||||
// include file
|
||||
@@ -174,6 +175,7 @@ void translation_unit_visitor::include_visitor::process_external_system_header(
|
||||
f->set_name(include_path.string());
|
||||
f->set_type(common::model::source_file_t::kHeader);
|
||||
f->set_id(common::to_id(include_path));
|
||||
f->set_system_header(true);
|
||||
|
||||
const auto f_id = f->id();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user