umlobject.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) 2002-2007 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef UMLOBJECT_H 00013 #define UMLOBJECT_H 00014 00015 //qt includes 00016 #include <qobject.h> 00017 #include <qstring.h> 00018 #include <qdom.h> 00019 00020 #include "umlnamespace.h" 00021 #include "umlpackagelist.h" 00022 00023 class kdbgstream; 00024 class UMLStereotype; 00025 class UMLObject; 00026 00036 class UMLObject : public QObject { 00037 Q_OBJECT 00038 public: 00039 00048 UMLObject(const UMLObject * parent, const QString &name, Uml::IDType id = Uml::id_None); 00049 00055 UMLObject(const UMLObject * parent); 00056 00063 explicit UMLObject(const QString &name = "" , Uml::IDType id = Uml::id_None); 00064 00068 virtual bool operator==(UMLObject & rhs ); 00069 00073 virtual ~UMLObject(); 00074 00079 virtual void copyInto(UMLObject *rhs) const; 00080 00085 virtual UMLObject* clone() const = 0; 00086 00092 Uml::Object_Type getBaseType() const; 00093 00099 virtual void setBaseType(Uml::Object_Type ot); 00100 00106 virtual Uml::IDType getID() const; 00107 00113 void setDoc(const QString &d); 00114 00120 QString getDoc() const; 00121 00127 Uml::Visibility getVisibility() const; 00128 00134 void setVisibility(Uml::Visibility s); 00135 00142 void setStereotype(const QString &_name); 00143 00153 void setUMLStereotype(UMLStereotype *s); 00154 00161 void setPackage(const QString &_name); 00162 00168 void setUMLPackage(UMLPackage* pPkg); 00169 00175 const UMLStereotype * getUMLStereotype(); 00176 00185 QString getStereotype(bool includeAdornments = false) const; 00186 00199 QString getPackage(QString separator = QString::null, 00200 bool includeRoot = false); 00201 00210 UMLPackageList getPackages(bool includeRoot = false) const; 00211 00217 UMLPackage* getUMLPackage(); 00218 00222 virtual void setID(Uml::IDType NewID); 00223 00227 QString getName() const; 00228 00232 void setName(const QString &strName); 00233 00245 virtual QString getFullyQualifiedName(QString separator = QString::null, 00246 bool includeRoot = false) const; 00247 00251 bool getAbstract() const; 00252 00256 void setAbstract(bool bAbstract); 00257 00261 void setInPaste(bool bInPaste = true); 00262 00272 bool showProperties(int page = 0, bool assoc = false); 00273 00285 virtual bool resolveRef(); 00286 00293 virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement ) = 0; 00294 00303 virtual bool loadFromXMI( QDomElement & element ); 00304 00309 bool getStatic() const; 00310 00311 00315 void setStatic(bool bStatic); 00316 00329 virtual bool acceptAssociationType(Uml::Association_Type); 00330 00334 QString getSecondaryId() const; 00335 00341 void setSecondaryId(const QString& id); 00342 00347 QString getSecondaryFallback() const; 00348 00353 void setSecondaryFallback(const QString& id); 00354 00361 QDomElement save( const QString &tag, QDomDocument & qDoc ); 00362 00363 public slots: 00369 void emitModified(); 00370 00371 signals: 00377 void modified(); 00378 00379 protected: 00383 virtual void init(); 00384 00389 void maybeSignalObjectCreated(); 00390 00397 virtual bool load( QDomElement& element ); 00398 00402 Uml::IDType m_nId; 00403 00407 QString m_Doc; 00408 00412 UMLPackage* m_pUMLPackage; 00413 00417 UMLStereotype* m_pStereotype; 00418 00422 QString m_Name; 00423 00427 Uml::Object_Type m_BaseType; 00428 00432 Uml::Visibility m_Vis; 00433 00437 bool m_bAbstract; 00438 00443 bool m_bStatic; 00444 00448 bool m_bInPaste; 00449 00453 bool m_bCreationWasSignalled; 00454 00461 UMLObject* m_pSecondary; 00462 00468 QString m_SecondaryId; 00469 00478 QString m_SecondaryFallback; 00479 }; 00480 00485 kdbgstream& operator<< (kdbgstream& s, const UMLObject& a); 00486 00487 #endif
