summaryrefslogtreecommitdiffstats
path: root/src/uml/qcomponent.cpp
blob: 1fea966a1b8772611dba42a4e7a6e73a97f6c70f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
/****************************************************************************
**
** Copyright (C) 2012 Sandro S. Andrade <sandroandrade@kde.org>
** Contact: http://www.qt-project.org/
**
** This file is part of the QtUml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

#include "qcomponent.h"
#include "qcomponent_p.h"

#include <QtUml/QClassifier>
#include <QtUml/QComponentRealization>
#include <QtUml/QPackageableElement>
#include <QtUml/QInterface>

#include <QtWrappedObjects/QtWrappedObjectsNamespace>

QT_BEGIN_NAMESPACE_QTUML

QComponentPrivate::QComponentPrivate() :
    isIndirectlyInstantiated(true)
{
}

QComponentPrivate::~QComponentPrivate()
{
}

/*!
    \class QComponent

    \inmodule QtUml

    \brief In the namespace of a component, all model elements that are involved in or related to its definition are either owned or imported explicitly. This may include, for example, use cases and dependencies (e.g. mappings), packages, components, and artifacts.A component represents a modular part of a system that encapsulates its contents and whose manifestation is replaceable within its environment.
 */

QComponent::QComponent(QWrappedObject *wrapper, QWrappedObject *parent) :
    QClass(*new QComponentPrivate, wrapper, parent)
{
    setPropertyData();
}

QComponent::QComponent(QComponentPrivate &dd, QWrappedObject *wrapper, QWrappedObject *parent) :
    QClass(dd, wrapper, parent)
{
    setPropertyData();
}

QComponent::~QComponent()
{
}

// ---------------------------------------------------------------
// ATTRIBUTES FROM QComponent
// ---------------------------------------------------------------

/*!
    isIndirectlyInstantiated : Boolean {default = true} The kind of instantiation that applies to a Component. If false, the component is instantiated as an addressable object. If true, the Component is defined at design-time, but at run-time (or execution-time) an object specified by the Component does not exist, that is, the component is instantiated indirectly, through the instantiation of its realizing classifiers or parts. Several standard stereotypes use this meta attribute (e.g., «specification», «focus», «subsystem»).
 */
bool QComponent::isIndirectlyInstantiated() const
{
    // This is a read-write attribute

    Q_D(const QComponent);
    return d->isIndirectlyInstantiated;
}

void QComponent::setIndirectlyInstantiated(bool isIndirectlyInstantiated)
{
    // This is a read-write attribute

    Q_D(QComponent);
    if (d->isIndirectlyInstantiated != isIndirectlyInstantiated) {
        d->isIndirectlyInstantiated = isIndirectlyInstantiated;
    }
    d->modifiedResettableProperties << QString::fromLatin1("isIndirectlyInstantiated");
}

void QComponent::unsetIndirectlyInstantiated()
{
    setIndirectlyInstantiated(true);
    Q_D(QComponent);
    d->modifiedResettableProperties.removeAll(QString::fromLatin1("isIndirectlyInstantiated"));
}

// ---------------------------------------------------------------
// ASSOCIATION ENDS FROM QComponent
// ---------------------------------------------------------------

/*!
    The set of Realizations owned by the Component. Realizations reference the Classifiers of which the Component is an abstraction; i.e., that realize its behavior.
 */
QSet<QComponentRealization *> QComponent::realizations() const
{
    // This is a read-write association end

    Q_D(const QComponent);
    return d->realizations;
}

void QComponent::addRealization(QComponentRealization *realization)
{
    // This is a read-write association end

    Q_D(QComponent);
    if (!d->realizations.contains(realization)) {
        d->realizations.insert(realization);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QElementPrivate *>(d))->addOwnedElement(qwrappedobject_cast<QElement *>(realization));

        // Adjust opposite property
        realization->setAbstraction(this);
    }
}

void QComponent::removeRealization(QComponentRealization *realization)
{
    // This is a read-write association end

    Q_D(QComponent);
    if (d->realizations.contains(realization)) {
        d->realizations.remove(realization);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QElementPrivate *>(d))->removeOwnedElement(qwrappedobject_cast<QElement *>(realization));

        // Adjust opposite property
        realization->setAbstraction(0);
    }
}

/*!
    The interfaces that the component requires from other components in its environment in order to be able to offer its full set of provided functionality. These interfaces may be used by the Component or any of its realizingClassifiers, or they may be the Interfaces that are required by its public Ports.
 */
QSet<QInterface *> QComponent::required() const
{
    // This is a read-only derived association end

    qWarning("QComponent::required: to be implemented (this is a derived associationend)");

    return QSet<QInterface *>(); // change here to your derived return
}

/*!
    The interfaces that the component exposes to its environment. These interfaces may be Realized by the Component or any of its realizingClassifiers, or they may be the Interfaces that are provided by its public Ports.
 */
QSet<QInterface *> QComponent::provided() const
{
    // This is a read-only derived association end

    qWarning("QComponent::provided: to be implemented (this is a derived associationend)");

    return QSet<QInterface *>(); // change here to your derived return
}

/*!
    The set of PackageableElements that a Component owns. In the namespace of a component, all model elements that are involved in or related to its definition may be owned or imported explicitly. These may include e.g. Classes, Interfaces, Components, Packages, Use cases, Dependencies (e.g. mappings), and Artifacts.
 */
QSet<QPackageableElement *> QComponent::packagedElements() const
{
    // This is a read-write association end

    Q_D(const QComponent);
    return d->packagedElements;
}

void QComponent::addPackagedElement(QPackageableElement *packagedElement)
{
    // This is a read-write association end

    Q_D(QComponent);
    if (!d->packagedElements.contains(packagedElement)) {
        d->packagedElements.insert(packagedElement);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QNamespacePrivate *>(d))->addOwnedMember(qwrappedobject_cast<QNamedElement *>(packagedElement));
    }
}

void QComponent::removePackagedElement(QPackageableElement *packagedElement)
{
    // This is a read-write association end

    Q_D(QComponent);
    if (d->packagedElements.contains(packagedElement)) {
        d->packagedElements.remove(packagedElement);

        // Adjust subsetted property(ies)
        (qwrappedobject_cast<QNamespacePrivate *>(d))->removeOwnedMember(qwrappedobject_cast<QNamedElement *>(packagedElement));
    }
}

/*!
    Utility returning the set of realized interfaces of a component.
 */
QSet<QInterface *> QComponent::realizedInterfaces(const QClassifier *classifier) const
{
    qWarning("QComponent::realizedInterfaces: operation to be implemented");
    Q_UNUSED(classifier);

    return QSet<QInterface *>(); // change here to your derived return
}

/*!
    Utility returning the set of used interfaces of a component.
 */
QSet<QInterface *> QComponent::usedInterfaces(const QClassifier *classifier) const
{
    qWarning("QComponent::usedInterfaces: operation to be implemented");
    Q_UNUSED(classifier);

    return QSet<QInterface *>(); // change here to your derived return
}

void QComponent::setPropertyData()
{
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("isIndirectlyInstantiated : Boolean {default = true} The kind of instantiation that applies to a Component. If false, the component is instantiated as an addressable object. If true, the Component is defined at design-time, but at run-time (or execution-time) an object specified by the Component does not exist, that is, the component is instantiated indirectly, through the instantiation of its realizing classifiers or parts. Several standard stereotypes use this meta attribute (e.g., «specification», «focus», «subsystem»).");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("isIndirectlyInstantiated")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("composite");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("The set of Realizations owned by the Component. Realizations reference the Classifiers of which the Component is an abstraction; i.e., that realize its behavior.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("QElement::ownedElements");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("realizations")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("QComponentRealization::abstraction");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("The interfaces that the component requires from other components in its environment in order to be able to offer its full set of provided functionality. These interfaces may be used by the Component or any of its realizingClassifiers, or they may be the Interfaces that are required by its public Ports.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("required")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("none");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("The interfaces that the component exposes to its environment. These interfaces may be Realized by the Component or any of its realizingClassifiers, or they may be the Interfaces that are provided by its public Ports.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("provided")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::AggregationRole] = QString::fromLatin1("composite");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::IsDerivedUnionRole] = false;
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::DocumentationRole] = QString::fromLatin1("The set of PackageableElements that a Component owns. In the namespace of a component, all model elements that are involved in or related to its definition may be owned or imported explicitly. These may include e.g. Classes, Interfaces, Components, Packages, Use cases, Dependencies (e.g. mappings), and Artifacts.");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::RedefinedPropertiesRole] = QString::fromLatin1("");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::SubsettedPropertiesRole] = QString::fromLatin1("QNamespace::ownedMembers");
    QWrappedObject::propertyDataHash[QString::fromLatin1("QComponent")][QString::fromLatin1("packagedElements")][QtWrappedObjects::OppositeEndRole] = QString::fromLatin1("");

    QClass::setPropertyData();
}

#include "moc_qcomponent.cpp"

QT_END_NAMESPACE_QTUML