diff options
Diffstat (limited to 'src/uml/qumlliteralstring.cpp')
-rw-r--r-- | src/uml/qumlliteralstring.cpp | 333 |
1 files changed, 26 insertions, 307 deletions
diff --git a/src/uml/qumlliteralstring.cpp b/src/uml/qumlliteralstring.cpp index e21e701e..5eeb4d5a 100644 --- a/src/uml/qumlliteralstring.cpp +++ b/src/uml/qumlliteralstring.cpp @@ -40,276 +40,61 @@ ****************************************************************************/ #include "qumlliteralstring.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/qumlliteralstringobject_p.h" /*! - \class UmlLiteralString + \class QUmlLiteralString \inmodule QtUml \brief A literal string is a specification of a string value. */ - -QUmlLiteralString::QUmlLiteralString(QObject *parent) : - QObject(parent) -{ -} - -// OWNED ATTRIBUTES [Element] - -/*! - The Comments owned by this element. - */ -const QSet<QUmlComment *> QUmlLiteralString::ownedComment() const -{ - return *(reinterpret_cast<const QSet<QUmlComment *> *>(&_ownedComment)); -} - -/*! - The Elements owned by this element. - */ -const QSet<QUmlElement *> QUmlLiteralString::ownedElement() const +QUmlLiteralString::QUmlLiteralString(bool createQObject) { - return *(reinterpret_cast<const QSet<QUmlElement *> *>(&_ownedElement)); + if (createQObject) + _qObject = new QUmlLiteralStringObject(this); } -/*! - The Element that owns this element. - */ -QUmlElement *QUmlLiteralString::owner() const +QUmlLiteralString::~QUmlLiteralString() { - 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 *> QUmlLiteralString::clientDependency() const -{ - return *(reinterpret_cast<const QSet<QUmlDependency *> *>(&_clientDependency)); -} - -/*! - The name of the NamedElement. - */ -QString QUmlLiteralString::name() const -{ - return _name; -} - -/*! - The string expression used to define the name of this named element. - */ -QUmlStringExpression *QUmlLiteralString::nameExpression() const -{ - return reinterpret_cast<QUmlStringExpression *>(_nameExpression); -} - -/*! - Specifies the namespace that owns the NamedElement. - */ -QUmlNamespace *QUmlLiteralString::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 QUmlLiteralString::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 *QUmlLiteralString::type() const -{ - return reinterpret_cast<QUmlType *>(_type); -} - -// OWNED ATTRIBUTES [ParameterableElement] - -/*! - The formal template parameter that owns this element. - */ -QUmlTemplateParameter *QUmlLiteralString::owningTemplateParameter() const -{ - return reinterpret_cast<QUmlTemplateParameter *>(_owningTemplateParameter); -} - -/*! - The template parameter that exposes this element as a formal parameter. - */ -QUmlTemplateParameter *QUmlLiteralString::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 QUmlLiteralString::visibility() const -{ - return _visibility; -} - -// OWNED ATTRIBUTES [LiteralString] +// OWNED ATTRIBUTES /*! The specified String value. */ -QString QUmlLiteralString::value() const -{ - return _value; -} - -// OPERATIONS [Element] - -/*! - The query allOwnedElements() gives all of the direct and indirect owned elements of an element. - */ -QSet<QUmlElement *> QUmlLiteralString::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 QUmlLiteralString::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 *> QUmlLiteralString::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 *> QUmlLiteralString::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 QUmlLiteralString::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 QUmlLiteralString::separator() const +QString +QUmlLiteralString::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 QUmlLiteralString::isTemplateParameter() const -{ - return UmlParameterableElement::isTemplateParameter(); -} - -// OPERATIONS [ValueSpecification] - -/*! - The query booleanValue() gives a single Boolean value when one can be computed. - */ -bool QUmlLiteralString::booleanValue() const -{ - return UmlValueSpecification::booleanValue(); + return _value; } -/*! - The query integerValue() gives a single Integer value when one can be computed. - */ -int QUmlLiteralString::integerValue() const +void QUmlLiteralString::setValue(QString value) { - return UmlValueSpecification::integerValue(); -} + // This is a read-write property -/*! - 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 QUmlLiteralString::isCompatibleWith(QUmlParameterableElement *p) const -{ - return UmlValueSpecification::isCompatibleWith(p); + if (_value != value) { + _value = value; + } } -/*! - The query isNull() returns true when it can be computed that the value is null. - */ -bool QUmlLiteralString::isNull() const -{ - return UmlValueSpecification::isNull(); -} - -/*! - The query realValue() gives a single Real value when one can be computed. - */ -double QUmlLiteralString::realValue() const -{ - return UmlValueSpecification::realValue(); -} - -/*! - The query unlimitedValue() gives a single UnlimitedNatural value when one can be computed. - */ -int QUmlLiteralString::unlimitedValue() const -{ - return UmlValueSpecification::unlimitedValue(); -} - -// OPERATIONS [LiteralString] +// OPERATIONS /*! The query isComputable() is redefined to be true. */ bool QUmlLiteralString::isComputable() const { - return UmlLiteralString::isComputable(); + qWarning("UmlLiteralString::isComputable(): to be implemented (operation)"); + + return bool (); } /*! @@ -317,74 +102,8 @@ bool QUmlLiteralString::isComputable() const */ QString QUmlLiteralString::stringValue() const { - return UmlLiteralString::stringValue(); -} - -// SLOTS FOR OWNED ATTRIBUTES [Element] - -void QUmlLiteralString::addOwnedComment(UmlComment *ownedComment) -{ - UmlElement::addOwnedComment(ownedComment); -} - -void QUmlLiteralString::removeOwnedComment(UmlComment *ownedComment) -{ - UmlElement::removeOwnedComment(ownedComment); -} - -// SLOTS FOR OWNED ATTRIBUTES [NamedElement] - -void QUmlLiteralString::addClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::addClientDependency(clientDependency); -} - -void QUmlLiteralString::removeClientDependency(UmlDependency *clientDependency) -{ - UmlNamedElement::removeClientDependency(clientDependency); -} - -void QUmlLiteralString::setName(QString name) -{ - UmlNamedElement::setName(name); -} - -void QUmlLiteralString::setNameExpression(QUmlStringExpression *nameExpression) -{ - UmlNamedElement::setNameExpression(nameExpression); -} -// SLOTS FOR OWNED ATTRIBUTES [TypedElement] - -void QUmlLiteralString::setType(QUmlType *type) -{ - UmlTypedElement::setType(type); -} + qWarning("UmlLiteralString::stringValue(): to be implemented (operation)"); -// SLOTS FOR OWNED ATTRIBUTES [ParameterableElement] - -void QUmlLiteralString::setOwningTemplateParameter(QUmlTemplateParameter *owningTemplateParameter) -{ - UmlParameterableElement::setOwningTemplateParameter(owningTemplateParameter); -} - -void QUmlLiteralString::setTemplateParameter(QUmlTemplateParameter *templateParameter) -{ - UmlParameterableElement::setTemplateParameter(templateParameter); + return QString (); } -// SLOTS FOR OWNED ATTRIBUTES [PackageableElement] - -void QUmlLiteralString::setVisibility(QtUml::VisibilityKind visibility) -{ - UmlPackageableElement::setVisibility(visibility); -} - -// SLOTS FOR OWNED ATTRIBUTES [LiteralString] - -void QUmlLiteralString::setValue(QString value) -{ - UmlLiteralString::setValue(value); -} - -QT_END_NAMESPACE - |