umbrello/umbrello
association.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef ASSOCIATION_H
00012 #define ASSOCIATION_H
00013
00014 #include <qdom.h>
00015
00016 #include "umlnamespace.h"
00017 #include "umlobject.h"
00018
00019 class UMLRole;
00020
00031 class UMLAssociation : public UMLObject
00032 {
00033 Q_OBJECT
00034 friend class AssociationWidget;
00035 public:
00036
00037 UMLAssociation(Uml::Association_Type type, UMLObject *roleA, UMLObject *roleB);
00038 UMLAssociation(Uml::Association_Type type = Uml::at_Unknown);
00039
00040 virtual ~UMLAssociation();
00041
00042 bool operator==(const UMLAssociation &rhs);
00043
00044 QString toString() const;
00045
00046 static QString toString(Uml::Association_Type atype);
00047 static QString toString(Uml::Changeability_Type type);
00048
00049 static bool assocTypeHasUMLRepresentation(Uml::Association_Type atype);
00050
00051 UMLRole * getUMLRole(Uml::Role_Type role) const;
00052 Uml::IDType getObjectId(Uml::Role_Type role) const;
00053 Uml::IDType getRoleId(Uml::Role_Type role) const;
00054
00055 void setAssocType(Uml::Association_Type assocType);
00056 Uml::Association_Type getAssocType() const;
00057
00058 void setObject(UMLObject *obj, Uml::Role_Type role);
00059 UMLObject* getObject(Uml::Role_Type role) const;
00060
00061 void setVisibility(Uml::Visibility value, Uml::Role_Type role);
00062 Uml::Visibility getVisibility(Uml::Role_Type role) const;
00063
00064 void setChangeability(Uml::Changeability_Type value, Uml::Role_Type role);
00065 Uml::Changeability_Type getChangeability(Uml::Role_Type role) const;
00066
00067 void setMulti(const QString &multi, Uml::Role_Type role);
00068 QString getMulti(Uml::Role_Type role) const;
00069
00070 void setRoleName(const QString &roleName, Uml::Role_Type role);
00071 QString getRoleName(Uml::Role_Type role) const;
00072
00073 void setRoleDoc(const QString &doc, Uml::Role_Type role);
00074 QString getRoleDoc(Uml::Role_Type role) const;
00075
00076 void setOldLoadMode(bool value = true);
00077 bool getOldLoadMode() const;
00078
00079 virtual UMLObject* clone() const { return NULL; }
00080
00081 virtual bool resolveRef();
00082
00083 void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
00084
00085 protected:
00086
00087 bool load(QDomElement& element);
00088
00089
00090 int nrof_parent_widgets;
00091
00092 void init(Uml::Association_Type type, UMLObject *roleAObj, UMLObject *roleBObj);
00093
00094
00095
00096
00097
00098
00099
00100 static const Uml::Association_Type atypeFirst;
00101 static const Uml::Association_Type atypeLast;
00102 static const unsigned int nAssocTypes;
00103 static const QString assocTypeStr[];
00104
00105 UMLRole * m_pRole[2];
00106 Uml::Association_Type m_AssocType;
00107 QString m_Name;
00108 bool m_bOldLoadMode;
00109
00110 private:
00111
00112 bool isRealization(UMLObject* objA, UMLObject* objB) const;
00113 };
00114
00115 #endif