2015-08-16 13:11:15 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** 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 "dclonevisitor.h"
|
|
|
|
|
|
|
|
|
|
#include "qmt/diagram/delement.h"
|
|
|
|
|
#include "qmt/diagram/dobject.h"
|
|
|
|
|
#include "qmt/diagram/dpackage.h"
|
|
|
|
|
#include "qmt/diagram/dclass.h"
|
|
|
|
|
#include "qmt/diagram/dcomponent.h"
|
|
|
|
|
#include "qmt/diagram/ddiagram.h"
|
|
|
|
|
#include "qmt/diagram/ditem.h"
|
|
|
|
|
#include "qmt/diagram/drelation.h"
|
|
|
|
|
#include "qmt/diagram/dinheritance.h"
|
|
|
|
|
#include "qmt/diagram/ddependency.h"
|
|
|
|
|
#include "qmt/diagram/dassociation.h"
|
|
|
|
|
#include "qmt/diagram/dannotation.h"
|
|
|
|
|
#include "qmt/diagram/dboundary.h"
|
|
|
|
|
#include "qmt/infrastructure/qmtassert.h"
|
|
|
|
|
|
|
|
|
|
namespace qmt {
|
|
|
|
|
|
|
|
|
|
DCloneVisitor::DCloneVisitor()
|
2015-11-03 22:30:46 +01:00
|
|
|
: m_cloned(0)
|
2015-08-16 13:11:15 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDElement(const DElement *element)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(element);
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDObject(const DObject *object)
|
|
|
|
|
{
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDPackage(const DPackage *package)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DPackage(*package);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(package);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDClass(const DClass *klass)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DClass(*klass);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(klass);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDComponent(const DComponent *component)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DComponent(*component);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(component);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDDiagram(const DDiagram *diagram)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DDiagram(*diagram);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(diagram);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDItem(const DItem *item)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DItem(*item);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(item);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDRelation(const DRelation *relation)
|
|
|
|
|
{
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(relation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDInheritance(const DInheritance *inheritance)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DInheritance(*inheritance);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(inheritance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDDependency(const DDependency *dependency)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DDependency(*dependency);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(dependency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDAssociation(const DAssociation *association)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DAssociation(*association);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(association);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDAnnotation(const DAnnotation *annotation)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DAnnotation(*annotation);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(annotation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneVisitor::visitDBoundary(const DBoundary *boundary)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DBoundary(*boundary);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(boundary);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DCloneDeepVisitor::DCloneDeepVisitor()
|
2015-11-03 22:30:46 +01:00
|
|
|
: m_cloned(0)
|
2015-08-16 13:11:15 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDElement(const DElement *element)
|
|
|
|
|
{
|
|
|
|
|
Q_UNUSED(element);
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDObject(const DObject *object)
|
|
|
|
|
{
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDPackage(const DPackage *package)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DPackage(*package);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(package);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDClass(const DClass *klass)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DClass(*klass);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(klass);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDComponent(const DComponent *component)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DComponent(*component);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(component);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDDiagram(const DDiagram *diagram)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DDiagram(*diagram);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(diagram);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDItem(const DItem *item)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DItem(*item);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDObject(item);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDRelation(const DRelation *relation)
|
|
|
|
|
{
|
2015-11-03 22:30:46 +01:00
|
|
|
QMT_CHECK(m_cloned);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(relation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDInheritance(const DInheritance *inheritance)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DInheritance(*inheritance);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(inheritance);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDDependency(const DDependency *dependency)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DDependency(*dependency);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(dependency);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDAssociation(const DAssociation *association)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DAssociation(*association);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDRelation(association);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDAnnotation(const DAnnotation *annotation)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DAnnotation(*annotation);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(annotation);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DCloneDeepVisitor::visitDBoundary(const DBoundary *boundary)
|
|
|
|
|
{
|
2015-11-14 16:59:30 +01:00
|
|
|
if (!m_cloned)
|
2015-11-03 22:30:46 +01:00
|
|
|
m_cloned = new DBoundary(*boundary);
|
2015-08-16 13:11:15 +02:00
|
|
|
visitDElement(boundary);
|
|
|
|
|
}
|
|
|
|
|
|
2015-11-14 16:59:30 +01:00
|
|
|
} // namespace qmt
|