Adding template specialization handling
This commit is contained in:
@@ -97,6 +97,17 @@ void tu_visitor::operator()(const cppast::cpp_entity &file)
|
||||
ctx.namespace_.pop_back();
|
||||
}
|
||||
}
|
||||
else if (e.kind() ==
|
||||
cppast::cpp_entity_kind::class_template_specialization_t) {
|
||||
LOG_DBG("========== Visiting '{}' - {}",
|
||||
cx::util::full_name(ctx.namespace_, e),
|
||||
cppast::to_string(e.kind()));
|
||||
|
||||
auto &tspec = static_cast<
|
||||
const cppast::cpp_class_template_specialization &>(e);
|
||||
|
||||
process_class_declaration(tspec.class_(), tspec);
|
||||
}
|
||||
else if (e.kind() == cppast::cpp_entity_kind::class_t) {
|
||||
LOG_DBG("========== Visiting '{}' - {}",
|
||||
cx::util::full_name(ctx.namespace_, e),
|
||||
@@ -112,6 +123,7 @@ void tu_visitor::operator()(const cppast::cpp_entity &file)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx.config.should_include(
|
||||
cx::util::fully_prefixed(ctx.namespace_, cls)))
|
||||
process_class_declaration(cls);
|
||||
@@ -204,7 +216,8 @@ void tu_visitor::process_enum_declaration(const cppast::cpp_enum &enm)
|
||||
ctx.d.add_enum(std::move(e));
|
||||
}
|
||||
|
||||
void tu_visitor::process_class_declaration(const cppast::cpp_class &cls)
|
||||
void tu_visitor::process_class_declaration(const cppast::cpp_class &cls,
|
||||
type_safe::optional_ref<const cppast::cpp_template_specialization> tspec)
|
||||
{
|
||||
class_ c;
|
||||
c.is_struct = cls.class_kind() == cppast::cpp_class_kind::struct_t;
|
||||
@@ -344,6 +357,10 @@ void tu_visitor::process_class_declaration(const cppast::cpp_class &cls)
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG_WARN("Class {} is templated but it's scope {} is not :-|",
|
||||
cls.name(), scope.name());
|
||||
}
|
||||
}
|
||||
|
||||
// Find if class is contained in another class
|
||||
@@ -793,7 +810,7 @@ void tu_visitor::process_friend(const cppast::cpp_friend &f, class_ &parent)
|
||||
r.destination = name;
|
||||
}
|
||||
else if (f.entity()) {
|
||||
std::string name{};
|
||||
std::string name {};
|
||||
|
||||
if (f.entity().value().kind() ==
|
||||
cppast::cpp_entity_kind::class_template_t) {
|
||||
|
||||
@@ -45,9 +45,9 @@ struct tu_context {
|
||||
tu_context(cppast::cpp_entity_index &idx,
|
||||
clanguml::model::class_diagram::diagram &d_,
|
||||
const clanguml::config::class_diagram &config_)
|
||||
: entity_index{idx}
|
||||
, d{d_}
|
||||
, config{config_}
|
||||
: entity_index {idx}
|
||||
, d {d_}
|
||||
, config {config_}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -128,13 +128,13 @@ struct tu_context {
|
||||
template <typename T> struct element_visitor_context {
|
||||
element_visitor_context(clanguml::model::class_diagram::diagram &d_, T &e)
|
||||
: element(e)
|
||||
, d{d_}
|
||||
, d {d_}
|
||||
{
|
||||
}
|
||||
tu_context *ctx;
|
||||
|
||||
T &element;
|
||||
clanguml::model::class_diagram::class_ *parent_class{};
|
||||
clanguml::model::class_diagram::class_ *parent_class {};
|
||||
clanguml::model::class_diagram::diagram &d;
|
||||
};
|
||||
|
||||
@@ -143,13 +143,15 @@ public:
|
||||
tu_visitor(cppast::cpp_entity_index &idx_,
|
||||
clanguml::model::class_diagram::diagram &d_,
|
||||
const clanguml::config::class_diagram &config_)
|
||||
: ctx{idx_, d_, config_}
|
||||
: ctx {idx_, d_, config_}
|
||||
{
|
||||
}
|
||||
|
||||
void operator()(const cppast::cpp_entity &file);
|
||||
|
||||
void process_class_declaration(const cppast::cpp_class &cls);
|
||||
void process_class_declaration(const cppast::cpp_class &cls,
|
||||
type_safe::optional_ref<const cppast::cpp_template_specialization>
|
||||
tspec = nullptr);
|
||||
|
||||
void process_enum_declaration(const cppast::cpp_enum &enm);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace clanguml {
|
||||
namespace t00016 {
|
||||
|
||||
template <typename> struct is_numeric {
|
||||
template <typename T> struct is_numeric {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user