entity.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-2007 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef ENTITY_H 00013 #define ENTITY_H 00014 00015 #include "classifier.h" 00016 00017 class UMLEntityAttribute; 00018 00029 class UMLEntity : public UMLClassifier { 00030 Q_OBJECT 00031 public: 00038 explicit UMLEntity(const QString& name = "", Uml::IDType id = Uml::id_None); 00039 00043 virtual ~UMLEntity(); 00044 00048 bool operator==(UMLEntity& rhs); 00049 00054 virtual void copyInto(UMLEntity* rhs) const; 00055 00059 virtual UMLObject* clone() const; 00060 00069 UMLAttribute* createAttribute(const QString &name = QString::null, 00070 UMLObject *type = 0); 00071 00080 UMLObject* addEntityAttribute(const QString &name, Uml::IDType id = Uml::id_None); 00081 00090 bool addEntityAttribute(UMLEntityAttribute* att, IDChangeLog* Log = 0); 00091 00101 //TODO: give default value -1 to position (append) - now it conflicts with the method above.. 00102 bool addEntityAttribute(UMLEntityAttribute* att, int position ); 00103 00111 int removeEntityAttribute(UMLClassifierListItem* a); 00112 00116 void signalEntityAttributeRemoved(UMLClassifierListItem *eattr); 00117 00123 int entityAttributes(); 00124 00129 virtual bool resolveRef(); 00130 00134 virtual void saveToXMI(QDomDocument& qDoc, QDomElement& qElement); 00135 00136 signals: 00137 void entityAttributeAdded(UMLClassifierListItem*); 00138 void entityAttributeRemoved(UMLClassifierListItem*); 00139 00140 protected: 00144 bool load(QDomElement& element); 00145 00146 private: 00150 void init(); 00151 00152 }; 00153 00154 #endif // ENTITY_H 00155
