umbrello: umbrello/codegenerators/hierarchicalcodeblock.h Source File

umbrello 2.31.0 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 HierarchicalCodeBlock : public CodeBlockWithComments, public CodeGenObjectWithTextBlocks
23 {
24 friend class CodeGenObjectWithTextBlocks;
25 public:
26
27 explicit HierarchicalCodeBlock (CodeDocument * doc, const QString &startString = QString(), const QString &endString = QString(), const QString &comment = QString());
28
32 virtual ~HierarchicalCodeBlock ();
33
34 void setEndText (const QString &new_var);
35
36 QString getEndText () const;
37
38 bool addTextBlock (TextBlock * add_object);
39
40 bool insertTextBlock (TextBlock * newBlock, TextBlock * existingBlock, bool after = true);
41
42 bool removeTextBlock (TextBlock * remove_object);
43
44 void setStartText (const QString &text);
45
46 QString getStartText () const;
47
48 virtual void saveToXMI1 (QDomDocument & doc, QDomElement & root);
49
50 virtual void loadFromXMI1 (QDomElement & root);
51
52 virtual QString toString () const;
53
54 QString getUniqueTag();
55 QString getUniqueTag(const QString& prefix);
56
57 void addCodeClassFieldMethods (CodeClassFieldList &list);
58
59 virtual CodeBlock * newCodeBlock();
60 virtual CodeBlockWithComments * newCodeBlockWithComments();
61 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock();
62
63 protected:
64
65 virtual void release ();
66
67 virtual void setAttributesOnNode (QDomDocument & doc, QDomElement & elem);
68
69 virtual void setAttributesFromNode (QDomElement & element);
70
71 virtual void setAttributesFromObject (TextBlock * obj);
72
73 TextBlock * findCodeClassFieldTextBlockByTag (const QString &tag);
74
75 private:
76
77 QString m_startText;
78 QString m_endText;
79
80 QString childTextBlocksToString() const;
81 void initAttributes () ;
82
83 };
84
85 #endif // HIERARCHICALCODEBLOCK_H
codeclassfield.h
CodeGenObjectWithTextBlocks::resetTextBlocks
virtual void resetTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:323
HierarchicalCodeBlock::setEndText
void setEndText(const QString &new_var)
Definition: hierarchicalcodeblock.cpp:43
TextBlock::getWriteOutText
bool getWriteOutText() const
Definition: textblock.cpp:141
codegenfactory.h
HierarchicalCodeBlock::initAttributes
void initAttributes()
Definition: hierarchicalcodeblock.cpp:374
TextBlock::toString
virtual QString toString() const
Definition: textblock.cpp:407
HierarchicalCodeBlock::HierarchicalCodeBlock
HierarchicalCodeBlock(CodeDocument *doc, const QString &startString=QString(), const QString &endString=QString(), const QString &comment=QString())
Definition: hierarchicalcodeblock.cpp:27
CodeDocument::addChildTagToMap
void addChildTagToMap(const QString &tag, TextBlock *tb)
Definition: codedocument.cpp:490
HierarchicalCodeBlock::m_endText
QString m_endText
Definition: hierarchicalcodeblock.h:87
codeblockwithcomments.h
HierarchicalCodeBlock::setStartText
void setStartText(const QString &text)
Definition: hierarchicalcodeblock.cpp:199
codeclassfieldlist.h
CodeGenObjectWithTextBlocks::m_textBlockTagMap
QMap< QString, TextBlock * > m_textBlockTagMap
Definition: codegenobjectwithtextblocks.h:95
hierarchicalcodeblock.h
CodeGenObjectWithTextBlocks::findTextBlockByTag
TextBlock * findTextBlockByTag(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:122
TextBlock::encodeText
static QString encodeText(const QString &text, const QString &endLine)
Definition: textblock.cpp:381
HierarchicalCodeBlock::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: hierarchicalcodeblock.cpp:240
HierarchicalCodeBlock::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: hierarchicalcodeblock.cpp:362
HierarchicalCodeBlock::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Definition: hierarchicalcodeblock.cpp:78
UMLApp::commonPolicy
CodeGenerationPolicy * commonPolicy() const
Definition: uml.cpp:2274
CodeGenObjectWithTextBlocks::addTextBlock
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:57
TextBlock::getIndentationString
QString getIndentationString(int level=0) const
Definition: textblock.cpp:193
CodeAccessorMethod
Definition: codeaccessormethod.h:20
CodeBlockWithComments::getComment
CodeComment * getComment() const
Definition: codeblockwithcomments.cpp:47
TextBlock::setTag
void setTag(const QString &value)
Definition: textblock.cpp:121
CodeClassField
Definition: codeclassfield.h:29
CodeDocument
Definition: codedocument.h:32
CodeDocument::removeChildTagFromMap
void removeChildTagFromMap(const QString &tag)
Definition: codedocument.cpp:485
TextBlock::decodeText
static QString decodeText(const QString &text, const QString &endLine)
Definition: textblock.cpp:395
HierarchicalCodeBlock::newCodeBlock
virtual CodeBlock * newCodeBlock()
Definition: hierarchicalcodeblock.cpp:73
CodeGenObjectWithTextBlocks::getTextBlockList
TextBlockList * getTextBlockList() const
Definition: codegenobjectwithtextblocks.cpp:46
CodeBlock
Definition: codeblock.h:20
ClassifierCodeDocument
Definition: classifiercodedocument.h:32
HierarchicalCodeBlock::release
virtual void release()
Definition: hierarchicalcodeblock.cpp:386
HierarchicalCodeBlock::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition: hierarchicalcodeblock.cpp:215
HierarchicalCodeBlock::~HierarchicalCodeBlock
virtual ~HierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:35
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:31
CodeGenObjectWithTextBlocks::m_textblockVector
TextBlockList m_textblockVector
Definition: codegenobjectwithtextblocks.h:96
ClassifierCodeDocument::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: classifiercodedocument.cpp:771
HierarchicalCodeBlock::childTextBlocksToString
QString childTextBlocksToString() const
Definition: hierarchicalcodeblock.cpp:346
HierarchicalCodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: hierarchicalcodeblock.cpp:269
uWarning
#define uWarning()
Definition: debug_utils.h:124
HierarchicalCodeBlock::getStartText
QString getStartText() const
Definition: hierarchicalcodeblock.cpp:207
classifiercodedocument.h
CodeAccessorMethodList
QList< CodeAccessorMethod * > CodeAccessorMethodList
Definition: codeaccessormethodlist.h:17
codegenerationpolicy.h
HierarchicalCodeBlock::addTextBlock
bool addTextBlock(TextBlock *add_object)
Definition: hierarchicalcodeblock.cpp:93
CodeBlockWithComments
Definition: codeblockwithcomments.h:23
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
CodeGenObjectWithTextBlocks::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codegenobjectwithtextblocks.cpp:373
CodeDocument::newCodeBlock
virtual CodeBlock * newCodeBlock()
Definition: codedocument.cpp:460
CodeBlock::contentType
ContentType contentType() const
Definition: codeblock.cpp:54
TextBlock::release
virtual void release()
Definition: textblock.cpp:275
CodeBlock::AutoGenerated
@ AutoGenerated
the content was generated by code generation itself
Definition: codeblock.h:46
codegenobjectwithtextblocks.h
CodeBlockWithComments::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codeblockwithcomments.cpp:106
codedocument.h
TextBlock::formatMultiLineText
static QString formatMultiLineText(const QString &work, const QString &linePrefix, const QString &breakStr, bool addBreak=true, bool lastLineHasBreak=true)
Definition: textblock.cpp:288
HierarchicalCodeBlock::insertTextBlock
bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
Definition: hierarchicalcodeblock.cpp:107
TextBlock::setCanDelete
void setCanDelete(bool canDelete)
Definition: textblock.cpp:50
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:22
CodeGenObjectWithTextBlocks::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &elem)
Definition: codegenobjectwithtextblocks.cpp:355
HierarchicalCodeBlock::getEndText
QString getEndText() const
Definition: hierarchicalcodeblock.cpp:52
uError
#define uError()
Definition: debug_utils.h:123
CodeGenObjectWithTextBlocks::setAttributesFromObject
void setAttributesFromObject(CodeGenObjectWithTextBlocks *obj)
Definition: codegenobjectwithtextblocks.cpp:339
uml.h
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Definition: codegenerationpolicy.cpp:253
debug_utils.h
CodeDocument::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Definition: codedocument.cpp:469
TextBlockList
QList< TextBlock * > TextBlockList
Definition: textblocklist.h:17
HierarchicalCodeBlock::m_startText
QString m_startText
Definition: hierarchicalcodeblock.h:86
HierarchicalCodeBlock::getUniqueTag
QString getUniqueTag()
Definition: hierarchicalcodeblock.cpp:60
TextBlock::getParentDocument
CodeDocument * getParentDocument() const
Definition: textblock.cpp:70
HierarchicalCodeBlock::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Definition: hierarchicalcodeblock.cpp:83
HierarchicalCodeBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: hierarchicalcodeblock.cpp:278
CodeClassField::getMethodList
CodeAccessorMethodList getMethodList() const
Definition: codeclassfield.cpp:191
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:17
TextBlock
Definition: textblock.h:24
CodeBlockWithComments::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &blockElement)
Definition: codeblockwithcomments.cpp:69
HierarchicalCodeBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: hierarchicalcodeblock.cpp:297
TextBlock::getTag
QString getTag() const
Definition: textblock.cpp:110
HierarchicalCodeBlock::removeTextBlock
bool removeTextBlock(TextBlock *remove_object)
Definition: hierarchicalcodeblock.cpp:169
CodeDocument::getUniqueTag
virtual QString getUniqueTag(const QString &prefix=QString())
Definition: codedocument.cpp:193
HierarchicalCodeBlock::toString
virtual QString toString() const
Definition: hierarchicalcodeblock.cpp:313
CodeBlockWithComments::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition: codeblockwithcomments.cpp:84
HierarchicalCodeBlock::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &elem)
Definition: hierarchicalcodeblock.cpp:251