Removed dead code and improve test coverage

This commit is contained in:
Bartek Kryza
2023-01-18 21:32:21 +01:00
parent 00b9321034
commit a9f793e407
30 changed files with 98 additions and 174 deletions

View File

@@ -93,12 +93,6 @@ std::string class_::base_template() const { return base_template_full_name_; }
bool operator==(const class_ &l, const class_ &r) { return l.id() == r.id(); }
void class_::add_type_alias(type_alias &&ta)
{
LOG_DBG("Adding class alias: {} -> {}", ta.alias(), ta.underlying_type());
type_aliases_[ta.alias()] = std::move(ta);
}
std::string class_::full_name_no_ns() const
{
using namespace clanguml::util;

View File

@@ -25,7 +25,6 @@
#include "common/model/stylable_element.h"
#include "common/types.h"
#include "template_parameter.h"
#include "type_alias.h"
#include <string>
#include <vector>
@@ -68,8 +67,6 @@ public:
friend bool operator==(const class_ &l, const class_ &r);
void add_type_alias(type_alias &&ta);
std::string full_name(bool relative = true) const override;
std::string full_name_no_ns() const override;
@@ -100,7 +97,6 @@ private:
std::vector<class_parent> bases_;
std::vector<template_parameter> templates_;
std::string base_template_full_name_;
std::map<std::string, type_alias> type_aliases_;
std::string full_name_;
};

View File

@@ -126,14 +126,6 @@ common::optional_ref<enum_> diagram::get_enum(
return {};
}
void diagram::add_type_alias(std::unique_ptr<type_alias> &&ta)
{
LOG_DBG(
"Adding global alias: {} -> {}", ta->alias(), ta->underlying_type());
type_aliases_[ta->alias()] = std::move(ta);
}
bool diagram::add_package(std::unique_ptr<common::model::package> &&p)
{
LOG_DBG("Adding namespace package: {}, {}", p->name(), p->full_name(true));

View File

@@ -23,7 +23,6 @@
#include "common/model/package.h"
#include "common/types.h"
#include "enum.h"
#include "type_alias.h"
#include <string>
#include <unordered_set>
@@ -69,8 +68,6 @@ public:
common::optional_ref<enum_> get_enum(
clanguml::common::model::diagram_element::id_t id) const;
void add_type_alias(std::unique_ptr<type_alias> &&ta);
bool add_class(std::unique_ptr<class_> &&c);
bool add_enum(std::unique_ptr<enum_> &&e);
@@ -93,8 +90,6 @@ private:
common::reference_vector<class_> classes_;
common::reference_vector<enum_> enums_;
std::map<std::string, std::unique_ptr<type_alias>> type_aliases_;
};
} // namespace clanguml::class_diagram::model

View File

@@ -1,34 +0,0 @@
/**
* src/class_diagram/model/type_alias.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "type_alias.h"
namespace clanguml::class_diagram::model {
void type_alias::set_alias(const std::string &alias) { alias_ = alias; }
std::string type_alias::alias() const { return alias_; }
void type_alias::set_underlying_type(const std::string &type)
{
underlying_type_ = type;
}
std::string type_alias::underlying_type() const { return underlying_type_; }
} // namespace clanguml::class_diagram::model

View File

@@ -1,37 +0,0 @@
/**
* src/class_diagram/model/type_alias.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <string>
namespace clanguml::class_diagram::model {
class type_alias {
public:
void set_alias(const std::string &alias);
std::string alias() const;
void set_underlying_type(const std::string &type);
std::string underlying_type() const;
private:
std::string alias_;
std::string underlying_type_;
};
} // namespace clanguml::class_diagram::model