umbrello: umbrello/codegenerators/codegenerationpolicy.h Source File

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

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

codegenerationpolicy.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 CODEGENERATIONPOLICY_H
9#define CODEGENERATIONPOLICY_H
10
11#include "basictypes.h"
12
13#include <QDir>
14#include <QObject>
15
16class QWidget;
17class CodeGenerationPolicyPage;
18
25 class CodeGenerationPolicy : public QObject
26{
27 Q_OBJECT
28public:
29
42 enum OverwritePolicy {Ok=0, Ask, Never, Cancel};
43 enum ModifyNamePolicy {No=0, Underscore, Capitalise};
44 enum NewLineType {UNIX=0, DOS, MAC};
45 enum IndentationType {NONE=0, TAB, SPACE};
46 enum CommentStyle { SingleLine=0, MultiLine };
47
48 explicit CodeGenerationPolicy(CodeGenerationPolicy * clone);
49 CodeGenerationPolicy();
50
51 virtual ~CodeGenerationPolicy();
52
53 void setOverwritePolicy(OverwritePolicy new_var);
54 OverwritePolicy getOverwritePolicy() const;
55
56 void setCodeVerboseSectionComments(bool new_var);
57 bool getCodeVerboseSectionComments() const;
58
59 void setCodeVerboseDocumentComments(bool new_var);
60 bool getCodeVerboseDocumentComments() const;
61
62 void setHeadingFileDir(const QString & path);
63 QString getHeadingFileDir() const;
64
65 void setIncludeHeadings(bool new_var);
66 bool getIncludeHeadings() const;
67
68 void setOutputDirectory(QDir new_var);
69 QDir getOutputDirectory();
70
71 void setLineEndingType(NewLineType type);
72 NewLineType getLineEndingType();
73
74 QString getNewLineEndingChars() const;
75
76 void setIndentationType(IndentationType type);
77 IndentationType getIndentationType();
78
79 void setIndentationAmount(int amount);
80 int getIndentationAmount();
81
82 QString getIndentation() const;
83
84 void setModifyPolicy(ModifyNamePolicy new_var);
85 ModifyNamePolicy getModifyPolicy() const;
86
87 void setAutoGenerateConstructors(bool var);
88 bool getAutoGenerateConstructors();
89
90 void setAttributeAccessorScope(Uml::Visibility::Enum var);
91 Uml::Visibility::Enum getAttributeAccessorScope();
92
93 void setAssociationFieldScope(Uml::Visibility::Enum var);
94 Uml::Visibility::Enum getAssociationFieldScope();
95
96 virtual CodeGenerationPolicyPage * createPage(QWidget *parent = 0, const char * name = 0);
97
98 QString getHeadingFile(const QString& str);
99
100 virtual void setDefaults(CodeGenerationPolicy * defaults, bool emitUpdateSignal = true);
101 virtual void setDefaults(bool emitUpdateSignal = true);
102
103 virtual void writeConfig();
104
105 void emitModifiedCodeContentSig();
106
107 void setCommentStyle(CommentStyle new_var);
108 CommentStyle getCommentStyle();
109
110signals:
111
112 void modifiedCodeContent();
113
114protected:
115
116/*
117 // Policy of how to deal with overwriting existing files. Allowed values are "ask", "yes" and "no".
118 OverwritePolicy m_overwritePolicy;
119
120 // Whether or not verbose code commenting for sections is desired.
121 // If true, comments for sections will be written even if the section is empty.
122 bool m_codeVerboseSectionComments;
123
124 // Whether or not verbose code commenting for documentation is desired.
125 // If true, documentation for various code will be written even if no
126 //code would normally be created at that point in the file.
127 bool m_codeVerboseDocumentComments;
128
129 QDir m_headingFiles; // location of the header file template.
130 bool m_includeHeadings;
131 QDir m_outputDirectory; // location of where output files will go.
132 NewLineType m_lineEndingType; // What type of line ending characters to use.
133 IndentationType m_indentationType; // The amount and type of whitespace to indent with.
134 int m_indentationAmount; // The amount of units to indent with.
135 ModifyNamePolicy m_modifyPolicy;
136 bool m_autoGenerateConstructors;
137 CommentStyle m_commentStyle;
138 Uml::Visibility::Value m_attributeAccessorScope;
139 Uml::Visibility::Value m_associationFieldScope;
140*/
141
142 // these 2 private fields 'cache' the string values of other fields we may frequently call for
143 QString m_lineEndingChars;
144 QString m_indentation;
145
146 void calculateIndentation();
147
148/*
149protected:
150
151 void initFields();
152*/
153};
154
155#endif // CODEGENERATIONPOLICY_H
basictypes.h
CodeGenerationPolicyPage
Definition: codegenerationpolicypage.h:17
CodeGenerationPolicy
Definition: codegenerationpolicy.h:26
CodeGenerationPolicy::setIndentationAmount
void setIndentationAmount(int amount)
Definition: codegenerationpolicy.cpp:278
CodeGenerationPolicy::m_indentation
QString m_indentation
Definition: codegenerationpolicy.h:144
CodeGenerationPolicy::setIndentationType
void setIndentationType(IndentationType type)
Definition: codegenerationpolicy.cpp:259
CodeGenerationPolicy::getCodeVerboseSectionComments
bool getCodeVerboseSectionComments() const
Definition: codegenerationpolicy.cpp:123
CodeGenerationPolicy::createPage
virtual CodeGenerationPolicyPage * createPage(QWidget *parent=0, const char *name=0)
Definition: codegenerationpolicy.cpp:408
CodeGenerationPolicy::setModifyPolicy
void setModifyPolicy(ModifyNamePolicy new_var)
Definition: codegenerationpolicy.cpp:333
CodeGenerationPolicy::getAssociationFieldScope
Uml::Visibility::Enum getAssociationFieldScope()
Definition: codegenerationpolicy.cpp:399
CodeGenerationPolicy::ModifyNamePolicy
ModifyNamePolicy
Definition: codegenerationpolicy.h:43
CodeGenerationPolicy::Underscore
@ Underscore
Definition: codegenerationpolicy.h:43
CodeGenerationPolicy::No
@ No
Definition: codegenerationpolicy.h:43
CodeGenerationPolicy::Capitalise
@ Capitalise
Definition: codegenerationpolicy.h:43
CodeGenerationPolicy::setAutoGenerateConstructors
void setAutoGenerateConstructors(bool var)
Definition: codegenerationpolicy.cpp:351
CodeGenerationPolicy::NewLineType
NewLineType
Definition: codegenerationpolicy.h:44
CodeGenerationPolicy::MAC
@ MAC
Definition: codegenerationpolicy.h:44
CodeGenerationPolicy::DOS
@ DOS
Definition: codegenerationpolicy.h:44
CodeGenerationPolicy::UNIX
@ UNIX
Definition: codegenerationpolicy.h:44
CodeGenerationPolicy::getOutputDirectory
QDir getOutputDirectory()
Definition: codegenerationpolicy.cpp:207
CodeGenerationPolicy::calculateIndentation
void calculateIndentation()
Definition: codegenerationpolicy.cpp:308
CodeGenerationPolicy::m_lineEndingChars
QString m_lineEndingChars
Definition: codegenerationpolicy.h:143
CodeGenerationPolicy::IndentationType
IndentationType
Definition: codegenerationpolicy.h:45
CodeGenerationPolicy::NONE
@ NONE
Definition: codegenerationpolicy.h:45
CodeGenerationPolicy::TAB
@ TAB
Definition: codegenerationpolicy.h:45
CodeGenerationPolicy::SPACE
@ SPACE
Definition: codegenerationpolicy.h:45
CodeGenerationPolicy::getIndentationType
IndentationType getIndentationType()
Definition: codegenerationpolicy.cpp:269
CodeGenerationPolicy::getModifyPolicy
ModifyNamePolicy getModifyPolicy() const
Definition: codegenerationpolicy.cpp:342
CodeGenerationPolicy::writeConfig
virtual void writeConfig()
Definition: codegenerationpolicy.cpp:504
CodeGenerationPolicy::setLineEndingType
void setLineEndingType(NewLineType type)
Definition: codegenerationpolicy.cpp:217
CodeGenerationPolicy::getHeadingFile
QString getHeadingFile(const QString &str)
Definition: codegenerationpolicy.cpp:542
CodeGenerationPolicy::setIncludeHeadings
void setIncludeHeadings(bool new_var)
Definition: codegenerationpolicy.cpp:177
CodeGenerationPolicy::OverwritePolicy
OverwritePolicy
Definition: codegenerationpolicy.h:42
CodeGenerationPolicy::Cancel
@ Cancel
Definition: codegenerationpolicy.h:42
CodeGenerationPolicy::Ask
@ Ask
Definition: codegenerationpolicy.h:42
CodeGenerationPolicy::Never
@ Never
Definition: codegenerationpolicy.h:42
CodeGenerationPolicy::Ok
@ Ok
Definition: codegenerationpolicy.h:42
CodeGenerationPolicy::getNewLineEndingChars
QString getNewLineEndingChars() const
Definition: codegenerationpolicy.cpp:249
CodeGenerationPolicy::getCodeVerboseDocumentComments
bool getCodeVerboseDocumentComments() const
Definition: codegenerationpolicy.cpp:148
CodeGenerationPolicy::getAttributeAccessorScope
Uml::Visibility::Enum getAttributeAccessorScope()
Definition: codegenerationpolicy.cpp:380
CodeGenerationPolicy::getAutoGenerateConstructors
bool getAutoGenerateConstructors()
Definition: codegenerationpolicy.cpp:361
CodeGenerationPolicy::getIncludeHeadings
bool getIncludeHeadings() const
Definition: codegenerationpolicy.cpp:187
CodeGenerationPolicy::setCommentStyle
void setCommentStyle(CommentStyle new_var)
Definition: codegenerationpolicy.cpp:90
CodeGenerationPolicy::getHeadingFileDir
QString getHeadingFileDir() const
Definition: codegenerationpolicy.cpp:168
CodeGenerationPolicy::getOverwritePolicy
OverwritePolicy getOverwritePolicy() const
Definition: codegenerationpolicy.cpp:81
CodeGenerationPolicy::setHeadingFileDir
void setHeadingFileDir(const QString &path)
Definition: codegenerationpolicy.cpp:158
CodeGenerationPolicy::emitModifiedCodeContentSig
void emitModifiedCodeContentSig()
Definition: codegenerationpolicy.cpp:416
CodeGenerationPolicy::modifiedCodeContent
void modifiedCodeContent()
CodeGenerationPolicy::setCodeVerboseDocumentComments
void setCodeVerboseDocumentComments(bool new_var)
Definition: codegenerationpolicy.cpp:135
CodeGenerationPolicy::getCommentStyle
CommentStyle getCommentStyle()
Definition: codegenerationpolicy.cpp:100
CodeGenerationPolicy::setOverwritePolicy
void setOverwritePolicy(OverwritePolicy new_var)
Definition: codegenerationpolicy.cpp:70
CodeGenerationPolicy::setAttributeAccessorScope
void setAttributeAccessorScope(Uml::Visibility::Enum var)
Definition: codegenerationpolicy.cpp:370
CodeGenerationPolicy::getIndentationAmount
int getIndentationAmount()
Definition: codegenerationpolicy.cpp:291
CodeGenerationPolicy::CommentStyle
CommentStyle
Definition: codegenerationpolicy.h:46
CodeGenerationPolicy::SingleLine
@ SingleLine
Definition: codegenerationpolicy.h:46
CodeGenerationPolicy::MultiLine
@ MultiLine
Definition: codegenerationpolicy.h:46
CodeGenerationPolicy::~CodeGenerationPolicy
virtual ~CodeGenerationPolicy()
Definition: codegenerationpolicy.cpp:60
CodeGenerationPolicy::setAssociationFieldScope
void setAssociationFieldScope(Uml::Visibility::Enum var)
Definition: codegenerationpolicy.cpp:389
CodeGenerationPolicy::setOutputDirectory
void setOutputDirectory(QDir new_var)
Definition: codegenerationpolicy.cpp:197
CodeGenerationPolicy::setDefaults
virtual void setDefaults(CodeGenerationPolicy *defaults, bool emitUpdateSignal=true)
Definition: codegenerationpolicy.cpp:425
CodeGenerationPolicy::getLineEndingType
NewLineType getLineEndingType()
Definition: codegenerationpolicy.cpp:240
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Definition: codegenerationpolicy.cpp:300
CodeGenerationPolicy::CodeGenerationPolicy
CodeGenerationPolicy()
Definition: codegenerationpolicy.cpp:52
CodeGenerationPolicy::setCodeVerboseSectionComments
void setCodeVerboseSectionComments(bool new_var)
Definition: codegenerationpolicy.cpp:111
Uml::Visibility::Enum
Enum
Definition: basictypes.h:45