Enabled type_aliases config option for sequence diagrams (#224)
This commit is contained in:
@@ -217,6 +217,7 @@ void inheritable_diagram_options::inherit(
|
||||
parent.generate_condition_statements);
|
||||
debug_mode.override(parent.debug_mode);
|
||||
generate_metadata.override(parent.generate_metadata);
|
||||
type_aliases.override(parent.type_aliases);
|
||||
}
|
||||
|
||||
std::string inheritable_diagram_options::simplify_template_type(
|
||||
|
||||
@@ -538,7 +538,8 @@ struct inheritable_diagram_options {
|
||||
option<std::filesystem::path> base_directory{"__parent_path"};
|
||||
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"};
|
||||
option<type_aliases_t> type_aliases{
|
||||
"type_aliases", option_inherit_mode::kAppend};
|
||||
option<comment_parser_t> comment_parser{
|
||||
"comment_parser", comment_parser_t::plain};
|
||||
option<bool> combine_free_functions_into_file_participants{
|
||||
|
||||
@@ -25,6 +25,18 @@ namespace config {
|
||||
|
||||
template <typename T> void append_value(T &l, const T &r) { l = r; }
|
||||
|
||||
template <typename T>
|
||||
void append_value(std::vector<T> &l, const std::vector<T> &r)
|
||||
{
|
||||
l.insert(std::end(l), r.begin(), r.end());
|
||||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
void append_value(std::map<K, V> &l, const std::map<K, V> &r)
|
||||
{
|
||||
l.insert(r.begin(), r.end());
|
||||
}
|
||||
|
||||
/**
|
||||
* Possible option inheritance methods from top level to diagram level.
|
||||
*/
|
||||
@@ -102,9 +114,7 @@ template <typename T> struct option {
|
||||
has_value = true;
|
||||
}
|
||||
else if (!is_declared && o.is_declared) {
|
||||
value = o.value;
|
||||
is_declared = true;
|
||||
has_value = true;
|
||||
set(o.value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ types:
|
||||
after: !optional [string]
|
||||
cmd: !optional string
|
||||
relative_to: !optional string
|
||||
type_aliases: !optional map_t<string;string>
|
||||
using_namespace: !optional [string, [string]]
|
||||
generate_metadata: !optional bool
|
||||
title: !optional string
|
||||
@@ -342,6 +343,7 @@ root:
|
||||
package_type: !optional package_type_t
|
||||
generate_template_argument_dependencies: !optional bool
|
||||
skip_redundant_dependencies: !optional bool
|
||||
type_aliases: !optional map_t<string;string>
|
||||
)";
|
||||
|
||||
} // namespace clanguml::config
|
||||
@@ -663,6 +663,7 @@ template <> struct convert<sequence_diagram> {
|
||||
get_option(node, rhs.generate_method_arguments);
|
||||
get_option(node, rhs.generate_message_comments);
|
||||
get_option(node, rhs.message_comment_width);
|
||||
get_option(node, rhs.type_aliases);
|
||||
|
||||
get_option(node, rhs.get_relative_to());
|
||||
|
||||
@@ -836,6 +837,7 @@ template <> struct convert<config> {
|
||||
get_option(node, rhs.generate_condition_statements);
|
||||
get_option(node, rhs.generate_message_comments);
|
||||
get_option(node, rhs.message_comment_width);
|
||||
get_option(node, rhs.type_aliases);
|
||||
|
||||
rhs.base_directory.set(node["__parent_path"].as<std::string>());
|
||||
get_option(node, rhs.get_relative_to());
|
||||
|
||||
@@ -114,8 +114,8 @@ bool translation_unit_visitor::VisitCXXRecordDecl(
|
||||
forward_declarations_.erase(class_id);
|
||||
|
||||
if (diagram().should_include(class_model)) {
|
||||
LOG_DBG("Adding class {} with id {}", class_model.full_name(false),
|
||||
class_model.id());
|
||||
LOG_DBG("Adding class participant {} with id {}",
|
||||
class_model.full_name(false), class_model.id());
|
||||
|
||||
assert(class_model.id() == class_id);
|
||||
|
||||
@@ -166,7 +166,8 @@ bool translation_unit_visitor::VisitClassTemplateDecl(
|
||||
forward_declarations_.erase(id);
|
||||
|
||||
if (diagram().should_include(*class_model_ptr)) {
|
||||
LOG_DBG("Adding class template {} with id {}", class_full_name, id);
|
||||
LOG_DBG("Adding class template participant {} with id {}",
|
||||
class_full_name, id);
|
||||
|
||||
context().set_caller_id(id);
|
||||
context().update(declaration);
|
||||
@@ -212,7 +213,8 @@ bool translation_unit_visitor::VisitClassTemplateSpecializationDecl(
|
||||
forward_declarations_.erase(id);
|
||||
|
||||
if (diagram().should_include(*template_specialization_ptr)) {
|
||||
LOG_DBG("Adding class template specialization {} with id {}",
|
||||
LOG_DBG(
|
||||
"Adding class template specialization participant {} with id {}",
|
||||
class_full_name, id);
|
||||
|
||||
context().set_caller_id(id);
|
||||
@@ -2047,12 +2049,12 @@ void translation_unit_visitor::process_template_specialization_argument(
|
||||
argument.set_type(type_name);
|
||||
}
|
||||
|
||||
LOG_TRACE("Adding template instantiation argument {}",
|
||||
argument.to_string(config().using_namespace(), false));
|
||||
|
||||
simplify_system_template(
|
||||
argument, argument.to_string(config().using_namespace(), false));
|
||||
|
||||
LOG_TRACE("Adding template instantiation argument {}",
|
||||
argument.to_string(config().using_namespace(), false));
|
||||
|
||||
template_instantiation.add_template(std::move(argument));
|
||||
}
|
||||
else if (argument_kind == clang::TemplateArgument::Integral) {
|
||||
|
||||
@@ -312,7 +312,7 @@ private:
|
||||
bool should_include(const clang::ClassTemplateDecl *decl) const;
|
||||
|
||||
/**
|
||||
* @todo Refactor this group of methods to @ref template_builder
|
||||
* @todo #227 Refactor this group of methods to @ref template_builder
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user