umbrello: umbrello/codegenerators/hierarchicalcodeblock.h Source File

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

hierarchicalcodeblock.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-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6*/
7
8#ifndef HIERARCHICALCODEBLOCK_H
9#define HIERARCHICALCODEBLOCK_H
10
11#include "codegenobjectwithtextblocks.h"
12#include "codeblockwithcomments.h"
13#include "codeclassfieldlist.h"
14
15#include <QMap>
16#include <QString>
17
18class QXmlStreamWriter;
19
20 class HierarchicalCodeBlock : public CodeBlockWithComments, public CodeGenObjectWithTextBlocks
21{
22 friend class CodeGenObjectWithTextBlocks;
23public:
24
25 explicit HierarchicalCodeBlock (CodeDocument * doc, const QString &startString = QString(), const QString &endString = QString(), const QString &comment = QString());
26
30 virtual ~HierarchicalCodeBlock ();
31
32 void setEndText (const QString &new_var);
33
34 QString getEndText () const;
35
36 bool addTextBlock (TextBlock * add_object);
37
38 bool insertTextBlock (TextBlock * newBlock, TextBlock * existingBlock, bool after = true);
39
40 bool removeTextBlock (TextBlock * remove_object);
41
42 void setStartText (const QString &text);
43
44 QString getStartText () const;
45
46 virtual void saveToXMI1(QXmlStreamWriter& writer);
47
48 virtual void loadFromXMI1 (QDomElement & root);
49
50 virtual QString toString () const;
51
52 QString getUniqueTag();
53 QString getUniqueTag(const QString& prefix);
54
55 void addCodeClassFieldMethods (CodeClassFieldList &list);
56
57 virtual CodeBlock * newCodeBlock();
58 virtual CodeBlockWithComments * newCodeBlockWithComments();
59 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock();
60
61protected:
62
63 virtual void release ();
64
65 virtual void setAttributesOnNode (QXmlStreamWriter& writer);
66
67 virtual void setAttributesFromNode (QDomElement & element);
68
69 virtual void setAttributesFromObject (TextBlock * obj);
70
71 TextBlock * findCodeClassFieldTextBlockByTag (const QString &tag);
72
73private:
74
75 QString m_startText;
76 QString m_endText;
77
78 QString childTextBlocksToString() const;
79 void initAttributes () ;
80
81};
82
83#endif // HIERARCHICALCODEBLOCK_H
CodeBlockWithComments
Definition: codeblockwithcomments.h:20
CodeBlock
Definition: codeblock.h:17
CodeDocument
Definition: codedocument.h:30
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:29
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:21
HierarchicalCodeBlock::m_endText
QString m_endText
Definition: hierarchicalcodeblock.h:76
HierarchicalCodeBlock::m_startText
QString m_startText
Definition: hierarchicalcodeblock.h:75
HierarchicalCodeBlock::release
virtual void release()
Definition: hierarchicalcodeblock.cpp:385
HierarchicalCodeBlock::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: hierarchicalcodeblock.cpp:250
HierarchicalCodeBlock::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: hierarchicalcodeblock.cpp:361
HierarchicalCodeBlock::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Definition: hierarchicalcodeblock.cpp:77
HierarchicalCodeBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: hierarchicalcodeblock.cpp:296
HierarchicalCodeBlock::toString
virtual QString toString() const
Definition: hierarchicalcodeblock.cpp:312
HierarchicalCodeBlock::setStartText
void setStartText(const QString &text)
Definition: hierarchicalcodeblock.cpp:198
HierarchicalCodeBlock::~HierarchicalCodeBlock
virtual ~HierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:34
HierarchicalCodeBlock::getEndText
QString getEndText() const
Definition: hierarchicalcodeblock.cpp:51
HierarchicalCodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: hierarchicalcodeblock.cpp:268
HierarchicalCodeBlock::newCodeBlock
virtual CodeBlock * newCodeBlock()
Definition: hierarchicalcodeblock.cpp:72
HierarchicalCodeBlock::initAttributes
void initAttributes()
Definition: hierarchicalcodeblock.cpp:373
HierarchicalCodeBlock::insertTextBlock
bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
Definition: hierarchicalcodeblock.cpp:106
HierarchicalCodeBlock::HierarchicalCodeBlock
HierarchicalCodeBlock(CodeDocument *doc, const QString &startString=QString(), const QString &endString=QString(), const QString &comment=QString())
Definition: hierarchicalcodeblock.cpp:26
HierarchicalCodeBlock::setEndText
void setEndText(const QString &new_var)
Definition: hierarchicalcodeblock.cpp:42
HierarchicalCodeBlock::removeTextBlock
bool removeTextBlock(TextBlock *remove_object)
Definition: hierarchicalcodeblock.cpp:168
HierarchicalCodeBlock::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition: hierarchicalcodeblock.cpp:214
HierarchicalCodeBlock::childTextBlocksToString
QString childTextBlocksToString() const
Definition: hierarchicalcodeblock.cpp:345
HierarchicalCodeBlock::getStartText
QString getStartText() const
Definition: hierarchicalcodeblock.cpp:206
HierarchicalCodeBlock::addTextBlock
bool addTextBlock(TextBlock *add_object)
Definition: hierarchicalcodeblock.cpp:92
HierarchicalCodeBlock::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:82
HierarchicalCodeBlock::getUniqueTag
QString getUniqueTag()
Definition: hierarchicalcodeblock.cpp:59
HierarchicalCodeBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: hierarchicalcodeblock.cpp:277
HierarchicalCodeBlock::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: hierarchicalcodeblock.cpp:239
TextBlock
Definition: textblock.h:23
codeblockwithcomments.h
codeclassfieldlist.h
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:12
codegenobjectwithtextblocks.h