umbrello  2.32.0
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 TextBlock;
27 
32 {
33 public:
34 
35  explicit CodeGenObjectWithTextBlocks(CodeDocument *parent);
37 
38  virtual bool addTextBlock(TextBlock * add_object);
39 
40  virtual bool removeTextBlock(TextBlock * remove_object);
41 
46  virtual bool insertTextBlock(TextBlock * newBlock, TextBlock * existingBlock, bool after) = 0;
47 
49 
50  virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel);
51 
52  virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel);
53 
54  CodeComment * addOrUpdateTaggedCodeComment(const QString &tag = QString(), const QString &text = QString(), int indentationLevel = 0);
55 
57  (const QString &tag, const QString &text, const QString &ctext,
58  int indentLevel, bool forceUserBlockUpdate);
59 
60  TextBlock * findTextBlockByTag(const QString &tag);
61 
66  virtual QString getUniqueTag(const QString& prefix = QString()) = 0;
67 
71  virtual CodeBlock * newCodeBlock() = 0;
74 
76 
77 protected:
78 
79  virtual void setAttributesOnNode(QDomDocument & doc, QDomElement & elem);
80 
81  virtual void setAttributesFromNode(QDomElement & element);
82 
84 
85  virtual void loadChildTextBlocksFromNode(QDomElement & root);
86 
87  virtual void resetTextBlocks();
88 
93  virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag) = 0;
94 
95  QMap<QString, TextBlock *> m_textBlockTagMap;
97 
98 private:
99 
100  // needed in order to use findTextBlocksByTag
102 
103 };
104 
105 #endif // CODEGENOBJECTWITHTEXTBLOCKS_H
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()=0
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Definition: codegenobjectwithtextblocks.cpp:390
Definition: codeclassfield.h:29
Definition: codeblock.h:20
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &elem)
Definition: codegenobjectwithtextblocks.cpp:355
void setAttributesFromObject(CodeGenObjectWithTextBlocks *obj)
Definition: codegenobjectwithtextblocks.cpp:339
virtual ~CodeGenObjectWithTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:37
virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)=0
virtual void resetTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:323
virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:209
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:57
TextBlockList * getTextBlockList() const
Definition: codegenobjectwithtextblocks.cpp:46
TextBlockList m_textblockVector
Definition: codegenobjectwithtextblocks.h:96
virtual QString getUniqueTag(const QString &prefix=QString())=0
Definition: codeblockwithcomments.h:23
virtual CodeBlock * newCodeBlock()=0
virtual CodeBlockWithComments * newCodeBlockWithComments()=0
Definition: codedocument.h:32
CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:142
Definition: codegenobjectwithtextblocks.h:31
CodeDocument * m_pCodeDoc
Definition: codegenobjectwithtextblocks.h:101
virtual void setAttributesFromNode(QDomElement &element)
Definition: codegenobjectwithtextblocks.cpp:373
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:177
QList< TextBlock * > TextBlockList
Definition: textblocklist.h:17
Definition: hierarchicalcodeblock.h:22
Definition: textblock.h:24
CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments(const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
Definition: codegenobjectwithtextblocks.cpp:280
virtual bool removeTextBlock(TextBlock *remove_object)
Definition: codegenobjectwithtextblocks.cpp:92
CodeGenObjectWithTextBlocks(CodeDocument *parent)
Definition: codegenobjectwithtextblocks.cpp:29
virtual bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
TextBlock * findTextBlockByTag(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:122
Definition: codecomment.h:23
QMap< QString, TextBlock * > m_textBlockTagMap
Definition: codegenobjectwithtextblocks.h:95
CodeComment * addOrUpdateTaggedCodeComment(const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
Definition: codegenobjectwithtextblocks.cpp:240