umbrello API Documentation

association.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2003-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 #ifndef ASSOCIATION_H
00013 #define ASSOCIATION_H
00014 
00015 #include <qdom.h>
00016 #include "umlnamespace.h"
00017 #include "umlobject.h"
00018 
00019 class UMLDoc;
00020 class UMLRole;
00021 
00033 class UMLAssociation : public UMLObject {
00034     Q_OBJECT
00035     friend class AssociationWidget;
00036 public:
00045     UMLAssociation(Uml::Association_Type type, UMLObject *roleA, UMLObject *roleB);
00046 
00055     UMLAssociation(Uml::Association_Type type = Uml::at_Unknown);
00056 
00060     bool operator==(UMLAssociation &rhs);
00061 
00065     virtual ~UMLAssociation();
00066 
00070     QString toString( ) const;
00071 
00078     static QString typeAsString(Uml::Association_Type atype);
00079 
00084     static bool assocTypeHasUMLRepresentation(Uml::Association_Type atype);
00085 
00091     Uml::Association_Type getAssocType() const;
00092 
00098     UMLObject* getObject(Uml::Role_Type role);
00099 
00106     Uml::IDType getObjectId(Uml::Role_Type role);
00107 
00108     /*
00109      * Returns the ID of the UMLObject assigned to the given role.
00110      * CURRENTLY UNUSED.
00111      *
00112      * @return  ID of the UMLObject of the given role.
00113     Uml::IDType getRoleId(Uml::Role_Type role) const;
00114      */
00115 
00121     Uml::Changeability_Type getChangeability(Uml::Role_Type role) const;
00122 
00128     Uml::Visibility getVisibility(Uml::Role_Type role) const;
00129 
00135     QString getMulti(Uml::Role_Type role) const;
00136 
00142     QString getRoleName(Uml::Role_Type role) const;
00143 
00149     QString getRoleDoc(Uml::Role_Type role) const;
00150 
00156     void setAssocType(Uml::Association_Type assocType);
00157 
00163     void setObject(UMLObject *obj, Uml::Role_Type role);
00164 
00170     void setVisibility(Uml::Visibility value, Uml::Role_Type role);
00171 
00177     void setChangeability(Uml::Changeability_Type value, Uml::Role_Type role);
00178 
00184     void setMulti(const QString &multi, Uml::Role_Type role);
00185 
00192     void setRoleName(const QString &roleName, Uml::Role_Type role);
00193 
00199     void setRoleDoc(const QString &doc, Uml::Role_Type role);
00200 
00206     static QString ChangeabilityToString(Uml::Changeability_Type type);
00207 
00213     UMLRole * getUMLRole(Uml::Role_Type role);
00214 
00220     void setOldLoadMode(bool value = true);
00221 
00225     bool getOldLoadMode() const;
00226 
00231     virtual UMLObject* clone() const { return NULL; }
00232 
00241     virtual bool resolveRef();
00242 
00247     void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
00248 
00249 protected:
00254     bool load(QDomElement& element);
00255 
00256     // keep track of number of parent widgets
00257     int nrof_parent_widgets;
00258 
00266     void init(Uml::Association_Type type, UMLObject *roleAObj, UMLObject *roleBObj);
00267 
00268     /* If the type Uml::Association_Type is changed then also the following
00269        must be changed accordingly:
00270        atypeFirst, atypeLast, assocTypeStr[], toAssocType(), toString().
00271        The ordering within assocTypeStr must match the enumeration
00272        order of Uml::Association_Type.
00273      */
00274     static const Uml::Association_Type atypeFirst;
00275     static const Uml::Association_Type atypeLast;
00276     static const unsigned int nAssocTypes;
00277     static const QString assocTypeStr[];
00278 
00279     UMLRole * m_pRole[2];
00280 
00281     Uml::Association_Type m_AssocType;
00282     QString m_Name;
00283     bool m_bOldLoadMode;
00284 };
00285 
00286 #endif
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:07:54 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003