umbrello  2.32.1
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  SPDX-License-Identifier: GPL-2.0-or-later
3 
4  SPDX-FileCopyrightText: 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov>
5  SPDX-FileCopyrightText: 2004-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
6 */
7 
8 #ifndef SIMPLECODEGENERATOR_H
9 #define SIMPLECODEGENERATOR_H
10 
11 #include "basictypes.h"
12 #include "codegenerator.h"
13 
14 #include <QMap>
15 #include <QString>
16 #include <QStringList>
17 
18 
30 {
31  Q_OBJECT
32 public:
33 
34  explicit SimpleCodeGenerator(bool createDirHierarchyForPackages = true);
35  virtual ~SimpleCodeGenerator();
36 
37  void writeCodeToFile(UMLClassifierList & concepts);
38  void writeCodeToFile();
39 
44  virtual void writeClass(UMLClassifier *c) = 0;
45 
46 protected:
47  QString className_;
48  QString fileName_;
49 
50  QString findFileName(UMLPackage* concept, const QString &ext);
51  QString overwritableName(UMLPackage* concept, const QString &name, const QString &ext);
54 
55  QString indent();
56 
61  QMap<UMLPackage*, QString> m_fileMap;
62 
70 
71  // old attributes writers will look for
72  QString m_indentation;
74  QString m_endl;
75 
76  virtual void initFromParentDocument();
77 
78 public slots:
79  virtual void syncCodeToDocument();
80 
81 };
82 
83 #endif // SIMPLECODEGENERATOR_H
CodeGenerationPolicy::Ok
@ Ok
Definition: codegenerationpolicy.h:42
umlattributelist.h
CodeGenerator::finalizeRun
virtual void finalizeRun()
Definition: codegenerator.cpp:382
SimpleCodeGenerator::m_indentation
QString m_indentation
Definition: simplecodegenerator.h:72
SimpleCodeGenerator::writeClass
virtual void writeClass(UMLClassifier *c)=0
CodeGenerationPolicy::Ask
@ Ask
Definition: codegenerationpolicy.h:42
UMLAttributeList
Definition: umlattributelist.h:20
umloperationlist.h
UMLDoc::classesAndInterfaces
UMLClassifierList classesAndInterfaces(bool includeNested=true) const
Definition: umldoc.cpp:2985
SimpleCodeGenerator::SimpleCodeGenerator
SimpleCodeGenerator(bool createDirHierarchyForPackages=true)
Definition: simplecodegenerator.cpp:44
operation.h
UMLAttribute::getInitialValue
QString getInitialValue() const
Definition: attribute.cpp:94
UMLApp::commonPolicy
CodeGenerationPolicy * commonPolicy() const
Definition: uml.cpp:2283
SimpleCodeGenerator::fileName_
QString fileName_
Definition: simplecodegenerator.h:48
SimpleCodeGenerator::hasDefaultValueAttr
bool hasDefaultValueAttr(UMLClassifier *c)
Definition: simplecodegenerator.cpp:251
CodeGenerationPolicy::Never
@ Never
Definition: codegenerationpolicy.h:42
SimpleCodeGenerator::overwritableName
QString overwritableName(UMLPackage *concept, const QString &name, const QString &ext)
Definition: simplecodegenerator.cpp:163
UMLClassifierList
QList< UMLClassifier * > UMLClassifierList
Definition: umlclassifierlist.h:12
CodeGenerationPolicy::setOverwritePolicy
void setOverwritePolicy(OverwritePolicy new_var)
Definition: codegenerationpolicy.cpp:70
model_utils.h
SimpleCodeGenerator::indent
QString indent()
Definition: simplecodegenerator.cpp:72
UMLObject::isAbstract
bool isAbstract() const
Definition: umlobject.cpp:343
SimpleCodeGenerator::m_indentLevel
int m_indentLevel
Definition: simplecodegenerator.h:73
CodeGenerationPolicy::Cancel
@ Cancel
Definition: codegenerationpolicy.h:42
SimpleCodeGenerator::m_createDirHierarchyForPackages
bool m_createDirHierarchyForPackages
Definition: simplecodegenerator.h:69
SimpleCodeGenerator::hasAbstractOps
bool hasAbstractOps(UMLClassifier *c)
Definition: simplecodegenerator.cpp:266
attribute.h
number
it is up to the author donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License If the distribution and or use of the Library is restricted in certain countries either by patents or by copyrighted the original copyright holder who places the Library under this License may add an geographical distribution limitation excluding those so that distribution is permitted only in or among countries not thus excluded In such this License incorporates the limitation as if written in the body of this License The Free Software Foundation may publish revised and or new versions of the Library General Public License from time to time Such new versions will be similar in spirit to the present but may differ in detail to address new problems or concerns Each version is given a distinguishing version number If the Library specifies a version number of this License which applies to it and any later you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation If the Library does not specify a license version number
Definition: LGPL-2.0-only.txt:368
SimpleCodeGenerator::className_
QString className_
Definition: simplecodegenerator.h:47
SimpleCodeGenerator::m_endl
QString m_endl
Definition: simplecodegenerator.h:74
UMLObject::fullyQualifiedName
virtual QString fullyQualifiedName(const QString &separator=QString(), bool includeRoot=false) const
Definition: umlobject.cpp:222
Model_Utils::isCommonDataType
bool isCommonDataType(QString type)
Definition: model_utils.cpp:782
SimpleCodeGenerator::syncCodeToDocument
virtual void syncCodeToDocument()
Definition: simplecodegenerator.cpp:303
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Definition: codegenerationpolicy.cpp:300
i18n
#define i18n
Definition: main.cpp:34
basictypes.h
codegenerationpolicy.h
CodeGenerationPolicy
Definition: codegenerationpolicy.h:25
SimpleCodeGenerator
Definition: simplecodegenerator.h:29
c
type show c for details The hypothetical commands show w and show c should show the appropriate parts of the General Public License Of the commands you use may be called something other than show w and show c
Definition: GPL-2.0-only.txt:301
CodeGenerationPolicy::getOverwritePolicy
OverwritePolicy getOverwritePolicy() const
Definition: codegenerationpolicy.cpp:81
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:275
overwritedialog.h
UMLAttribute
Sets up attribute information.
Definition: attribute.h:22
SimpleCodeGenerator::writeCodeToFile
void writeCodeToFile()
Definition: simplecodegenerator.cpp:279
codedocument.h
CodeGenerator::m_applyToAllRemaining
bool m_applyToAllRemaining
Definition: codegenerator.h:141
classifier.h
UMLOperation
Definition: operation.h:19
SimpleCodeGenerator::initFromParentDocument
virtual void initFromParentDocument()
Definition: simplecodegenerator.cpp:314
uml.h
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Definition: codegenerationpolicy.cpp:249
UMLClassifier
Information for a non-graphical Concept/Class.
Definition: classifier.h:34
CodeGenerationPolicy::getOutputDirectory
QDir getOutputDirectory()
Definition: codegenerationpolicy.cpp:207
codegenerator.h
simplecodegenerator.h
SimpleCodeGenerator::~SimpleCodeGenerator
virtual ~SimpleCodeGenerator()
Definition: simplecodegenerator.cpp:64
CodeGenerator
Definition: codegenerator.h:53
OverwriteDialog
Definition: overwritedialog.h:24
UMLOperationList
QList< UMLOperation * > UMLOperationList
Definition: umloperationlist.h:12
CodeGenerator::m_document
UMLDoc * m_document
Definition: codegenerator.h:146
SimpleCodeGenerator::m_fileMap
QMap< UMLPackage *, QString > m_fileMap
Definition: simplecodegenerator.h:61
SimpleCodeGenerator::findFileName
QString findFileName(UMLPackage *concept, const QString &ext)
Definition: simplecodegenerator.cpp:87
umldoc.h
UMLPackage
Non-graphical information for a Package.
Definition: package.h:27