Refactored common diagram elements to clanguml::common:model namespace

This commit is contained in:
Bartek Kryza
2022-01-16 20:57:39 +01:00
parent d62a2a1e9f
commit 6d11376039
26 changed files with 111 additions and 113 deletions

View File

@@ -18,7 +18,7 @@
#pragma once
#include "class_diagram/model/class.h"
#include "class_diagram/model/class_relationship.h"
#include "common/model/relationship.h"
#include "class_diagram/model/diagram.h"
#include "class_diagram/model/enum.h"
#include "class_diagram/visitor/translation_unit_visitor.h"
@@ -44,8 +44,8 @@ using diagram_config = clanguml::class_diagram::model::diagram;
using diagram_model = clanguml::class_diagram::model::diagram;
using clanguml::class_diagram::model::class_;
using clanguml::class_diagram::model::enum_;
using clanguml::class_diagram::model::relationship_t;
using clanguml::class_diagram::model::scope_t;
using clanguml::common::model::relationship_t;
using clanguml::common::model::scope_t;
using namespace clanguml::util;
std::string relative_to(std::string n, std::string c);

View File

@@ -21,9 +21,9 @@
#include "class_method.h"
#include "class_parent.h"
#include "class_template.h"
#include "element.h"
#include "enums.h"
#include "stylable_element.h"
#include "common/model/element.h"
#include "common/model/enums.h"
#include "common/model/stylable_element.h"
#include "type_alias.h"
#include <string>
@@ -31,7 +31,8 @@
namespace clanguml::class_diagram::model {
class class_ : public element, public stylable_element {
class class_ : public common::model::element,
public common::model::stylable_element {
public:
class_(const std::vector<std::string> &using_namespaces);

View File

@@ -20,15 +20,15 @@
namespace clanguml::class_diagram::model {
class_element::class_element(
scope_t scope, const std::string &name, const std::string &type)
class_element::class_element(common::model::scope_t scope,
const std::string &name, const std::string &type)
: scope_{scope}
, name_{name}
, type_{type}
{
}
scope_t class_element::scope() const { return scope_; }
common::model::scope_t class_element::scope() const { return scope_; }
std::string class_element::name() const { return name_; }

View File

@@ -17,23 +17,23 @@
*/
#pragma once
#include "decorated_element.h"
#include "common/model/decorated_element.h"
#include <string>
namespace clanguml::class_diagram::model {
class class_element : public decorated_element {
class class_element : public common::model::decorated_element {
public:
class_element(
scope_t scope, const std::string &name, const std::string &type);
class_element(common::model::scope_t scope, const std::string &name,
const std::string &type);
scope_t scope() const;
common::model::scope_t scope() const;
std::string name() const;
std::string type() const;
private:
scope_t scope_;
common::model::scope_t scope_;
std::string name_;
std::string type_;
};

View File

@@ -20,8 +20,8 @@
namespace clanguml::class_diagram::model {
class_member::class_member(
scope_t scope, const std::string &name, const std::string &type)
class_member::class_member(common::model::scope_t scope,
const std::string &name, const std::string &type)
: class_element{scope, name, type}
{
}

View File

@@ -25,8 +25,8 @@ namespace clanguml::class_diagram::model {
class class_member : public class_element {
public:
class_member(
scope_t scope, const std::string &name, const std::string &type);
class_member(common::model::scope_t scope, const std::string &name,
const std::string &type);
bool is_relationship() const;
void is_relationship(bool is_relationship);

View File

@@ -20,8 +20,8 @@
namespace clanguml::class_diagram::model {
class_method::class_method(
scope_t scope, const std::string &name, const std::string &type)
class_method::class_method(common::model::scope_t scope,
const std::string &name, const std::string &type)
: class_element{scope, name, type}
{
}

View File

@@ -27,8 +27,8 @@ namespace clanguml::class_diagram::model {
class class_method : public class_element {
public:
class_method(
scope_t scope, const std::string &name, const std::string &type);
class_method(common::model::scope_t scope, const std::string &name,
const std::string &type);
bool is_pure_virtual() const;
void is_pure_virtual(bool is_pure_virtual);

View File

@@ -28,8 +28,11 @@ void class_parent::is_virtual(bool is_virtual) { is_virtual_ = is_virtual; }
bool class_parent::is_virtual() const { return is_virtual_; }
void class_parent::set_access(access_t access) { access_ = access; }
void class_parent::set_access(common::model::access_t access)
{
access_ = access;
}
access_t class_parent::access() const { return access_; }
common::model::access_t class_parent::access() const { return access_; }
}

View File

@@ -17,7 +17,7 @@
*/
#pragma once
#include "enums.h"
#include "common/model/enums.h"
#include <string>
@@ -31,12 +31,12 @@ public:
void is_virtual(bool is_virtual);
bool is_virtual() const;
void set_access(access_t access);
access_t access() const;
void set_access(common::model::access_t access);
common::model::access_t access() const;
private:
std::string name_;
bool is_virtual_{false};
access_t access_;
common::model::access_t access_;
};
}

View File

@@ -1,113 +0,0 @@
/**
* src/class_diagram/model/class_relationship.cc
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "class_relationship.h"
namespace clanguml::class_diagram::model {
std::string to_string(relationship_t r)
{
switch (r) {
case relationship_t::kNone:
return "none";
case relationship_t::kExtension:
return "extension";
case relationship_t::kComposition:
return "composition";
case relationship_t::kAggregation:
return "aggregation";
case relationship_t::kContainment:
return "containment";
case relationship_t::kOwnership:
return "ownership";
case relationship_t::kAssociation:
return "association";
case relationship_t::kInstantiation:
return "instantiation";
case relationship_t::kFriendship:
return "frendship";
case relationship_t::kDependency:
return "dependency";
default:
return "invalid";
}
}
class_relationship::class_relationship(relationship_t type,
const std::string &destination, scope_t scope, const std::string &label,
const std::string &multiplicity_source,
const std::string &multiplicity_destination)
: type_{type}
, destination_{destination}
, scope_{scope}
, label_{label}
, multiplicity_source_{multiplicity_source}
, multiplicity_destination_{multiplicity_destination}
{
}
void class_relationship::set_type(relationship_t type) noexcept
{
type_ = type;
}
relationship_t class_relationship::type() const noexcept { return type_; }
void class_relationship::set_destination(const std::string &destination)
{
destination_ = destination;
}
std::string class_relationship::destination() const { return destination_; }
void class_relationship::set_multiplicity_source(
const std::string &multiplicity_source)
{
multiplicity_source_ = multiplicity_source;
}
std::string class_relationship::multiplicity_source() const
{
return multiplicity_source_;
}
void class_relationship::set_multiplicity_destination(
const std::string &multiplicity_destination)
{
multiplicity_destination_ = multiplicity_destination;
}
std::string class_relationship::multiplicity_destination() const
{
return multiplicity_destination_;
}
void class_relationship::set_label(const std::string &label) { label_ = label; }
std::string class_relationship::label() const { return label_; }
void class_relationship::set_scope(scope_t scope) noexcept { scope_ = scope; }
scope_t class_relationship::scope() const noexcept { return scope_; }
bool operator==(const class_relationship &l, const class_relationship &r)
{
return l.type() == r.type() && l.destination() == r.destination() &&
l.label() == r.label();
}
}

View File

@@ -1,68 +0,0 @@
/**
* src/class_diagram/model/class_relationship.h
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "decorated_element.h"
#include "stylable_element.h"
#include <string>
namespace clanguml::class_diagram::model {
std::string to_string(relationship_t r);
class class_relationship : public decorated_element, public stylable_element {
public:
class_relationship(relationship_t type, const std::string &destination,
scope_t scope = scope_t::kNone, const std::string &label = "",
const std::string &multiplicity_source = "",
const std::string &multiplicity_destination = "");
virtual ~class_relationship() = default;
void set_type(relationship_t type) noexcept;
relationship_t type() const noexcept;
void set_destination(const std::string &destination);
std::string destination() const;
void set_multiplicity_source(const std::string &multiplicity_source);
std::string multiplicity_source() const;
void set_multiplicity_destination(
const std::string &multiplicity_destination);
std::string multiplicity_destination() const;
void set_label(const std::string &label);
std::string label() const;
void set_scope(scope_t scope) noexcept;
scope_t scope() const noexcept;
friend bool operator==(
const class_relationship &l, const class_relationship &r);
private:
relationship_t type_{relationship_t::kAssociation};
std::string destination_;
std::string multiplicity_source_;
std::string multiplicity_destination_;
std::string label_;
scope_t scope_{scope_t::kNone};
};
}

View File

@@ -1,82 +0,0 @@
/**
* src/class_diagram/model/decorated_element.cc
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "decorated_element.h"
namespace clanguml::class_diagram::model {
bool decorated_element::skip() const
{
for (auto d : decorators_)
if (std::dynamic_pointer_cast<decorators::skip>(d))
return true;
return false;
}
bool decorated_element::skip_relationship() const
{
for (auto d : decorators_)
if (std::dynamic_pointer_cast<decorators::skip_relationship>(d))
return true;
return false;
}
std::pair<relationship_t, std::string> decorated_element::relationship() const
{
for (auto &d : decorators_)
if (std::dynamic_pointer_cast<decorators::association>(d))
return {relationship_t::kAssociation,
std::dynamic_pointer_cast<decorators::relationship>(d)
->multiplicity};
else if (std::dynamic_pointer_cast<decorators::aggregation>(d))
return {relationship_t::kAggregation,
std::dynamic_pointer_cast<decorators::relationship>(d)
->multiplicity};
else if (std::dynamic_pointer_cast<decorators::composition>(d))
return {relationship_t::kComposition,
std::dynamic_pointer_cast<decorators::relationship>(d)
->multiplicity};
return {relationship_t::kNone, ""};
}
std::string decorated_element::style_spec()
{
for (auto d : decorators_)
if (std::dynamic_pointer_cast<decorators::style>(d))
return std::dynamic_pointer_cast<decorators::style>(d)->spec;
return "";
}
const std::vector<std::shared_ptr<decorators::decorator>> &
decorated_element::decorators() const
{
return decorators_;
}
void decorated_element::add_decorators(
const std::vector<std::shared_ptr<decorators::decorator>> &decorators)
{
for (auto d : decorators) {
decorators_.push_back(d);
}
}
}

View File

@@ -1,50 +0,0 @@
/**
* src/class_diagram/model/decorated_element.h
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "enums.h"
#include "decorators/decorators.h"
#include <memory>
#include <string>
#include <vector>
namespace clanguml::class_diagram::model {
class decorated_element {
public:
bool skip() const;
bool skip_relationship() const;
std::pair<relationship_t, std::string> relationship() const;
std::string style_spec();
const std::vector<std::shared_ptr<decorators::decorator>> &
decorators() const;
void add_decorators(
const std::vector<std::shared_ptr<decorators::decorator>> &decorators);
private:
std::vector<std::shared_ptr<decorators::decorator>> decorators_;
};
}

View File

@@ -1,68 +0,0 @@
/**
* src/class_diagram/model/element.cc
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "element.h"
#include "util/util.h"
namespace clanguml::class_diagram::model {
std::atomic_uint64_t element::m_nextId = 1;
element::element(const std::vector<std::string> &using_namespaces)
: using_namespaces_{using_namespaces}
, m_id{m_nextId++}
{
}
std::string element::alias() const { return fmt::format("C_{:010}", m_id); }
void element::add_relationship(class_relationship &&cr)
{
if (cr.destination().empty()) {
LOG_WARN("Skipping relationship '{}' - {} - '{}' due empty "
"destination",
cr.destination(), to_string(cr.type()), full_name(true));
return;
}
auto it = std::find(relationships_.begin(), relationships_.end(), cr);
if (it == relationships_.end())
relationships_.emplace_back(std::move(cr));
}
void element::set_using_namespaces(const std::vector<std::string> &un)
{
using_namespaces_ = un;
}
const std::vector<std::string> &element::using_namespaces() const
{
return using_namespaces_;
}
std::vector<class_relationship> &element::relationships()
{
return relationships_;
}
const std::vector<class_relationship> &element::relationships() const
{
return relationships_;
}
}

View File

@@ -1,66 +0,0 @@
/**
* src/class_diagram/model/element.h
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "class_relationship.h"
#include "decorated_element.h"
#include <atomic>
#include <string>
#include <vector>
namespace clanguml::class_diagram::model {
class element : public decorated_element {
public:
element(const std::vector<std::string> &using_namespaces);
std::string alias() const;
void set_name(const std::string &name) { name_ = name; }
std::string name() const { return name_; }
void set_namespace(const std::vector<std::string> &ns) { namespace_ = ns; }
std::vector<std::string> get_namespace() const { return namespace_; }
virtual std::string full_name(bool relative) const { return name(); }
void set_using_namespaces(const std::vector<std::string> &un);
const std::vector<std::string> &using_namespaces() const;
std::vector<class_relationship> &relationships();
const std::vector<class_relationship> &relationships() const;
void add_relationship(class_relationship &&cr);
protected:
const uint64_t m_id{0};
private:
std::string name_;
std::vector<std::string> namespace_;
std::vector<std::string> using_namespaces_;
std::vector<class_relationship> relationships_;
static std::atomic_uint64_t m_nextId;
};
}

View File

@@ -24,7 +24,8 @@
namespace clanguml::class_diagram::model {
class enum_ : public element, public stylable_element {
class enum_ : public common::model::element,
public common::model::stylable_element {
public:
enum_(const std::vector<std::string> &using_namespaces);

View File

@@ -1,39 +0,0 @@
/**
* src/class_diagram/model/enums.h
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
namespace clanguml::class_diagram::model {
enum class access_t { kPublic, kProtected, kPrivate };
enum class scope_t { kPublic, kProtected, kPrivate, kNone };
enum class relationship_t {
kNone,
kExtension,
kComposition,
kAggregation,
kContainment,
kOwnership,
kAssociation,
kInstantiation,
kFriendship,
kDependency
};
}

View File

@@ -17,14 +17,14 @@
*/
#pragma once
#include "decorated_element.h"
#include "common/model/decorated_element.h"
#include <string>
#include <vector>
namespace clanguml::class_diagram::model {
class method_parameter : public decorated_element {
class method_parameter : public common::model::decorated_element {
public:
void set_type(const std::string &type);
std::string type() const;

View File

@@ -1,27 +0,0 @@
/**
* src/class_diagram/model/stylable_element.cc
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "stylable_element.h"
namespace clanguml::class_diagram::model {
void stylable_element::set_style(const std::string &style) { style_ = style; }
std::string stylable_element::style() const { return style_; }
}

View File

@@ -1,33 +0,0 @@
/**
* src/class_diagram/model/stylable_element.h
*
* Copyright (c) 2021-2022 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
namespace clanguml::class_diagram::model {
class stylable_element {
public:
void set_style(const std::string &style);
std::string style() const;
private:
std::string style_;
};
}

View File

@@ -36,19 +36,20 @@
namespace clanguml::class_diagram::visitor {
using clanguml::class_diagram::model::access_t;
using clanguml::common::model::access_t;
using clanguml::class_diagram::model::class_;
using clanguml::class_diagram::model::class_member;
using clanguml::class_diagram::model::class_method;
using clanguml::class_diagram::model::class_parent;
using clanguml::class_diagram::model::class_relationship;
using clanguml::class_diagram::model::class_template;
using clanguml::class_diagram::model::class_template;
using clanguml::class_diagram::model::diagram;
using clanguml::class_diagram::model::enum_;
using clanguml::class_diagram::model::method_parameter;
using clanguml::class_diagram::model::relationship_t;
using clanguml::class_diagram::model::scope_t;
using clanguml::common::model::relationship_t;
using clanguml::common::model::scope_t;
using clanguml::class_diagram::model::type_alias;
using clanguml::common::model::relationship;
namespace detail {
scope_t cpp_access_specifier_to_scope(
@@ -551,12 +552,12 @@ bool translation_unit_visitor::process_field_with_template_instantiation(
else
relationship_type = relationship_t::kAggregation;
class_relationship rr{relationship_type, tinst.full_name(),
relationship rr{relationship_type, tinst.full_name(),
detail::cpp_access_specifier_to_scope(as), mv.name()};
rr.set_style(m.style_spec());
// Process field decorators
auto [decorator_rtype, decorator_rmult] = m.relationship();
auto [decorator_rtype, decorator_rmult] = m.get_relationship();
if (decorator_rtype != relationship_t::kNone) {
rr.set_type(decorator_rtype);
auto mult = util::split(decorator_rmult, ":");
@@ -569,7 +570,7 @@ bool translation_unit_visitor::process_field_with_template_instantiation(
if (ctx.config().should_include(tinst.name())) {
LOG_DBG("Adding field instantiation relationship {} {} {} : {}",
rr.destination(),
clanguml::class_diagram::model::to_string(rr.type()), c.full_name(),
clanguml::common::model::to_string(rr.type()), c.full_name(),
rr.label());
c.add_relationship(std::move(rr));
@@ -632,11 +633,11 @@ void translation_unit_visitor::process_field(
for (const auto &[type, relationship_type] : relationships) {
if (relationship_type != relationship_t::kNone) {
class_relationship r{
relationship r{
relationship_type, type, m.scope(), m.name()};
r.set_style(m.style_spec());
auto [decorator_rtype, decorator_rmult] = m.relationship();
auto [decorator_rtype, decorator_rmult] = m.get_relationship();
if (decorator_rtype != relationship_t::kNone) {
r.set_type(decorator_rtype);
auto mult = util::split(decorator_rmult, ":");
@@ -648,7 +649,7 @@ void translation_unit_visitor::process_field(
LOG_DBG("Adding field relationship {} {} {} : {}",
r.destination(),
clanguml::class_diagram::model::to_string(r.type()),
clanguml::common::model::to_string(r.type()),
c.full_name(), r.label());
c.add_relationship(std::move(r));
@@ -874,11 +875,11 @@ void translation_unit_visitor::process_function_parameter(
for (const auto &[type, relationship_type] : relationships) {
if ((relationship_type != relationship_t::kNone) &&
(type != c.name())) {
class_relationship r{relationship_t::kDependency, type};
relationship r{relationship_t::kDependency, type};
LOG_DBG("Adding field relationship {} {} {} : {}",
r.destination(),
clanguml::class_diagram::model::to_string(r.type()),
clanguml::common::model::to_string(r.type()),
c.full_name(), r.label());
c.add_relationship(std::move(r));
@@ -940,14 +941,14 @@ void translation_unit_visitor::process_function_parameter(
"only adding reference to template {}",
cx::util::full_name(cppast::remove_cv(t),
ctx.entity_index(), false));
class_relationship rr{relationship_t::kDependency,
relationship rr{relationship_t::kDependency,
cx::util::full_name(cppast::remove_cv(t),
ctx.entity_index(), false)};
LOG_DBG("Adding field template dependency relationship "
"{} {} {} "
": {}",
rr.destination(),
clanguml::class_diagram::model::to_string(
clanguml::common::model::to_string(
rr.type()),
c.full_name(), rr.label());
c.add_relationship(std::move(rr));
@@ -957,13 +958,13 @@ void translation_unit_visitor::process_function_parameter(
class_ tinst = build_template_instantiation(
template_instantiation_type);
class_relationship rr{
relationship rr{
relationship_t::kDependency, tinst.full_name()};
LOG_DBG("Adding field dependency relationship {} {} {} "
": {}",
rr.destination(),
clanguml::class_diagram::model::to_string(
clanguml::common::model::to_string(
rr.type()),
c.full_name(), rr.label());
@@ -1008,7 +1009,7 @@ void translation_unit_visitor::process_friend(
cppast::cpp_entity_kind::class_template_t))
return;
class_relationship r{
relationship r{
relationship_t::kFriendship, "", scope_t::kNone, "<<friend>>"};
if (f.comment().has_value())
@@ -1355,7 +1356,7 @@ class_ translation_unit_visitor::build_template_instantiation(
? std::make_optional(&tinst)
: parent);
class_relationship tinst_dependency{
relationship tinst_dependency{
relationship_t::kDependency, nested_tinst.full_name()};
auto nested_tinst_full_name = nested_tinst.full_name();
@@ -1392,7 +1393,7 @@ class_ translation_unit_visitor::build_template_instantiation(
}
else if (targ.type().value().kind() ==
cppast::cpp_type_kind::user_defined_t) {
class_relationship tinst_dependency{
relationship tinst_dependency{
relationship_t::kDependency,
cx::util::full_name(
cppast::remove_cv(
@@ -1478,7 +1479,7 @@ class_ translation_unit_visitor::build_template_instantiation(
// Otherwise point to the base template
destination = tinst.base_template();
}
class_relationship r{relationship_t::kInstantiation, destination};
relationship r{relationship_t::kInstantiation, destination};
tinst.add_relationship(std::move(r));
return tinst;

View File

@@ -100,9 +100,9 @@ public:
bool find_relationships(const cppast::cpp_type &t,
std::vector<std::pair<std::string,
clanguml::class_diagram::model::relationship_t>> &relationships,
clanguml::class_diagram::model::relationship_t relationship_hint =
clanguml::class_diagram::model::relationship_t::kNone);
clanguml::common::model::relationship_t>> &relationships,
clanguml::common::model::relationship_t relationship_hint =
clanguml::common::model::relationship_t::kNone);
void process_template_type_parameter(
const cppast::cpp_template_type_parameter &t,