umbrello: umbrello/codegenerators/codeclassfield.h Source File

umbrello 2.32.1 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

codeclassfield.h
Go to the documentation of this file.
1 /***************************************************************************
2 * This program is free software; you can redistribute it and/or modify *
3 * it under the terms of the GNU General Public License as published by *
4 * the Free Software Foundation; either version 2 of the License, or *
5 * (at your option) any later version. *
6 * *
7 * copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> *
8 * copyright (C) 2004-2020 *
9 * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
10 ***************************************************************************/
11
12 #ifndef CODECLASSFIELD_H
13 #define CODECLASSFIELD_H
14
15 #include "codeaccessormethodlist.h"
16 #include "codeclassfielddeclarationblock.h"
17 #include "codeparameter.h"
18 #include "codeaccessormethod.h"
19
20 class ClassifierCodeDocument;
21 class UMLAttribute;
22 class UMLObject;
23 class UMLRole;
24
29 class CodeClassField : public CodeParameter
30 {
31 Q_OBJECT
32 public:
33
34 enum ClassFieldType { Attribute, PlainAssociation, Self, Aggregation, Composition, Unknown_Assoc };
35
36 CodeClassField (ClassifierCodeDocument * parentDoc, UMLAttribute * attrib);
37 CodeClassField (ClassifierCodeDocument * parentDoc, UMLRole * role);
38
39 void finishInitialization();
40
41 // CodeClassField (ClassifierCodeDocument * doc, UMLRole role);
42
43 virtual ~CodeClassField ();
44
45 // /**
46 // * Get the value of m_dialog
47 // * @return the value of m_dialog
48 // */
49 // CodeClassFieldDialog getDialog ();
50
51 // Determine if this cf is attribute or some type of association
52 QString getTypeName ();
53
54 CodeClassFieldDeclarationBlock * getDeclarationCodeBlock();
55
56 CodeAccessorMethodList getMethodList() const;
57
58 CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id = -1);
59
60 bool fieldIsSingleValue ();
61
62 ClassFieldType getClassFieldType() const;
63
64 // quick utility call to figure out if parent is an attribute or not
65 bool parentIsAttribute () const;
66
67 // get the type of object that will be added/removed from lists
68 // of objects (as per specification of associations)
69 QString getListObjectType();
70
71 bool getWriteOutMethods () const;
72
73 void setWriteOutMethods(bool val);
74
75 int minimumListOccurances();
76
77 int maximumListOccurances();
78
79 virtual void saveToXMI1(QXmlStreamWriter& writer);
80
81 virtual void loadFromXMI1 (QDomElement & root);
82
83 virtual void synchronize ();
84
85 void updateContent();
86
87 protected:
88
89 void setParentUMLObject (UMLObject * obj);
90
91 // CodeClassFieldDialog * m_dialog;
92
93 QString cleanName(const QString &name);
94
95 QString fixInitialStringDeclValue(const QString& val, const QString &type);
96
97 // set the list class name
98 void setListClassName (const QString &className);
99
100 bool addMethod (CodeAccessorMethod * add);
101
102 QString getUMLObjectName(UMLObject *obj);
103
104 bool removeMethod (CodeAccessorMethod * remove);
105
106 private:
107
108 QString m_listClassName;
109 ClassFieldType m_classFieldType;
110 CodeClassFieldDeclarationBlock * m_declCodeBlock;
111 CodeAccessorMethodList m_methodVector; // the list of methods related to this codeclassfield
112 bool m_parentIsAttribute;
113
119 bool m_writeOutMethods;
120
121 virtual void setAttributesOnNode (QXmlStreamWriter& writer);
122
123 virtual void setAttributesFromNode (QDomElement & element);
124
125 void initFields(bool inConstructor = false);
126
127 // initialize the accessor methods for this field
128 void initAccessorMethods();
129
130 signals:
131
132 void modified ();
133
134 };
135
136 #endif // CODECLASSFIELD_H
ClassifierCodeDocument
Definition: classifiercodedocument.h:33
CodeAccessorMethod
Definition: codeaccessormethod.h:22
CodeAccessorMethod::AccessorType
AccessorType
Definition: codeaccessormethod.h:33
CodeClassFieldDeclarationBlock
Definition: codeclassfielddeclarationblock.h:30
CodeClassField
Definition: codeclassfield.h:30
CodeClassField::CodeClassField
CodeClassField(ClassifierCodeDocument *parentDoc, UMLAttribute *attrib)
Definition: codeclassfield.cpp:43
CodeClassField::~CodeClassField
virtual ~CodeClassField()
Definition: codeclassfield.cpp:53
CodeClassField::removeMethod
bool removeMethod(CodeAccessorMethod *remove)
Definition: codeclassfield.cpp:179
CodeClassField::m_declCodeBlock
CodeClassFieldDeclarationBlock * m_declCodeBlock
Definition: codeclassfield.h:110
CodeClassField::setParentUMLObject
void setParentUMLObject(UMLObject *obj)
Definition: codeclassfield.cpp:75
CodeClassField::m_listClassName
QString m_listClassName
Definition: codeclassfield.h:108
CodeClassField::getMethodList
CodeAccessorMethodList getMethodList() const
Definition: codeclassfield.cpp:192
CodeClassField::m_parentIsAttribute
bool m_parentIsAttribute
Definition: codeclassfield.h:112
CodeClassField::synchronize
virtual void synchronize()
Definition: codeclassfield.cpp:413
CodeClassField::getTypeName
QString getTypeName()
Definition: codeclassfield.cpp:95
CodeClassField::initFields
void initFields(bool inConstructor=false)
Definition: codeclassfield.cpp:642
CodeClassField::fieldIsSingleValue
bool fieldIsSingleValue()
Definition: codeclassfield.cpp:619
CodeClassField::finishInitialization
void finishInitialization()
Definition: codeclassfield.cpp:662
CodeClassField::maximumListOccurances
int maximumListOccurances()
Definition: codeclassfield.cpp:358
CodeClassField::fixInitialStringDeclValue
QString fixInitialStringDeclValue(const QString &val, const QString &type)
Definition: codeclassfield.cpp:396
CodeClassField::getDeclarationCodeBlock
CodeClassFieldDeclarationBlock * getDeclarationCodeBlock()
Definition: codeclassfield.cpp:222
CodeClassField::m_classFieldType
ClassFieldType m_classFieldType
Definition: codeclassfield.h:109
CodeClassField::ClassFieldType
ClassFieldType
Definition: codeclassfield.h:34
CodeClassField::Composition
@ Composition
Definition: codeclassfield.h:34
CodeClassField::Unknown_Assoc
@ Unknown_Assoc
Definition: codeclassfield.h:34
CodeClassField::Attribute
@ Attribute
Definition: codeclassfield.h:34
CodeClassField::Self
@ Self
Definition: codeclassfield.h:34
CodeClassField::PlainAssociation
@ PlainAssociation
Definition: codeclassfield.h:34
CodeClassField::Aggregation
@ Aggregation
Definition: codeclassfield.h:34
CodeClassField::parentIsAttribute
bool parentIsAttribute() const
Definition: codeclassfield.cpp:128
CodeClassField::getListObjectType
QString getListObjectType()
Definition: codeclassfield.cpp:113
CodeClassField::m_methodVector
CodeAccessorMethodList m_methodVector
Definition: codeclassfield.h:111
CodeClassField::initAccessorMethods
void initAccessorMethods()
Definition: codeclassfield.cpp:458
CodeClassField::minimumListOccurances
int minimumListOccurances()
Definition: codeclassfield.cpp:330
CodeClassField::getUMLObjectName
QString getUMLObjectName(UMLObject *obj)
Definition: codeclassfield.cpp:150
CodeClassField::setWriteOutMethods
void setWriteOutMethods(bool val)
Definition: codeclassfield.cpp:212
CodeClassField::updateContent
void updateContent()
Definition: codeclassfield.cpp:519
CodeClassField::getClassFieldType
ClassFieldType getClassFieldType() const
Definition: codeclassfield.cpp:137
CodeClassField::findMethodByType
CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id=-1)
Definition: codeclassfield.cpp:427
CodeClassField::m_writeOutMethods
bool m_writeOutMethods
Definition: codeclassfield.h:119
CodeClassField::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: codeclassfield.cpp:315
CodeClassField::modified
void modified()
CodeClassField::getWriteOutMethods
bool getWriteOutMethods() const
Definition: codeclassfield.cpp:202
CodeClassField::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeclassfield.cpp:264
CodeClassField::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: codeclassfield.cpp:239
CodeClassField::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeclassfield.cpp:230
CodeClassField::addMethod
bool addMethod(CodeAccessorMethod *add)
Definition: codeclassfield.cpp:158
CodeClassField::cleanName
QString cleanName(const QString &name)
Definition: codeclassfield.cpp:386
CodeClassField::setListClassName
void setListClassName(const QString &className)
CodeParameter
Definition: codeparameter.h:27
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
UMLObject
The base class for UML objects.
Definition: umlobject.h:75
UMLRole
Definition: umlrole.h:25
codeaccessormethod.h
codeaccessormethodlist.h
CodeAccessorMethodList
QList< CodeAccessorMethod * > CodeAccessorMethodList
Definition: codeaccessormethodlist.h:17
codeclassfielddeclarationblock.h
codeparameter.h