diff options
Diffstat (limited to 'src/uml/qumlliteralboolean.cpp')
-rw-r--r-- | src/uml/qumlliteralboolean.cpp | 334 |
1 files changed, 27 insertions, 307 deletions
diff --git a/src/uml/qumlliteralboolean.cpp b/src/uml/qumlliteralboolean.cpp index 8fbf516b..d91b49cf 100644 --- a/src/uml/qumlliteralboolean.cpp +++ b/src/uml/qumlliteralboolean.cpp @@ -40,276 +40,62 @@ ****************************************************************************/ #include "qumlliteralboolean.h" -#include <QtUml/QUmlComment> -#include <QtUml/QUmlDependency> -#include <QtUml/QUmlElement> -#include <QtUml/QUmlNamedElement> -#include <QtUml/QUmlNamespace> -#include <QtUml/QUmlPackage> -#include <QtUml/QUmlParameterableElement> -#include <QtUml/QUmlStringExpression> -#include <QtUml/QUmlTemplateParameter> -#include <QtUml/QUmlType> - -QT_BEGIN_NAMESPACE +#include "private/qumlliteralbooleanobject_p.h" /*! - \class UmlLiteralBoolean + \class QUmlLiteralBoolean \inmodule QtUml \brief A literal Boolean is a specification of a Boolean value. */ - -QUmlLiteralBoolean::QUmlLiteralBoolean(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlLiteralBoolean::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlLiteralBoolean::ownedElement() const +QUmlLiteralBoolean::QUmlLiteralBoolean(bool createQObject) : + _value(false) { - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); + if (createQObject) + _qObject = new QUmlLiteralBooleanObject(this); } -/*! - The Element that owns this element. - */ -QUmlElement *QUmlLiteralBoolean::owner() const +QUmlLiteralBoolean::~QUmlLiteralBoolean() { - return reinterpret_cast<QUmlElement *>(_owner); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlLiteralBoolean::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlLiteralBoolean::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlLiteralBoolean::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlLiteralBoolean::namespace_() const -{ - return reinterpret_cast<QUmlNamespace *>(_namespace_); -} - -/*! - A name which allows the NamedElement to be identified within a hierarchy of nested Namespaces. It is constructed from the names of the containing namespaces starting at the root of the hierarchy and ending with the name of the NamedElement itself. - */ -QString QUmlLiteralBoolean::qualifiedName() const -{ - return UmlNamedElement::qualifiedName(); -} -// OWNED ATTRIBUTES [TypedElement] - -/*! - This information is derived from the return result for this Operation.The type of the TypedElement. - */ -QUmlType *QUmlLiteralBoolean::type() const -{ - return reinterpret_cast<QUmlType *>(_type); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlLiteralBoolean::owningTemplateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} - -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlLiteralBoolean::templateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_templateParameter); -} - -// OWNED ATTRIBUTES [PackageableElement] - -/*! - Indicates that packageable elements must always have a visibility, i.e., visibility is not optional. - */ -QtUml::VisibilityKind QUmlLiteralBoolean::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [LiteralBoolean] +// OWNED ATTRIBUTES /*! The specified Boolean value. */ -bool QUmlLiteralBoolean::value() const -{ - return _value; -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlLiteralBoolean::allOwnedElements() const -{ - QSet<QUmlElement *> r; - foreach (UmlElement *element, UmlElement::allOwnedElements()) - r.insert(reinterpret_cast<QUmlElement *>(element)); - return r; -} - -/*! - The query mustBeOwned() indicates whether elements of this type must have an owner. Subclasses of Element that do not require an owner must override this operation. - */ -bool QUmlLiteralBoolean::mustBeOwned() const -{ - return UmlElement::mustBeOwned(); -} - -// OPERATIONS [NamedElement] - -/*! - The query allNamespaces() gives the sequence of namespaces in which the NamedElement is nested, working outwards. - */ -QList<QUmlNamespace *> QUmlLiteralBoolean::allNamespaces() const -{ - QList<QUmlNamespace *> r; - foreach (UmlNamespace *element, UmlNamedElement::allNamespaces()) - r.append(reinterpret_cast<QUmlNamespace *>(element)); - return r; -} - -/*! - The query allOwningPackages() returns all the directly or indirectly owning packages. - */ -QSet<QUmlPackage *> QUmlLiteralBoolean::allOwningPackages() const -{ - QSet<QUmlPackage *> r; - foreach (UmlPackage *element, UmlNamedElement::allOwningPackages()) - r.insert(reinterpret_cast<QUmlPackage *>(element)); - return r; -} - -/*! - The query isDistinguishableFrom() determines whether two NamedElements may logically co-exist within a Namespace. By default, two named elements are distinguishable if (a) they have unrelated types or (b) they have related types but different names. - */ -bool QUmlLiteralBoolean::isDistinguishableFrom(QUmlNamedElement *n, QUmlNamespace *ns) const -{ - return UmlNamedElement::isDistinguishableFrom(n, ns); -} - -/*! - The query separator() gives the string that is used to separate names when constructing a qualified name. - */ -QString QUmlLiteralBoolean::separator() const +bool +QUmlLiteralBoolean::value() const { - return UmlNamedElement::separator(); -} - -// OPERATIONS [ParameterableElement] + // This is a read-write property -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlLiteralBoolean::isTemplateParameter() const -{ - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [ValueSpecification] - -/*! - The query integerValue() gives a single Integer value when one can be computed. - */ -int QUmlLiteralBoolean::integerValue() const -{ - return UmlValueSpecification::integerValue(); + return _value; } -/*! - The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. In addition, for ValueSpecification, the type must be conformant with the type of the specified parameterable element. - */ -bool QUmlLiteralBoolean::isCompatibleWith(QUmlParameterableElement *p) const +void QUmlLiteralBoolean::setValue(bool value) { - return UmlValueSpecification::isCompatibleWith(p); -} + // This is a read-write property -/*! - The query isNull() returns true when it can be computed that the value is null. - */ -bool QUmlLiteralBoolean::isNull() const -{ - return UmlValueSpecification::isNull(); + if (_value != value) { + _value = value; + } } -/*! - The query realValue() gives a single Real value when one can be computed. - */ -double QUmlLiteralBoolean::realValue() const -{ - return UmlValueSpecification::realValue(); -} - -/*! - The query stringValue() gives a single String value when one can be computed. - */ -QString QUmlLiteralBoolean::stringValue() const -{ - return UmlValueSpecification::stringValue(); -} - -/*! - The query unlimitedValue() gives a single UnlimitedNatural value when one can be computed. - */ -int QUmlLiteralBoolean::unlimitedValue() const -{ - return UmlValueSpecification::unlimitedValue(); -} - -// OPERATIONS [LiteralBoolean] +// OPERATIONS /*! The query booleanValue() gives the value. */ bool QUmlLiteralBoolean::booleanValue() const { - return UmlLiteralBoolean::booleanValue(); + qWarning("UmlLiteralBoolean::booleanValue(): to be implemented (operation)"); + + return bool (); } /*! @@ -317,74 +103,8 @@ bool QUmlLiteralBoolean::booleanValue() const */ bool QUmlLiteralBoolean::isComputable() const { - return UmlLiteralBoolean::isComputable(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlLiteralBoolean::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlLiteralBoolean::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlLiteralBoolean::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlLiteralBoolean::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlLiteralBoolean::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlLiteralBoolean::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [TypedElement] - -void QUmlLiteralBoolean::setType(QUmlType *type) -{ - UmlTypedElement::setType(type); -} + qWarning("UmlLiteralBoolean::isComputable(): to be implemented (operation)"); -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlLiteralBoolean::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlLiteralBoolean::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); + return bool (); } -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlLiteralBoolean::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [LiteralBoolean] - -void QUmlLiteralBoolean::setValue(bool value) -{ - UmlLiteralBoolean::setValue(value); -} - -QT_END_NAMESPACE - |