Added generation of packages in class diagrams

This commit is contained in:
Bartek Kryza
2022-02-24 22:16:50 +01:00
parent 8854f764a5
commit fe3c4aedf1
4 changed files with 90 additions and 32 deletions

View File

@@ -96,6 +96,18 @@ void class_::add_type_alias(type_alias &&ta)
type_aliases_[ta.alias()] = std::move(ta);
}
std::string class_::full_name_no_ns() const {
using namespace clanguml::util;
std::ostringstream ostr;
ostr << name();
render_template_params(ostr);
return ostr.str();
}
std::string class_::full_name(bool relative) const
{
using namespace clanguml::util;
@@ -106,6 +118,13 @@ std::string class_::full_name(bool relative) const
else
ostr << name_and_ns();
render_template_params(ostr);
return ostr.str();
}
std::ostringstream &class_::render_template_params(
std::ostringstream &ostr) const
{
if (!templates_.empty()) {
std::vector<std::string> tnames;
std::transform(templates_.cbegin(), templates_.cend(),
@@ -114,11 +133,11 @@ std::string class_::full_name(bool relative) const
if (!tmplt.type().empty())
res.push_back(
ns_relative(using_namespaces(), tmplt.type()));
util::ns_relative(using_namespaces(), tmplt.type()));
if (!tmplt.name().empty())
res.push_back(
ns_relative(using_namespaces(), tmplt.name()));
util::ns_relative(using_namespaces(), tmplt.name()));
if (!tmplt.default_value().empty()) {
res.push_back("=");
@@ -129,8 +148,7 @@ std::string class_::full_name(bool relative) const
});
ostr << fmt::format("<{}>", fmt::join(tnames, ","));
}
return ostr.str();
return ostr;
}
bool class_::is_abstract() const