Files
clang-uml/src/common/model/diagram.cc

88 lines
2.0 KiB
C++

/**
* src/common/model/diagram.cc
*
* Copyright (c) 2021-2022 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 "diagram.h"
#include "diagram_filter.h"
#include "namespace.h"
namespace clanguml::common::model {
diagram::diagram() = default;
diagram::~diagram() = default;
diagram::diagram(diagram &&) = default;
diagram &diagram::operator=(diagram &&) = default;
std::string diagram::name() const { return name_; }
void diagram::set_name(const std::string &name) { name_ = name; }
void diagram::set_filter(std::unique_ptr<diagram_filter> filter)
{
filter_ = std::move(filter);
}
void diagram::set_complete(bool complete) { complete_ = complete; }
bool diagram::complete() const { return complete_; }
bool diagram::should_include(const element &e) const
{
if (filter_.get() == nullptr)
return true;
return filter_->should_include(e);
}
bool diagram::should_include(const std::string &name) const
{
if (filter_.get() == nullptr)
return true;
return filter_->should_include(name);
}
bool diagram::should_include(const relationship_t r) const
{
if (filter_.get() == nullptr)
return true;
return filter_->should_include(r);
}
bool diagram::should_include(const scope_t s) const
{
if (filter_.get() == nullptr)
return true;
return filter_->should_include(s);
}
bool diagram::should_include(
const namespace_ &ns, const std::string &name) const
{
if (filter_.get() == nullptr)
return true;
return filter_->should_include(ns, name);
}
}