umbrello: umbrello/codegenerators/codeaccessormethod.h Source File

umbrello 2.32.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 class QXmlStreamWriter;
20
21 class CodeAccessorMethod : public CodeMethodBlock
22 {
23 friend class CodeClassField;
24 Q_OBJECT
25 public:
26
27 // some types of accessor methods that are possible:
28 // "GET" is to retrieve single-valued (primitive or Object) fields
29 // "SET" is to set single-valued (primitive or Object) fields
30 // "ADD" is to add a value to a multiple-valued field of either primitive or Object items
31 // "REMOVE" is to remove a value to a multiple-valued field of either primitive or Object items
32 // "LIST" is to retrieve the entire list of items in a multiple-valued field
33 enum AccessorType {GET=0, SET, ADD, REMOVE, LIST};
34
35 explicit CodeAccessorMethod(CodeClassField * field);
36 virtual ~CodeAccessorMethod();
37
38 CodeClassField * getParentClassField();
39
40 AccessorType getType();
41
42 void setType(AccessorType type);
43
44 // virtual UMLObject * getParentObject();
45
46 bool parentIsAttribute();
47
48 virtual void updateContent() = 0;
49
50 virtual void saveToXMI1(QXmlStreamWriter& writer);
51 virtual void loadFromXMI1(QDomElement & root);
52
53 virtual void setAttributesFromObject(TextBlock * obj);
54
55 protected:
56
57 virtual void release();
58
59 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
60
61 virtual void setAttributesFromNode(QDomElement & element);
62
63 virtual void updateMethodDeclaration() = 0;
64
65 void forceRelease();
66
67 private:
68
69 CodeClassField * m_parentclassfield;
70 AccessorType m_accessorType;
71
72 void initFields(CodeClassField * parentCF);
73
74 };
75
76 #endif // CODEACCESSORMETHOD_H
CodeAccessorMethod
Definition: codeaccessormethod.h:22
CodeAccessorMethod::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeaccessormethod.cpp:103
CodeAccessorMethod::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: codeaccessormethod.cpp:111
CodeAccessorMethod::getParentClassField
CodeClassField * getParentClassField()
Definition: codeaccessormethod.cpp:41
CodeAccessorMethod::getType
AccessorType getType()
Definition: codeaccessormethod.cpp:65
CodeAccessorMethod::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: codeaccessormethod.cpp:171
CodeAccessorMethod::forceRelease
void forceRelease()
Definition: codeaccessormethod.cpp:92
CodeAccessorMethod::CodeAccessorMethod
CodeAccessorMethod(CodeClassField *field)
Definition: codeaccessormethod.cpp:24
CodeAccessorMethod::m_accessorType
AccessorType m_accessorType
Definition: codeaccessormethod.h:70
CodeAccessorMethod::parentIsAttribute
bool parentIsAttribute()
Definition: codeaccessormethod.cpp:46
CodeAccessorMethod::release
virtual void release()
Definition: codeaccessormethod.cpp:84
CodeAccessorMethod::~CodeAccessorMethod
virtual ~CodeAccessorMethod()
Definition: codeaccessormethod.cpp:33
CodeAccessorMethod::initFields
void initFields(CodeClassField *parentCF)
Definition: codeaccessormethod.cpp:185
CodeAccessorMethod::updateMethodDeclaration
virtual void updateMethodDeclaration()=0
CodeAccessorMethod::updateContent
virtual void updateContent()=0
CodeAccessorMethod::m_parentclassfield
CodeClassField * m_parentclassfield
Definition: codeaccessormethod.h:69
CodeAccessorMethod::setType
void setType(AccessorType type)
Definition: codeaccessormethod.cpp:73
CodeAccessorMethod::AccessorType
AccessorType
Definition: codeaccessormethod.h:33
CodeAccessorMethod::GET
@ GET
Definition: codeaccessormethod.h:33
CodeAccessorMethod::REMOVE
@ REMOVE
Definition: codeaccessormethod.h:33
CodeAccessorMethod::ADD
@ ADD
Definition: codeaccessormethod.h:33
CodeAccessorMethod::SET
@ SET
Definition: codeaccessormethod.h:33
CodeAccessorMethod::LIST
@ LIST
Definition: codeaccessormethod.h:33
CodeAccessorMethod::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: codeaccessormethod.cpp:124
CodeAccessorMethod::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeaccessormethod.cpp:138
CodeClassField
Definition: codeclassfield.h:30
CodeMethodBlock
Definition: codemethodblock.h:30
TextBlock
Definition: textblock.h:27
codemethodblock.h