umbrello API Documentation

codeclassfield.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   : Fri Jun 20 2003
00015  */
00016 
00017 
00018 
00019 #ifndef CODECLASSFIELD_H
00020 #define CODECLASSFIELD_H
00021 
00022 #include "codeaccessormethodlist.h"
00023 #include "codeclassfielddeclarationblock.h"
00024 #include "codeparameter.h"
00025 #include "codeaccessormethod.h"
00026 
00027 // #include "codeclassfielddialog.h"
00028 
00029 
00030 class ClassifierCodeDocument;
00031 class UMLAttribute;
00032 class UMLObject;
00033 class UMLRole;
00034 
00040 class CodeClassField : public CodeParameter
00041 {
00042     Q_OBJECT
00043 public:
00044 
00045     enum ClassFieldType { Attribute, PlainAssociation, Self, Aggregation, Composition, Unknown_Assoc };
00046 
00047     // Constructors/Destructors
00048     //
00049 
00053     CodeClassField ( ClassifierCodeDocument * parentDoc , UMLAttribute * attrib );
00054     CodeClassField ( ClassifierCodeDocument * parentDoc , UMLRole * role);
00055 
00064     void finishInitialization();
00065 
00066     // CodeClassField ( ClassifierCodeDocument * doc , UMLRole role);
00067 
00071     virtual ~CodeClassField ( );
00072 
00073     // Public attributes
00074     //
00075 
00076     // Public attribute accessor methods
00077     //
00078 
00083     //  CodeClassFieldDialog getDialog ( );
00084 
00085     // Determine if this cf is attribute or some type of association
00086     QString getTypeName ( );
00087 
00091     CodeClassFieldDeclarationBlock * getDeclarationCodeBlock( );
00092 
00098     CodeAccessorMethodList getMethodList();
00099 
00103     CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id = -1);
00104 
00109     bool fieldIsSingleValue ( );
00110 
00114     ClassFieldType getClassFieldType();
00115 
00116     // quick utility call to figure out if parent is an attribute or not
00117     bool parentIsAttribute ( );
00118 
00119     // get the type of object that will be added/removed from lists
00120     // of objects (as per specification of associations)
00121     QString getListObjectType();
00122 
00127     bool getWriteOutMethods ();
00128 
00133     void setWriteOutMethods( bool val);
00134 
00140     int minimumListOccurances( );
00141 
00147     int maximumListOccurances( );
00148 
00152     virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
00153 
00157     virtual void loadFromXMI ( QDomElement & root );
00158 
00162     virtual void synchronize ();
00163 
00164 protected:
00165 
00168     void setParentUMLObject (UMLObject * obj);
00169 
00170     //  CodeClassFieldDialog * m_dialog;
00171 
00174     QString cleanName(const QString &name);
00175 
00180     QString fixInitialStringDeclValue(QString value, const QString &type);
00181 
00182     // set the list class name
00183     void setListClassName ( const QString &className );
00184 
00188     bool addMethod ( CodeAccessorMethod * add );
00189 
00190     QString getUMLObjectName(UMLObject *obj);
00191 
00195     bool removeMethod ( CodeAccessorMethod * remove);
00196 
00197     // Updates the status of the accessor methods
00198     // as to whether or not they should be written out.
00199     void updateContent();
00200 
00201 private:
00202 
00203     QString m_listClassName;
00204     ClassFieldType m_classFieldType;
00205     CodeClassFieldDeclarationBlock * m_declCodeBlock;
00206     CodeAccessorMethodList m_methodVector; // the list of methods related to this codeclassfield
00207     bool m_parentIsAttribute;
00208 
00213     bool m_writeOutMethods;
00214 
00218     virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
00219 
00223     virtual void setAttributesFromNode ( QDomElement & element);
00224 
00226     void initFields(bool inConstructor = false);
00227 
00228     // initialize the accessor methods for this field
00229     void initAccessorMethods();
00230 
00231 signals:
00232 
00233     void modified ();
00234 
00235 };
00236 
00237 #endif // CODECLASSFIELD_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:55 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003