umbrello: umbrello/codegenerators/codegenerationpolicy.h Source File

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

- Main Page
- Related Pages
- Topics
- 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 WriteSectionCommentsPolicy { None=0, WhenNonEmpty, Always };
45 enum NewLineType {UNIX=0, DOS, MAC};
46 enum IndentationType {NONE=0, TAB, SPACE};
47 enum CommentStyle { SingleLine=0, MultiLine };
48
49 explicit CodeGenerationPolicy(CodeGenerationPolicy * clone);
50 CodeGenerationPolicy();
51
52 virtual ~CodeGenerationPolicy();
53
54 void setOverwritePolicy(OverwritePolicy new_var);
55 OverwritePolicy getOverwritePolicy() const;
56
57 void setSectionCommentsPolicy(WriteSectionCommentsPolicy new_var);
58 WriteSectionCommentsPolicy getSectionCommentsPolicy() const;
59
60 void setCodeVerboseDocumentComments(bool new_var);
61 bool getCodeVerboseDocumentComments() const;
62
63 void setHeadingFileDir(const QString & path);
64 QString getHeadingFileDir() const;
65
66 void setIncludeHeadings(bool new_var);
67 bool getIncludeHeadings() const;
68
69 void setOutputDirectory(QDir new_var);
70 QDir getOutputDirectory();
71
72 void setLineEndingType(NewLineType type);
73 NewLineType getLineEndingType();
74
75 QString getNewLineEndingChars() const;
76
77 void setIndentationType(IndentationType type);
78 IndentationType getIndentationType();
79
80 void setIndentationAmount(int amount);
81 int getIndentationAmount();
82
83 QString getIndentation() const;
84
85 void setModifyPolicy(ModifyNamePolicy new_var);
86 ModifyNamePolicy getModifyPolicy() const;
87
88 void setAutoGenerateConstructors(bool var);
89 bool getAutoGenerateConstructors();
90
91 void setAttributeAccessorScope(Uml::Visibility::Enum var);
92 Uml::Visibility::Enum getAttributeAccessorScope();
93
94 void setAssociationFieldScope(Uml::Visibility::Enum var);
95 Uml::Visibility::Enum getAssociationFieldScope();
96
97 virtual CodeGenerationPolicyPage * createPage(QWidget *parent = 0, const char * name = 0);
98
99 QString getHeadingFile(const QString& str);
100
101 virtual void setDefaults(CodeGenerationPolicy * defaults, bool emitUpdateSignal = true);
102 virtual void setDefaults(bool emitUpdateSignal = true);
103
104 virtual void writeConfig();
105
106 void emitModifiedCodeContentSig();
107
108 void setCommentStyle(CommentStyle new_var);
109 CommentStyle getCommentStyle();
110
111signals:
112
113 void modifiedCodeContent();
114
115protected:
116
117/*
118 // Policy of how to deal with overwriting existing files. Allowed values are "ask", "yes" and "no".
119 OverwritePolicy m_overwritePolicy;
120
121 // Whether or not verbose code commenting for sections is desired.
122 // If true, comments for sections will be written even if the section is empty.
123 WriteSectionCommentsPolicy m_sectionCommentsPolicy;
124
125 // Whether or not verbose code commenting for documentation is desired.
126 // If true, documentation for various code will be written even if no
127 //code would normally be created at that point in the file.
128 bool m_codeVerboseDocumentComments;
129
130 QDir m_headingFiles; // location of the header file template.
131 bool m_includeHeadings;
132 QDir m_outputDirectory; // location of where output files will go.
133 NewLineType m_lineEndingType; // What type of line ending characters to use.
134 IndentationType m_indentationType; // The amount and type of whitespace to indent with.
135 int m_indentationAmount; // The amount of units to indent with.
136 ModifyNamePolicy m_modifyPolicy;
137 bool m_autoGenerateConstructors;
138 CommentStyle m_commentStyle;
139 Uml::Visibility::Value m_attributeAccessorScope;
140 Uml::Visibility::Value m_associationFieldScope;
141*/
142
143 // these 2 private fields 'cache' the string values of other fields we may frequently call for
144 QString m_lineEndingChars;
145 QString m_indentation;
146
147 void calculateIndentation();
148
149/*
150protected:
151
152 void initFields();
153*/
154};
155
156#endif // CODEGENERATIONPOLICY_H
basictypes.h
CodeGenerationPolicyPage
Definition codegenerationpolicypage.h:17
CodeGenerationPolicy
Definition codegenerationpolicy.h:26
CodeGenerationPolicy::setIndentationAmount
void setIndentationAmount(int amount)
Definition codegenerationpolicy.cpp:276
CodeGenerationPolicy::m_indentation
QString m_indentation
Definition codegenerationpolicy.h:145
CodeGenerationPolicy::setIndentationType
void setIndentationType(IndentationType type)
Definition codegenerationpolicy.cpp:257
CodeGenerationPolicy::createPage
virtual CodeGenerationPolicyPage * createPage(QWidget *parent=0, const char *name=0)
Definition codegenerationpolicy.cpp:406
CodeGenerationPolicy::setModifyPolicy
void setModifyPolicy(ModifyNamePolicy new_var)
Definition codegenerationpolicy.cpp:331
CodeGenerationPolicy::getAssociationFieldScope
Uml::Visibility::Enum getAssociationFieldScope()
Definition codegenerationpolicy.cpp:397
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::setSectionCommentsPolicy
void setSectionCommentsPolicy(WriteSectionCommentsPolicy new_var)
Definition codegenerationpolicy.cpp:107
CodeGenerationPolicy::setAutoGenerateConstructors
void setAutoGenerateConstructors(bool var)
Definition codegenerationpolicy.cpp:349
CodeGenerationPolicy::NewLineType
NewLineType
Definition codegenerationpolicy.h:45
CodeGenerationPolicy::MAC
@ MAC
Definition codegenerationpolicy.h:45
CodeGenerationPolicy::DOS
@ DOS
Definition codegenerationpolicy.h:45
CodeGenerationPolicy::UNIX
@ UNIX
Definition codegenerationpolicy.h:45
CodeGenerationPolicy::getOutputDirectory
QDir getOutputDirectory()
Definition codegenerationpolicy.cpp:205
CodeGenerationPolicy::calculateIndentation
void calculateIndentation()
Definition codegenerationpolicy.cpp:306
CodeGenerationPolicy::m_lineEndingChars
QString m_lineEndingChars
Definition codegenerationpolicy.h:144
CodeGenerationPolicy::IndentationType
IndentationType
Definition codegenerationpolicy.h:46
CodeGenerationPolicy::NONE
@ NONE
Definition codegenerationpolicy.h:46
CodeGenerationPolicy::TAB
@ TAB
Definition codegenerationpolicy.h:46
CodeGenerationPolicy::SPACE
@ SPACE
Definition codegenerationpolicy.h:46
CodeGenerationPolicy::getIndentationType
IndentationType getIndentationType()
Definition codegenerationpolicy.cpp:267
CodeGenerationPolicy::getModifyPolicy
ModifyNamePolicy getModifyPolicy() const
Definition codegenerationpolicy.cpp:340
CodeGenerationPolicy::writeConfig
virtual void writeConfig()
Definition codegenerationpolicy.cpp:497
CodeGenerationPolicy::setLineEndingType
void setLineEndingType(NewLineType type)
Definition codegenerationpolicy.cpp:215
CodeGenerationPolicy::getHeadingFile
QString getHeadingFile(const QString &str)
Definition codegenerationpolicy.cpp:535
CodeGenerationPolicy::setIncludeHeadings
void setIncludeHeadings(bool new_var)
Definition codegenerationpolicy.cpp:175
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:247
CodeGenerationPolicy::getCodeVerboseDocumentComments
bool getCodeVerboseDocumentComments() const
Definition codegenerationpolicy.cpp:146
CodeGenerationPolicy::WriteSectionCommentsPolicy
WriteSectionCommentsPolicy
Definition codegenerationpolicy.h:44
CodeGenerationPolicy::None
@ None
Definition codegenerationpolicy.h:44
CodeGenerationPolicy::Always
@ Always
Definition codegenerationpolicy.h:44
CodeGenerationPolicy::WhenNonEmpty
@ WhenNonEmpty
Definition codegenerationpolicy.h:44
CodeGenerationPolicy::getAttributeAccessorScope
Uml::Visibility::Enum getAttributeAccessorScope()
Definition codegenerationpolicy.cpp:378
CodeGenerationPolicy::getAutoGenerateConstructors
bool getAutoGenerateConstructors()
Definition codegenerationpolicy.cpp:359
CodeGenerationPolicy::getIncludeHeadings
bool getIncludeHeadings() const
Definition codegenerationpolicy.cpp:185
CodeGenerationPolicy::setCommentStyle
void setCommentStyle(CommentStyle new_var)
Definition codegenerationpolicy.cpp:85
CodeGenerationPolicy::getHeadingFileDir
QString getHeadingFileDir() const
Definition codegenerationpolicy.cpp:166
CodeGenerationPolicy::getOverwritePolicy
OverwritePolicy getOverwritePolicy() const
Definition codegenerationpolicy.cpp:76
CodeGenerationPolicy::setHeadingFileDir
void setHeadingFileDir(const QString &path)
Definition codegenerationpolicy.cpp:156
CodeGenerationPolicy::emitModifiedCodeContentSig
void emitModifiedCodeContentSig()
Definition codegenerationpolicy.cpp:414
CodeGenerationPolicy::modifiedCodeContent
void modifiedCodeContent()
CodeGenerationPolicy::setCodeVerboseDocumentComments
void setCodeVerboseDocumentComments(bool new_var)
Definition codegenerationpolicy.cpp:133
CodeGenerationPolicy::getCommentStyle
CommentStyle getCommentStyle()
Definition codegenerationpolicy.cpp:95
CodeGenerationPolicy::setOverwritePolicy
void setOverwritePolicy(OverwritePolicy new_var)
Definition codegenerationpolicy.cpp:65
CodeGenerationPolicy::setAttributeAccessorScope
void setAttributeAccessorScope(Uml::Visibility::Enum var)
Definition codegenerationpolicy.cpp:368
CodeGenerationPolicy::getIndentationAmount
int getIndentationAmount()
Definition codegenerationpolicy.cpp:289
CodeGenerationPolicy::CommentStyle
CommentStyle
Definition codegenerationpolicy.h:47
CodeGenerationPolicy::SingleLine
@ SingleLine
Definition codegenerationpolicy.h:47
CodeGenerationPolicy::MultiLine
@ MultiLine
Definition codegenerationpolicy.h:47
CodeGenerationPolicy::~CodeGenerationPolicy
virtual ~CodeGenerationPolicy()
Definition codegenerationpolicy.cpp:55
CodeGenerationPolicy::setAssociationFieldScope
void setAssociationFieldScope(Uml::Visibility::Enum var)
Definition codegenerationpolicy.cpp:387
CodeGenerationPolicy::setOutputDirectory
void setOutputDirectory(QDir new_var)
Definition codegenerationpolicy.cpp:195
CodeGenerationPolicy::setDefaults
virtual void setDefaults(CodeGenerationPolicy *defaults, bool emitUpdateSignal=true)
Definition codegenerationpolicy.cpp:423
CodeGenerationPolicy::getLineEndingType
NewLineType getLineEndingType()
Definition codegenerationpolicy.cpp:238
CodeGenerationPolicy::getIndentation
QString getIndentation() const
Definition codegenerationpolicy.cpp:298
CodeGenerationPolicy::getSectionCommentsPolicy
WriteSectionCommentsPolicy getSectionCommentsPolicy() const
Definition codegenerationpolicy.cpp:121
CodeGenerationPolicy::CodeGenerationPolicy
CodeGenerationPolicy()
Definition codegenerationpolicy.cpp:47
Uml::Visibility::Enum
Enum
Definition basictypes.h:45