umbrello 2.32.3 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 (QDomDocument & doc, QDomElement & root);
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 (QDomDocument & doc, QDomElement & blockElement);
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
CodeClassField::Composition
@ Composition
Definition: codeclassfield.h:34
umlrole.h
codeclassfield.h
CodeGenFactory::newDeclarationCodeBlock
CodeClassFieldDeclarationBlock * newDeclarationCodeBlock(ClassifierCodeDocument *cd, CodeClassField *cf)
Definition: codegenfactory.cpp:363
codegenfactory.h
CodeClassFieldDeclarationBlock
Definition: codeclassfielddeclarationblock.h:30
CodeClassField::getWriteOutMethods
bool getWriteOutMethods() const
Definition: codeclassfield.cpp:201
CodeClassField::finishInitialization
void finishInitialization()
Definition: codeclassfield.cpp:661
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
CodeClassField::ClassFieldType
ClassFieldType
Definition: codeclassfield.h:34
CodeClassField::parentIsAttribute
bool parentIsAttribute() const
Definition: codeclassfield.cpp:127
CodeClassField::m_listClassName
QString m_listClassName
Definition: codeclassfield.h:108
Uml::Changeability::Changeable
@ Changeable
Definition: basictypes.h:205
CodeGenObjectWithTextBlocks::removeTextBlock
virtual bool removeTextBlock(TextBlock *remove_object)
Definition: codegenobjectwithtextblocks.cpp:92
CodeClassField::cleanName
QString cleanName(const QString &name)
Definition: codeclassfield.cpp:385
UMLClassifierListItem::getTypeName
virtual QString getTypeName() const
Definition: classifierlistitem.cpp:112
TextBlock::setWriteOutText
void setWriteOutText(bool write)
Definition: textblock.cpp:131
CodeAccessorMethod::SET
@ SET
Definition: codeaccessormethod.h:32
CodeClassField::initAccessorMethods
void initAccessorMethods()
Definition: codeclassfield.cpp:457
CodeMethodBlock::syncToParent
virtual void syncToParent()
Definition: codemethodblock.cpp:169
CodeClassField::getUMLObjectName
QString getUMLObjectName(UMLObject *obj)
Definition: codeclassfield.cpp:149
CodeClassFieldDeclarationBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeclassfielddeclarationblock.cpp:90
CodeAccessorMethod::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeaccessormethod.cpp:102
association.h
CodeAccessorMethod
Definition: codeaccessormethod.h:21
CodeClassField::setListClassName
void setListClassName(const QString &className)
CodeClassFieldDeclarationBlock::forceRelease
void forceRelease()
Definition: codeclassfielddeclarationblock.cpp:65
CodeClassField::Aggregation
@ Aggregation
Definition: codeclassfield.h:34
CodeClassField::PlainAssociation
@ PlainAssociation
Definition: codeclassfield.h:34
CodeClassField::Unknown_Assoc
@ Unknown_Assoc
Definition: codeclassfield.h:34
CodeClassField::Attribute
@ Attribute
Definition: codeclassfield.h:34
CodeAccessorMethod::setType
void setType(AccessorType type)
Definition: codeaccessormethod.cpp:72
codeparameter.h
CodeClassField
Definition: codeclassfield.h:30
CodeParameter::getParentDocument
ClassifierCodeDocument * getParentDocument()
Definition: codeparameter.cpp:133
CodeClassFieldDeclarationBlock::syncToParent
virtual void syncToParent()
Definition: codeclassfielddeclarationblock.cpp:136
CodeClassField::findMethodByType
CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id=-1)
Definition: codeclassfield.cpp:426
CodeClassField::getTypeName
QString getTypeName()
Definition: codeclassfield.cpp:94
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLRole
Definition: umlrole.h:25
CodeClassField::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: codeclassfield.cpp:314
Uml::AssociationType::Association_Self
@ Association_Self
Definition: basictypes.h:111
CodeAccessorMethod::forceRelease
void forceRelease()
Definition: codeaccessormethod.cpp:91
CodeClassField::m_writeOutMethods
bool m_writeOutMethods
Definition: codeclassfield.h:119
ClassifierCodeDocument
Definition: classifiercodedocument.h:33
OwnedCodeBlock::getParentObject
UMLObject * getParentObject()
Definition: ownedcodeblock.cpp:64
Uml::Changeability::Enum
Enum
Definition: basictypes.h:204
CodeAccessorMethod::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: codeaccessormethod.cpp:110
CodeAccessorMethod::getType
AccessorType getType()
Definition: codeaccessormethod.cpp:64
Uml::AssociationType::Aggregation
@ Aggregation
Definition: basictypes.h:108
Uml::Changeability::Frozen
@ Frozen
Definition: basictypes.h:206
CodeClassField::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeclassfield.cpp:229
CodeClassField::Self
@ Self
Definition: codeclassfield.h:34
attribute.h
CodeClassField::modified
void modified()
Definition: moc_codeclassfield.cpp:129
uWarning
#define uWarning()
Definition: debug_utils.h:124
CodeClassField::CodeClassField
CodeClassField(ClassifierCodeDocument *parentDoc, UMLAttribute *attrib)
Definition: codeclassfield.cpp:42
CodeClassField::removeMethod
bool removeMethod(CodeAccessorMethod *remove)
Definition: codeclassfield.cpp:178
CodeClassField::fixInitialStringDeclValue
QString fixInitialStringDeclValue(const QString &val, const QString &type)
Definition: codeclassfield.cpp:395
UMLObject::asUMLRole
UMLRole * asUMLRole()
Definition: umlobject.cpp:1327
classifiercodedocument.h
Uml::AssociationType::Association
@ Association
Definition: basictypes.h:110
codeclassfielddeclarationblock.h
CodeClassField::initFields
void initFields(bool inConstructor=false)
Definition: codeclassfield.cpp:641
CodeAccessorMethodList
QList< CodeAccessorMethod * > CodeAccessorMethodList
Definition: codeaccessormethodlist.h:17
CodeClassField::getListObjectType
QString getListObjectType()
Definition: codeclassfield.cpp:112
CodeClassField::maximumListOccurances
int maximumListOccurances()
Definition: codeclassfield.cpp:357
CodeClassField::setWriteOutMethods
void setWriteOutMethods(bool val)
Definition: codeclassfield.cpp:211
Uml::AssociationType::Enum
Enum
Definition: basictypes.h:106
MyProject\connect
connect()
Definition: namespaces-multiple.php:5
CodeGenFactory::newCodeAccessorMethod
CodeAccessorMethod * newCodeAccessorMethod(ClassifierCodeDocument *ccd, CodeClassField *cf, CodeAccessorMethod::AccessorType type)
Definition: codegenfactory.cpp:313
CodeParameter::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeparameter.cpp:192
CodeParameter::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Definition: codeparameter.cpp:166
CodeAccessorMethod::GET
@ GET
Definition: codeaccessormethod.h:32
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
CodeClassField::~CodeClassField
virtual ~CodeClassField()
Definition: codeclassfield.cpp:52
CodeDocument::cleanName
QString cleanName(const QString &name)
Definition: codedocument.cpp:270
CodeBlock::contentType
ContentType contentType() const
Definition: codeblock.cpp:54
CodeClassField::synchronize
virtual void synchronize()
Definition: codeclassfield.cpp:412
CodeBlock::AutoGenerated
@ AutoGenerated
the content was generated by code generation itself
Definition: codeblock.h:28
UMLRole::changeability
Uml::Changeability::Enum changeability() const
Definition: umlrole.cpp:103
CodeClassField::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeclassfield.cpp:263
CodeClassField::addMethod
bool addMethod(CodeAccessorMethod *add)
Definition: codeclassfield.cpp:157
uError
#define uError()
Definition: debug_utils.h:123
CodeClassField::m_classFieldType
ClassFieldType m_classFieldType
Definition: codeclassfield.h:109
uml.h
CodeClassField::minimumListOccurances
int minimumListOccurances()
Definition: codeclassfield.cpp:329
debug_utils.h
CodeClassField::updateContent
void updateContent()
Definition: codeclassfield.cpp:518
UMLAssociation
Sets up association information.
Definition: association.h:33
CodeClassField::fieldIsSingleValue
bool fieldIsSingleValue()
Definition: codeclassfield.cpp:618
CodeAccessorMethod::LIST
@ LIST
Definition: codeaccessormethod.h:32
codeaccessormethod.h
umlobject.h
UMLAssociation::getAssocType
Uml::AssociationType::Enum getAssocType() const
Definition: association.cpp:105
CodeClassField::getMethodList
CodeAccessorMethodList getMethodList() const
Definition: codeclassfield.cpp:191
Uml::AssociationType::Composition
@ Composition
Definition: basictypes.h:117
UMLRole::role
Uml::RoleType::Enum role() const
Definition: umlrole.cpp:169
CodeAccessorMethod::REMOVE
@ REMOVE
Definition: codeaccessormethod.h:32
codegenerator.h
CodeClassField::setParentUMLObject
void setParentUMLObject(UMLObject *obj)
Definition: codeclassfield.cpp:74
CodeClassField::getDeclarationCodeBlock
CodeClassFieldDeclarationBlock * getDeclarationCodeBlock()
Definition: codeclassfield.cpp:221
CodeParameter
Definition: codeparameter.h:26
UMLRole::object
UMLObject * object() const
Definition: umlrole.cpp:93
CodeClassField::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Definition: codeclassfield.cpp:238
CodeClassField::getClassFieldType
ClassFieldType getClassFieldType() const
Definition: codeclassfield.cpp:136
CodeAccessorMethod::ADD
@ ADD
Definition: codeaccessormethod.h:32
CodeClassField::m_parentIsAttribute
bool m_parentIsAttribute
Definition: codeclassfield.h:112
CodeAccessorMethod::AccessorType
AccessorType
Definition: codeaccessormethod.h:32
UMLRole::multiplicity
QString multiplicity() const
Definition: umlrole.cpp:113
CodeClassField::m_methodVector
CodeAccessorMethodList m_methodVector
Definition: codeclassfield.h:111
CodeClassField::m_declCodeBlock
CodeClassFieldDeclarationBlock * m_declCodeBlock
Definition: codeclassfield.h:110
CodeParameter::getParentObject
UMLObject * getParentObject()
Definition: codeparameter.cpp:141
UMLRole::parentAssociation
UMLAssociation * parentAssociation() const
Definition: umlrole.cpp:84
codeaccessormethodlist.h
CodeClassFieldDeclarationBlock::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: codeclassfielddeclarationblock.cpp:80