umbrello: umbrello/codegenerators/hierarchicalcodeblock.h Source File

umbrello 2.32.1 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 * 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 HIERARCHICALCODEBLOCK_H
13 #define HIERARCHICALCODEBLOCK_H
14
15 #include "codegenobjectwithtextblocks.h"
16 #include "codeblockwithcomments.h"
17 #include "codeclassfieldlist.h"
18
19 #include <QMap>
20 #include <QString>
21
22 class QXmlStreamWriter;
23
24 class HierarchicalCodeBlock : public CodeBlockWithComments, public CodeGenObjectWithTextBlocks
25 {
26 friend class CodeGenObjectWithTextBlocks;
27 public:
28
29 explicit HierarchicalCodeBlock (CodeDocument * doc, const QString &startString = QString(), const QString &endString = QString(), const QString &comment = QString());
30
34 virtual ~HierarchicalCodeBlock ();
35
36 void setEndText (const QString &new_var);
37
38 QString getEndText () const;
39
40 bool addTextBlock (TextBlock * add_object);
41
42 bool insertTextBlock (TextBlock * newBlock, TextBlock * existingBlock, bool after = true);
43
44 bool removeTextBlock (TextBlock * remove_object);
45
46 void setStartText (const QString &text);
47
48 QString getStartText () const;
49
50 virtual void saveToXMI1(QXmlStreamWriter& writer);
51
52 virtual void loadFromXMI1 (QDomElement & root);
53
54 virtual QString toString () const;
55
56 QString getUniqueTag();
57 QString getUniqueTag(const QString& prefix);
58
59 void addCodeClassFieldMethods (CodeClassFieldList &list);
60
61 virtual CodeBlock * newCodeBlock();
62 virtual CodeBlockWithComments * newCodeBlockWithComments();
63 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock();
64
65 protected:
66
67 virtual void release ();
68
69 virtual void setAttributesOnNode (QXmlStreamWriter& writer);
70
71 virtual void setAttributesFromNode (QDomElement & element);
72
73 virtual void setAttributesFromObject (TextBlock * obj);
74
75 TextBlock * findCodeClassFieldTextBlockByTag (const QString &tag);
76
77 private:
78
79 QString m_startText;
80 QString m_endText;
81
82 QString childTextBlocksToString() const;
83 void initAttributes () ;
84
85 };
86
87 #endif // HIERARCHICALCODEBLOCK_H
CodeBlockWithComments
Definition: codeblockwithcomments.h:24
CodeBlock
Definition: codeblock.h:21
CodeDocument
Definition: codedocument.h:34
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:33
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:25
HierarchicalCodeBlock::m_endText
QString m_endText
Definition: hierarchicalcodeblock.h:80
HierarchicalCodeBlock::m_startText
QString m_startText
Definition: hierarchicalcodeblock.h:79
HierarchicalCodeBlock::release
virtual void release()
Definition: hierarchicalcodeblock.cpp:389
HierarchicalCodeBlock::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: hierarchicalcodeblock.cpp:254
HierarchicalCodeBlock::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: hierarchicalcodeblock.cpp:365
HierarchicalCodeBlock::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Definition: hierarchicalcodeblock.cpp:81
HierarchicalCodeBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: hierarchicalcodeblock.cpp:300
HierarchicalCodeBlock::toString
virtual QString toString() const
Definition: hierarchicalcodeblock.cpp:316
HierarchicalCodeBlock::setStartText
void setStartText(const QString &text)
Definition: hierarchicalcodeblock.cpp:202
HierarchicalCodeBlock::~HierarchicalCodeBlock
virtual ~HierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:38
HierarchicalCodeBlock::getEndText
QString getEndText() const
Definition: hierarchicalcodeblock.cpp:55
HierarchicalCodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: hierarchicalcodeblock.cpp:272
HierarchicalCodeBlock::newCodeBlock
virtual CodeBlock * newCodeBlock()
Definition: hierarchicalcodeblock.cpp:76
HierarchicalCodeBlock::initAttributes
void initAttributes()
Definition: hierarchicalcodeblock.cpp:377
HierarchicalCodeBlock::insertTextBlock
bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
Definition: hierarchicalcodeblock.cpp:110
HierarchicalCodeBlock::HierarchicalCodeBlock
HierarchicalCodeBlock(CodeDocument *doc, const QString &startString=QString(), const QString &endString=QString(), const QString &comment=QString())
Definition: hierarchicalcodeblock.cpp:30
HierarchicalCodeBlock::setEndText
void setEndText(const QString &new_var)
Definition: hierarchicalcodeblock.cpp:46
HierarchicalCodeBlock::removeTextBlock
bool removeTextBlock(TextBlock *remove_object)
Definition: hierarchicalcodeblock.cpp:172
HierarchicalCodeBlock::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition: hierarchicalcodeblock.cpp:218
HierarchicalCodeBlock::childTextBlocksToString
QString childTextBlocksToString() const
Definition: hierarchicalcodeblock.cpp:349
HierarchicalCodeBlock::getStartText
QString getStartText() const
Definition: hierarchicalcodeblock.cpp:210
HierarchicalCodeBlock::addTextBlock
bool addTextBlock(TextBlock *add_object)
Definition: hierarchicalcodeblock.cpp:96
HierarchicalCodeBlock::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:86
HierarchicalCodeBlock::getUniqueTag
QString getUniqueTag()
Definition: hierarchicalcodeblock.cpp:63
HierarchicalCodeBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: hierarchicalcodeblock.cpp:281
HierarchicalCodeBlock::saveToXMI1
virtual void saveToXMI1(QXmlStreamWriter &writer)
Definition: hierarchicalcodeblock.cpp:243
TextBlock
Definition: textblock.h:27
codeblockwithcomments.h
codeclassfieldlist.h
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:17
codegenobjectwithtextblocks.h