diff options
Diffstat (limited to 'src/libs/modelinglib/qmt/model')
30 files changed, 2608 insertions, 0 deletions
diff --git a/src/libs/modelinglib/qmt/model/massociation.cpp b/src/libs/modelinglib/qmt/model/massociation.cpp new file mode 100644 index 0000000000..d8cca9397e --- /dev/null +++ b/src/libs/modelinglib/qmt/model/massociation.cpp @@ -0,0 +1,130 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "massociation.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MAssociationEnd::MAssociationEnd() + : m_kind(Association), + m_isNavigable(false) +{ +} + +MAssociationEnd::MAssociationEnd(const MAssociationEnd &rhs) + : m_name(rhs.m_name), + m_cardinality(rhs.m_cardinality), + m_kind(rhs.m_kind), + m_isNavigable(rhs.m_isNavigable) +{ +} + +MAssociationEnd::~MAssociationEnd() +{ +} + +MAssociationEnd &MAssociationEnd::operator =(const MAssociationEnd &rhs) +{ + if (this != &rhs) { + m_name = rhs.m_name; + m_cardinality = rhs.m_cardinality; + m_kind = rhs.m_kind; + m_isNavigable = rhs.m_isNavigable; + } + return *this; +} + +void MAssociationEnd::setName(const QString &name) +{ + m_name = name; +} + +void MAssociationEnd::setCardinality(const QString &cardinality) +{ + m_cardinality = cardinality; +} + +void MAssociationEnd::setKind(MAssociationEnd::Kind kind) +{ + m_kind = kind; +} + +void MAssociationEnd::setNavigable(bool navigable) +{ + m_isNavigable = navigable; +} + +bool operator==(const MAssociationEnd &lhs, const MAssociationEnd &rhs) +{ + return lhs.name() == rhs.name() + && lhs.cardinality() == rhs.cardinality() + && lhs.kind() == rhs.kind() + && lhs.isNavigable() == rhs.isNavigable(); +} + +MAssociation::MAssociation() + : MRelation(), + m_associationClassUid(Uid::invalidUid()) +{ +} + +MAssociation::~MAssociation() +{ +} + +void MAssociation::setEndA(const MAssociationEnd &end) +{ + m_endA = end; +} + +void MAssociation::setEndB(const MAssociationEnd &end) +{ + m_endB = end; +} + +void MAssociation::setAssociationClassUid(const Uid &uid) +{ + m_associationClassUid = uid; +} + +void MAssociation::accept(MVisitor *visitor) +{ + visitor->visitMAssociation(this); +} + +void MAssociation::accept(MConstVisitor *visitor) const +{ + visitor->visitMAssociation(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/massociation.h b/src/libs/modelinglib/qmt/model/massociation.h new file mode 100644 index 0000000000..82919eac34 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/massociation.h @@ -0,0 +1,104 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MASSOCIATION_H +#define QMT_MASSOCIATION_H + +#include "mrelation.h" +#include "qmt/infrastructure/handle.h" + +#include <QString> + +namespace qmt { + +class MClass; + +class QMT_EXPORT MAssociationEnd +{ +public: + enum Kind { + Association, + Aggregation, + Composition + }; + + MAssociationEnd(); + MAssociationEnd(const MAssociationEnd &rhs); + ~MAssociationEnd(); + + MAssociationEnd &operator=(const MAssociationEnd &rhs); + + QString name() const { return m_name; } + void setName(const QString &name); + QString cardinality() const { return m_cardinality; } + void setCardinality(const QString &cardinality); + Kind kind() const { return m_kind; } + void setKind(Kind kind); + bool isNavigable() const { return m_isNavigable; } + void setNavigable(bool navigable); + +private: + QString m_name; + QString m_cardinality; + Kind m_kind; + bool m_isNavigable; +}; + +bool operator==(const MAssociationEnd &lhs, const MAssociationEnd &rhs); +inline bool operator!=(const MAssociationEnd &lhs, const MAssociationEnd &rhs) +{ + return !(lhs == rhs); +} + +class QMT_EXPORT MAssociation : public MRelation +{ +public: + MAssociation(); + ~MAssociation() override; + + MAssociationEnd endA() const { return m_endA; } + void setEndA(const MAssociationEnd &end); + MAssociationEnd endB() const { return m_endB; } + void setEndB(const MAssociationEnd &end); + Uid assoicationClassUid() const { return m_associationClassUid; } + void setAssociationClassUid(const Uid &uid); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + MAssociationEnd m_endA; + MAssociationEnd m_endB; + Uid m_associationClassUid; +}; + +} // namespace qmt + +#endif // QMT_MASSOCIATION_H diff --git a/src/libs/modelinglib/qmt/model/mcanvasdiagram.cpp b/src/libs/modelinglib/qmt/model/mcanvasdiagram.cpp new file mode 100644 index 0000000000..03dc768f3d --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mcanvasdiagram.cpp @@ -0,0 +1,56 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcanvasdiagram.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MCanvasDiagram::MCanvasDiagram() +{ +} + +MCanvasDiagram::~MCanvasDiagram() +{ +} + +void MCanvasDiagram::accept(MVisitor *visitor) +{ + visitor->visitMCanvasDiagram(this); +} + +void MCanvasDiagram::accept(MConstVisitor *visitor) const +{ + visitor->visitMCanvasDiagram(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mcanvasdiagram.h b/src/libs/modelinglib/qmt/model/mcanvasdiagram.h new file mode 100644 index 0000000000..61c82ecc9c --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mcanvasdiagram.h @@ -0,0 +1,50 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MCANVASDIAGRAM_H +#define QMT_MCANVASDIAGRAM_H + +#include "mdiagram.h" + +namespace qmt { + +class QMT_EXPORT MCanvasDiagram : public MDiagram +{ +public: + MCanvasDiagram(); + ~MCanvasDiagram() override; + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; +}; + +} // namespace qmt + +#endif // QMT_MCANVASDIAGRAM_H diff --git a/src/libs/modelinglib/qmt/model/mclass.cpp b/src/libs/modelinglib/qmt/model/mclass.cpp new file mode 100644 index 0000000000..5c8b32ed64 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mclass.cpp @@ -0,0 +1,120 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mclass.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" +#include "minheritance.h" +#include "mclassmember.h" + +namespace qmt { + +MClass::MClass() + : MObject() +{ +} + +MClass::MClass(const MClass &rhs) + : MObject(rhs), + m_umlNamespace(rhs.m_umlNamespace), + m_templateParameters(rhs.m_templateParameters), + m_members(rhs.m_members) +{ +} + +MClass::~MClass() +{ +} + +MClass &MClass::operator=(const MClass &rhs) +{ + if (this != &rhs) { + MObject::operator =(rhs); + m_umlNamespace = rhs.m_umlNamespace; + m_templateParameters = rhs.m_templateParameters; + m_members = rhs.m_members; + } + return *this; +} + +void MClass::setUmlNamespace(const QString ¨Namespace) +{ + m_umlNamespace = umlNamespace; +} + +void MClass::setTemplateParameters(const QList<QString> &templateParameters) +{ + m_templateParameters = templateParameters; +} + +void MClass::setMembers(const QList<MClassMember> &members) +{ + m_members = members; +} + +void MClass::addMember(const MClassMember &member) +{ + m_members.append(member); +} + +void MClass::insertMember(int beforeIndex, const MClassMember &member) +{ + m_members.insert(beforeIndex, member); +} + +void MClass::removeMember(const Uid &uid) +{ + QMT_CHECK(uid.isValid()); + for (int i = 0; i < m_members.count(); ++i) { + if (m_members.at(i).uid() == uid) { + m_members.removeAt(i); + return; + } + } + QMT_CHECK(false); +} + +void MClass::removeMember(const MClassMember &member) +{ + removeMember(member.uid()); +} + +void MClass::accept(MVisitor *visitor) +{ + visitor->visitMClass(this); +} + +void MClass::accept(MConstVisitor *visitor) const +{ + visitor->visitMClass(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mclass.h b/src/libs/modelinglib/qmt/model/mclass.h new file mode 100644 index 0000000000..7ca73cbcc7 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mclass.h @@ -0,0 +1,73 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MCLASS_H +#define QMT_MCLASS_H + +#include "mobject.h" +#include "mclassmember.h" + +namespace qmt { + +class MInheritance; + +class QMT_EXPORT MClass : public MObject +{ +public: + MClass(); + MClass(const MClass &rhs); + ~MClass() override; + + MClass &operator=(const MClass &rhs); + + QString umlNamespace() const { return m_umlNamespace; } + void setUmlNamespace(const QString ¨Namespace); + QList<QString> templateParameters() const { return m_templateParameters; } + void setTemplateParameters(const QList<QString> &templateParameters); + QList<MClassMember> members() const { return m_members; } + void setMembers(const QList<MClassMember> &members); + + void addMember(const MClassMember &member); + void insertMember(int beforeIndex, const MClassMember &member); + void removeMember(const Uid &uid); + void removeMember(const MClassMember &member); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + QString m_umlNamespace; + QList<QString> m_templateParameters; + QList<MClassMember> m_members; +}; + +} // namespace qmt + +#endif // QMT_MCLASS_H diff --git a/src/libs/modelinglib/qmt/model/mclassmember.cpp b/src/libs/modelinglib/qmt/model/mclassmember.cpp new file mode 100644 index 0000000000..fcfeacdf59 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mclassmember.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mclassmember.h" + +namespace qmt { + +MClassMember::MClassMember(MemberType memberType) + : m_visibility(VisibilityUndefined), + m_memberType(memberType) +{ +} + +MClassMember::MClassMember(const MClassMember &rhs) + : m_uid(rhs.m_uid), + m_stereotypes(rhs.m_stereotypes), + m_group(rhs.m_group), + m_declaration(rhs.m_declaration), + m_visibility(rhs.m_visibility), + m_memberType(rhs.m_memberType), + m_properties(rhs.m_properties) +{ +} + +MClassMember::~MClassMember() +{ +} + +MClassMember &MClassMember::operator=(const MClassMember &rhs) +{ + if (this != &rhs) { + m_uid = rhs.m_uid; + m_stereotypes = rhs.m_stereotypes; + m_group = rhs.m_group; + m_declaration = rhs.m_declaration; + m_visibility = rhs.m_visibility; + m_memberType = rhs.m_memberType; + m_properties = rhs.m_properties; + } + return *this; +} + +void MClassMember::setUid(const Uid &uid) +{ + m_uid = uid; +} + +void MClassMember::renewUid() +{ + m_uid.renew(); +} + +void MClassMember::setStereotypes(const QList<QString> &stereotypes) +{ + m_stereotypes = stereotypes; +} + +void MClassMember::setGroup(const QString &group) +{ + m_group = group; +} + +void MClassMember::setDeclaration(const QString &declaration) +{ + m_declaration = declaration; +} + +void MClassMember::setVisibility(MClassMember::Visibility visibility) +{ + m_visibility = visibility; +} + +void MClassMember::setMemberType(MClassMember::MemberType memberType) +{ + m_memberType = memberType; +} + +void MClassMember::setProperties(Properties properties) +{ + m_properties = properties; +} + +bool operator==(const MClassMember &lhs, const MClassMember &rhs) +{ + return lhs.uid() == rhs.uid(); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mclassmember.h b/src/libs/modelinglib/qmt/model/mclassmember.h new file mode 100644 index 0000000000..edb343fe4b --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mclassmember.h @@ -0,0 +1,113 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MCLASSMEMBER_H +#define QMT_MCLASSMEMBER_H + +#include "qmt/infrastructure/uid.h" + +#include <QList> +#include <QString> + +namespace qmt { + +class QMT_EXPORT MClassMember +{ +public: + enum Visibility { + VisibilityUndefined, + VisibilityPublic, + VisibilityProtected, + VisibilityPrivate, + VisibilitySignals, + VisibilityPrivateSlots, + VisibilityProtectedSlots, + VisibilityPublicSlots + }; + + enum MemberType { + MemberUndefined, + MemberAttribute, + MemberMethod, + }; + + enum Property { + PropertyVirtual = 0x1, + PropertyAbstract = 0x2, + PropertyConst = 0x4, + PropertyOverride = 0x8, + PropertyFinal = 0x10, + PropertyConstexpr = 0x20, + PropertyStatic = 0x40, + PropertyQsignal = 0x100, + PropertyQslot = 0x200, + PropertyQinvokable = 0x400, + PropertyQproperty = 0x800 + }; + + Q_DECLARE_FLAGS(Properties, Property) + + explicit MClassMember(MemberType memberType = MemberUndefined); + MClassMember(const MClassMember &rhs); + ~MClassMember(); + + MClassMember &operator=(const MClassMember &rhs); + + Uid uid() const { return m_uid; } + void setUid(const Uid &uid); + void renewUid(); + QList<QString> stereotypes() const { return m_stereotypes; } + void setStereotypes(const QList<QString> &stereotypes); + QString group() const { return m_group; } + void setGroup(const QString &group); + QString declaration() const { return m_declaration; } + void setDeclaration(const QString &declaration); + Visibility visibility() const { return m_visibility; } + void setVisibility(Visibility visibility); + MemberType memberType() const { return m_memberType; } + void setMemberType(MemberType memberType); + Properties properties() const { return m_properties; } + void setProperties(Properties properties); + +private: + Uid m_uid; + QList<QString> m_stereotypes; + QString m_group; + QString m_declaration; + Visibility m_visibility; + MemberType m_memberType; + Properties m_properties; +}; + +bool operator==(const MClassMember &lhs, const MClassMember &rhs); + +} // namespace qmt + +#endif // QMT_MCLASSMEMBER_H diff --git a/src/libs/modelinglib/qmt/model/mcomponent.cpp b/src/libs/modelinglib/qmt/model/mcomponent.cpp new file mode 100644 index 0000000000..2d1ea93a32 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mcomponent.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mcomponent.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MComponent::MComponent() + : MObject() +{ +} + +MComponent::~MComponent() +{ +} + +void MComponent::accept(MVisitor *visitor) +{ + visitor->visitMComponent(this); +} + +void MComponent::accept(MConstVisitor *visitor) const +{ + visitor->visitMComponent(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mcomponent.h b/src/libs/modelinglib/qmt/model/mcomponent.h new file mode 100644 index 0000000000..66c6eead91 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mcomponent.h @@ -0,0 +1,50 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MCOMPONENT_H +#define QMT_MCOMPONENT_H + +#include "mobject.h" + +namespace qmt { + +class QMT_EXPORT MComponent : public MObject +{ +public: + MComponent(); + ~MComponent() override; + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; +}; + +} // namespace qmt + +#endif // QMT_MCOMPONENT_H diff --git a/src/libs/modelinglib/qmt/model/mconstvisitor.h b/src/libs/modelinglib/qmt/model/mconstvisitor.h new file mode 100644 index 0000000000..b0c572d370 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mconstvisitor.h @@ -0,0 +1,72 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MCONSTVISITOR_H +#define QMT_MCONSTVISITOR_H + +namespace qmt { + +class MElement; + +class MObject; +class MPackage; +class MClass; +class MComponent; +class MDiagram; +class MCanvasDiagram; +class MItem; + +class MRelation; +class MDependency; +class MInheritance; +class MAssociation; + +class MConstVisitor +{ +public: + virtual ~MConstVisitor() { } + + virtual void visitMElement(const MElement *element) = 0; + virtual void visitMObject(const MObject *object) = 0; + virtual void visitMPackage(const MPackage *package) = 0; + virtual void visitMClass(const MClass *klass) = 0; + virtual void visitMComponent(const MComponent *component) = 0; + virtual void visitMDiagram(const MDiagram *diagram) = 0; + virtual void visitMCanvasDiagram(const MCanvasDiagram *diagram) = 0; + virtual void visitMItem(const MItem *item) = 0; + virtual void visitMRelation(const MRelation *relation) = 0; + virtual void visitMDependency(const MDependency *dependency) = 0; + virtual void visitMInheritance(const MInheritance *inheritance) = 0; + virtual void visitMAssociation(const MAssociation *association) = 0; +}; + +} // namespace qmt + +#endif // QMT_MCONSTVISITOR_H diff --git a/src/libs/modelinglib/qmt/model/mdependency.cpp b/src/libs/modelinglib/qmt/model/mdependency.cpp new file mode 100644 index 0000000000..108c703b7b --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mdependency.cpp @@ -0,0 +1,104 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mdependency.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MDependency::MDependency() + : MRelation(), + m_direction(AToB) +{ +} + +MDependency::MDependency(const MDependency &rhs) + : MRelation(rhs), + m_direction(rhs.m_direction) +{ +} + +MDependency::~MDependency() +{ +} + +MDependency &MDependency::operator =(const MDependency &rhs) +{ + if (this != &rhs) { + MRelation::operator=(rhs); + m_direction = rhs.m_direction; + } + return *this; +} + +void MDependency::setDirection(MDependency::Direction direction) +{ + m_direction = direction; +} + +Uid MDependency::source() const +{ + return m_direction == BToA ? endBUid() : endAUid(); +} + +void MDependency::setSource(const Uid &source) +{ + if (m_direction == BToA) + setEndBUid(source); + else + setEndAUid(source); +} + +Uid MDependency::target() const +{ + return m_direction == BToA ? endAUid() : endBUid(); +} + +void MDependency::setTarget(const Uid &target) +{ + if (m_direction == BToA) + setEndAUid(target); + else + setEndBUid(target); +} + +void MDependency::accept(MVisitor *visitor) +{ + visitor->visitMDependency(this); +} + +void MDependency::accept(MConstVisitor *visitor) const +{ + visitor->visitMDependency(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mdependency.h b/src/libs/modelinglib/qmt/model/mdependency.h new file mode 100644 index 0000000000..dc29395f5a --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mdependency.h @@ -0,0 +1,71 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MDEPENDENCY_H +#define QMT_MDEPENDENCY_H + +#include "mrelation.h" + +namespace qmt { + +class MObject; + +class QMT_EXPORT MDependency : public MRelation +{ +public: + enum Direction { + AToB, + BToA, + Bidirectional + }; + + MDependency(); + MDependency(const MDependency &rhs); + ~MDependency() override; + + MDependency &operator=(const MDependency &rhs); + + Direction direction() const { return m_direction; } + void setDirection(Direction direction); + Uid source() const; + void setSource(const Uid &source); + Uid target() const; + void setTarget(const Uid &target); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + Direction m_direction; +}; + +} // namespace qmt + +#endif // QMT_MDEPENDENCY_H diff --git a/src/libs/modelinglib/qmt/model/mdiagram.cpp b/src/libs/modelinglib/qmt/model/mdiagram.cpp new file mode 100644 index 0000000000..fbda9e6e80 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mdiagram.cpp @@ -0,0 +1,141 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mdiagram.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" +#include "qmt/diagram/delement.h" + +namespace qmt { + +MDiagram::MDiagram() + : MObject(), + // modification date is set to null value for performance reasons + m_lastModified() +{ +} + +MDiagram::MDiagram(const MDiagram &rhs) + : MObject(rhs), + m_elements(), + // modification date is copied (instead of set to current time) to allow exact copies of the diagram + m_lastModified(rhs.m_lastModified), + m_toolbarId(rhs.toolbarId()) +{ +} + +MDiagram::~MDiagram() +{ + qDeleteAll(m_elements); +} + +MDiagram &MDiagram::operator=(const MDiagram &rhs) +{ + if (this != &rhs) { + MObject::operator=(rhs); + // no deep copy; list of elements remains unchanged + // modification date is copied (instead of set to current time) to allow exact copies of the diagram + m_lastModified = rhs.m_lastModified; + m_toolbarId = rhs.m_toolbarId; + } + return *this; +} + +DElement *MDiagram::findDiagramElement(const Uid &key) const +{ + // PERFORM introduce map for better performance + foreach (DElement *element, m_elements) { + if (element->uid() == key) + return element; + } + return 0; +} + +void MDiagram::setDiagramElements(const QList<DElement *> &elements) +{ + m_elements = elements; +} + +void MDiagram::addDiagramElement(DElement *element) +{ + QMT_CHECK(element); + + m_elements.append(element); +} + +void MDiagram::insertDiagramElement(int beforeElement, DElement *element) +{ + QMT_CHECK(beforeElement >= 0 && beforeElement <= m_elements.size()); + + m_elements.insert(beforeElement, element); +} + +void MDiagram::removeDiagramElement(int index) +{ + QMT_CHECK(index >= 0 && index < m_elements.size()); + + delete m_elements.at(index); + m_elements.removeAt(index); +} + +void MDiagram::removeDiagramElement(DElement *element) +{ + QMT_CHECK(element); + + removeDiagramElement(m_elements.indexOf(element)); +} + +void MDiagram::setLastModified(const QDateTime &lastModified) +{ + m_lastModified = lastModified; +} + +void MDiagram::setLastModifiedToNow() +{ + m_lastModified = QDateTime::currentDateTime(); +} + +void MDiagram::setToolbarId(const QString &toolbarId) +{ + m_toolbarId = toolbarId; +} + +void MDiagram::accept(MVisitor *visitor) +{ + visitor->visitMDiagram(this); +} + +void MDiagram::accept(MConstVisitor *visitor) const +{ + visitor->visitMDiagram(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mdiagram.h b/src/libs/modelinglib/qmt/model/mdiagram.h new file mode 100644 index 0000000000..1c2acb3b05 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mdiagram.h @@ -0,0 +1,78 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MDIAGRAM_H +#define QMT_MDIAGRAM_H + +#include "mobject.h" + +#include <QDateTime> + +namespace qmt { + +class DElement; + +class QMT_EXPORT MDiagram : public MObject +{ +public: + MDiagram(); + MDiagram(const MDiagram &rhs); + ~MDiagram() override; + + MDiagram &operator=(const MDiagram &rhs); + + const QList<DElement *> &diagramElements() const { return m_elements; } + DElement *findDiagramElement(const Uid &key) const; + void setDiagramElements(const QList<DElement *> &elements); + + void addDiagramElement(DElement *element); + void insertDiagramElement(int beforeElement, DElement *element); + void removeDiagramElement(int index); + void removeDiagramElement(DElement *element); + + QDateTime lastModified() const { return m_lastModified; } + void setLastModified(const QDateTime &lastModified); + void setLastModifiedToNow(); + + QString toolbarId() const { return m_toolbarId; } + void setToolbarId(const QString &toolbarId); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + QList<DElement *> m_elements; + QDateTime m_lastModified; + QString m_toolbarId; +}; + +} // namespace qmt + +#endif // QMT_MDIAGRAM_H diff --git a/src/libs/modelinglib/qmt/model/melement.cpp b/src/libs/modelinglib/qmt/model/melement.cpp new file mode 100644 index 0000000000..e444cc058d --- /dev/null +++ b/src/libs/modelinglib/qmt/model/melement.cpp @@ -0,0 +1,123 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "melement.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +void MExpansion::assign(MElement *lhs, const MElement &rhs) +{ + if (lhs->m_expansion) + lhs->m_expansion->destroy(lhs); + lhs->m_expansion = clone(rhs); +} + +void MExpansion::destroy(MElement *element) +{ + Q_UNUSED(element); + + delete this; +} + +MElement::MElement() +{ +} + +MElement::MElement(const MElement &rhs) + : m_uid(rhs.m_uid), + m_expansion(rhs.m_expansion ? rhs.m_expansion->clone(rhs) : 0), + m_stereotypes(rhs.m_stereotypes) +{ +} + +MElement::~MElement() +{ + if (m_expansion) + m_expansion->destroy(this); +} + +MElement &MElement::operator=(const MElement &rhs) +{ + if (this != &rhs) { + m_uid = rhs.m_uid; + // owner is intentionally left unchanged + if (rhs.m_expansion) + rhs.m_expansion->assign(this, rhs); + m_stereotypes = rhs.m_stereotypes; + } + return *this; +} + +void MElement::setUid(const Uid &uid) +{ + m_uid = uid; +} + +void MElement::renewUid() +{ + m_uid.renew(); +} + +void MElement::setOwner(MObject *owner) +{ + m_owner = owner; +} + +void MElement::setExpansion(MExpansion *expansion) +{ + if (m_expansion) + m_expansion->destroy(this); + m_expansion = expansion; +} + +void MElement::setStereotypes(const QList<QString> &stereotypes) +{ + m_stereotypes = stereotypes; +} + +void MElement::setFlags(const Flags &flags) +{ + m_flags = flags; +} + +void MElement::accept(MVisitor *visitor) +{ + visitor->visitMElement(this); +} + +void MElement::accept(MConstVisitor *visitor) const +{ + visitor->visitMElement(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/melement.h b/src/libs/modelinglib/qmt/model/melement.h new file mode 100644 index 0000000000..b8b0901333 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/melement.h @@ -0,0 +1,100 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MELEMENT_H +#define QMT_MELEMENT_H + +#include "qmt/infrastructure/uid.h" + +#include <QList> +#include <QString> + +namespace qmt { + +class MElement; +class MObject; +class MVisitor; +class MConstVisitor; + +class MExpansion +{ +public: + virtual ~MExpansion() { } + + virtual MExpansion *clone(const MElement &rhs) const = 0; + virtual void assign(MElement *lhs, const MElement &rhs); + virtual void destroy(MElement *element); +}; + +class QMT_EXPORT MElement +{ + friend class MExpansion; + +public: + enum Flag { + ReverseEngineered = 0x01 + }; + + Q_DECLARE_FLAGS(Flags, Flag) + + MElement(); + MElement(const MElement &rhs); + virtual ~MElement(); + + MElement &operator=(const MElement &rhs); + + Uid uid() const { return m_uid; } + void setUid(const Uid &uid); + void renewUid(); + MObject *owner() const { return m_owner; } + void setOwner(MObject *owner); + MExpansion *expansion() const { return m_expansion; } + void setExpansion(MExpansion *expansion); + QList<QString> stereotypes() const { return m_stereotypes; } + void setStereotypes(const QList<QString> &stereotypes); + Flags flags() const { return m_flags; } + void setFlags(const Flags &flags); + + virtual void accept(MVisitor *visitor); + virtual void accept(MConstVisitor *visitor) const; + +private: + Uid m_uid; + MObject *m_owner = 0; + MExpansion *m_expansion = 0; + QList<QString> m_stereotypes; + Flags m_flags = 0; +}; + +Q_DECLARE_OPERATORS_FOR_FLAGS(MElement::Flags) + +} // namespace qmt + +#endif // QMT_MELEMENT_H diff --git a/src/libs/modelinglib/qmt/model/minheritance.cpp b/src/libs/modelinglib/qmt/model/minheritance.cpp new file mode 100644 index 0000000000..4ce16251bd --- /dev/null +++ b/src/libs/modelinglib/qmt/model/minheritance.cpp @@ -0,0 +1,90 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "minheritance.h" + +#include "mclass.h" +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MInheritance::MInheritance() + : MRelation() +{ +} + +MInheritance::MInheritance(const MInheritance &rhs) + : MRelation(rhs) +{ +} + +MInheritance::~MInheritance() +{ +} + +MInheritance MInheritance::operator =(const MInheritance &rhs) +{ + if (this != &rhs) + MRelation::operator=(rhs); + return *this; +} + +Uid MInheritance::derived() const +{ + return endAUid(); +} + +void MInheritance::setDerived(const Uid &derived) +{ + setEndAUid(derived); +} + +Uid MInheritance::base() const +{ + return endBUid(); +} + +void MInheritance::setBase(const Uid &base) +{ + setEndBUid(base); +} + +void MInheritance::accept(MVisitor *visitor) +{ + visitor->visitMInheritance(this); +} + +void MInheritance::accept(MConstVisitor *visitor) const +{ + visitor->visitMInheritance(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/minheritance.h b/src/libs/modelinglib/qmt/model/minheritance.h new file mode 100644 index 0000000000..612fe3a069 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/minheritance.h @@ -0,0 +1,59 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MINHERITANCE_H +#define QMT_MINHERITANCE_H + +#include "mrelation.h" +#include "qmt/infrastructure/handle.h" + +namespace qmt { + +class QMT_EXPORT MInheritance : public MRelation +{ +public: + MInheritance(); + MInheritance(const MInheritance &rhs); + ~MInheritance() override; + + MInheritance operator=(const MInheritance &rhs); + + Uid derived() const; + void setDerived(const Uid &derived); + Uid base() const; + void setBase(const Uid &base); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; +}; + +} // namespace qmt + +#endif // QMT_MINHERITANCE_H diff --git a/src/libs/modelinglib/qmt/model/mitem.cpp b/src/libs/modelinglib/qmt/model/mitem.cpp new file mode 100644 index 0000000000..cdf18fecef --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mitem.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mitem.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MItem::MItem() + : MObject(), + m_isVarietyEditable(true), + m_isShapeEditable(false) +{ +} + +MItem::~MItem() +{ +} + +void MItem::setVariety(const QString &variety) +{ + m_variety = variety; +} + +void MItem::setVarietyEditable(bool varietyEditable) +{ + m_isVarietyEditable = varietyEditable; +} + +void MItem::setShapeEditable(bool shapeEditable) +{ + m_isShapeEditable = shapeEditable; +} + +void MItem::accept(MVisitor *visitor) +{ + visitor->visitMItem(this); +} + +void MItem::accept(MConstVisitor *visitor) const +{ + visitor->visitMItem(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mitem.h b/src/libs/modelinglib/qmt/model/mitem.h new file mode 100644 index 0000000000..3bb2c6efe7 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mitem.h @@ -0,0 +1,62 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MITEM_H +#define QMT_MITEM_H + +#include "mobject.h" + +namespace qmt { + +class QMT_EXPORT MItem : public MObject +{ +public: + MItem(); + ~MItem() override; + + QString variety() const { return m_variety; } + void setVariety(const QString &variety); + bool isVarietyEditable() const { return m_isVarietyEditable; } + void setVarietyEditable(bool varietyEditable); + bool isShapeEditable() const { return m_isShapeEditable; } + void setShapeEditable(bool shapeEditable); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + QString m_variety; + bool m_isVarietyEditable; + bool m_isShapeEditable; +}; + +} // namespace qmt + +#endif // QMT_MITEM_H diff --git a/src/libs/modelinglib/qmt/model/mobject.cpp b/src/libs/modelinglib/qmt/model/mobject.cpp new file mode 100644 index 0000000000..cfa77a88d2 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mobject.cpp @@ -0,0 +1,197 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mobject.h" + +#include "mrelation.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MObject::MObject() + : MElement(), + m_children(true), + m_relations(true) +{ +} + +MObject::MObject(const MObject &rhs) + : MElement(rhs), + m_name(rhs.m_name), + m_children(true), + m_relations(true) +{ +} + +MObject::~MObject() +{ +} + +MObject &MObject::operator =(const MObject &rhs) +{ + if (this != &rhs) { + MElement::operator=(rhs); + m_name = rhs.m_name; + // no deep copy; list of children remains unchanged + } + return *this; +} + +void MObject::setName(const QString &name) +{ + m_name = name; +} + +void MObject::setChildren(const Handles<MObject> &children) +{ + m_children = children; + foreach (const Handle<MObject> &handle, children) { + if (handle.hasTarget()) + handle.target()->setOwner(this); + } +} + +void MObject::addChild(const Uid &uid) +{ + m_children.add(uid); +} + +void MObject::addChild(MObject *child) +{ + QMT_CHECK(child); + QMT_CHECK(child->owner() == 0); + m_children.add(child); + child->setOwner(this); +} + +void MObject::insertChild(int beforeIndex, const Uid &uid) +{ + m_children.insert(beforeIndex, uid); +} + +void MObject::insertChild(int beforeIndex, MObject *child) +{ + QMT_CHECK(child); + QMT_CHECK(child->owner() == 0); + m_children.insert(beforeIndex, child); + child->setOwner(this); +} + +void MObject::removeChild(const Uid &uid) +{ + QMT_CHECK(m_children.contains(uid)); + MObject *child = m_children.find(uid); + if (child) + child->setOwner(0); + m_children.remove(uid); +} + +void MObject::removeChild(MObject *child) +{ + QMT_CHECK(child); + QMT_CHECK(m_children.contains(child)); + child->setOwner(0); + m_children.remove(child); +} + +void MObject::decontrolChild(const Uid &uid) +{ + QMT_CHECK(m_children.contains(uid)); + MObject *child = m_children.find(uid); + if (child) + child->setOwner(0); + m_children.take(uid); +} + +void MObject::decontrolChild(MObject *child) +{ + QMT_CHECK(child); + QMT_CHECK(m_children.contains(child)); + child->setOwner(0); + m_children.take(child); +} + +void MObject::setRelations(const Handles<MRelation> &relations) +{ + m_relations = relations; + foreach (const Handle<MRelation> &handle, relations) { + if (handle.hasTarget()) + handle.target()->setOwner(this); + } +} + +void MObject::addRelation(const Uid &uid) +{ + m_relations.add(uid); +} + +void MObject::addRelation(MRelation *relation) +{ + QMT_CHECK(relation); + QMT_CHECK(relation->owner() == 0); + relation->setOwner(this); + m_relations.add(relation); +} + +void MObject::insertRelation(int beforeIndex, MRelation *relation) +{ + QMT_CHECK(relation); + QMT_CHECK(relation->owner() == 0); + relation->setOwner(this); + m_relations.insert(beforeIndex, relation); +} + +void MObject::removeRelation(MRelation *relation) +{ + QMT_CHECK(relation); + relation->setOwner(0); + m_relations.remove(relation); +} + +void MObject::decontrolRelation(MRelation *relation) +{ + QMT_CHECK(relation); + relation->setOwner(0); + m_relations.take(relation); +} + +void MObject::accept(MVisitor *visitor) +{ + visitor->visitMObject(this); +} + +void MObject::accept(MConstVisitor *visitor) const +{ + visitor->visitMObject(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mobject.h b/src/libs/modelinglib/qmt/model/mobject.h new file mode 100644 index 0000000000..fcfb32b4e4 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mobject.h @@ -0,0 +1,85 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MOBJECT_H +#define QMT_MOBJECT_H + +#include "melement.h" +#include "qmt/infrastructure/handles.h" + +#include <QString> + +namespace qmt { + +class MRelation; + +class QMT_EXPORT MObject : public MElement +{ +public: + MObject(); + MObject(const MObject &rhs); + ~MObject() override; + + MObject &operator=(const MObject &rhs); + + QString name() const { return m_name; } + void setName(const QString &name); + + const Handles<MObject> &children() const { return m_children; } + void setChildren(const Handles<MObject> &children); + void addChild(const Uid &uid); + void addChild(MObject *child); + void insertChild(int beforeIndex, const Uid &uid); + void insertChild(int beforeIndex, MObject *child); + void removeChild(const Uid &uid); + void removeChild(MObject *child); + void decontrolChild(const Uid &uid); + void decontrolChild(MObject *child); + + const Handles<MRelation> &relations() const { return m_relations; } + void setRelations(const Handles<MRelation> &relations); + void addRelation(const Uid &uid); + void addRelation(MRelation *relation); + void insertRelation(int beforeIndex, MRelation *relation); + void removeRelation(MRelation *relation); + void decontrolRelation(MRelation *relation); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + QString m_name; + Handles<MObject> m_children; + Handles<MRelation> m_relations; +}; + +} // namespace qmt + +#endif // QMT_MOBJECT_H diff --git a/src/libs/modelinglib/qmt/model/mpackage.cpp b/src/libs/modelinglib/qmt/model/mpackage.cpp new file mode 100644 index 0000000000..029aeeedd9 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mpackage.cpp @@ -0,0 +1,57 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mpackage.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MPackage::MPackage() + : MObject() +{ +} + +MPackage::~MPackage() +{ +} + +void MPackage::accept(MVisitor *visitor) +{ + visitor->visitMPackage(this); +} + +void MPackage::accept(MConstVisitor *visitor) const +{ + visitor->visitMPackage(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mpackage.h b/src/libs/modelinglib/qmt/model/mpackage.h new file mode 100644 index 0000000000..666267ca63 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mpackage.h @@ -0,0 +1,51 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MPACKAGE_H +#define QMT_MPACKAGE_H + +#include "mobject.h" +#include "qmt/infrastructure/handles.h" + +namespace qmt { + +class QMT_EXPORT MPackage : public MObject +{ +public: + MPackage(); + ~MPackage() override; + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; +}; + +} // namespace qmt + +#endif // QMT_MPACKAGE_H diff --git a/src/libs/modelinglib/qmt/model/mrelation.cpp b/src/libs/modelinglib/qmt/model/mrelation.cpp new file mode 100644 index 0000000000..cfdb3f28e5 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mrelation.cpp @@ -0,0 +1,93 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "mrelation.h" + +#include "mvisitor.h" +#include "mconstvisitor.h" + +namespace qmt { + +MRelation::MRelation() + : MElement(), + m_endAUid(Uid::invalidUid()), + m_endBUid(Uid::invalidUid()) +{ +} + +MRelation::MRelation(const MRelation &rhs) + : MElement(rhs), + m_name(rhs.m_name), + m_endAUid(rhs.m_endAUid), + m_endBUid(rhs.m_endBUid) +{ +} + +MRelation::~MRelation() +{ +} + +MRelation &MRelation::operator =(const MRelation &rhs) +{ + if (this != &rhs) { + MElement::operator=(rhs); + m_name = rhs.m_name; + m_endAUid = rhs.m_endAUid; + m_endBUid = rhs.m_endBUid; + } + return *this; +} + +void MRelation::setName(const QString &name) +{ + m_name = name; +} + +void MRelation::setEndAUid(const Uid &uid) +{ + m_endAUid = uid; +} + +void MRelation::setEndBUid(const Uid &uid) +{ + m_endBUid = uid; +} + +void MRelation::accept(MVisitor *visitor) +{ + visitor->visitMRelation(this); +} + +void MRelation::accept(MConstVisitor *visitor) const +{ + visitor->visitMRelation(this); +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/mrelation.h b/src/libs/modelinglib/qmt/model/mrelation.h new file mode 100644 index 0000000000..413196f5bb --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mrelation.h @@ -0,0 +1,69 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MRELATION_H +#define QMT_MRELATION_H + +#include "melement.h" + +#include "qmt/infrastructure/handle.h" + +namespace qmt { + +class MObject; + +class QMT_EXPORT MRelation : public MElement +{ +public: + MRelation(); + MRelation(const MRelation &rhs); + ~MRelation() override; + + MRelation &operator=(const MRelation &rhs); + + QString name() const { return m_name; } + void setName(const QString &name); + Uid endAUid() const { return m_endAUid; } + void setEndAUid(const Uid &uid); + Uid endBUid() const { return m_endBUid; } + void setEndBUid(const Uid &uid); + + void accept(MVisitor *visitor) override; + void accept(MConstVisitor *visitor) const override; + +private: + QString m_name; + Uid m_endAUid; + Uid m_endBUid; +}; + +} // namespace qmt + +#endif // QMT_MRELATION_H diff --git a/src/libs/modelinglib/qmt/model/msourceexpansion.cpp b/src/libs/modelinglib/qmt/model/msourceexpansion.cpp new file mode 100644 index 0000000000..7088bb0c86 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/msourceexpansion.cpp @@ -0,0 +1,81 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "msourceexpansion.h" + +#include "qmt/infrastructure/qmtassert.h" + +namespace qmt { + +MSourceExpansion::MSourceExpansion() + : MExpansion(), + m_isTransient(false) +{ +} + +MSourceExpansion::MSourceExpansion(const MSourceExpansion &rhs) + : MExpansion(rhs), + m_sourceId(rhs.m_sourceId), + m_isTransient(rhs.m_isTransient) +{ +} + +MSourceExpansion::~MSourceExpansion() +{ +} + +MSourceExpansion &MSourceExpansion::operator=(const MSourceExpansion &rhs) +{ + if (this != &rhs) { + m_sourceId = rhs.m_sourceId; + m_isTransient = rhs.m_isTransient; + } + return *this; +} + +MSourceExpansion *MSourceExpansion::clone(const MElement &rhs) const +{ + auto rightExpansion = dynamic_cast<MSourceExpansion *>(rhs.expansion()); + QMT_CHECK(rightExpansion); + auto expansion = new MSourceExpansion(*rightExpansion); + return expansion; +} + +void MSourceExpansion::setSourceId(const QString &sourceId) +{ + m_sourceId = sourceId; +} + +void MSourceExpansion::setTransient(bool transient) +{ + m_isTransient = transient; +} + +} // namespace qmt diff --git a/src/libs/modelinglib/qmt/model/msourceexpansion.h b/src/libs/modelinglib/qmt/model/msourceexpansion.h new file mode 100644 index 0000000000..cfb229373f --- /dev/null +++ b/src/libs/modelinglib/qmt/model/msourceexpansion.h @@ -0,0 +1,61 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MSOURCEEXPANSION_H +#define QMT_MSOURCEEXPANSION_H + +#include "melement.h" + +namespace qmt { + +class QMT_EXPORT MSourceExpansion : public MExpansion +{ +public: + MSourceExpansion(); + MSourceExpansion(const MSourceExpansion &rhs); + ~MSourceExpansion() override; + + MSourceExpansion &operator=(const MSourceExpansion &rhs); + + MSourceExpansion *clone(const MElement &rhs) const override; + + QString sourceId() const { return m_sourceId; } + void setSourceId(const QString &sourceId); + bool isTransient() const { return m_isTransient; } + void setTransient(bool transient); + +private: + QString m_sourceId; + bool m_isTransient; +}; + +} // namespace qmt + +#endif // QMT_MSOURCEEXPANSION_H diff --git a/src/libs/modelinglib/qmt/model/mvisitor.h b/src/libs/modelinglib/qmt/model/mvisitor.h new file mode 100644 index 0000000000..7bde915773 --- /dev/null +++ b/src/libs/modelinglib/qmt/model/mvisitor.h @@ -0,0 +1,72 @@ +/*************************************************************************** +** +** Copyright (C) 2015 Jochen Becher +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef QMT_MVISITOR_H +#define QMT_MVISITOR_H + +namespace qmt { + +class MElement; + +class MObject; +class MPackage; +class MClass; +class MComponent; +class MDiagram; +class MCanvasDiagram; +class MItem; + +class MRelation; +class MDependency; +class MInheritance; +class MAssociation; + +class MVisitor +{ +public: + virtual ~MVisitor() { } + + virtual void visitMElement(MElement *element) = 0; + virtual void visitMObject(MObject *object) = 0; + virtual void visitMPackage(MPackage *package) = 0; + virtual void visitMClass(MClass *klass) = 0; + virtual void visitMComponent(MComponent *component) = 0; + virtual void visitMDiagram(MDiagram *diagram) = 0; + virtual void visitMCanvasDiagram(MCanvasDiagram *diagram) = 0; + virtual void visitMItem(MItem *item) = 0; + virtual void visitMRelation(MRelation *relation) = 0; + virtual void visitMDependency(MDependency *dependency) = 0; + virtual void visitMInheritance(MInheritance *inheritance) = 0; + virtual void visitMAssociation(MAssociation *association) = 0; +}; + +} // namespace qmt + +#endif // QMT_MVISITOR_H |
