umbrello API Documentation

classifiercodedocument.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) 2004-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 /*  This code generated by:
00013  *      Author : thomas
00014  *      Date   : Thu Jun 19 2003
00015  */
00016 
00017 
00018 
00019 #ifndef CLASSIFIERCODEDOCUMENT_H
00020 #define CLASSIFIERCODEDOCUMENT_H
00021 
00022 #include <qmap.h>
00023 #include <qstring.h>
00024 #include <qptrlist.h>
00025 
00026 #include "classifier.h"
00027 #include "codeaccessormethod.h"
00028 #include "codedocument.h"
00029 #include "codeoperation.h"
00030 #include "codeclassfield.h"
00031 #include "codeclassfieldlist.h"
00032 #include "umlassociationlist.h"
00033 
00034 class UMLRole;
00035 
00041 class ClassifierCodeDocument : public CodeDocument
00042 {
00043     friend class HierarchicalCodeBlock;
00044     Q_OBJECT
00045 public:
00046 
00047     // Constructors/Destructors
00048     //
00049 
00050 
00054     ClassifierCodeDocument ( UMLClassifier * parent );
00055 
00059     virtual ~ClassifierCodeDocument ( );
00060 
00064     bool addCodeClassField ( CodeClassField * add_object );
00065 
00069     bool removeCodeClassField ( CodeClassField * remove_object );
00070 
00076     CodeClassFieldList * getCodeClassFieldList ( );
00077 
00078     // some Utility methods
00079 
00083     bool parentIsInterface();
00084 
00088     bool parentIsClass();
00089 
00093     bool hasAssociationClassFields();
00097     bool hasAttributeClassFields();
00098 
00102     bool hasObjectVectorClassFields();
00103 
00107     bool hasClassFields();
00108 
00113     QPtrList<CodeOperation> getCodeOperations ( );
00114 
00118     CodeClassFieldList getSpecificClassFields (CodeClassField::ClassFieldType cfType);
00119 
00123     CodeClassFieldList getSpecificClassFields (CodeClassField::ClassFieldType cfType, bool isStatic);
00124 
00128     CodeClassFieldList getSpecificClassFields (CodeClassField::ClassFieldType cfType, Uml::Visibility visibility);
00129 
00133     CodeClassFieldList getSpecificClassFields (CodeClassField::ClassFieldType cfType, bool isStatic, Uml::Visibility visibility);
00134 
00144     CodeClassField * findCodeClassFieldFromParentID (Uml::IDType id, int role_id = -1);
00145 
00150     UMLClassifier * getParentClassifier ( );
00151 
00152     // a utility method that allows user to easily add classfield methods to this document
00153     void addCodeClassFieldMethods(CodeClassFieldList &list );
00154 
00158     virtual void initCodeClassFields ( );
00159 
00160     // cause this classifier code document to synchronize to current policy
00161     virtual void synchronize();
00162 
00166     virtual bool addCodeOperation (CodeOperation *opBlock) = 0;
00167 
00171     virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
00172 
00176     virtual void loadFromXMI ( QDomElement & root );
00177 
00178 protected:
00179 
00183     void loadClassFieldsFromXMI( QDomElement & childElem);
00184 
00188     virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
00189 
00193     virtual void setAttributesFromNode ( QDomElement & element);
00194 
00195     // find a specific textblock held by any code class field in this document
00196     // by its tag
00197     TextBlock * findCodeClassFieldTextBlockByTag (const QString &tag);
00198 
00199     // add the declaration text blocks for various classfields
00200     void declareClassFields (CodeClassFieldList & list , CodeGenObjectWithTextBlocks * parent);
00201 
00202     virtual void updateContent( ) = 0;
00203 
00204     // force syncronization of child classfields to their parent objects
00205     void syncClassFields( );
00206 
00207     // IF the classifier object is modified, this will get called.
00208     // @fixme We cannot make this virtual because the ClassifierCodeDocument
00209     //        constructor calls it.
00210     void syncNamesToParent( );
00211 
00212 private:
00213 
00214     CodeClassFieldList m_classfieldVector;
00215     UMLClassifier* m_parentclassifier;
00216 
00217     // using the passed list, update our inventory of CodeClassFields which are
00218     // based on UMLRoles (e.g. derived from associations with other classifiers).
00219     void updateAssociationClassFields ( UMLAssociationList &assocList );
00220 
00221     // update code operations in this document using the parent classifier
00222     void updateOperations( );
00223 
00228     QMap<UMLObject *,CodeClassField *> m_classFieldMap;
00229 
00234     void init ( UMLClassifier * classifier );
00235 
00236 public slots:
00237 
00241     void addAttributeClassField(UMLClassifierListItem *at, bool syncToParentIfAdded = true);
00242     void addAssociationClassField (UMLAssociation * assoc, bool syncToParentIfAdded = true);
00243     void removeAttributeClassField(UMLClassifierListItem *at);
00244     void removeAssociationClassField(UMLAssociation *assoc);
00245     void addOperation (UMLClassifierListItem * obj);
00246     void removeOperation (UMLClassifierListItem * obj);
00247     void syncToParent( );
00248 
00249 };
00250 
00251 #endif // CLASSIFIERCODEDOCUMENT_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