umbrello: umbrello/codegenerators/cpp/cppheadercodedocument.h Source File

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

cppheadercodedocument.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 CPPHEADERCODEDOCUMENT_H
13 #define CPPHEADERCODEDOCUMENT_H
14
15 #include "codeclassfieldlist.h"
16 #include "classifiercodedocument.h"
17 #include "hierarchicalcodeblock.h"
18
19 #include <QString>
20
21 class CPPHeaderClassDeclarationBlock;
22
35 class CPPHeaderCodeDocument : public ClassifierCodeDocument
36 {
37 Q_OBJECT
38 public:
39
40 explicit CPPHeaderCodeDocument(UMLClassifier* classifier);
41 virtual ~CPPHeaderCodeDocument();
42
43 bool addCodeOperation(CodeOperation* op);
44
45 void updateContent();
46
50 //virtual void saveToXMI1(QDomDocument & doc, QDomElement & root);
51
52 protected:
53
54 // reset/clear our inventory of textblocks in this document
55 void resetTextBlocks();
56
61 virtual void loadChildTextBlocksFromNode(QDomElement & root);
62
63 void addOrUpdateCodeClassFieldMethodsInCodeBlock(CodeClassFieldList &list, CPPHeaderClassDeclarationBlock * codeBlock);
64
68 CodeComment * newCodeComment();
69
70 private:
71
72 CPPHeaderClassDeclarationBlock * m_classDeclCodeBlock;
73
74 HierarchicalCodeBlock * m_publicBlock;
75 HierarchicalCodeBlock * m_privateBlock;
76 HierarchicalCodeBlock * m_protectedBlock;
77
78 HierarchicalCodeBlock * m_namespaceBlock;
79
80 HierarchicalCodeBlock * m_pubConstructorBlock;
81 HierarchicalCodeBlock * m_protConstructorBlock;
82 HierarchicalCodeBlock * m_privConstructorBlock;
83
84 HierarchicalCodeBlock * m_pubOperationsBlock;
85 HierarchicalCodeBlock * m_privOperationsBlock;
86 HierarchicalCodeBlock * m_protOperationsBlock;
87
88 CPPHeaderClassDeclarationBlock * getClassDecl();
89
90 };
91
92 #endif // CPPHEADERCODEDOCUMENT_H
CodeClassField::Composition
@ Composition
Definition: codeclassfield.h:34
UMLObject::package
QString package(const QString &separator=QString(), bool includeRoot=false)
Definition: umlobject.cpp:577
CPPHeaderCodeOperation
Definition: cppheadercodeoperation.h:21
cppcodedocumentation.h
umlpackagelist.h
HierarchicalCodeBlock::setEndText
void setEndText(const QString &new_var)
Definition: hierarchicalcodeblock.cpp:43
ClassifierCodeDocument::parentIsInterface
bool parentIsInterface()
Definition: classifiercodedocument.cpp:418
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Definition: classifier.cpp:939
cppheadercodeaccessormethod.h
CodeDocument::resetTextBlocks
void resetTextBlocks()
Definition: codedocument.cpp:338
CPPCodeGenerationPolicy::getPackageIsNamespace
bool getPackageIsNamespace()
Definition: cppcodegenerationpolicy.cpp:171
CPPHeaderCodeDocument::updateContent
void updateContent()
Definition: cppheadercodedocument.cpp:336
cppcodegenerator.h
CodeDocument::newHierarchicalCodeBlock
virtual HierarchicalCodeBlock * newHierarchicalCodeBlock()
Definition: codedocument.cpp:478
CPPHeaderClassDeclarationBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: cppheaderclassdeclarationblock.cpp:33
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
CPPHeaderClassDeclarationBlock
Definition: cppheaderclassdeclarationblock.h:20
UMLObject::asUMLOperation
UMLOperation * asUMLOperation()
Definition: umlobject.cpp:1323
CPPHeaderCodeDocument::addOrUpdateCodeClassFieldMethodsInCodeBlock
void addOrUpdateCodeClassFieldMethodsInCodeBlock(CodeClassFieldList &list, CPPHeaderClassDeclarationBlock *codeBlock)
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
CPPHeaderCodeDocument::m_publicBlock
HierarchicalCodeBlock * m_publicBlock
Definition: cppheadercodedocument.h:74
includes
Definition: includes.h:3
HierarchicalCodeBlock::setStartText
void setStartText(const QString &text)
Definition: hierarchicalcodeblock.cpp:199
codeclassfieldlist.h
cppheadercodedocument.h
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Definition: codegenerator.cpp:549
hierarchicalcodeblock.h
UMLClassifier::getFilteredList
virtual UMLClassifierListItemList getFilteredList(UMLObject::ObjectType ot) const
Definition: classifier.cpp:998
CPPHeaderCodeDocument::loadChildTextBlocksFromNode
virtual void loadChildTextBlocksFromNode(QDomElement &root)
Definition: cppheadercodedocument.cpp:84
CodeComment
Definition: codecomment.h:23
TextBlock::setWriteOutText
void setWriteOutText(bool write)
Definition: textblock.cpp:131
CPPHeaderCodeDocument
Definition: cppheadercodedocument.h:35
CPPCodeGenerationPolicy::vectorIncludeIsGlobal
bool vectorIncludeIsGlobal()
Definition: cppcodegenerationpolicy.cpp:274
CodeDocument::setFileExtension
void setFileExtension(const QString &new_var)
Definition: codedocument.cpp:72
cppheadercodeclassfielddeclarationblock.h
CodeGenerator::findObjectsRelated
static void findObjectsRelated(UMLClassifier *c, UMLPackageList &cList)
Definition: codegenerator.cpp:622
UMLApp::commonPolicy
CodeGenerationPolicy * commonPolicy() const
Definition: uml.cpp:2274
CodeGenObjectWithTextBlocks::addTextBlock
virtual bool addTextBlock(TextBlock *add_object)
Definition: codegenobjectwithtextblocks.cpp:57
CPPHeaderCodeDocument::m_pubOperationsBlock
HierarchicalCodeBlock * m_pubOperationsBlock
Definition: cppheadercodedocument.h:84
CPPHeaderCodeDocument::m_classDeclCodeBlock
CPPHeaderClassDeclarationBlock * m_classDeclCodeBlock
Definition: cppheadercodedocument.h:72
cppheaderclassdeclarationblock.h
ClassifierCodeDocument::declareClassFields
void declareClassFields(CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent)
Definition: classifiercodedocument.cpp:378
CPPCodeDocumentation
Definition: cppcodedocumentation.h:27
UMLObject::umlPackage
UMLPackage * umlPackage() const
Definition: umlobject.cpp:645
CodeClassField::Aggregation
@ Aggregation
Definition: codeclassfield.h:34
UMLClassifierListItemListIt
QListIterator< UMLClassifierListItem * > UMLClassifierListItemListIt
Definition: umlclassifierlistitemlist.h:17
CodeClassField::PlainAssociation
@ PlainAssociation
Definition: codeclassfield.h:34
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
CodeClassField::Attribute
@ Attribute
Definition: codeclassfield.h:34
CodeBlockWithComments::getComment
CodeComment * getComment() const
Definition: codeblockwithcomments.cpp:47
TextBlock::setTag
void setTag(const QString &value)
Definition: textblock.cpp:121
ClassifierCodeDocument::hasObjectVectorClassFields
bool hasObjectVectorClassFields()
Definition: classifiercodedocument.cpp:124
CodeGenPolicyExt
Definition: codegenpolicyext.h:27
UMLObject
The base class for UML objects.
Definition: umlobject.h:73
CPPCodeGenerationPolicy
Definition: cppcodegenerationpolicy.h:22
UMLObject::asUMLEnum
UMLEnum * asUMLEnum()
Definition: umlobject.cpp:1315
CPPHeaderCodeDocument::m_privateBlock
HierarchicalCodeBlock * m_privateBlock
Definition: cppheadercodedocument.h:75
CPPHeaderCodeDocument::m_pubConstructorBlock
HierarchicalCodeBlock * m_pubConstructorBlock
Definition: cppheadercodedocument.h:80
CodeBlock
Definition: codeblock.h:20
ClassifierCodeDocument
Definition: classifiercodedocument.h:32
HierarchicalCodeBlock::addCodeClassFieldMethods
void addCodeClassFieldMethods(CodeClassFieldList &list)
Definition: hierarchicalcodeblock.cpp:215
UMLObject::ot_EnumLiteral
@ ot_EnumLiteral
Definition: umlobject.h:94
umlclassifierlistitemlist.h
CodeOperation::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeoperation.cpp:83
CPPCodeGenerationPolicy::getStringClassNameInclude
QString getStringClassNameInclude()
Definition: cppcodegenerationpolicy.cpp:200
Uml::Visibility::Public
@ Public
Definition: basictypes.h:77
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1285
CPPHeaderCodeDocument::m_protConstructorBlock
HierarchicalCodeBlock * m_protConstructorBlock
Definition: cppheadercodedocument.h:81
ClassifierCodeDocument::hasClassFields
bool hasClassFields()
Definition: classifiercodedocument.cpp:151
classifierlistitem.h
UMLOperation::isLifeOperation
bool isLifeOperation()
Definition: operation.cpp:414
UMLObject::visibility
Uml::Visibility::Enum visibility() const
Definition: umlobject.cpp:466
UMLDoc::findObjectById
UMLObject * findObjectById(Uml::ID::Type id)
Definition: umldoc.cpp:1036
ClassifierCodeDocument::findCodeClassFieldTextBlockByTag
TextBlock * findCodeClassFieldTextBlockByTag(const QString &tag)
Definition: classifiercodedocument.cpp:771
ClassifierCodeDocument::getSpecificClassFields
CodeClassFieldList getSpecificClassFields(CodeClassField::ClassFieldType cfType)
Definition: classifiercodedocument.cpp:54
CodeOperation::updateMethodDeclaration
virtual void updateMethodDeclaration()=0
CPPHeaderCodeDocument::~CPPHeaderCodeDocument
virtual ~CPPHeaderCodeDocument()
Definition: cppheadercodedocument.cpp:65
HierarchicalCodeBlock::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: hierarchicalcodeblock.cpp:269
uWarning
#define uWarning()
Definition: debug_utils.h:124
UMLClassifier::findSuperClassConcepts
UMLClassifierList findSuperClassConcepts(ClassifierType type=ALL)
Definition: classifier.cpp:609
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Definition: codegenerationpolicy.cpp:304
classifiercodedocument.h
CPPHeaderCodeDocument::m_protOperationsBlock
HierarchicalCodeBlock * m_protOperationsBlock
Definition: cppheadercodedocument.h:86
CodeBlockWithComments::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codeblockwithcomments.cpp:97
CPPHeaderCodeDocument::addCodeOperation
bool addCodeOperation(CodeOperation *op)
Definition: cppheadercodedocument.cpp:277
CPPCodeGenerationPolicy::getVectorClassNameInclude
QString getVectorClassNameInclude()
Definition: cppcodegenerationpolicy.cpp:210
UMLObject::packages
UMLPackageList packages(bool includeRoot=false) const
Definition: umlobject.cpp:597
CodeGenerationPolicy
Definition: codegenerationpolicy.h:29
uDebug
#define uDebug()
Definition: debug_utils.h:122
CodeGenerationPolicy::getCodeVerboseDocumentComments
bool getCodeVerboseDocumentComments() const
Definition: codegenerationpolicy.cpp:152
CPPHeaderCodeDocument::getClassDecl
CPPHeaderClassDeclarationBlock * getClassDecl()
Definition: cppheadercodedocument.cpp:70
HierarchicalCodeBlock::addTextBlock
bool addTextBlock(TextBlock *add_object)
Definition: hierarchicalcodeblock.cpp:93
CPPHeaderCodeDocument::newCodeComment
CodeComment * newCodeComment()
CPPHeaderCodeDocument::m_namespaceBlock
HierarchicalCodeBlock * m_namespaceBlock
Definition: cppheadercodedocument.h:78
ClassifierCodeDocument::getCodeClassFieldList
CodeClassFieldList * getCodeClassFieldList()
Definition: classifiercodedocument.cpp:266
CodeBlockWithComments
Definition: codeblockwithcomments.h:23
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:269
cppcodegenerationpolicy.h
UMLPackageList
QList< UMLPackage * > UMLPackageList
Definition: umlpackagelist.h:17
CodeDocument::cleanName
QString cleanName(const QString &name)
Definition: codedocument.cpp:270
CodeDocument::newCodeBlock
virtual CodeBlock * newCodeBlock()
Definition: codedocument.cpp:460
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
Uml::Visibility::Enum
Enum
Definition: basictypes.h:76
UMLClassifierListItemList
Definition: umlclassifierlistitemlist.h:26
ClassifierCodeDocument::getParentClassifier
UMLClassifier * getParentClassifier()
Definition: classifiercodedocument.cpp:275
HierarchicalCodeBlock
Definition: hierarchicalcodeblock.h:22
CodeOperation::getParentOperation
UMLOperation * getParentOperation()
Definition: codeoperation.cpp:64
uError
#define uError()
Definition: debug_utils.h:123
UMLOperation
Definition: operation.h:24
CodeOperation
Definition: codeoperation.h:23
CodeDocument::getFileName
QString getFileName() const
Definition: codedocument.cpp:63
CPPCodeGenerationPolicy::stringIncludeIsGlobal
bool stringIncludeIsGlobal()
Definition: cppcodegenerationpolicy.cpp:265
UMLApp::policyExt
CodeGenPolicyExt * policyExt() const
Definition: uml.cpp:2290
uml.h
CodeOperation::updateContent
virtual void updateContent()
Definition: codeoperation.cpp:151
cppheadercodeoperation.h
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Definition: codegenerationpolicy.cpp:253
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:39
debug_utils.h
CPPHeaderCodeDocument::m_privOperationsBlock
HierarchicalCodeBlock * m_privOperationsBlock
Definition: cppheadercodedocument.h:85
CodeDocument::newCodeBlockWithComments
virtual CodeBlockWithComments * newCodeBlockWithComments()
Definition: codedocument.cpp:469
UMLObject::isUMLDatatype
bool isUMLDatatype()
Definition: umlobject.h:206
CPPHeaderCodeDocument::m_protectedBlock
HierarchicalCodeBlock * m_protectedBlock
Definition: cppheadercodedocument.h:76
CodeComment::loadFromXMI1
virtual void loadFromXMI1(QDomElement &root)
Definition: codecomment.cpp:42
CodeClassFieldList
QList< CodeClassField * > CodeClassFieldList
Definition: codeclassfieldlist.h:17
CPPHeaderCodeDocument::resetTextBlocks
void resetTextBlocks()
Definition: cppheadercodedocument.cpp:218
TextBlock
Definition: textblock.h:24
Uml::Visibility::Private
@ Private
Definition: basictypes.h:78
package.h
CPPHeaderCodeDocument::m_privConstructorBlock
HierarchicalCodeBlock * m_privConstructorBlock
Definition: cppheadercodedocument.h:82
Uml::Visibility::Protected
@ Protected
Definition: basictypes.h:79
CodeGenerationPolicy::getAutoGenerateConstructors
bool getAutoGenerateConstructors()
Definition: codegenerationpolicy.cpp:365
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:18
CPPCodeGenerationPolicy::getAutoGenerateAccessors
bool getAutoGenerateAccessors()
Definition: cppcodegenerationpolicy.cpp:190
CPPHeaderCodeDocument::CPPHeaderCodeDocument
CPPHeaderCodeDocument(UMLClassifier *classifier)
Definition: cppheadercodedocument.cpp:37
UMLClassifierListItem
A base class for classifier list items (e.g. attributes)
Definition: classifierlistitem.h:29
UMLEnum
Non-graphical Information for an Enum.
Definition: enum.h:28
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1055
CodeDocument::findTextBlockByTag
TextBlock * findTextBlockByTag(const QString &tag, bool descendIntoChildren=false)
Definition: codedocument.cpp:503
CPPCodeGenerationPolicy::getAccessorsArePublic
bool getAccessorsArePublic()
Definition: cppcodegenerationpolicy.cpp:62
CPPHeaderClassDeclarationBlock::updateContent
void updateContent()
Definition: cppheaderclassdeclarationblock.cpp:60
UMLPackage
Non-graphical information for a Package.
Definition: package.h:32
enum.h