umbrello: umbrello/codegenerators/classifiercodedocument.h Source File

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

classifiercodedocument.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 CLASSIFIERCODEDOCUMENT_H
13 #define CLASSIFIERCODEDOCUMENT_H
14
15 #include "classifier.h"
16 #include "codeaccessormethod.h"
17 #include "codedocument.h"
18 #include "codeoperation.h"
19 #include "codeclassfield.h"
20 #include "codeclassfieldlist.h"
21 #include "umlassociationlist.h"
22
23 #include <QMap>
24 #include <QList>
25 #include <QString>
26
27
32 class ClassifierCodeDocument : public CodeDocument
33 {
34 friend class HierarchicalCodeBlock;
35 Q_OBJECT
36 public:
37
38 // Constructors/Destructors
39
40 explicit ClassifierCodeDocument(UMLClassifier * parent);
41 virtual ~ClassifierCodeDocument();
42
43 bool addCodeClassField(CodeClassField * add_object);
44
45 bool removeCodeClassField(CodeClassField * remove_object);
46
47 CodeClassFieldList* getCodeClassFieldList();
48
49 // some Utility methods
50
51 bool parentIsInterface();
52 bool parentIsClass();
53
54 bool hasAssociationClassFields();
55 bool hasAttributeClassFields();
56 bool hasObjectVectorClassFields();
57 bool hasClassFields();
58
59 QList<CodeOperation*> getCodeOperations();
60
61 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType);
62 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType, bool isStatic);
63 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType, Uml::Visibility::Enum visibility);
64 CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType, bool isStatic, Uml::Visibility::Enum visibility);
65
66 CodeClassField * findCodeClassFieldFromParentID (Uml::ID::Type id, int role_id = -1);
67
68 UMLClassifier * getParentClassifier();
69
70 void addCodeClassFieldMethods(CodeClassFieldList &list);
71
72 virtual void initCodeClassFields();
73
74 virtual void synchronize();
75
79 virtual bool addCodeOperation(CodeOperation *opBlock) = 0;
80
81 virtual void updateContent() = 0;
82
83 virtual void saveToXMI1(QXmlStreamWriter& writer);
84 virtual void loadFromXMI1(QDomElement &root);
85
86 protected:
87
88 void loadClassFieldsFromXMI(QDomElement &childElem);
89
90 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
91 virtual void setAttributesFromNode(QDomElement &element);
92
93 TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag);
94
95 void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent);
96
97 void syncClassFields();
98 void syncNamesToParent();
99
100 private:
101
102 CodeClassFieldList m_classfieldVector;
103 UMLClassifier* m_parentclassifier;
104
105 void updateAssociationClassFields(UMLAssociationList &assocList);
106 void updateOperations();
107
112 QMap<UMLObject *, CodeClassField *> m_classFieldMap;
113
114 void init(UMLClassifier *classifier);
115
116 public slots:
117
118 void addAttributeClassField(UMLClassifierListItem *at, bool syncToParentIfAdded = true);
119 void addAssociationClassField(UMLAssociation *assoc, bool syncToParentIfAdded = true);
120 void removeAttributeClassField(UMLClassifierListItem *at);
121 void removeAssociationClassField(UMLAssociation *assoc);
122 void addOperation(UMLClassifierListItem *obj);
123 void removeOperation(UMLClassifierListItem *obj);
124 void syncToParent();
125
126 };
127
128 #endif // CLASSIFIERCODEDOCUMENT_H
ClassifierCodeDocument
Definition: classifiercodedocument.h:33
ClassifierCodeDocument::removeAssociationClassField
void removeAssociationClassField(UMLAssociation *assoc)
Definition: classifiercodedocument.cpp:248
ClassifierCodeDocument::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: classifiercodedocument.cpp:737
ClassifierCodeDocument::hasObjectVectorClassFields
bool hasObjectVectorClassFields()
Definition: classifiercodedocument.cpp:125
ClassifierCodeDocument::addAssociationClassField
void addAssociationClassField(UMLAssociation *assoc, bool syncToParentIfAdded=true)
Definition: classifiercodedocument.cpp:576
ClassifierCodeDocument::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: classifiercodedocument.cpp:750
ClassifierCodeDocument::ClassifierCodeDocument
ClassifierCodeDocument(UMLClassifier *parent)
Definition: classifiercodedocument.cpp:38
ClassifierCodeDocument::getParentClassifier
UMLClassifier * getParentClassifier()
Definition: classifiercodedocument.cpp:276
ClassifierCodeDocument::removeAttributeClassField
void removeAttributeClassField(UMLClassifierListItem *at)
Definition: classifiercodedocument.cpp:241
ClassifierCodeDocument::updateOperations
void updateOperations()
Definition: classifiercodedocument.cpp:505
ClassifierCodeDocument::hasClassFields
bool hasClassFields()
Definition: classifiercodedocument.cpp:152
ClassifierCodeDocument::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: classifiercodedocument.cpp:621
ClassifierCodeDocument::m_parentclassifier
UMLClassifier * m_parentclassifier
Definition: classifiercodedocument.h:103
ClassifierCodeDocument::updateContent
virtual void updateContent()=0
ClassifierCodeDocument::syncToParent
void syncToParent()
Definition: classifiercodedocument.cpp:532
ClassifierCodeDocument::hasAssociationClassFields
bool hasAssociationClassFields()
Definition: classifiercodedocument.cpp:162
ClassifierCodeDocument::parentIsInterface
bool parentIsInterface()
Definition: classifiercodedocument.cpp:419
ClassifierCodeDocument::addAttributeClassField
void addAttributeClassField(UMLClassifierListItem *at, bool syncToParentIfAdded=true)
Definition: classifiercodedocument.cpp:200
ClassifierCodeDocument::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: classifiercodedocument.cpp:772
ClassifierCodeDocument::addCodeOperation
virtual bool addCodeOperation(CodeOperation *opBlock)=0
ClassifierCodeDocument::loadClassFieldsFromXMI
void loadClassFieldsFromXMI(QDomElement &childElem)
Definition: classifiercodedocument.cpp:680
ClassifierCodeDocument::synchronize
virtual void synchronize()
Definition: classifiercodedocument.cpp:481
ClassifierCodeDocument::hasAttributeClassFields
bool hasAttributeClassFields()
Definition: classifiercodedocument.cpp:171
ClassifierCodeDocument::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: classifiercodedocument.cpp:714
ClassifierCodeDocument::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition: classifiercodedocument.cpp:354
ClassifierCodeDocument::updateAssociationClassFields
void updateAssociationClassFields(UMLAssociationList &assocList)
Definition: classifiercodedocument.cpp:570
ClassifierCodeDocument::findCodeClassFieldFromParentID
CodeClassField * findCodeClassFieldFromParentID(Uml::ID::Type id, int role_id=-1)
Definition: classifiercodedocument.cpp:650
ClassifierCodeDocument::addOperation
void addOperation(UMLClassifierListItem *obj)
Definition: classifiercodedocument.cpp:303
ClassifierCodeDocument::m_classFieldMap
QMap< UMLObject *, CodeClassField * > m_classFieldMap
Definition: classifiercodedocument.h:112
ClassifierCodeDocument::syncNamesToParent
void syncNamesToParent()
Definition: classifiercodedocument.cpp:467
ClassifierCodeDocument::m_classfieldVector
CodeClassFieldList m_classfieldVector
Definition: classifiercodedocument.h:102
ClassifierCodeDocument::getCodeClassFieldList
CodeClassFieldList * getCodeClassFieldList()
Definition: classifiercodedocument.cpp:267
ClassifierCodeDocument::getCodeOperations
QList< CodeOperation * > getCodeOperations()
Definition: classifiercodedocument.cpp:285
ClassifierCodeDocument::declareClassFields
void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent)
Definition: classifiercodedocument.cpp:379
ClassifierCodeDocument::initCodeClassFields
virtual void initCodeClassFields()
Definition: classifiercodedocument.cpp:541
ClassifierCodeDocument::getSpecificClassFields
CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType)
Definition: classifiercodedocument.cpp:55
ClassifierCodeDocument::addCodeClassField
bool addCodeClassField(CodeClassField *add_object)
Definition: classifiercodedocument.cpp:183
ClassifierCodeDocument::removeCodeClassField
bool removeCodeClassField(CodeClassField *remove_object)
Definition: classifiercodedocument.cpp:225
ClassifierCodeDocument::parentIsClass
bool parentIsClass()
Definition: classifiercodedocument.cpp:411
ClassifierCodeDocument::~ClassifierCodeDocument
virtual ~ClassifierCodeDocument()
Definition: classifiercodedocument.cpp:46
ClassifierCodeDocument::syncClassFields
void syncClassFields()
Definition: classifiercodedocument.cpp:494
ClassifierCodeDocument::removeOperation
void removeOperation(UMLClassifierListItem *obj)
Definition: classifiercodedocument.cpp:332
ClassifierCodeDocument::init
void init(UMLClassifier *classifier)
Definition: classifiercodedocument.cpp:429
CodeClassField
Definition: codeclassfield.h:30
CodeClassField::ClassFieldType
ClassFieldType
Definition: codeclassfield.h:34
CodeDocument
Definition: codedocument.h:34
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:33
CodeOperation
Definition: codeoperation.h:24
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:25
TextBlock
Definition: textblock.h:27
UMLAssociation
Sets up association information.
Definition: association.h:34
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:30
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
classifier.h
codeaccessormethod.h
codeclassfield.h
codeclassfieldlist.h
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:17
codedocument.h
codeoperation.h
Uml::ID::Type
std::string Type
Definition: basictypes.h:385
Uml::Visibility::Enum
Enum
Definition: basictypes.h:59
visibility
Definition: visibility.py:1
umlassociationlist.h
UMLAssociationList
QList< UMLAssociation * > UMLAssociationList
Definition: umlassociationlist.h:18