umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

codeclassfield.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3
4 SPDX-FileCopyrightText: 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov>
5 SPDX-FileCopyrightText: 2004-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6*/
7
8#ifndef CODECLASSFIELD_H
9#define CODECLASSFIELD_H
10
11#include "codeaccessormethodlist.h"
12#include "codeclassfielddeclarationblock.h"
13#include "codeparameter.h"
14#include "codeaccessormethod.h"
15
16 class ClassifierCodeDocument;
17 class UMLAttribute;
18 class UMLObject;
19 class UMLRole;
20
25 class CodeClassField : public CodeParameter
26{
27 Q_OBJECT
28 public:
29
30 enum ClassFieldType { Attribute, PlainAssociation, Self, Aggregation, Composition, Unknown_Assoc };
31
32 CodeClassField (ClassifierCodeDocument * parentDoc, UMLAttribute * attrib);
33 CodeClassField (ClassifierCodeDocument * parentDoc, UMLRole * role);
34
35 void finishInitialization();
36
37 // CodeClassField (ClassifierCodeDocument * doc, UMLRole role);
38
39 virtual ~CodeClassField ();
40
41// /**
42// * Get the value of m_dialog
43// * @return the value of m_dialog
44// */
45// CodeClassFieldDialog getDialog ();
46
47 // Determine if this cf is attribute or some type of association
48 QString getTypeName ();
49
50 CodeClassFieldDeclarationBlock * getDeclarationCodeBlock();
51
52 CodeAccessorMethodList getMethodList() const;
53
54 CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id = -1);
55
56 bool fieldIsSingleValue ();
57
58 ClassFieldType getClassFieldType() const;
59
60 // quick utility call to figure out if parent is an attribute or not
61 bool parentIsAttribute () const;
62
63 // get the type of object that will be added/removed from lists
64 // of objects (as per specification of associations)
65 QString getListObjectType();
66
67 bool getWriteOutMethods () const;
68
69 void setWriteOutMethods(bool val);
70
71 int minimumListOccurances();
72
73 int maximumListOccurances();
74
75 virtual void saveToXMI(QXmlStreamWriter& writer);
76
77 virtual void loadFromXMI (QDomElement & root);
78
79 virtual void synchronize ();
80
81 void updateContent();
82
83 protected:
84
85 void setParentUMLObject (UMLObject * obj);
86
87 // CodeClassFieldDialog * m_dialog;
88
89 QString cleanName(const QString &name);
90
91 QString fixInitialStringDeclValue(const QString& val, const QString &type);
92
93 // set the list class name
94 void setListClassName (const QString &className);
95
96 bool addMethod (CodeAccessorMethod * add);
97
98 QString getUMLObjectName(UMLObject *obj);
99
100 bool removeMethod (CodeAccessorMethod * remove);
101
102 private:
103
104 QString m_listClassName;
105 ClassFieldType m_classFieldType;
106 CodeClassFieldDeclarationBlock * m_declCodeBlock;
107 CodeAccessorMethodList m_methodVector; // the list of methods related to this codeclassfield
108 bool m_parentIsAttribute;
109
115 bool m_writeOutMethods;
116
117 virtual void setAttributesOnNode (QXmlStreamWriter& writer);
118
119 virtual void setAttributesFromNode (QDomElement & element);
120
121 void initFields(bool inConstructor = false);
122
123 // initialize the accessor methods for this field
124 void initAccessorMethods();
125
126Q_SIGNALS:
127
128 void modified ();
129
130};
131
132#endif // CODECLASSFIELD_H
ClassifierCodeDocument
Definition: classifiercodedocument.h:29
CodeAccessorMethod
Definition: codeaccessormethod.h:18
CodeAccessorMethod::AccessorType
AccessorType
Definition: codeaccessormethod.h:29
CodeClassFieldDeclarationBlock
Definition: codeclassfielddeclarationblock.h:26
CodeClassField
Definition: codeclassfield.h:26
CodeClassField::~CodeClassField
virtual ~CodeClassField()
Definition: codeclassfield.cpp:49
CodeClassField::removeMethod
bool removeMethod(CodeAccessorMethod *remove)
Definition: codeclassfield.cpp:175
CodeClassField::m_declCodeBlock
CodeClassFieldDeclarationBlock * m_declCodeBlock
Definition: codeclassfield.h:106
CodeClassField::setParentUMLObject
void setParentUMLObject(UMLObject *obj)
Definition: codeclassfield.cpp:71
CodeClassField::m_listClassName
QString m_listClassName
Definition: codeclassfield.h:104
CodeClassField::getMethodList
CodeAccessorMethodList getMethodList() const
Definition: codeclassfield.cpp:188
CodeClassField::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Definition: codeclassfield.cpp:226
CodeClassField::m_parentIsAttribute
bool m_parentIsAttribute
Definition: codeclassfield.h:108
CodeClassField::synchronize
virtual void synchronize()
Definition: codeclassfield.cpp:409
CodeClassField::getTypeName
QString getTypeName()
Definition: codeclassfield.cpp:91
CodeClassField::initFields
void initFields(bool inConstructor=false)
Definition: codeclassfield.cpp:640
CodeClassField::fieldIsSingleValue
bool fieldIsSingleValue()
Definition: codeclassfield.cpp:617
CodeClassField::finishInitialization
void finishInitialization()
Definition: codeclassfield.cpp:660
CodeClassField::maximumListOccurances
int maximumListOccurances()
Definition: codeclassfield.cpp:354
CodeClassField::fixInitialStringDeclValue
QString fixInitialStringDeclValue(const QString &val, const QString &type)
Definition: codeclassfield.cpp:392
CodeClassField::getDeclarationCodeBlock
CodeClassFieldDeclarationBlock * getDeclarationCodeBlock()
Definition: codeclassfield.cpp:218
CodeClassField::m_classFieldType
ClassFieldType m_classFieldType
Definition: codeclassfield.h:105
CodeClassField::ClassFieldType
ClassFieldType
Definition: codeclassfield.h:30
CodeClassField::Composition
@ Composition
Definition: codeclassfield.h:30
CodeClassField::Unknown_Assoc
@ Unknown_Assoc
Definition: codeclassfield.h:30
CodeClassField::Attribute
@ Attribute
Definition: codeclassfield.h:30
CodeClassField::Self
@ Self
Definition: codeclassfield.h:30
CodeClassField::PlainAssociation
@ PlainAssociation
Definition: codeclassfield.h:30
CodeClassField::Aggregation
@ Aggregation
Definition: codeclassfield.h:30
CodeClassField::parentIsAttribute
bool parentIsAttribute() const
Definition: codeclassfield.cpp:124
CodeClassField::getListObjectType
QString getListObjectType()
Definition: codeclassfield.cpp:109
CodeClassField::m_methodVector
CodeAccessorMethodList m_methodVector
Definition: codeclassfield.h:107
CodeClassField::initAccessorMethods
void initAccessorMethods()
Definition: codeclassfield.cpp:455
CodeClassField::minimumListOccurances
int minimumListOccurances()
Definition: codeclassfield.cpp:326
CodeClassField::getUMLObjectName
QString getUMLObjectName(UMLObject *obj)
Definition: codeclassfield.cpp:146
CodeClassField::setWriteOutMethods
void setWriteOutMethods(bool val)
Definition: codeclassfield.cpp:208
CodeClassField::updateContent
void updateContent()
Definition: codeclassfield.cpp:516
CodeClassField::getClassFieldType
ClassFieldType getClassFieldType() const
Definition: codeclassfield.cpp:133
CodeClassField::findMethodByType
CodeAccessorMethod * findMethodByType(CodeAccessorMethod::AccessorType type, int role_id=-1)
Definition: codeclassfield.cpp:424
CodeClassField::m_writeOutMethods
bool m_writeOutMethods
Definition: codeclassfield.h:115
CodeClassField::modified
void modified()
CodeClassField::getWriteOutMethods
bool getWriteOutMethods() const
Definition: codeclassfield.cpp:198
CodeClassField::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeclassfield.cpp:260
CodeClassField::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: codeclassfield.cpp:235
CodeClassField::addMethod
bool addMethod(CodeAccessorMethod *add)
Definition: codeclassfield.cpp:154
CodeClassField::cleanName
QString cleanName(const QString &name)
Definition: codeclassfield.cpp:382
CodeClassField::setListClassName
void setListClassName(const QString &className)
CodeClassField::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition: codeclassfield.cpp:311
CodeParameter
Definition: codeparameter.h:23
UMLAttribute
Sets up attribute information.
Definition: umlattribute.h:23
UMLObject
The base class for UML objects.
Definition: umlobject.h:70
UMLRole
Definition: umlrole.h:20
codeaccessormethod.h
codeaccessormethodlist.h
CodeAccessorMethodList
QList< CodeAccessorMethod * > CodeAccessorMethodList
Definition: codeaccessormethodlist.h:14
codeclassfielddeclarationblock.h
codeparameter.h