umbrello: umbrello/codegenerators/codeblock.h Source File

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

codeblock.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3
4 SPDX-FileCopyrightText: 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov>
5 SPDX-FileCopyrightText: 2004-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6*/
7
8#ifndef CODEBLOCK_H
9#define CODEBLOCK_H
10
11#include "textblock.h"
12
16 class CodeBlock : public TextBlock
17{
18public:
19
23 enum ContentType {
24 AutoGenerated=0,
25 UserGenerated
26 };
27
28 explicit CodeBlock(CodeDocument * parent, const QString & body = QString());
29 virtual ~CodeBlock();
30
31 void setContentType(ContentType new_var);
32 ContentType contentType() const;
33
34 static QString enumToString(const ContentType& val);
35
36 virtual void saveToXMI(QXmlStreamWriter& writer);
37 virtual void loadFromXMI(QDomElement & root);
38
39 virtual void setAttributesFromObject(TextBlock * obj);
40
41 friend QDebug operator<<(QDebug str, const CodeBlock& obj);
42
43protected:
44
45 virtual void setAttributesOnNode(QXmlStreamWriter& writer);
46 virtual void setAttributesFromNode(QDomElement & element);
47
48private:
49
50 // specifies whether the content (text) of this object
51 // was generated by the code generator or was supplied by the user (or some other way).
52 ContentType m_contentType;
53
54};
55
56#endif // CODEBLOCK_H
CodeBlock
Definition codeblock.h:17
CodeBlock::setAttributesFromNode
virtual void setAttributesFromNode(QDomElement &element)
Definition codeblock.cpp:95
CodeBlock::loadFromXMI
virtual void loadFromXMI(QDomElement &root)
Definition codeblock.cpp:85
CodeBlock::ContentType
ContentType
Definition codeblock.h:23
CodeBlock::UserGenerated
@ UserGenerated
the content was entered by the user
Definition codeblock.h:25
CodeBlock::AutoGenerated
@ AutoGenerated
the content was generated by code generation itself
Definition codeblock.h:24
CodeBlock::operator<<
friend QDebug operator<<(QDebug str, const CodeBlock &obj)
Definition codeblock.cpp:131
CodeBlock::setContentType
void setContentType(ContentType new_var)
Definition codeblock.cpp:39
CodeBlock::enumToString
static QString enumToString(const ContentType &val)
Definition codeblock.cpp:121
CodeBlock::~CodeBlock
virtual ~CodeBlock()
Definition codeblock.cpp:29
CodeBlock::saveToXMI
virtual void saveToXMI(QXmlStreamWriter &writer)
Definition codeblock.cpp:59
CodeBlock::m_contentType
ContentType m_contentType
Definition codeblock.h:52
CodeBlock::setAttributesFromObject
virtual void setAttributesFromObject(TextBlock *obj)
Definition codeblock.cpp:107
CodeBlock::contentType
ContentType contentType() const
Definition codeblock.cpp:50
CodeBlock::setAttributesOnNode
virtual void setAttributesOnNode(QXmlStreamWriter &writer)
Definition codeblock.cpp:72
CodeBlock::CodeBlock
CodeBlock(CodeDocument *parent, const QString &body=QString())
Definition codeblock.cpp:20
CodeDocument
Definition codedocument.h:30
TextBlock
Definition textblock.h:23
TextBlock::TextBlock
TextBlock(CodeDocument *parent, const QString &text=QString())
Definition textblock.cpp:24
textblock.h