1 /**************************************************************************** 2 ** 3 ** Copyright (C) 2016 Jochen Becher 4 ** Contact: https://www.qt.io/licensing/ 5 ** 6 ** This file is part of Qt Creator. 7 ** 8 ** Commercial License Usage 9 ** Licensees holding valid commercial Qt licenses may use this file in 10 ** accordance with the commercial license agreement provided with the 11 ** Software or, alternatively, in accordance with the terms contained in 12 ** a written agreement between you and The Qt Company. For licensing terms 13 ** and conditions see https://www.qt.io/terms-conditions. For further 14 ** information use the contact form at https://www.qt.io/contact-us. 15 ** 16 ** GNU General Public License Usage 17 ** Alternatively, this file may be used under the terms of the GNU 18 ** General Public License version 3 as published by the Free Software 19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT 20 ** included in the packaging of this file. Please review the following 21 ** information to ensure the GNU General Public License requirements will 22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html. 23 ** 24 ****************************************************************************/ 25 26 #include "mconnection.h" 27 28 #include "mvisitor.h" 29 #include "mconstvisitor.h" 30 31 namespace qmt { 32 MConnectionEnd()33MConnectionEnd::MConnectionEnd() 34 { 35 } 36 MConnectionEnd(const MConnectionEnd & rhs)37MConnectionEnd::MConnectionEnd(const MConnectionEnd &rhs) 38 : m_name(rhs.name()), 39 m_cardinality(rhs.m_cardinality), 40 m_isNavigable(rhs.m_isNavigable) 41 { 42 } 43 ~MConnectionEnd()44MConnectionEnd::~MConnectionEnd() 45 { 46 } 47 operator =(const MConnectionEnd & rhs)48MConnectionEnd &MConnectionEnd::operator=(const MConnectionEnd &rhs) 49 { 50 if (this != &rhs) { 51 m_name = rhs.m_name; 52 m_cardinality = rhs.m_cardinality; 53 m_isNavigable = rhs.m_isNavigable; 54 } 55 return *this; 56 } 57 setName(const QString & name)58void MConnectionEnd::setName(const QString &name) 59 { 60 m_name = name; 61 } 62 setCardinality(const QString & cardinality)63void MConnectionEnd::setCardinality(const QString &cardinality) 64 { 65 m_cardinality = cardinality; 66 } 67 setNavigable(bool navigable)68void MConnectionEnd::setNavigable(bool navigable) 69 { 70 m_isNavigable = navigable; 71 } 72 operator ==(const MConnectionEnd & lhs,const MConnectionEnd & rhs)73bool operator==(const MConnectionEnd &lhs, const MConnectionEnd &rhs) 74 { 75 return lhs.name() == rhs.name() 76 && lhs.cardinality() == rhs.cardinality() 77 && lhs.isNavigable() == rhs.isNavigable(); 78 } 79 MConnection()80MConnection::MConnection() 81 : MRelation() 82 { 83 } 84 ~MConnection()85MConnection::~MConnection() 86 { 87 } 88 setCustomRelationId(const QString & customRelationId)89void MConnection::setCustomRelationId(const QString &customRelationId) 90 { 91 m_customRelationId = customRelationId; 92 } 93 setEndA(const MConnectionEnd & end)94void MConnection::setEndA(const MConnectionEnd &end) 95 { 96 m_endA = end; 97 } 98 setEndB(const MConnectionEnd & end)99void MConnection::setEndB(const MConnectionEnd &end) 100 { 101 m_endB = end; 102 } 103 accept(MVisitor * visitor)104void MConnection::accept(MVisitor *visitor) 105 { 106 visitor->visitMConnection(this); 107 } 108 accept(MConstVisitor * visitor) const109void MConnection::accept(MConstVisitor *visitor) const 110 { 111 visitor->visitMConnection(this); 112 } 113 114 } // namespace qmt 115