Added note decorator test case
This commit is contained in:
@@ -289,8 +289,9 @@ public:
|
||||
for (auto decorator : c.decorators) {
|
||||
auto note = std::dynamic_pointer_cast<decorators::note>(decorator);
|
||||
if (note) {
|
||||
ostr << "note " << note->position << " of " << c.alias()
|
||||
<< " : " << note->text << '\n';
|
||||
ostr << "note " << note->position << " of " << c.alias() << '\n'
|
||||
<< note->text << '\n'
|
||||
<< "end note\n";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,6 +340,7 @@ public:
|
||||
relstr << " : " << r.label;
|
||||
|
||||
relstr << '\n';
|
||||
|
||||
ostr << relstr.str();
|
||||
}
|
||||
catch (error::uml_alias_missing &ex) {
|
||||
@@ -347,6 +349,18 @@ public:
|
||||
to_string(r.type), e.name, destination, ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Process notes
|
||||
//
|
||||
for (auto decorator : e.decorators) {
|
||||
auto note = std::dynamic_pointer_cast<decorators::note>(decorator);
|
||||
if (note) {
|
||||
ostr << "note " << note->position << " of " << e.alias() << '\n'
|
||||
<< note->text << '\n'
|
||||
<< "end note\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void generate(std::ostream &ostr) const
|
||||
|
||||
@@ -193,6 +193,10 @@ void tu_visitor::process_enum_declaration(const cppast::cpp_enum &enm)
|
||||
enum_ e;
|
||||
e.name = cx::util::full_name(ctx.namespace_, enm);
|
||||
|
||||
// Process enum documentation comment
|
||||
if (enm.comment().has_value())
|
||||
e.decorators = decorators::parse(enm.comment().value());
|
||||
|
||||
for (const auto &ev : enm) {
|
||||
if (ev.kind() == cppast::cpp_entity_kind::enum_value_t) {
|
||||
e.constants.push_back(ev.name());
|
||||
@@ -230,8 +234,15 @@ void tu_visitor::process_class_declaration(const cppast::cpp_class &cls,
|
||||
cppast::cpp_access_specifier_kind::cpp_private;
|
||||
|
||||
// Process class documentation comment
|
||||
if(cls.comment().has_value())
|
||||
c.decorators = decorators::parse(cls.comment().value());
|
||||
if (cppast::is_templated(cls)) {
|
||||
if (cls.parent().value().comment().has_value())
|
||||
c.decorators =
|
||||
decorators::parse(cls.parent().value().comment().value());
|
||||
}
|
||||
else {
|
||||
if (cls.comment().has_value())
|
||||
c.decorators = decorators::parse(cls.comment().value());
|
||||
}
|
||||
|
||||
// Process class child entities
|
||||
if (c.is_struct)
|
||||
|
||||
@@ -68,7 +68,7 @@ std::shared_ptr<decorator> note::from_string(std::string_view c)
|
||||
|
||||
std::advance(it, note_position.size() + 1);
|
||||
}
|
||||
else if (*it == ' ') {
|
||||
else if (std::isspace(*it)) {
|
||||
std::advance(it, 1);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user