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

simplecodegenerator.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 SIMPLECODEGENERATOR_H
13 #define SIMPLECODEGENERATOR_H
14
15 #include "basictypes.h"
16 #include "codegenerator.h"
17
18 #include <QMap>
19 #include <QString>
20 #include <QStringList>
21
22
33 class SimpleCodeGenerator : public CodeGenerator
34 {
35 Q_OBJECT
36 public:
37
38 explicit SimpleCodeGenerator(bool createDirHierarchyForPackages = true);
39 virtual ~SimpleCodeGenerator();
40
41 void writeCodeToFile(UMLClassifierList & concepts);
42 void writeCodeToFile();
43
48 virtual void writeClass(UMLClassifier *c) = 0;
49
50 protected:
51 QString className_;
52 QString fileName_;
53
54 QString findFileName(UMLPackage* concept, const QString &ext);
55 QString overwritableName(UMLPackage* concept, const QString &name, const QString &ext);
56 bool hasDefaultValueAttr(UMLClassifier *c);
57 bool hasAbstractOps(UMLClassifier *c);
58
59 QString indent();
60
65 QMap<UMLPackage*, QString> m_fileMap;
66
73 bool m_createDirHierarchyForPackages;
74
75 // old attributes writers will look for
76 QString m_indentation;
77 int m_indentLevel;
78 QString m_endl;
79
80 virtual void initFromParentDocument();
81
82 public slots:
83 virtual void syncCodeToDocument();
84
85 };
86
87 #endif // SIMPLECODEGENERATOR_H
CodeGenerationPolicy::Ok
@ Ok
Definition: codegenerationpolicy.h:46
umlattributelist.h
UMLClassifier::getOpList
UMLOperationList getOpList(bool includeInherited=false, UMLClassifierSet *alreadyTraversed=0)
Definition: classifier.cpp:939
CodeGenerator::finalizeRun
virtual void finalizeRun()
Definition: codegenerator.cpp:385
SimpleCodeGenerator::m_indentation
QString m_indentation
Definition: simplecodegenerator.h:76
SimpleCodeGenerator::writeClass
virtual void writeClass(UMLClassifier *c)=0
CodeGenerationPolicy::Ask
@ Ask
Definition: codegenerationpolicy.h:46
UMLAttributeList
Definition: umlattributelist.h:27
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
umloperationlist.h
SimpleCodeGenerator::SimpleCodeGenerator
SimpleCodeGenerator(bool createDirHierarchyForPackages=true)
Definition: simplecodegenerator.cpp:48
operation.h
UMLAttribute::getInitialValue
QString getInitialValue() const
Definition: attribute.cpp:99
UMLApp::commonPolicy
CodeGenerationPolicy * commonPolicy() const
Definition: uml.cpp:2283
SimpleCodeGenerator::fileName_
QString fileName_
Definition: simplecodegenerator.h:52
SimpleCodeGenerator::hasDefaultValueAttr
bool hasDefaultValueAttr(UMLClassifier *c)
Definition: simplecodegenerator.cpp:255
CodeGenerationPolicy::Never
@ Never
Definition: codegenerationpolicy.h:46
SimpleCodeGenerator::overwritableName
QString overwritableName(UMLPackage *concept, const QString &name, const QString &ext)
Definition: simplecodegenerator.cpp:167
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:17
CodeGenerationPolicy::setOverwritePolicy
void setOverwritePolicy(OverwritePolicy new_var)
Definition: codegenerationpolicy.cpp:74
model_utils.h
SimpleCodeGenerator::indent
QString indent()
Definition: simplecodegenerator.cpp:76
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:348
SimpleCodeGenerator::m_indentLevel
int m_indentLevel
Definition: simplecodegenerator.h:77
CodeGenerationPolicy::Cancel
@ Cancel
Definition: codegenerationpolicy.h:46
SimpleCodeGenerator::m_createDirHierarchyForPackages
bool m_createDirHierarchyForPackages
Definition: simplecodegenerator.h:73
SimpleCodeGenerator::hasAbstractOps
bool hasAbstractOps(UMLClassifier *c)
Definition: simplecodegenerator.cpp:270
attribute.h
SimpleCodeGenerator::className_
QString className_
Definition: simplecodegenerator.h:51
SimpleCodeGenerator::m_endl
QString m_endl
Definition: simplecodegenerator.h:78
UMLObject::fullyQualifiedName
virtual QString fullyQualifiedName(const QString &separator=QString(), bool includeRoot=false) const
Definition: umlobject.cpp:227
Model_Utils::isCommonDataType
bool isCommonDataType(QString type)
Definition: model_utils.cpp:786
SimpleCodeGenerator::syncCodeToDocument
virtual void syncCodeToDocument()
Definition: simplecodegenerator.cpp:307
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Definition: codegenerationpolicy.cpp:304
i18n
#define i18n
Definition: main.cpp:39
basictypes.h
codegenerationpolicy.h
CodeGenerationPolicy
Definition: codegenerationpolicy.h:30
SimpleCodeGenerator
Definition: simplecodegenerator.h:34
CodeGenerationPolicy::getOverwritePolicy
OverwritePolicy getOverwritePolicy() const
Definition: codegenerationpolicy.cpp:85
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:278
overwritedialog.h
UMLAttribute
Sets up attribute information.
Definition: attribute.h:28
SimpleCodeGenerator::writeCodeToFile
void writeCodeToFile()
Definition: simplecodegenerator.cpp:283
UMLClassifier::getAttributeList
UMLAttributeList getAttributeList() const
Definition: classifier.cpp:436
UMLDoc::classesAndInterfaces
UMLClassifierList classesAndInterfaces(bool includeNested=true)
Definition: umldoc.cpp:3014
codedocument.h
CodeGenerator::m_applyToAllRemaining
bool m_applyToAllRemaining
Definition: codegenerator.h:143
classifier.h
UMLOperation
Definition: operation.h:25
SimpleCodeGenerator::initFromParentDocument
virtual void initFromParentDocument()
Definition: simplecodegenerator.cpp:318
uml.h
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Definition: codegenerationpolicy.cpp:253
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:40
CodeGenerationPolicy::getOutputDirectory
QDir getOutputDirectory()
Definition: codegenerationpolicy.cpp:211
codegenerator.h
simplecodegenerator.h
SimpleCodeGenerator::~SimpleCodeGenerator
virtual ~SimpleCodeGenerator()
Definition: simplecodegenerator.cpp:68
CodeGenerator
Definition: codegenerator.h:57
OverwriteDialog
Definition: overwritedialog.h:30
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:18
CodeGenerator::m_document
UMLDoc * m_document
Definition: codegenerator.h:148
SimpleCodeGenerator::m_fileMap
QMap< UMLPackage *, QString > m_fileMap
Definition: simplecodegenerator.h:65
SimpleCodeGenerator::findFileName
QString findFileName(UMLPackage *concept, const QString &ext)
Definition: simplecodegenerator.cpp:91
umldoc.h
UMLPackage
Non-graphical information for a Package.
Definition: package.h:33