Fixed formatting
This commit is contained in:
@@ -18,10 +18,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "class_diagram/model/class.h"
|
#include "class_diagram/model/class.h"
|
||||||
#include "common/model/relationship.h"
|
|
||||||
#include "class_diagram/model/diagram.h"
|
#include "class_diagram/model/diagram.h"
|
||||||
#include "class_diagram/model/enum.h"
|
#include "class_diagram/model/enum.h"
|
||||||
#include "class_diagram/visitor/translation_unit_visitor.h"
|
#include "class_diagram/visitor/translation_unit_visitor.h"
|
||||||
|
#include "common/model/relationship.h"
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
#include "cx/compilation_database.h"
|
#include "cx/compilation_database.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
|
|||||||
@@ -36,20 +36,19 @@
|
|||||||
|
|
||||||
namespace clanguml::class_diagram::visitor {
|
namespace clanguml::class_diagram::visitor {
|
||||||
|
|
||||||
using clanguml::common::model::access_t;
|
|
||||||
using clanguml::class_diagram::model::class_;
|
using clanguml::class_diagram::model::class_;
|
||||||
using clanguml::class_diagram::model::class_member;
|
using clanguml::class_diagram::model::class_member;
|
||||||
using clanguml::class_diagram::model::class_method;
|
using clanguml::class_diagram::model::class_method;
|
||||||
using clanguml::class_diagram::model::class_parent;
|
using clanguml::class_diagram::model::class_parent;
|
||||||
using clanguml::class_diagram::model::class_template;
|
using clanguml::class_diagram::model::class_template;
|
||||||
using clanguml::class_diagram::model::class_template;
|
|
||||||
using clanguml::class_diagram::model::diagram;
|
using clanguml::class_diagram::model::diagram;
|
||||||
using clanguml::class_diagram::model::enum_;
|
using clanguml::class_diagram::model::enum_;
|
||||||
using clanguml::class_diagram::model::method_parameter;
|
using clanguml::class_diagram::model::method_parameter;
|
||||||
|
using clanguml::class_diagram::model::type_alias;
|
||||||
|
using clanguml::common::model::access_t;
|
||||||
|
using clanguml::common::model::relationship;
|
||||||
using clanguml::common::model::relationship_t;
|
using clanguml::common::model::relationship_t;
|
||||||
using clanguml::common::model::scope_t;
|
using clanguml::common::model::scope_t;
|
||||||
using clanguml::class_diagram::model::type_alias;
|
|
||||||
using clanguml::common::model::relationship;
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
scope_t cpp_access_specifier_to_scope(
|
scope_t cpp_access_specifier_to_scope(
|
||||||
@@ -569,9 +568,8 @@ bool translation_unit_visitor::process_field_with_template_instantiation(
|
|||||||
|
|
||||||
if (ctx.config().should_include(tinst.name())) {
|
if (ctx.config().should_include(tinst.name())) {
|
||||||
LOG_DBG("Adding field instantiation relationship {} {} {} : {}",
|
LOG_DBG("Adding field instantiation relationship {} {} {} : {}",
|
||||||
rr.destination(),
|
rr.destination(), clanguml::common::model::to_string(rr.type()),
|
||||||
clanguml::common::model::to_string(rr.type()), c.full_name(),
|
c.full_name(), rr.label());
|
||||||
rr.label());
|
|
||||||
|
|
||||||
c.add_relationship(std::move(rr));
|
c.add_relationship(std::move(rr));
|
||||||
|
|
||||||
@@ -633,8 +631,7 @@ void translation_unit_visitor::process_field(
|
|||||||
|
|
||||||
for (const auto &[type, relationship_type] : relationships) {
|
for (const auto &[type, relationship_type] : relationships) {
|
||||||
if (relationship_type != relationship_t::kNone) {
|
if (relationship_type != relationship_t::kNone) {
|
||||||
relationship r{
|
relationship r{relationship_type, type, m.scope(), m.name()};
|
||||||
relationship_type, type, m.scope(), m.name()};
|
|
||||||
r.set_style(m.style_spec());
|
r.set_style(m.style_spec());
|
||||||
|
|
||||||
auto [decorator_rtype, decorator_rmult] = m.get_relationship();
|
auto [decorator_rtype, decorator_rmult] = m.get_relationship();
|
||||||
@@ -649,8 +646,8 @@ void translation_unit_visitor::process_field(
|
|||||||
|
|
||||||
LOG_DBG("Adding field relationship {} {} {} : {}",
|
LOG_DBG("Adding field relationship {} {} {} : {}",
|
||||||
r.destination(),
|
r.destination(),
|
||||||
clanguml::common::model::to_string(r.type()),
|
clanguml::common::model::to_string(r.type()), c.full_name(),
|
||||||
c.full_name(), r.label());
|
r.label());
|
||||||
|
|
||||||
c.add_relationship(std::move(r));
|
c.add_relationship(std::move(r));
|
||||||
}
|
}
|
||||||
@@ -879,8 +876,8 @@ void translation_unit_visitor::process_function_parameter(
|
|||||||
|
|
||||||
LOG_DBG("Adding field relationship {} {} {} : {}",
|
LOG_DBG("Adding field relationship {} {} {} : {}",
|
||||||
r.destination(),
|
r.destination(),
|
||||||
clanguml::common::model::to_string(r.type()),
|
clanguml::common::model::to_string(r.type()), c.full_name(),
|
||||||
c.full_name(), r.label());
|
r.label());
|
||||||
|
|
||||||
c.add_relationship(std::move(r));
|
c.add_relationship(std::move(r));
|
||||||
}
|
}
|
||||||
@@ -948,8 +945,7 @@ void translation_unit_visitor::process_function_parameter(
|
|||||||
"{} {} {} "
|
"{} {} {} "
|
||||||
": {}",
|
": {}",
|
||||||
rr.destination(),
|
rr.destination(),
|
||||||
clanguml::common::model::to_string(
|
clanguml::common::model::to_string(rr.type()),
|
||||||
rr.type()),
|
|
||||||
c.full_name(), rr.label());
|
c.full_name(), rr.label());
|
||||||
c.add_relationship(std::move(rr));
|
c.add_relationship(std::move(rr));
|
||||||
}
|
}
|
||||||
@@ -964,8 +960,7 @@ void translation_unit_visitor::process_function_parameter(
|
|||||||
LOG_DBG("Adding field dependency relationship {} {} {} "
|
LOG_DBG("Adding field dependency relationship {} {} {} "
|
||||||
": {}",
|
": {}",
|
||||||
rr.destination(),
|
rr.destination(),
|
||||||
clanguml::common::model::to_string(
|
clanguml::common::model::to_string(rr.type()),
|
||||||
rr.type()),
|
|
||||||
c.full_name(), rr.label());
|
c.full_name(), rr.label());
|
||||||
|
|
||||||
c.add_relationship(std::move(rr));
|
c.add_relationship(std::move(rr));
|
||||||
@@ -1393,8 +1388,7 @@ class_ translation_unit_visitor::build_template_instantiation(
|
|||||||
}
|
}
|
||||||
else if (targ.type().value().kind() ==
|
else if (targ.type().value().kind() ==
|
||||||
cppast::cpp_type_kind::user_defined_t) {
|
cppast::cpp_type_kind::user_defined_t) {
|
||||||
relationship tinst_dependency{
|
relationship tinst_dependency{relationship_t::kDependency,
|
||||||
relationship_t::kDependency,
|
|
||||||
cx::util::full_name(
|
cx::util::full_name(
|
||||||
cppast::remove_cv(
|
cppast::remove_cv(
|
||||||
cx::util::unreferenced(targ.type().value())),
|
cx::util::unreferenced(targ.type().value())),
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ bool decorated_element::skip_relationship() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<relationship_t, std::string> decorated_element::get_relationship() const
|
std::pair<relationship_t, std::string>
|
||||||
|
decorated_element::get_relationship() const
|
||||||
{
|
{
|
||||||
for (auto &d : decorators_)
|
for (auto &d : decorators_)
|
||||||
if (std::dynamic_pointer_cast<decorators::association>(d))
|
if (std::dynamic_pointer_cast<decorators::association>(d))
|
||||||
|
|||||||
@@ -56,10 +56,7 @@ const std::vector<std::string> &element::using_namespaces() const
|
|||||||
return using_namespaces_;
|
return using_namespaces_;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<relationship> &element::relationships()
|
std::vector<relationship> &element::relationships() { return relationships_; }
|
||||||
{
|
|
||||||
return relationships_;
|
|
||||||
}
|
|
||||||
|
|
||||||
const std::vector<relationship> &element::relationships() const
|
const std::vector<relationship> &element::relationships() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "relationship.h"
|
|
||||||
#include "decorated_element.h"
|
#include "decorated_element.h"
|
||||||
#include "relationship.h"
|
#include "relationship.h"
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ std::string to_string(relationship_t r)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
relationship::relationship(relationship_t type,
|
relationship::relationship(relationship_t type, const std::string &destination,
|
||||||
const std::string &destination, scope_t scope, const std::string &label,
|
scope_t scope, const std::string &label,
|
||||||
const std::string &multiplicity_source,
|
const std::string &multiplicity_source,
|
||||||
const std::string &multiplicity_destination)
|
const std::string &multiplicity_destination)
|
||||||
: type_{type}
|
: type_{type}
|
||||||
@@ -61,10 +61,7 @@ relationship::relationship(relationship_t type,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void relationship::set_type(relationship_t type) noexcept
|
void relationship::set_type(relationship_t type) noexcept { type_ = type; }
|
||||||
{
|
|
||||||
type_ = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
relationship_t relationship::type() const noexcept { return type_; }
|
relationship_t relationship::type() const noexcept { return type_; }
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace clanguml::common::model {
|
|||||||
std::string to_string(relationship_t r);
|
std::string to_string(relationship_t r);
|
||||||
|
|
||||||
class relationship : public common::model::decorated_element,
|
class relationship : public common::model::decorated_element,
|
||||||
public common::model::stylable_element {
|
public common::model::stylable_element {
|
||||||
public:
|
public:
|
||||||
relationship(relationship_t type, const std::string &destination,
|
relationship(relationship_t type, const std::string &destination,
|
||||||
scope_t scope = scope_t::kNone, const std::string &label = "",
|
scope_t scope = scope_t::kNone, const std::string &label = "",
|
||||||
@@ -55,8 +55,7 @@ public:
|
|||||||
void set_scope(scope_t scope) noexcept;
|
void set_scope(scope_t scope) noexcept;
|
||||||
scope_t scope() const noexcept;
|
scope_t scope() const noexcept;
|
||||||
|
|
||||||
friend bool operator==(
|
friend bool operator==(const relationship &l, const relationship &r);
|
||||||
const relationship &l, const relationship &r);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
relationship_t type_{relationship_t::kAssociation};
|
relationship_t type_{relationship_t::kAssociation};
|
||||||
|
|||||||
@@ -89,8 +89,7 @@ bool diagram::should_include(const std::string &name_) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool diagram::should_include(
|
bool diagram::should_include(const clanguml::common::model::scope_t scope) const
|
||||||
const clanguml::common::model::scope_t scope) const
|
|
||||||
{
|
{
|
||||||
for (const auto &s : exclude.scopes) {
|
for (const auto &s : exclude.scopes) {
|
||||||
if (s == scope)
|
if (s == scope)
|
||||||
|
|||||||
@@ -17,12 +17,12 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "package_diagram/model/package.h"
|
|
||||||
#include "package_diagram/visitor/translation_unit_visitor.h"
|
|
||||||
#include "common/model/relationship.h"
|
#include "common/model/relationship.h"
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
#include "cx/compilation_database.h"
|
#include "cx/compilation_database.h"
|
||||||
#include "package_diagram/model/diagram.h"
|
#include "package_diagram/model/diagram.h"
|
||||||
|
#include "package_diagram/model/package.h"
|
||||||
|
#include "package_diagram/visitor/translation_unit_visitor.h"
|
||||||
#include "util/util.h"
|
#include "util/util.h"
|
||||||
|
|
||||||
#include <cppast/cpp_entity_index.hpp>
|
#include <cppast/cpp_entity_index.hpp>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ std::string package::full_name(bool relative) const
|
|||||||
auto ns = using_namespaces();
|
auto ns = using_namespaces();
|
||||||
|
|
||||||
if (relative && (fn.size() >= ns.size())) {
|
if (relative && (fn.size() >= ns.size())) {
|
||||||
if(starts_with(fn, ns))
|
if (starts_with(fn, ns))
|
||||||
fn = std::vector<std::string>(fn.begin() + ns.size(), fn.end());
|
fn = std::vector<std::string>(fn.begin() + ns.size(), fn.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "util/util.h"
|
|
||||||
#include "common/model/element.h"
|
#include "common/model/element.h"
|
||||||
#include "common/model/stylable_element.h"
|
#include "common/model/stylable_element.h"
|
||||||
|
#include "util/util.h"
|
||||||
|
|
||||||
#include <spdlog/spdlog.h>
|
#include <spdlog/spdlog.h>
|
||||||
#include <type_safe/optional_ref.hpp>
|
#include <type_safe/optional_ref.hpp>
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "package_diagram/model/diagram.h"
|
|
||||||
#include "package_diagram/visitor/translation_unit_context.h"
|
|
||||||
#include "config/config.h"
|
#include "config/config.h"
|
||||||
#include "cx/cursor.h"
|
#include "cx/cursor.h"
|
||||||
|
#include "package_diagram/model/diagram.h"
|
||||||
|
#include "package_diagram/visitor/translation_unit_context.h"
|
||||||
|
|
||||||
#include <clang-c/CXCompilationDatabase.h>
|
#include <clang-c/CXCompilationDatabase.h>
|
||||||
#include <clang-c/Index.h>
|
#include <clang-c/Index.h>
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ template <typename T> void append(std::vector<T> &l, const std::vector<T> &r)
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
bool starts_with(const std::vector<T> &col, const std::vector<T> &prefix)
|
bool starts_with(const std::vector<T> &col, const std::vector<T> &prefix)
|
||||||
{
|
{
|
||||||
if(prefix.size() > col.size())
|
if (prefix.size() > col.size())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return std::vector<std::string>(prefix.begin(), prefix.end()) ==
|
return std::vector<std::string>(prefix.begin(), prefix.end()) ==
|
||||||
|
|||||||
27335
tests/catch.h
27335
tests/catch.h
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user