Updated code for Doxygen documentation
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/generators/json/class_diagram_generator.cc
|
||||
* @file rc/class_diagram/generators/json/class_diagram_generator.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/generators/json/class_diagram_generator.h
|
||||
* @file src/class_diagram/generators/json/class_diagram_generator.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/generators/plantuml/class_diagram_generator.cc
|
||||
* @file src/class_diagram/generators/plantuml/class_diagram_generator.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -813,10 +813,9 @@ void generator::generate(const package &p, std::ostream &ostr) const
|
||||
// using_namespace
|
||||
if (!uns.starts_with({p.full_name(false)})) {
|
||||
ostr << "}" << '\n';
|
||||
generate_notes(ostr, p);
|
||||
}
|
||||
}
|
||||
|
||||
generate_notes(ostr, p);
|
||||
}
|
||||
|
||||
void generator::generate_relationships(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/generators/plantuml/class_diagram_generator.h
|
||||
* @file src/class_diagram/generators/plantuml/class_diagram_generator.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class.cc
|
||||
* @file src/class_diagram/model/class.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -37,6 +37,10 @@ bool class_::is_template() const { return is_template_; }
|
||||
|
||||
void class_::is_template(bool is_template) { is_template_ = is_template; }
|
||||
|
||||
bool class_::is_union() const { return is_union_; }
|
||||
|
||||
void class_::is_union(bool is_union) { is_union_ = is_union; }
|
||||
|
||||
void class_::add_member(class_member &&member)
|
||||
{
|
||||
members_.emplace_back(std::move(member));
|
||||
@@ -121,4 +125,24 @@ int class_::calculate_template_specialization_match(const class_ &other) const
|
||||
|
||||
return template_trait::calculate_template_specialization_match(other);
|
||||
}
|
||||
|
||||
void class_::template_specialization_found(bool found)
|
||||
{
|
||||
template_specialization_found_ = found;
|
||||
}
|
||||
|
||||
bool class_::template_specialization_found() const
|
||||
{
|
||||
return template_specialization_found_;
|
||||
}
|
||||
|
||||
std::optional<std::string> class_::doxygen_link() const
|
||||
{
|
||||
auto type = is_struct() ? "struct" : "class";
|
||||
|
||||
auto name = name_and_ns();
|
||||
util::replace_all(name, "_", "__");
|
||||
util::replace_all(name, "::", "_1_1");
|
||||
return fmt::format("{}{}.html", type, name);
|
||||
}
|
||||
} // namespace clanguml::class_diagram::model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class.h
|
||||
* @file src/class_diagram/model/class.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -32,6 +32,9 @@
|
||||
|
||||
namespace clanguml::class_diagram::model {
|
||||
|
||||
/**
|
||||
* @brief Diagram element representing a class or class template.
|
||||
*/
|
||||
class class_ : public common::model::element,
|
||||
public common::model::stylable_element,
|
||||
public template_trait {
|
||||
@@ -43,44 +46,165 @@ public:
|
||||
class_ &operator=(const class_ &) = delete;
|
||||
class_ &operator=(class_ &&) = delete;
|
||||
|
||||
std::string type_name() const override { return "class"; }
|
||||
|
||||
bool is_struct() const;
|
||||
void is_struct(bool is_struct);
|
||||
|
||||
bool is_template() const;
|
||||
void is_template(bool is_template);
|
||||
|
||||
bool is_union() const { return is_union_; }
|
||||
void is_union(bool u) { is_union_ = u; }
|
||||
|
||||
void add_member(class_member &&member);
|
||||
void add_method(class_method &&method);
|
||||
void add_parent(class_parent &&parent);
|
||||
|
||||
const std::vector<class_member> &members() const;
|
||||
const std::vector<class_method> &methods() const;
|
||||
const std::vector<class_parent> &parents() const;
|
||||
|
||||
friend bool operator==(const class_ &l, const class_ &r);
|
||||
|
||||
/**
|
||||
* Get the type name of the diagram element.
|
||||
*
|
||||
* @return Type name of the diagram element.
|
||||
*/
|
||||
std::string type_name() const override { return "class"; }
|
||||
|
||||
/**
|
||||
* Whether or not the class was declared in the code as 'struct'.
|
||||
*
|
||||
* @return True, if the class was declared as 'struct'
|
||||
*/
|
||||
bool is_struct() const;
|
||||
|
||||
/**
|
||||
* Set, whether the class was declared as 'struct'.
|
||||
*
|
||||
* @param is_struct True, if the class was declared as 'struct'
|
||||
*/
|
||||
void is_struct(bool is_struct);
|
||||
|
||||
/**
|
||||
* Whether or not the class is a template.
|
||||
*
|
||||
* @return True, if the class is a template.
|
||||
*/
|
||||
bool is_template() const;
|
||||
|
||||
/**
|
||||
* Set, whether the class is a template.
|
||||
*
|
||||
* @param is_struct True, if the class is a template.
|
||||
*/
|
||||
void is_template(bool is_template);
|
||||
|
||||
/**
|
||||
* Whether or not the class is a union.
|
||||
*
|
||||
* @return True, if the class is a union.
|
||||
*/
|
||||
bool is_union() const;
|
||||
|
||||
/**
|
||||
* Set, whether the class is a union.
|
||||
*
|
||||
* @param u True, if the class is a union.
|
||||
*/
|
||||
void is_union(bool is_union);
|
||||
|
||||
/**
|
||||
* Add a data member to the class.
|
||||
*
|
||||
* @param member Class data member.
|
||||
*/
|
||||
void add_member(class_member &&member);
|
||||
|
||||
/**
|
||||
* Add a method to the class.
|
||||
*
|
||||
* @param method Class method.
|
||||
*/
|
||||
void add_method(class_method &&method);
|
||||
|
||||
/**
|
||||
* Add class parent (inheritance relationship).
|
||||
*
|
||||
* @todo Maybe it would be good to refactor this into a regular
|
||||
* relationship. We could drop the 'class_parent' class completely...
|
||||
*
|
||||
* @param parent Class parent.
|
||||
*/
|
||||
void add_parent(class_parent &&parent);
|
||||
|
||||
/**
|
||||
* Get reference to class member list.
|
||||
*
|
||||
* @return Reference to class members.
|
||||
*/
|
||||
const std::vector<class_member> &members() const;
|
||||
|
||||
/**
|
||||
* Get reference to class method list.
|
||||
*
|
||||
* @return Reference to class methods.
|
||||
*/
|
||||
const std::vector<class_method> &methods() const;
|
||||
|
||||
/**
|
||||
* Get reference to class parent list.
|
||||
*
|
||||
* @return Reference to class parents.
|
||||
*/
|
||||
const std::vector<class_parent> &parents() const;
|
||||
|
||||
/**
|
||||
* @brief Get class full name.
|
||||
*
|
||||
* This method renders the entire class name including all template
|
||||
* parameters and/or arguments.
|
||||
*
|
||||
* @param relative Whether the class name should be relative to
|
||||
* using_namespace
|
||||
* @return Full class name.
|
||||
*/
|
||||
std::string full_name(bool relative = true) const override;
|
||||
|
||||
/**
|
||||
* @brief Get unqualified class ful name.
|
||||
*
|
||||
* This method returns the class full name but without any namespace
|
||||
* qualifier.
|
||||
*
|
||||
* @return Full class name without namespace.
|
||||
*/
|
||||
std::string full_name_no_ns() const override;
|
||||
|
||||
/**
|
||||
* Whether the class is abstract.
|
||||
*
|
||||
* @return True, if at least one method is abstract (=0).
|
||||
*/
|
||||
bool is_abstract() const;
|
||||
|
||||
/**
|
||||
* @brief Calculate template specialization match with other class.
|
||||
*
|
||||
* This method is a wrapper over
|
||||
* @ref template_trait::calculate_template_specialization_match()
|
||||
*
|
||||
* @param other
|
||||
* @return
|
||||
*/
|
||||
int calculate_template_specialization_match(const class_ &other) const;
|
||||
|
||||
void template_specialization_found(bool found)
|
||||
{
|
||||
template_specialization_found_ = found;
|
||||
}
|
||||
/**
|
||||
* Whether, a template specialization has already been found for this class.
|
||||
* @return True, if a template specialization has already been found.
|
||||
*/
|
||||
bool template_specialization_found() const;
|
||||
|
||||
bool template_specialization_found() const
|
||||
{
|
||||
return template_specialization_found_;
|
||||
}
|
||||
/**
|
||||
* Set, whether a template specialization has already been found for this
|
||||
* class.
|
||||
*
|
||||
* @param found True, if a template specialization has already been found.
|
||||
*/
|
||||
void template_specialization_found(bool found);
|
||||
|
||||
/**
|
||||
* @brief Generate Doxygen style HTML link for the class.
|
||||
*
|
||||
* This method generates a link, which can be used in SVG diagrams to
|
||||
* create links from classes to Doxygen documentation pages.
|
||||
*
|
||||
* @return Doxygen-style HTML link for the class.
|
||||
*/
|
||||
std::optional<std::string> doxygen_link() const override;
|
||||
|
||||
private:
|
||||
bool is_struct_{false};
|
||||
@@ -90,7 +214,6 @@ private:
|
||||
std::vector<class_method> methods_;
|
||||
std::vector<class_parent> bases_;
|
||||
std::string base_template_full_name_;
|
||||
|
||||
std::string full_name_;
|
||||
|
||||
bool template_specialization_found_{false};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_element.cc
|
||||
* @file src/class_diagram/model/class_element.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_element.h
|
||||
* @file src/class_diagram/model/class_element.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_member.cc
|
||||
* @file src/class_diagram/model/class_member.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_member.h
|
||||
* @file src/class_diagram/model/class_member.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_method.cc
|
||||
* @file src/class_diagram/model/class_method.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_method.h
|
||||
* @file src/class_diagram/model/class_method.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_parent.cc
|
||||
* @file src/class_diagram/model/class_parent.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/class_parent.h
|
||||
* @file src/class_diagram/model/class_parent.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/concept.cc
|
||||
* @file src/class_diagram/model/concept.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/concept.h
|
||||
* @file src/class_diagram/model/concept.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/diagram.cc
|
||||
* @file src/class_diagram/model/diagram.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -198,6 +198,11 @@ inja::json diagram::context() const
|
||||
elements.emplace_back(e.get().context());
|
||||
}
|
||||
|
||||
// Add enums
|
||||
for (const auto &c : concepts()) {
|
||||
elements.emplace_back(c.get().context());
|
||||
}
|
||||
|
||||
ctx["elements"] = elements;
|
||||
|
||||
return ctx;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/diagram.h
|
||||
* @file src/class_diagram/model/diagram.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/enum.cc
|
||||
* @file src/class_diagram/model/enum.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -54,4 +54,11 @@ std::vector<std::string> &enum_::constants() { return constants_; }
|
||||
|
||||
const std::vector<std::string> &enum_::constants() const { return constants_; }
|
||||
|
||||
std::optional<std::string> enum_::doxygen_link() const
|
||||
{
|
||||
auto name = name_and_ns();
|
||||
util::replace_all(name, "_", "__");
|
||||
util::replace_all(name, "::", "_1_1");
|
||||
return fmt::format("enum{}.html", name);
|
||||
}
|
||||
} // namespace clanguml::class_diagram::model
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/enum.h
|
||||
* @file src/class_diagram/model/enum.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
|
||||
const std::vector<std::string> &constants() const;
|
||||
|
||||
std::optional<std::string> doxygen_link() const override;
|
||||
|
||||
private:
|
||||
std::vector<std::string> constants_;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/method_parameter.cc
|
||||
* @file src/class_diagram/model/method_parameter.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/model/method_parameter.h
|
||||
* @file src/class_diagram/model/method_parameter.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
@@ -31,6 +31,8 @@ public:
|
||||
method_parameter(
|
||||
std::string type, std::string name, std::string default_value = {});
|
||||
|
||||
virtual ~method_parameter() = default;
|
||||
|
||||
void set_type(const std::string &type);
|
||||
std::string type() const;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/visitor/template_builder.cc
|
||||
* @file src/class_diagram/visitor/template_builder.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/visitor/template_builder.h
|
||||
* @file src/class_diagram/visitor/template_builder.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/visitor/translation_unit_visitor.cc
|
||||
* @file src/class_diagram/visitor/translation_unit_visitor.cc
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* src/class_diagram/visitor/translation_unit_visitor.h
|
||||
* @file src/class_diagram/visitor/translation_unit_visitor.h
|
||||
*
|
||||
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user