umbrello  2.32.3
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;
22 class CodeClassField;
23 class CodeComment;
24 class CodeDocument;
26 class QXmlStreamWriter;
27 class TextBlock;
28 
33 {
34 public:
35 
36  explicit CodeGenObjectWithTextBlocks(CodeDocument *parent);
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 
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 
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;
75 
77 
78 protected:
79 
80  virtual void setAttributesOnNode(QXmlStreamWriter& writer);
81 
82  virtual void setAttributesFromNode(QDomElement & element);
83 
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;
98 
99 private:
100 
101  // needed in order to use findTextBlocksByTag
103 
104 };
105 
106 #endif // CODEGENOBJECTWITHTEXTBLOCKS_H
Definition: codeblockwithcomments.h:24
Definition: codeblock.h:21
Definition: codeclassfield.h:30
Definition: codecomment.h:24
Definition: codedocument.h:34
Definition: codegenobjectwithtextblocks.h:33
CodeGenObjectWithTextBlocks(CodeDocument *parent)
Definition: codegenobjectwithtextblocks.cpp:32
virtual bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:60
virtual ~CodeGenObjectWithTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:40
virtual CodeBlockWithComments * newCodeBlockWithComments()=0
virtual CodeBlock * newCodeBlock()=0
CodeComment * addOrUpdateTaggedCodeComment(const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
Definition: codegenobjectwithtextblocks.cpp:243
virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)=0
CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments(const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
Definition: codegenobjectwithtextblocks.cpp:283
void setAttributesFromObject(CodeGenObjectWithTextBlocks *obj)
Definition: codegenobjectwithtextblocks.cpp:342
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:180
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()=0
virtual void resetTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:326
virtual void setAttributesFromNode(QDomElement &element)
Definition: codegenobjectwithtextblocks.cpp:376
TextBlockList m_textblockVector
Definition: codegenobjectwithtextblocks.h:97
TextBlock * findTextBlockByTag(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:125
CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:145
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition: codegenobjectwithtextblocks.cpp:358
virtual QString getUniqueTag(const QString &prefix=QString())=0
virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:212
QMap< QString, TextBlock * > m_textBlockTagMap
Definition: codegenobjectwithtextblocks.h:96
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Definition: codegenobjectwithtextblocks.cpp:393
virtual bool removeTextBlock(TextBlock *remove_object)
Definition: codegenobjectwithtextblocks.cpp:95
CodeDocument * m_pCodeDoc
Definition: codegenobjectwithtextblocks.h:102
TextBlockList * getTextBlockList() const
Definition: codegenobjectwithtextblocks.cpp:49
Definition: hierarchicalcodeblock.h:25
Definition: textblock.h:27
QList< TextBlock * > TextBlockList
Definition: textblocklist.h:17