Added namespace deprecated attribute test case
This commit is contained in:
@@ -114,7 +114,11 @@ void generator::generate(const package &p, std::ostream &ostr) const
|
||||
{
|
||||
const auto uns = m_config.using_namespace;
|
||||
|
||||
ostr << "package [" << p.name() << "] as " << p.alias();
|
||||
ostr << "package [" << p.name() << "] ";
|
||||
ostr << "as " << p.alias();
|
||||
|
||||
if (p.is_deprecated())
|
||||
ostr << " <<deprecated>>";
|
||||
|
||||
if (!p.style().empty())
|
||||
ostr << " " << p.style();
|
||||
|
||||
@@ -47,4 +47,8 @@ bool operator==(const package &l, const package &r)
|
||||
{
|
||||
return l.full_name(false) == r.full_name(false);
|
||||
}
|
||||
|
||||
bool package::is_deprecated() const { return is_deprecated_; }
|
||||
|
||||
void package::set_deprecated(bool deprecated) { is_deprecated_ = deprecated; }
|
||||
}
|
||||
@@ -118,5 +118,11 @@ public:
|
||||
std::string full_name(bool relative) const override;
|
||||
|
||||
friend bool operator==(const package &l, const package &r);
|
||||
|
||||
bool is_deprecated() const;
|
||||
|
||||
void set_deprecated(bool deprecated);
|
||||
private:
|
||||
bool is_deprecated_{false};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -106,6 +106,15 @@ void translation_unit_visitor::operator()(const cppast::cpp_entity &file)
|
||||
p->set_name(e.name());
|
||||
p->set_namespace(package_parent);
|
||||
|
||||
for (const auto &attr :
|
||||
ns_declaration.attributes()) {
|
||||
if (attr.kind() ==
|
||||
cppast::cpp_attribute_kind::deprecated) {
|
||||
p->set_deprecated(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ctx.diagram().add_package(
|
||||
package_parent, std::move(p));
|
||||
ctx.set_current_package(
|
||||
|
||||
Reference in New Issue
Block a user