Refactored stylable_element
This commit is contained in:
@@ -130,8 +130,8 @@ void generator::generate(const class_ &c, std::ostream &ostr) const
|
||||
|
||||
ostr << class_type << " " << c.alias();
|
||||
|
||||
if (!c.style.empty())
|
||||
ostr << " " << c.style;
|
||||
if (!c.style().empty())
|
||||
ostr << " " << c.style();
|
||||
|
||||
ostr << " {" << '\n';
|
||||
|
||||
@@ -203,7 +203,7 @@ void generator::generate(const class_ &c, std::ostream &ostr) const
|
||||
if (!r.multiplicity_source.empty())
|
||||
puml_relation += "\"" + r.multiplicity_source + "\" ";
|
||||
|
||||
puml_relation += to_string(r.type, r.style);
|
||||
puml_relation += to_string(r.type, r.style());
|
||||
|
||||
if (!r.multiplicity_destination.empty())
|
||||
puml_relation += " \"" + r.multiplicity_destination + "\"";
|
||||
@@ -290,8 +290,8 @@ void generator::generate(const enum_ &e, std::ostream &ostr) const
|
||||
{
|
||||
ostr << "enum " << e.alias();
|
||||
|
||||
if (!e.style.empty())
|
||||
ostr << " " << e.style;
|
||||
if (!e.style().empty())
|
||||
ostr << " " << e.style();
|
||||
|
||||
ostr << " {" << '\n';
|
||||
|
||||
|
||||
@@ -51,6 +51,13 @@ std::string to_string(relationship_t r)
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// stylable_element
|
||||
//
|
||||
void stylable_element::set_style(const std::string &style) { style_ = style; }
|
||||
|
||||
std::string stylable_element::style() const { return style_; }
|
||||
|
||||
//
|
||||
// decorated_element
|
||||
//
|
||||
|
||||
@@ -54,8 +54,13 @@ enum class relationship_t {
|
||||
|
||||
std::string to_string(relationship_t r);
|
||||
|
||||
struct stylable_element {
|
||||
std::string style;
|
||||
class stylable_element {
|
||||
public:
|
||||
void set_style(const std::string &style);
|
||||
std::string style() const;
|
||||
|
||||
private:
|
||||
std::string style_;
|
||||
};
|
||||
|
||||
struct decorated_element {
|
||||
|
||||
@@ -288,7 +288,7 @@ void tu_visitor::process_enum_declaration(const cppast::cpp_enum &enm)
|
||||
if (e.skip())
|
||||
return;
|
||||
|
||||
e.style = e.style_spec();
|
||||
e.set_style(e.style_spec());
|
||||
|
||||
// Process enum documentation comment
|
||||
if (enm.comment().has_value())
|
||||
@@ -347,7 +347,7 @@ void tu_visitor::process_class_declaration(const cppast::cpp_class &cls,
|
||||
if (c.skip())
|
||||
return;
|
||||
|
||||
c.style = c.style_spec();
|
||||
c.set_style(c.style_spec());
|
||||
|
||||
// Process class child entities
|
||||
if (c.is_struct())
|
||||
@@ -633,7 +633,7 @@ bool tu_visitor::process_field_with_template_instantiation(
|
||||
rr.type = relationship_t::kAggregation;
|
||||
rr.label = mv.name();
|
||||
rr.scope = detail::cpp_access_specifier_to_scope(as);
|
||||
rr.style = m.style_spec();
|
||||
rr.set_style(m.style_spec());
|
||||
|
||||
// Process field decorators
|
||||
auto [decorator_rtype, decorator_rmult] = m.relationship();
|
||||
@@ -718,7 +718,7 @@ void tu_visitor::process_field(const cppast::cpp_member_variable &mv, class_ &c,
|
||||
r.type = relationship_type;
|
||||
r.label = m.name;
|
||||
r.scope = m.scope;
|
||||
r.style = m.style_spec();
|
||||
r.set_style(m.style_spec());
|
||||
|
||||
auto [decorator_rtype, decorator_rmult] = m.relationship();
|
||||
if (decorator_rtype != relationship_t::kNone) {
|
||||
|
||||
Reference in New Issue
Block a user