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

cppcodegenerator.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 CPPCODEGENERATOR_H
13 #define CPPCODEGENERATOR_H
14
15 #include "codedocumentlist.h"
16 #include "codeviewerstate.h"
17 #include "advancedcodegenerator.h"
18 #include "cppmakecodedocument.h"
19 #include "umldoc.h"
20
21 #include <QString>
22
23 class CodeViewerDialog;
24 class CPPHeaderCodeDocument;
25
26 class CPPCodeGenerator : public AdvancedCodeGenerator
27 {
28 Q_OBJECT
29 public:
30
31 static const bool DEFAULT_BUILD_MAKEFILE;
32
33 CPPCodeGenerator();
34 virtual ~CPPCodeGenerator();
35
36 void setCreateProjectMakefile(bool buildIt);
37 bool getCreateProjectMakefile();
38
39 QString fixTypeName(const QString &name);
40
41 bool addHeaderCodeDocument (CPPHeaderCodeDocument * doc);
42 bool removeHeaderCodeDocument (CPPHeaderCodeDocument * remove_object);
43
44 Uml::ProgrammingLanguage::Enum language() const;
45
46 CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier);
47 CPPHeaderCodeDocument * newHeaderClassifierCodeDocument (UMLClassifier * classifier);
48
49 virtual CodeViewerDialog * getCodeViewerDialog(QWidget* parent, CodeDocument * doc,
50 Settings::CodeViewerState & state);
51
52 virtual void writeCodeToFile();
53 virtual void writeCodeToFile(UMLClassifierList &list);
54
55 QStringList defaultDatatypes();
56
57 virtual void saveToXMI1 (QDomDocument & doc, QDomElement & root);
58
59 virtual QStringList reservedKeywords() const;
60
61 virtual void createDefaultStereotypes ();
62
63 void initFromParentDocument();
64
65 protected:
66
67 CPPMakefileCodeDocument * newMakefileCodeDocument ();
68
69 CPPHeaderCodeDocument * findHeaderCodeDocumentByClassifier (UMLClassifier * classifier);
70
71 private:
72
73 bool m_createMakefile;
74 CodeDocumentList m_headercodedocumentVector; //< a separate list for recording the header documents
75
76 public slots:
77
78 virtual void checkAddUMLObject (UMLObject * obj);
79 virtual void checkRemoveUMLObject (UMLObject * obj);
80
81 virtual void syncCodeToDocument ();
82 };
83
84 #endif // CPPCODEGENERATOR_H
UMLObject::id
virtual Uml::ID::Type id() const
Definition: umlobject.cpp:425
CPPCodeGenerator::newHeaderClassifierCodeDocument
CPPHeaderCodeDocument * newHeaderClassifierCodeDocument(UMLClassifier *classifier)
Definition: cppcodegenerator.cpp:287
cppcodedocumentation.h
CPPCodeGenerator::initFromParentDocument
void initFromParentDocument()
Definition: cppcodegenerator.cpp:307
UMLObject::asUMLClassifier
UMLClassifier * asUMLClassifier()
Definition: umlobject.cpp:1309
CodeDocument::setWriteOutCode
void setWriteOutCode(bool new_var)
Definition: codedocument.cpp:154
CPPCodeGenerator::checkRemoveUMLObject
virtual void checkRemoveUMLObject(UMLObject *obj)
Definition: cppcodegenerator.cpp:368
CPPCodeGenerator::language
Uml::ProgrammingLanguage::Enum language() const
Definition: cppcodegenerator.cpp:61
CPPCodeGenerator::CPPCodeGenerator
CPPCodeGenerator()
Definition: cppcodegenerator.cpp:36
cppcodegenerator.h
Codegen_Utils::cppDatatypes
QStringList cppDatatypes()
Definition: codegen_utils.cpp:23
Uml::ProgrammingLanguage::Enum
Enum
Definition: basictypes.h:271
CPPCodeGenerator::reservedKeywords
virtual QStringList reservedKeywords() const
Definition: cppcodegenerator.cpp:401
CPPCodeGenerator::getCreateProjectMakefile
bool getCreateProjectMakefile()
Definition: cppcodegenerator.cpp:83
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
CPPCodeGenerator::m_createMakefile
bool m_createMakefile
Definition: cppcodegenerator.h:73
codedocumentlist.h
CPPCodeGenerator::setCreateProjectMakefile
void setCreateProjectMakefile(bool buildIt)
Definition: cppcodegenerator.cpp:70
CPPCodeGenerator::newMakefileCodeDocument
CPPMakefileCodeDocument * newMakefileCodeDocument()
Definition: cppcodegenerator.cpp:298
cppheadercodedocument.h
CodeGenerator::cleanName
static QString cleanName(const QString &name)
Definition: codegenerator.cpp:549
CPPCodeGenerator::writeCodeToFile
virtual void writeCodeToFile()
Definition: cppcodegenerator.cpp:227
CPPCodeGenerator::createDefaultStereotypes
virtual void createDefaultStereotypes()
Definition: cppcodegenerator.cpp:409
CodeViewerDialog::addCodeDocument
void addCodeDocument(CodeDocument *doc)
Definition: codeviewerdialog.cpp:58
codeviewerdialog.h
CodeGenerator::isReservedKeyword
virtual bool isReservedKeyword(const QString &keyword)
Definition: codegenerator.cpp:797
CPPHeaderCodeDocument
Definition: cppheadercodedocument.h:36
CPPCodeGenerator::~CPPCodeGenerator
virtual ~CPPCodeGenerator()
Definition: cppcodegenerator.cpp:50
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1263
CPPCodeGenerator::defaultDatatypes
QStringList defaultDatatypes()
Definition: cppcodegenerator.cpp:392
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
CPPCodeGenerator::addHeaderCodeDocument
bool addHeaderCodeDocument(CPPHeaderCodeDocument *doc)
Definition: cppcodegenerator.cpp:93
CodeGenerator::findCodeDocumentByID
CodeDocument * findCodeDocumentByID(const QString &id)
Definition: codegenerator.cpp:110
CPPCodeGenerator
Definition: cppcodegenerator.h:27
CodeGenerator::findCodeDocumentByClassifier
CodeDocument * findCodeDocumentByClassifier(UMLClassifier *classifier)
Definition: codegenerator.cpp:300
CodeDocument
Definition: codedocument.h:33
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
CPPCodeGenerationPolicy
Definition: cppcodegenerationpolicy.h:23
CPPCodeGenerator::findHeaderCodeDocumentByClassifier
CPPHeaderCodeDocument * findHeaderCodeDocumentByClassifier(UMLClassifier *classifier)
Definition: cppcodegenerator.cpp:264
UMLApp::setPolicyExt
void setPolicyExt(CodeGenPolicyExt *policy)
Definition: uml.cpp:2291
CPPMakefileCodeDocument
Definition: cppmakecodedocument.h:24
ClassifierCodeDocument
Definition: classifiercodedocument.h:33
CodeGenerator::m_codeDocumentDictionary
QHash< QString, CodeDocument * > m_codeDocumentDictionary
Definition: codegenerator.h:137
CPPCodeGenerator::checkAddUMLObject
virtual void checkAddUMLObject(UMLObject *obj)
Definition: cppcodegenerator.cpp:341
advancedcodegenerator.h
CPPCodeGenerator::newClassifierCodeDocument
CodeDocument * newClassifierCodeDocument(UMLClassifier *classifier)
Definition: cppcodegenerator.cpp:275
ClassifierCodeDocument::synchronize
virtual void synchronize()
Definition: classifiercodedocument.cpp:480
CPPCodeGenerator::syncCodeToDocument
virtual void syncCodeToDocument()
Definition: cppcodegenerator.cpp:209
ClassifierCodeDocument::initCodeClassFields
virtual void initCodeClassFields()
Definition: classifiercodedocument.cpp:540
AdvancedCodeGenerator
Definition: advancedcodegenerator.h:22
CodeGenerator::removeCodeDocument
bool removeCodeDocument(CodeDocument *remove_object)
Definition: codegenerator.cpp:150
AdvancedCodeGenerator::connectSlots
void connectSlots()
Definition: advancedcodegenerator.cpp:112
Uml::ProgrammingLanguage::Cpp
@ Cpp
Definition: basictypes.h:274
CodeGenerator::getCodeDocumentList
CodeDocumentList * getCodeDocumentList()
Definition: codegenerator.cpp:169
AdvancedCodeGenerator::getCodeViewerDialog
virtual CodeViewerDialog * getCodeViewerDialog(QWidget *parent, CodeDocument *doc, Settings::CodeViewerState &state)
Definition: advancedcodegenerator.cpp:37
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:278
CodeDocument::synchronize
virtual void synchronize()
Definition: codedocument.cpp:329
UMLDoc::classesAndInterfaces
UMLClassifierList classesAndInterfaces(bool includeNested=true)
Definition: umldoc.cpp:3014
cppcodegenerationpolicy.h
CPPSourceCodeDocument
Definition: cppsourcecodedocument.h:23
CodeViewerDialog
Definition: codeviewerdialog.h:28
ClassifierCodeDocument::getParentClassifier
UMLClassifier * getParentClassifier()
Definition: classifiercodedocument.cpp:275
Codegen_Utils::createCppStereotypes
void createCppStereotypes()
Definition: codegen_utils.cpp:417
cppmakecodedocument.h
uml.h
Codegen_Utils::reservedCppKeywords
const QStringList reservedCppKeywords()
Definition: codegen_utils.cpp:51
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
codeviewerstate.h
CPPCodeGenerator::DEFAULT_BUILD_MAKEFILE
static const bool DEFAULT_BUILD_MAKEFILE
Definition: cppcodegenerator.h:31
CodeDocument::ID
QString ID() const
Definition: codedocument.cpp:143
cppsourcecodedocument.h
CPPCodeGenerator::m_headercodedocumentVector
CodeDocumentList m_headercodedocumentVector
Definition: cppcodegenerator.h:74
CPPCodeGenerator::removeHeaderCodeDocument
bool removeHeaderCodeDocument(CPPHeaderCodeDocument *remove_object)
Definition: cppcodegenerator.cpp:115
Settings::CodeViewerState
configurable params for the code viewer tool
Definition: codeviewerstate.h:20
CPPMakefileCodeDocument::DOCUMENT_ID_VALUE
static const char * DOCUMENT_ID_VALUE
Definition: cppmakecodedocument.h:28
CodeDocumentList
QList< CodeDocument * > CodeDocumentList
Definition: codedocumentlist.h:17
CodeGenerator::addCodeDocument
bool addCodeDocument(CodeDocument *add_object)
Definition: codegenerator.cpp:125
CodeGenerator::writeListedCodeDocsToFile
void writeListedCodeDocsToFile(CodeDocumentList *docs)
Definition: codegenerator.cpp:341
CodeDocument::setID
void setID(const QString &new_id)
Definition: codedocument.cpp:134
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1064
codegen_utils.h
umldoc.h
CPPCodeGenerator::saveToXMI1
virtual void saveToXMI1(QDomDocument &doc, QDomElement &root)
Definition: cppcodegenerator.cpp:184
CPPCodeGenerator::getCodeViewerDialog
virtual CodeViewerDialog * getCodeViewerDialog(QWidget *parent, CodeDocument *doc, Settings::CodeViewerState &state)
Definition: cppcodegenerator.cpp:136
CPPCodeGenerator::fixTypeName
QString fixTypeName(const QString &name)
Definition: cppcodegenerator.cpp:173