Added comment() inja function - Fixes #30
This commit is contained in:
@@ -41,6 +41,21 @@ common::model::diagram_t diagram::type() const
|
||||
return common::model::diagram_t::kClass;
|
||||
}
|
||||
|
||||
type_safe::optional_ref<const clanguml::common::model::element> diagram::get(
|
||||
const std::string &full_name) const
|
||||
{
|
||||
type_safe::optional_ref<const clanguml::common::model::element> res;
|
||||
|
||||
res = get_class(full_name);
|
||||
|
||||
if (res.has_value())
|
||||
return res;
|
||||
|
||||
res = get_enum(full_name);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
bool diagram::has_class(const class_ &c) const
|
||||
{
|
||||
return std::any_of(classes_.cbegin(), classes_.cend(),
|
||||
@@ -65,6 +80,18 @@ type_safe::optional_ref<const class_> diagram::get_class(
|
||||
return type_safe::nullopt;
|
||||
}
|
||||
|
||||
type_safe::optional_ref<const enum_> diagram::get_enum(
|
||||
const std::string &name) const
|
||||
{
|
||||
for (const auto &e : enums_) {
|
||||
if (e.get().full_name(false) == name) {
|
||||
return {e};
|
||||
}
|
||||
}
|
||||
|
||||
return type_safe::nullopt;
|
||||
}
|
||||
|
||||
void diagram::add_type_alias(std::unique_ptr<type_alias> &&ta)
|
||||
{
|
||||
LOG_DBG(
|
||||
|
||||
@@ -43,6 +43,9 @@ public:
|
||||
|
||||
common::model::diagram_t type() const override;
|
||||
|
||||
type_safe::optional_ref<const clanguml::common::model::element> get(
|
||||
const std::string &full_name) const override;
|
||||
|
||||
const std::vector<type_safe::object_ref<const class_>> classes() const;
|
||||
|
||||
const std::vector<type_safe::object_ref<const enum_>> enums() const;
|
||||
@@ -54,6 +57,9 @@ public:
|
||||
type_safe::optional_ref<const class_> get_class(
|
||||
const std::string &name) const;
|
||||
|
||||
type_safe::optional_ref<const enum_> get_enum(
|
||||
const std::string &name) const;
|
||||
|
||||
void add_type_alias(std::unique_ptr<type_alias> &&ta);
|
||||
|
||||
void add_class(std::unique_ptr<class_> &&c);
|
||||
|
||||
Reference in New Issue
Block a user