umbrello: umbrello/codegenerators/codegenobjectwithtextblocks.h Source File

umbrello 2.31.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 TextBlock;
27
31 class CodeGenObjectWithTextBlocks
32 {
33 public:
34
35 explicit CodeGenObjectWithTextBlocks(CodeDocument *parent);
36 virtual ~CodeGenObjectWithTextBlocks();
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
48 TextBlockList * getTextBlockList() const;
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
56 CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments
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;
72 virtual CodeBlockWithComments * newCodeBlockWithComments() = 0;
73 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock() = 0;
74
75 CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString & tag);
76
77 protected:
78
79 virtual void setAttributesOnNode(QDomDocument & doc, QDomElement & elem);
80
81 virtual void setAttributesFromNode(QDomElement & element);
82
83 /*virtual*/ void setAttributesFromObject(CodeGenObjectWithTextBlocks * obj);
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;
96 TextBlockList m_textblockVector;
97
98 private:
99
100 // needed in order to use findTextBlocksByTag
101 CodeDocument *m_pCodeDoc;
102
103 };
104
105 #endif // CODEGENOBJECTWITHTEXTBLOCKS_H
CodeGenObjectWithTextBlocks::resetTextBlocks
virtual void resetTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:323
CodeGenObjectWithTextBlocks::findParentObjectForTaggedTextBlock
CodeGenObjectWithTextBlocks * findParentObjectForTaggedTextBlock(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:142
CodeGenObjectWithTextBlocks::findCodeClassFieldTextBlockByTag
virtual TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)=0
textblocklist.h
codegenfactory.h
CodeGenObjectWithTextBlocks::getCodeBlockWithComments
virtual CodeBlockWithComments * getCodeBlockWithComments(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:209
CodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeblock.cpp:91
CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeBlockWithComments
CodeBlockWithComments * addOrUpdateTaggedCodeBlockWithComments(const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
Definition: codegenobjectwithtextblocks.cpp:280
UMLObject::asUMLOperation
UMLOperation * asUMLOperation()
Definition: umlobject.cpp:1323
CodeGenObjectWithTextBlocks::m_textBlockTagMap
QMap< QString, TextBlock * > m_textBlockTagMap
Definition: codegenobjectwithtextblocks.h:95
CodeGenObjectWithTextBlocks::removeTextBlock
virtual bool removeTextBlock(TextBlock *remove_object)
Definition: codegenobjectwithtextblocks.cpp:92
hierarchicalcodeblock.h
namespace_enum_literal::test
test
Definition: namespace-enum-literal.h:3
CodeGenObjectWithTextBlocks::findTextBlockByTag
TextBlock * findTextBlockByTag(const QString &tag)
Definition: codegenobjectwithtextblocks.cpp:122
CodeComment
Definition: codecomment.h:24
TextBlock::setWriteOutText
void setWriteOutText(bool write)
Definition: textblock.cpp:131
CodeGenObjectWithTextBlocks::addTextBlock
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:57
CodeGenObjectWithTextBlocks::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()=0
CodeBlockWithComments::getComment
CodeComment * getComment() const
Definition: codeblockwithcomments.cpp:47
TextBlock::setTag
void setTag(const QString &value)
Definition: textblock.cpp:121
CodeClassField
Definition: codeclassfield.h:30
CodeDocument
Definition: codedocument.h:33
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
CodeGenObjectWithTextBlocks::getTextBlockList
TextBlockList * getTextBlockList() const
Definition: codegenobjectwithtextblocks.cpp:46
codeoperation.h
CodeBlock
Definition: codeblock.h:21
ClassifierCodeDocument
Definition: classifiercodedocument.h:33
CodeOperation::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeoperation.cpp:83
CodeGenObjectWithTextBlocks::addOrUpdateTaggedCodeComment
CodeComment * addOrUpdateTaggedCodeComment(const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
Definition: codegenobjectwithtextblocks.cpp:240
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1285
CodeBlockWithComments::setOverallIndentationLevel
void setOverallIndentationLevel(int level)
Definition: codeblockwithcomments.cpp:164
TextBlock::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)=0
CodeBlockWithComments::setComment
void setComment(CodeComment *object)
Definition: codeblockwithcomments.cpp:39
CodeGenObjectWithTextBlocks
Definition: codegenobjectwithtextblocks.h:32
CodeGenObjectWithTextBlocks::m_pCodeDoc
CodeDocument * m_pCodeDoc
Definition: codegenobjectwithtextblocks.h:101
CodeGenObjectWithTextBlocks::m_textblockVector
TextBlockList m_textblockVector
Definition: codegenobjectwithtextblocks.h:96
CodeGenFactory::newCodeComment
CodeComment * newCodeComment(CodeDocument *cd)
Definition: codegenfactory.cpp:412
UMLDoc::findObjectById
UMLObject * findObjectById(Uml::ID::Type id)
Definition: umldoc.cpp:1036
CodeGenObjectWithTextBlocks::CodeGenObjectWithTextBlocks
CodeGenObjectWithTextBlocks(CodeDocument *parent)
Definition: codegenobjectwithtextblocks.cpp:29
HierarchicalCodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: hierarchicalcodeblock.cpp:269
uWarning
#define uWarning()
Definition: debug_utils.h:124
classifiercodedocument.h
CodeGenObjectWithTextBlocks::getUniqueTag
virtual QString getUniqueTag(const QString &prefix=QString())=0
CodeBlockWithComments::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeblockwithcomments.cpp:97
TextBlock::setIndentationLevel
void setIndentationLevel(int level)
Definition: textblock.cpp:152
uDebug
#define uDebug()
Definition: debug_utils.h:122
CodeGenObjectWithTextBlocks::newCodeBlock
virtual CodeBlock * newCodeBlock()=0
CodeBlockWithComments
Definition: codeblockwithcomments.h:24
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
CodeGenObjectWithTextBlocks::insertTextBlock
virtual bool insertTextBlock(TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
CodeGenObjectWithTextBlocks::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition: codegenobjectwithtextblocks.cpp:373
CodeBlock::contentType
ContentType contentType() const
Definition: codeblock.cpp:54
CodeBlock::AutoGenerated
@ AutoGenerated
the content was generated by code generation itself
Definition: codeblock.h:46
CodeGenObjectWithTextBlocks::getHierarchicalCodeBlock
virtual HierarchicalCodeBlock * getHierarchicalCodeBlock(const QString &tag, const QString &comment, int indentLevel)
Definition: codegenobjectwithtextblocks.cpp:177
codegenobjectwithtextblocks.h
codedocument.h
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:23
CodeGenObjectWithTextBlocks::setAttributesOnNode
virtual void setAttributesOnNode(QDomDocument &doc, QDomElement &elem)
Definition: codegenobjectwithtextblocks.cpp:355
uError
#define uError()
Definition: debug_utils.h:123
UMLOperation
Definition: operation.h:25
CodeOperation
Definition: codeoperation.h:24
CodeGenObjectWithTextBlocks::setAttributesFromObject
void setAttributesFromObject(CodeGenObjectWithTextBlocks *obj)
Definition: codegenobjectwithtextblocks.cpp:339
uml.h
debug_utils.h
TextBlockList
QList< TextBlock * > TextBlockList
Definition: textblocklist.h:17
codeaccessormethod.h
TextBlock::getParentDocument
CodeDocument * getParentDocument() const
Definition: textblock.cpp:70
CodeComment::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codecomment.cpp:42
TextBlock
Definition: textblock.h:25
TextBlock::setText
void setText(const QString &text)
Definition: textblock.cpp:80
CodeGenObjectWithTextBlocks::~CodeGenObjectWithTextBlocks
virtual ~CodeGenObjectWithTextBlocks()
Definition: codegenobjectwithtextblocks.cpp:37
CodeGenObjectWithTextBlocks::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()=0
CodeGenFactory::newCodeOperation
CodeOperation * newCodeOperation(ClassifierCodeDocument *ccd, UMLOperation *op)
Definition: codegenfactory.cpp:232
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1055
CodeGenObjectWithTextBlocks::loadChildTextBlocksFromNode
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Definition: codegenobjectwithtextblocks.cpp:390
TextBlock::getTag
QString getTag() const
Definition: textblock.cpp:110
umldoc.h
HierarchicalCodeBlock::removeTextBlock
bool removeTextBlock(TextBlock *remove_object)
Definition: hierarchicalcodeblock.cpp:169