umbrello API Documentation

classifier.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 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 // forward declarations
00024 class UMLAssociation;
00025 class IDChangeLog;
00026 
00038 class UMLClassifier : public UMLPackage {
00039     Q_OBJECT
00040 public:
00041 
00045     enum ClassifierType { ALL = 0, CLASS, INTERFACE, DATATYPE };
00046 
00047 
00054     explicit UMLClassifier(const QString & name = "", Uml::IDType id = Uml::id_None);
00055 
00059     virtual ~UMLClassifier();
00060 
00064     bool operator==( UMLClassifier & rhs );
00065 
00070     virtual void copyInto(UMLClassifier *rhs) const;
00071 
00075     UMLObject* clone() const;
00076 
00086     virtual UMLAttribute* createAttribute(const QString &name = QString::null,
00087                                           UMLObject *type = 0,
00088                                           Uml::Visibility vis = Uml::Visibility::Private,
00089                                           const QString &init = QString::null);
00090 
00103     UMLAttribute* addAttribute(const QString &name, Uml::IDType id = Uml::id_None);
00104 
00105     UMLAttribute* addAttribute(const QString &name, UMLObject *type, Uml::Visibility scope);
00106 
00119     bool addAttribute(UMLAttribute* Att, IDChangeLog* Log = 0,
00120                       int position = -1);
00121 
00129     int removeAttribute(UMLAttribute *a);
00130 
00136     int attributes();
00137 
00145     UMLAttributeList getAttributeList();
00146 
00168     UMLOperation* createOperation( const QString &name = QString::null,
00169                                    bool *isExistingOp = NULL,
00170                                    Model_Utils::NameAndType_List *params = NULL);
00171 
00183     bool addOperation(UMLOperation* Op, int position = -1);
00184 
00194     bool addOperation(UMLOperation* Op, IDChangeLog* Log);
00195 
00207     UMLOperation * checkOperationSignature( const QString& name,
00208                                             UMLAttributeList opParams,
00209                                             UMLOperation *exemptOp = NULL);
00210 
00220     int removeOperation(UMLOperation *op);
00221 
00227     int operations();
00228 
00235     UMLOperationList getOpList(bool includeInherited = false);
00236 
00242     UMLObject* createTemplate(const QString& name = QString::null);
00243 
00251     UMLTemplate* addTemplate(const QString &name, Uml::IDType id = Uml::id_None);
00252 
00261     bool addTemplate(UMLTemplate* newTemplate, IDChangeLog* log = 0);
00262 
00272     //TODO: if the param IDChangeLog from the method above is not being used,
00273     // give position a default value of -1 and the method can replace the above one
00274     bool addTemplate(UMLTemplate* Template, int position);
00275 
00283     int removeTemplate(UMLTemplate* umltemplate);
00284 
00288     UMLTemplate *findTemplate(const QString& name);
00289 
00295     int templates();
00296 
00304     UMLTemplateList getTemplateList();
00305 
00314     int takeItem(UMLClassifierListItem* item);
00315 
00323     UMLClassifierListItemList getFilteredList(Uml::Object_Type ot);
00324 
00333     virtual bool resolveRef();
00334 
00341     UMLOperationList findOperations(const QString &n);
00342 
00350     virtual UMLObject* findChildObjectById(Uml::IDType id, bool considerAncestors = false);
00351 
00360     UMLOperation* findOperation(const QString& name,
00361                                 Model_Utils::NameAndType_List params);
00362 
00369     UMLClassifierList findSuperClassConcepts(ClassifierType type = ALL);
00370 
00377     UMLClassifierList findSubClassConcepts(ClassifierType type = ALL);
00378 
00380     virtual bool acceptAssociationType(Uml::Association_Type);
00381 
00386     void setClassAssoc(UMLAssociation *assoc);
00387 
00393     UMLAssociation *getClassAssoc();
00394 
00399     void setBaseType(Uml::Object_Type ot);
00400 
00404     bool isInterface() const;
00405 
00409     bool isDatatype() const;
00410 
00414     void setOriginType(UMLClassifier *origType);
00415 
00419     UMLClassifier * originType();
00420 
00424     void setIsReference(bool isRef = true);
00425 
00429     bool isReference();
00430 
00434     bool hasAbstractOps ();
00435 
00443     UMLClassifierListItem* makeChildObject(const QString& xmiTag);
00444 
00448     virtual UMLAssociationList  getUniAssociationToBeImplemented();
00449 
00450 signals:
00453     void operationAdded(UMLClassifierListItem *);
00454 
00457     void operationRemoved(UMLClassifierListItem *);
00458 
00459     void templateAdded(UMLClassifierListItem*);
00460     void templateRemoved(UMLClassifierListItem*);
00461 
00462     // only applies when (m_Type == ot_Class)
00463     void attributeAdded(UMLClassifierListItem*);
00464     void attributeRemoved(UMLClassifierListItem*);
00465 
00466 private:
00467 
00471     void init();
00472 
00473     UMLAssociation *m_pClassAssoc;
00474 
00475     bool m_isRef;
00476 
00477 protected:
00478 
00483     void saveToXMI(QDomDocument& qDoc, QDomElement& qElement);
00484 
00492     virtual bool load(QDomElement& element);
00493 
00494 };
00495 
00496 #endif // CONCEPT_H
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