diff options
Diffstat (limited to 'src/uml/qumlliteralreal.cpp')
-rw-r--r-- | src/uml/qumlliteralreal.cpp | 331 |
1 files changed, 25 insertions, 306 deletions
diff --git a/src/uml/qumlliteralreal.cpp b/src/uml/qumlliteralreal.cpp index 6be0e14b..c9fbc69f 100644 --- a/src/uml/qumlliteralreal.cpp +++ b/src/uml/qumlliteralreal.cpp @@ -40,273 +40,58 @@ ****************************************************************************/ #include "qumlliteralreal.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/qumlliteralrealobject_p.h" /*! - \class UmlLiteralReal + \class QUmlLiteralReal \inmodule QtUml \brief A literal real is a specification of a real value. */ - -QUmlLiteralReal::QUmlLiteralReal(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlLiteralReal::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlLiteralReal::ownedElement() const -{ - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); -} - -/*! - The Element that owns this element. - */ -QUmlElement *QUmlLiteralReal::owner() const -{ - return reinterpret_cast<QUmlElement *>(_owner); -} - -// OWNED ATTRIBUTES [NamedElement] - -/*! - Indicates the dependencies that reference the client. - */ -const QSet<QUmlDependency *> QUmlLiteralReal::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlLiteralReal::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlLiteralReal::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlLiteralReal::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 QUmlLiteralReal::qualifiedName() const +QUmlLiteralReal::QUmlLiteralReal(bool createQObject) { - return UmlNamedElement::qualifiedName(); + if (createQObject) + _qObject = new QUmlLiteralRealObject(this); } -// OWNED ATTRIBUTES [TypedElement] -/*! - This information is derived from the return result for this Operation.The type of the TypedElement. - */ -QUmlType *QUmlLiteralReal::type() const +QUmlLiteralReal::~QUmlLiteralReal() { - return reinterpret_cast<QUmlType *>(_type); + if (!deletingFromQObject) { + _qObject->setProperty("deletingFromModelingObject", true); + delete _qObject; + } } -// OWNED ATTRIBUTES [ParameterableElement] +// OWNED ATTRIBUTES -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlLiteralReal::owningTemplateParameter() const +double +QUmlLiteralReal::value() const { - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} + // This is a read-write property -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlLiteralReal::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 QUmlLiteralReal::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [LiteralReal] - -double QUmlLiteralReal::value() const -{ return _value; } -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlLiteralReal::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 QUmlLiteralReal::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 *> QUmlLiteralReal::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 *> QUmlLiteralReal::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 QUmlLiteralReal::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 QUmlLiteralReal::separator() const -{ - return UmlNamedElement::separator(); -} - -// OPERATIONS [ParameterableElement] - -/*! - The query isTemplateParameter() determines if this parameterable element is exposed as a formal template parameter. - */ -bool QUmlLiteralReal::isTemplateParameter() const -{ - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [ValueSpecification] - -/*! - The query booleanValue() gives a single Boolean value when one can be computed. - */ -bool QUmlLiteralReal::booleanValue() const -{ - return UmlValueSpecification::booleanValue(); -} - -/*! - The query integerValue() gives a single Integer value when one can be computed. - */ -int QUmlLiteralReal::integerValue() const -{ - return UmlValueSpecification::integerValue(); -} - -/*! - 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 QUmlLiteralReal::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlValueSpecification::isCompatibleWith(p); -} - -/*! - The query isNull() returns true when it can be computed that the value is null. - */ -bool QUmlLiteralReal::isNull() const -{ - return UmlValueSpecification::isNull(); -} - -/*! - The query stringValue() gives a single String value when one can be computed. - */ -QString QUmlLiteralReal::stringValue() const +void QUmlLiteralReal::setValue(double value) { - return UmlValueSpecification::stringValue(); -} + // This is a read-write property -/*! - The query unlimitedValue() gives a single UnlimitedNatural value when one can be computed. - */ -int QUmlLiteralReal::unlimitedValue() const -{ - return UmlValueSpecification::unlimitedValue(); + if (_value != value) { + _value = value; + } } -// OPERATIONS [LiteralReal] +// OPERATIONS /*! The query isComputable() is redefined to be true. */ bool QUmlLiteralReal::isComputable() const { - return UmlLiteralReal::isComputable(); + qWarning("UmlLiteralReal::isComputable(): to be implemented (operation)"); + + return bool (); } /*! @@ -314,74 +99,8 @@ bool QUmlLiteralReal::isComputable() const */ double QUmlLiteralReal::realValue() const { - return UmlLiteralReal::realValue(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlLiteralReal::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlLiteralReal::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlLiteralReal::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlLiteralReal::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlLiteralReal::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlLiteralReal::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [TypedElement] - -void QUmlLiteralReal::setType(QUmlType *type) -{ - UmlTypedElement::setType(type); -} + qWarning("UmlLiteralReal::realValue(): to be implemented (operation)"); -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlLiteralReal::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlLiteralReal::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); + return double (); } -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlLiteralReal::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [LiteralReal] - -void QUmlLiteralReal::setValue(double value) -{ - UmlLiteralReal::setValue(value); -} - -QT_END_NAMESPACE - |