umbrello: umbrello/codegenerators/codegenobjectwithtextblocks.h Source File

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

codegenobjectwithtextblocks.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 CODEGENOBJECTWITHTEXTBLOCKS_H
13 #define CODEGENOBJECTWITHTEXTBLOCKS_H
14
15 #include "codeaccessormethod.h"
16 #include "textblocklist.h"
17
18 #include <QMap>
19
20 class CodeBlock;
21 class CodeBlockWithComments;
22 class CodeClassField;
23 class CodeComment;
24 class CodeDocument;
25 class HierarchicalCodeBlock;
26 class QXmlStreamWriter;
27 class TextBlock;
28
32 class CodeGenObjectWithTextBlocks
33 {
34 public:
35
36 explicit CodeGenObjectWithTextBlocks(CodeDocument *parent);
37 virtual ~CodeGenObjectWithTextBlocks();
38
39 virtual bool addTextBlock(TextBlock * add_object);
40
41 virtual bool removeTextBlock(TextBlock * remove_object);
42
47 virtual bool insertTextBlock(TextBlock * newBlock, TextBlock * existingBlock, bool after) = 0;
48
49 TextBlockList * getTextBlockList() const;
50
51 virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel);
52
53 virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel);
54
55 CodeComment * addOrUpdateTaggedCodeComment(const QString &tag = QString(), const QString &text = QString(), int indentationLevel = 0);
56
57 CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments
58 (const QString &tag, const QString &text, const QString &ctext,
59 int indentLevel, bool forceUserBlockUpdate);
60
61 TextBlock * findTextBlockByTag(const QString &tag);
62
67 virtual QString getUniqueTag(const QString& prefix = QString()) = 0;
68
72 virtual CodeBlock * newCodeBlock() = 0;
73 virtual CodeBlockWithComments * newCodeBlockWithComments() = 0;
74 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock() = 0;
75
76 CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString & tag);
77
78 protected:
79
80 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
81
82 virtual void setAttributesFromNode(QDomElement & element);
83
84 /*virtual*/ void setAttributesFromObject(CodeGenObjectWithTextBlocks * obj);
85
86 virtual void loadChildTextBlocksFromNode(QDomElement & root);
87
88 virtual void resetTextBlocks();
89
94 virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag) = 0;
95
96 QMap<QString, TextBlock *> m_textBlockTagMap;
97 TextBlockList m_textblockVector;
98
99 private:
100
101 // needed in order to use findTextBlocksByTag
102 CodeDocument *m_pCodeDoc;
103
104 };
105
106 #endif // CODEGENOBJECTWITHTEXTBLOCKS_H
CodeBlockWithComments
Definition: codeblockwithcomments.h:24
CodeBlock
Definition: codeblock.h:21
CodeClassField
Definition: codeclassfield.h:30
CodeComment
Definition: codecomment.h:24
CodeDocument
Definition: codedocument.h:34
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:33
CodeGenObjectWithTextBlocks::CodeGenObjectWithTextBlocks
CodeGenObjectWithTextBlocks(CodeDocument *parent)
Definition: codegenobjectwithtextblocks.cpp:32
CodeGenObjectWithTextBlocks::insertTextBlock
virtual bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
CodeGenObjectWithTextBlocks::addTextBlock
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:60
CodeGenObjectWithTextBlocks::~CodeGenObjectWithTextBlocks
virtual ~CodeGenObjectWithTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:40
CodeGenObjectWithTextBlocks::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()=0
CodeGenObjectWithTextBlocks::newCodeBlock
virtual CodeBlock * newCodeBlock()=0
CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeComment
CodeComment * addOrUpdateTaggedCodeComment(const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
Definition: codegenobjectwithtextblocks.cpp:243
CodeGenObjectWithTextBlocks::findCodeClassFieldTextBlockByTag
virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)=0
CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeBlockWithComments
CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments(const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
Definition: codegenobjectwithtextblocks.cpp:283
CodeGenObjectWithTextBlocks::setAttributesFromObject
void setAttributesFromObject(CodeGenObjectWithTextBlocks *obj)
Definition: codegenobjectwithtextblocks.cpp:342
CodeGenObjectWithTextBlocks::getHierarchicalCodeBlock
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:180
CodeGenObjectWithTextBlocks::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()=0
CodeGenObjectWithTextBlocks::resetTextBlocks
virtual void resetTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:326
CodeGenObjectWithTextBlocks::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codegenobjectwithtextblocks.cpp:376
CodeGenObjectWithTextBlocks::m_textblockVector
TextBlockList m_textblockVector
Definition: codegenobjectwithtextblocks.h:97
CodeGenObjectWithTextBlocks::findTextBlockByTag
TextBlock * findTextBlockByTag(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:125
CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock
CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:145
CodeGenObjectWithTextBlocks::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: codegenobjectwithtextblocks.cpp:358
CodeGenObjectWithTextBlocks::getUniqueTag
virtual QString getUniqueTag(const QString &prefix=QString())=0
CodeGenObjectWithTextBlocks::getCodeBlockWithComments
virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:212
CodeGenObjectWithTextBlocks::m_textBlockTagMap
QMap< QString, TextBlock * > m_textBlockTagMap
Definition: codegenobjectwithtextblocks.h:96
CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Definition: codegenobjectwithtextblocks.cpp:393
CodeGenObjectWithTextBlocks::removeTextBlock
virtual bool removeTextBlock(TextBlock *remove_object)
Definition: codegenobjectwithtextblocks.cpp:95
CodeGenObjectWithTextBlocks::m_pCodeDoc
CodeDocument * m_pCodeDoc
Definition: codegenobjectwithtextblocks.h:102
CodeGenObjectWithTextBlocks::getTextBlockList
TextBlockList * getTextBlockList() const
Definition: codegenobjectwithtextblocks.cpp:49
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:25
TextBlock
Definition: textblock.h:27
codeaccessormethod.h
textblocklist.h
TextBlockList
QList< TextBlock * > TextBlockList
Definition: textblocklist.h:17