Refactored handling of relative paths (#213)

This commit is contained in:
Bartek Kryza
2023-12-08 08:17:00 +01:00
parent f1d3695ccc
commit d7195d5a5d
130 changed files with 317 additions and 255 deletions

View File

@@ -482,10 +482,6 @@ struct inheritable_diagram_options {
// This is the absolute filesystem path to the directory containing
// the current .clang-uml config file - it is set automatically
option<std::filesystem::path> base_directory{"__parent_path"};
// This is the relative path with respect to the `base_directory`,
// against which all matches are made, if not provided it defaults to
// the `base_directory`
option<std::filesystem::path> relative_to{"relative_to"};
option<bool> generate_system_headers{"generate_system_headers", false};
option<relationship_hints_t> relationship_hints{"relationship_hints"};
option<type_aliases_t> type_aliases{"type_aliases"};
@@ -502,6 +498,30 @@ struct inheritable_diagram_options {
"message_comment_width", clanguml::util::kDefaultMessageCommentWidth};
option<bool> debug_mode{"debug_mode", false};
option<bool> generate_metadata{"generate_metadata", true};
/**
* @brief Get reference to `relative_to` diagram config option
*
* This method is only to allow access to `relative_to` for loading
* and adjusting configuration file and for making test cases work.
*
* Instead use @see config::diagram::root_directory() method.
*
* @return Reference to `relative_to` config option.
*/
option<std::filesystem::path> &get_relative_to() { return relative_to; }
protected:
// This is the relative path with respect to the `base_directory`,
// against which all matches are made, if not provided it defaults to
// the `base_directory`
//
// This option should not be accessed directly in code - instead use
// @see config::diagram::root_directory()
option<std::filesystem::path> relative_to{"relative_to"};
friend YAML::Emitter &operator<<(
YAML::Emitter &out, const inheritable_diagram_options &c);
};
/**