umbrello/umbrello
classifier.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef CLASSIFIER_H
00011 #define CLASSIFIER_H
00012
00013 #include "package.h"
00014 #include "umlattributelist.h"
00015 #include "umloperationlist.h"
00016 #include "umlclassifierlistitemlist.h"
00017 #include "classifierlistitem.h"
00018 #include "umltemplatelist.h"
00019 #include "model_utils.h"
00020
00021
00022 class UMLAssociation;
00023 class IDChangeLog;
00024
00038 class UMLClassifier : public UMLPackage
00039 {
00040 Q_OBJECT
00041 public:
00042
00046 enum ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE };
00047
00048 explicit UMLClassifier(const QString & name = QString(), Uml::IDType id = Uml::id_None);
00049 virtual ~UMLClassifier();
00050
00051 bool operator==(const UMLClassifier & rhs );
00052
00053 virtual void copyInto(UMLObject *lhs) const;
00054
00055 UMLObject* clone() const;
00056
00057 virtual UMLAttribute* createAttribute(const QString &name = QString(),
00058 UMLObject *type = 0,
00059 Uml::Visibility vis = Uml::Visibility::Private,
00060 const QString &init = QString());
00061
00062 UMLAttribute* addAttribute(const QString &name, Uml::IDType id = Uml::id_None);
00063 UMLAttribute* addAttribute(const QString &name, UMLObject *type, Uml::Visibility scope);
00064
00065 bool addAttribute(UMLAttribute* att, IDChangeLog* log = 0,
00066 int position = -1);
00067
00068 int removeAttribute(UMLAttribute *att);
00069
00070 int attributes() ;
00071
00072 UMLAttributeList getAttributeList() const;
00073 UMLAttributeList getAttributeList(Uml::Visibility scope) const;
00074
00075 UMLAttributeList getAttributeListStatic(Uml::Visibility scope) const;
00076
00077 UMLOperation* createOperation( const QString &name = QString(),
00078 bool *isExistingOp = NULL,
00079 Model_Utils::NameAndType_List *params = NULL);
00080
00081 bool addOperation(UMLOperation* op, int position = -1);
00082 bool addOperation(UMLOperation* op, IDChangeLog* log);
00083
00084 UMLOperation * checkOperationSignature( const QString& name,
00085 UMLAttributeList opParams,
00086 UMLOperation *exemptOp = NULL);
00087
00088 int removeOperation(UMLOperation *op);
00089
00090 int operations() ;
00091
00092 UMLOperationList getOpList(bool includeInherited = false);
00093
00094 UMLObject* createTemplate(const QString& name = QString());
00095
00096 UMLTemplate* addTemplate(const QString &name, Uml::IDType id = Uml::id_None);
00097
00098 bool addTemplate(UMLTemplate* newTemplate, IDChangeLog* log = 0);
00099 bool addTemplate(UMLTemplate* templt, int position);
00100
00101 int removeTemplate(UMLTemplate* umltemplate);
00102
00103 UMLTemplate *findTemplate(const QString& name);
00104
00105 int templates();
00106
00107 UMLTemplateList getTemplateList() const;
00108
00109 int takeItem(UMLClassifierListItem* item);
00110
00111 virtual UMLClassifierListItemList getFilteredList(Uml::Object_Type ot) const;
00112
00113 virtual bool resolveRef();
00114
00115 UMLOperationList findOperations(const QString &n);
00116
00117 virtual UMLObject* findChildObjectById(Uml::IDType id, bool considerAncestors = false);
00118
00119 UMLOperation* findOperation(const QString& name,
00120 Model_Utils::NameAndType_List params);
00121
00122 UMLClassifierList findSuperClassConcepts(ClassifierType type = ALL);
00123
00124 UMLClassifierList findSubClassConcepts(ClassifierType type = ALL);
00125
00126 virtual bool acceptAssociationType(Uml::Association_Type);
00127
00128 void setClassAssoc(UMLAssociation *assoc);
00129
00130 UMLAssociation *getClassAssoc() const;
00131
00132 void setBaseType(Uml::Object_Type ot);
00133
00134 bool isInterface() const;
00135
00136 bool isDatatype() const;
00137
00138 void setOriginType(UMLClassifier *origType);
00139
00140 UMLClassifier * originType() const;
00141
00142 void setIsReference(bool isRef = true);
00143
00144 bool isReference() const;
00145
00146 bool hasAbstractOps();
00147
00148 bool hasAssociations();
00149
00150 bool hasAttributes();
00151
00152 bool hasStaticAttributes();
00153
00154 bool hasMethods();
00155
00156 bool hasAccessorMethods();
00157
00158 bool hasOperationMethods();
00159
00160 bool hasVectorFields();
00161
00167
00168
00169
00170
00171 virtual UMLClassifierListItem* makeChildObject(const QString& xmiTag);
00172
00173 virtual UMLAssociationList getUniAssociationToBeImplemented();
00174
00175 signals:
00176
00177 void operationAdded(UMLClassifierListItem *);
00178 void operationRemoved(UMLClassifierListItem *);
00179
00180 void templateAdded(UMLClassifierListItem*);
00181 void templateRemoved(UMLClassifierListItem*);
00182
00183
00184 void attributeAdded(UMLClassifierListItem*);
00185 void attributeRemoved(UMLClassifierListItem*);
00186
00187 private:
00188
00189 UMLAssociation *m_pClassAssoc;
00190
00191 bool m_isRef;
00192
00199
00200
00201 protected:
00202
00203 void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
00204
00205 virtual bool load(QDomElement& element);
00206
00207 };
00208
00209 #endif // CLASSIFIER_H