83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
/**
|
|
* src/common/model/relationship.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 "relationship.h"
|
|
|
|
namespace clanguml::common::model {
|
|
|
|
relationship::relationship(relationship_t type, const std::string &destination,
|
|
access_t access, const std::string &label,
|
|
const std::string &multiplicity_source,
|
|
const std::string &multiplicity_destination)
|
|
: type_{type}
|
|
, destination_{destination}
|
|
, multiplicity_source_{multiplicity_source}
|
|
, multiplicity_destination_{multiplicity_destination}
|
|
, label_{label}
|
|
, access_{access}
|
|
{
|
|
}
|
|
|
|
void relationship::set_type(relationship_t type) noexcept { type_ = type; }
|
|
|
|
relationship_t relationship::type() const noexcept { return type_; }
|
|
|
|
void relationship::set_destination(const std::string &destination)
|
|
{
|
|
destination_ = destination;
|
|
}
|
|
|
|
std::string relationship::destination() const { return destination_; }
|
|
|
|
void relationship::set_multiplicity_source(
|
|
const std::string &multiplicity_source)
|
|
{
|
|
multiplicity_source_ = multiplicity_source;
|
|
}
|
|
|
|
std::string relationship::multiplicity_source() const
|
|
{
|
|
return multiplicity_source_;
|
|
}
|
|
|
|
void relationship::set_multiplicity_destination(
|
|
const std::string &multiplicity_destination)
|
|
{
|
|
multiplicity_destination_ = multiplicity_destination;
|
|
}
|
|
|
|
std::string relationship::multiplicity_destination() const
|
|
{
|
|
return multiplicity_destination_;
|
|
}
|
|
|
|
void relationship::set_label(const std::string &label) { label_ = label; }
|
|
|
|
std::string relationship::label() const { return label_; }
|
|
|
|
void relationship::set_access(access_t access) noexcept { access_ = access; }
|
|
|
|
access_t relationship::access() const noexcept { return access_; }
|
|
|
|
bool operator==(const relationship &l, const relationship &r)
|
|
{
|
|
return l.type() == r.type() && l.destination() == r.destination() &&
|
|
l.label() == r.label();
|
|
}
|
|
}
|