umbrello: umbrello/codegenerators/codeaccessormethod.h Source File

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

codeaccessormethod.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 CODEACCESSORMETHOD_H
13 #define CODEACCESSORMETHOD_H
14
15 #include "codemethodblock.h"
16 #include <QString>
17
18 class CodeClassField;
19
20 class CodeAccessorMethod : public CodeMethodBlock
21 {
22 friend class CodeClassField;
23 Q_OBJECT
24 public:
25
26 // some types of accessor methods that are possible:
27 // "GET" is to retrieve single-valued (primitive or Object) fields
28 // "SET" is to set single-valued (primitive or Object) fields
29 // "ADD" is to add a value to a multiple-valued field of either primitive or Object items
30 // "REMOVE" is to remove a value to a multiple-valued field of either primitive or Object items
31 // "LIST" is to retrieve the entire list of items in a multiple-valued field
32 enum AccessorType {GET=0, SET, ADD, REMOVE, LIST};
33
34 explicit CodeAccessorMethod(CodeClassField * field);
35 virtual ~CodeAccessorMethod();
36
37 CodeClassField * getParentClassField();
38
39 AccessorType getType();
40
41 void setType(AccessorType type);
42
43 // virtual UMLObject * getParentObject();
44
45 bool parentIsAttribute();
46
47 virtual void updateContent() = 0;
48
49 virtual void saveToXMI1(QDomDocument & doc, QDomElement & root);
50 virtual void loadFromXMI1(QDomElement & root);
51
52 virtual void setAttributesFromObject(TextBlock * obj);
53
54 protected:
55
56 virtual void release();
57
58 virtual void setAttributesOnNode(QDomDocument & doc, QDomElement & blockElement);
59
60 virtual void setAttributesFromNode(QDomElement & element);
61
62 virtual void updateMethodDeclaration() = 0;
63
64 void forceRelease();
65
66 private:
67
68 CodeClassField * m_parentclassfield;
69 AccessorType m_accessorType;
70
71 void initFields(CodeClassField * parentCF);
72
73 };
74
75 #endif // CODEACCESSORMETHOD_H
codeclassfield.h
CodeAccessorMethod::release
virtual void release()
Definition: codeaccessormethod.cpp:83
CodeAccessorMethod::~CodeAccessorMethod
virtual ~CodeAccessorMethod()
Definition: codeaccessormethod.cpp:32
CodeClassField::parentIsAttribute
bool parentIsAttribute() const
Definition: codeclassfield.cpp:127
CodeMethodBlock::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Definition: codemethodblock.cpp:87
CodeAccessorMethod::SET
@ SET
Definition: codeaccessormethod.h:32
CodeMethodBlock::syncToParent
virtual void syncToParent()
Definition: codemethodblock.cpp:169
CodeAccessorMethod::getParentClassField
CodeClassField * getParentClassField()
Definition: codeaccessormethod.cpp:40
CodeAccessorMethod::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeaccessormethod.cpp:102
CodeAccessorMethod
Definition: codeaccessormethod.h:21
CodeAccessorMethod::updateMethodDeclaration
virtual void updateMethodDeclaration()=0
CodeAccessorMethod::CodeAccessorMethod
CodeAccessorMethod(CodeClassField *field)
Definition: codeaccessormethod.cpp:23
CodeAccessorMethod::setType
void setType(AccessorType type)
Definition: codeaccessormethod.cpp:72
CodeClassField
Definition: codeclassfield.h:30
CodeAccessorMethod::forceRelease
void forceRelease()
Definition: codeaccessormethod.cpp:91
CodeAccessorMethod::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: codeaccessormethod.cpp:110
CodeAccessorMethod::getType
AccessorType getType()
Definition: codeaccessormethod.cpp:64
CodeMethodBlock::release
virtual void release()
Definition: codemethodblock.cpp:76
CodeMethodBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codemethodblock.cpp:106
CodeAccessorMethod::initFields
void initFields(CodeClassField *parentCF)
Definition: codeaccessormethod.cpp:184
CodeAccessorMethod::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Definition: codeaccessormethod.cpp:123
CodeAccessorMethod::m_accessorType
AccessorType m_accessorType
Definition: codeaccessormethod.h:69
MyProject\connect
connect()
Definition: namespaces-multiple.php:5
CodeMethodBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: codemethodblock.cpp:124
CodeAccessorMethod::GET
@ GET
Definition: codeaccessormethod.h:32
CodeAccessorMethod::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: codeaccessormethod.cpp:170
CodeAccessorMethod::m_parentclassfield
CodeClassField * m_parentclassfield
Definition: codeaccessormethod.h:68
TextBlock::setCanDelete
void setCanDelete(bool canDelete)
Definition: textblock.cpp:50
CodeAccessorMethod::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeaccessormethod.cpp:137
CodeAccessorMethod::LIST
@ LIST
Definition: codeaccessormethod.h:32
codeaccessormethod.h
TextBlock::getParentDocument
CodeDocument * getParentDocument() const
Definition: textblock.cpp:70
codemethodblock.h
CodeAccessorMethod::REMOVE
@ REMOVE
Definition: codeaccessormethod.h:32
TextBlock
Definition: textblock.h:25
CodeAccessorMethod::parentIsAttribute
bool parentIsAttribute()
Definition: codeaccessormethod.cpp:45
CodeAccessorMethod::ADD
@ ADD
Definition: codeaccessormethod.h:32
CodeAccessorMethod::AccessorType
AccessorType
Definition: codeaccessormethod.h:32
CodeAccessorMethod::updateContent
virtual void updateContent()=0
CodeMethodBlock
Definition: codemethodblock.h:29