umbrello/umbrello
classifier.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef CLASSIFIER__H
00013 #define CLASSIFIER__H
00014
00015 #include "package.h"
00016 #include "umlattributelist.h"
00017 #include "umloperationlist.h"
00018 #include "umlclassifierlistitemlist.h"
00019 #include "classifierlistitem.h"
00020 #include "umltemplatelist.h"
00021 #include "model_utils.h"
00022
00023
00024 class UMLAssociation;
00025 class IDChangeLog;
00026
00041 class UMLClassifier : public UMLPackage
00042 {
00043 Q_OBJECT
00044 public:
00045
00049 enum ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE };
00050
00051
00058 explicit UMLClassifier(const QString & name = QString(), Uml::IDType id = Uml::id_None);
00059
00063 virtual ~UMLClassifier();
00064
00068 bool operator==(const UMLClassifier & rhs );
00069
00074 virtual void copyInto(UMLObject *lhs) const;
00075
00079 UMLObject* clone() const;
00080
00090 virtual UMLAttribute* createAttribute(const QString &name = QString(),
00091 UMLObject *type = 0,
00092 Uml::Visibility vis = Uml::Visibility::Private,
00093 const QString &init = QString());
00094
00107 UMLAttribute* addAttribute(const QString &name, Uml::IDType id = Uml::id_None);
00108
00109 UMLAttribute* addAttribute(const QString &name, UMLObject *type, Uml::Visibility scope);
00110
00123 bool addAttribute(UMLAttribute* Att, IDChangeLog* Log = 0,
00124 int position = -1);
00125
00133 int removeAttribute(UMLAttribute *a);
00134
00140 int attributes() ;
00141
00149 UMLAttributeList getAttributeList() const;
00150
00157 UMLAttributeList getAttributeList(Uml::Visibility scope) const;
00158
00165 UMLAttributeList getAttributeListStatic(Uml::Visibility scope) const;
00166
00188 UMLOperation* createOperation( const QString &name = QString(),
00189 bool *isExistingOp = NULL,
00190 Model_Utils::NameAndType_List *params = NULL);
00191
00203 bool addOperation(UMLOperation* Op, int position = -1);
00204
00214 bool addOperation(UMLOperation* Op, IDChangeLog* Log);
00215
00227 UMLOperation * checkOperationSignature( const QString& name,
00228 UMLAttributeList opParams,
00229 UMLOperation *exemptOp = NULL);
00230
00240 int removeOperation(UMLOperation *op);
00241
00247 int operations() ;
00248
00255 UMLOperationList getOpList(bool includeInherited = false);
00256
00262 UMLObject* createTemplate(const QString& name = QString());
00263
00271 UMLTemplate* addTemplate(const QString &name, Uml::IDType id = Uml::id_None);
00272
00281 bool addTemplate(UMLTemplate* newTemplate, IDChangeLog* log = 0);
00282
00292
00293
00294 bool addTemplate(UMLTemplate* Template, int position);
00295
00303 int removeTemplate(UMLTemplate* umltemplate);
00304
00308 UMLTemplate *findTemplate(const QString& name);
00309
00315 int templates();
00316
00324 UMLTemplateList getTemplateList() const;
00325
00334 int takeItem(UMLClassifierListItem* item);
00335
00343 virtual UMLClassifierListItemList getFilteredList(Uml::Object_Type ot) const;
00344
00353 virtual bool resolveRef();
00354
00361 UMLOperationList findOperations(const QString &n);
00362
00371 virtual UMLObject* findChildObjectById(Uml::IDType id, bool considerAncestors = false);
00372
00381 UMLOperation* findOperation(const QString& name,
00382 Model_Utils::NameAndType_List params);
00383
00390 UMLClassifierList findSuperClassConcepts(ClassifierType type = ALL);
00391
00398 UMLClassifierList findSubClassConcepts(ClassifierType type = ALL);
00399
00401 virtual bool acceptAssociationType(Uml::Association_Type);
00402
00407 void setClassAssoc(UMLAssociation *assoc);
00408
00414 UMLAssociation *getClassAssoc() const;
00415
00420 void setBaseType(Uml::Object_Type ot);
00421
00425 bool isInterface() const;
00426
00430 bool isDatatype() const;
00431
00435 void setOriginType(UMLClassifier *origType);
00436
00440 UMLClassifier * originType() const;
00441
00445 void setIsReference(bool isRef = true);
00446
00450 bool isReference() const;
00451
00455 bool hasAbstractOps();
00456
00460 bool hasAssociations();
00461
00465 bool hasAttributes();
00466
00470 bool hasStaticAttributes();
00471
00475 bool hasMethods();
00476
00480 bool hasAccessorMethods();
00481
00485 bool hasOperationMethods();
00486
00490 bool hasVectorFields();
00491
00497
00498
00499
00500
00508 UMLClassifierListItem* makeChildObject(const QString& xmiTag);
00509
00513 virtual UMLAssociationList getUniAssociationToBeImplemented();
00514
00515 signals:
00518 void operationAdded(UMLClassifierListItem *);
00519
00522 void operationRemoved(UMLClassifierListItem *);
00523
00524 void templateAdded(UMLClassifierListItem*);
00525 void templateRemoved(UMLClassifierListItem*);
00526
00527
00528 void attributeAdded(UMLClassifierListItem*);
00529 void attributeRemoved(UMLClassifierListItem*);
00530
00531 private:
00532
00533 UMLAssociation *m_pClassAssoc;
00534
00535 bool m_isRef;
00536
00543
00544
00545 protected:
00546
00551 void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
00552
00560 virtual bool load(QDomElement& element);
00561
00562 };
00563
00564 #endif // CONCEPT_H