umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Types | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CodeGenerationPolicy Class Reference

#include <codegenerationpolicy.h>

Inheritance diagram for CodeGenerationPolicy:
Collaboration diagram for CodeGenerationPolicy:

Public Types

enum  OverwritePolicy { Ok =0 , Ask , Never , Cancel }
 
enum  ModifyNamePolicy { No =0 , Underscore , Capitalise }
 
enum  NewLineType { UNIX =0 , DOS , MAC }
 
enum  IndentationType { NONE =0 , TAB , SPACE }
 
enum  CommentStyle { SingleLine =0 , MultiLine }
 

Signals

void modifiedCodeContent ()
 

Public Member Functions

 CodeGenerationPolicy (CodeGenerationPolicy *clone)
 
 CodeGenerationPolicy ()
 
virtual ~CodeGenerationPolicy ()
 
void setOverwritePolicy (OverwritePolicy new_var)
 
OverwritePolicy getOverwritePolicy () const
 
void setCodeVerboseSectionComments (bool new_var)
 
bool getCodeVerboseSectionComments () const
 
void setCodeVerboseDocumentComments (bool new_var)
 
bool getCodeVerboseDocumentComments () const
 
void setHeadingFileDir (const QString &path)
 
QString getHeadingFileDir () const
 
void setIncludeHeadings (bool new_var)
 
bool getIncludeHeadings () const
 
void setOutputDirectory (QDir new_var)
 
QDir getOutputDirectory ()
 
void setLineEndingType (NewLineType type)
 
NewLineType getLineEndingType ()
 
QString getNewLineEndingChars () const
 
void setIndentationType (IndentationType type)
 
IndentationType getIndentationType ()
 
void setIndentationAmount (int amount)
 
int getIndentationAmount ()
 
QString getIndentation () const
 
void setModifyPolicy (ModifyNamePolicy new_var)
 
ModifyNamePolicy getModifyPolicy () const
 
void setAutoGenerateConstructors (bool var)
 
bool getAutoGenerateConstructors ()
 
void setAttributeAccessorScope (Uml::Visibility::Enum var)
 
Uml::Visibility::Enum getAttributeAccessorScope ()
 
void setAssociationFieldScope (Uml::Visibility::Enum var)
 
Uml::Visibility::Enum getAssociationFieldScope ()
 
virtual CodeGenerationPolicyPagecreatePage (QWidget *parent=0, const char *name=0)
 
QString getHeadingFile (const QString &str)
 
virtual void setDefaults (CodeGenerationPolicy *defaults, bool emitUpdateSignal=true)
 
virtual void setDefaults (bool emitUpdateSignal=true)
 
virtual void writeConfig ()
 
void emitModifiedCodeContentSig ()
 
void setCommentStyle (CommentStyle new_var)
 
CommentStyle getCommentStyle ()
 

Protected Member Functions

void calculateIndentation ()
 

Protected Attributes

QString m_lineEndingChars
 
QString m_indentation
 

Detailed Description

class CodeGenerationPolicy This class describes the code generation policy for this project. Note that as the code gen policy may be the 'default' policy, it may not be coupled with a code generator.

Member Enumeration Documentation

◆ CommentStyle

Enumerator
SingleLine 
MultiLine 

◆ IndentationType

Enumerator
NONE 
TAB 
SPACE 

◆ ModifyNamePolicy

Enumerator
No 
Underscore 
Capitalise 

◆ NewLineType

Enumerator
UNIX 
DOS 
MAC 

◆ OverwritePolicy

OverwritePolicy can have the following values

  • Ok: if there is a file named the same as what you want to name your output file, you can overwrite the old file.
  • Ask:if there is a file named the same as what you want to name your output file, you should ask the User what to do, and give him the option to overwrite the file write the code to a different file, or to abort the generation of this class.
  • Never: you cannot overwrite any files. Generates a new file name like "fileName1.h", "fileName2.h" until you find an appropriate name.
  • Cancel: Do not output anything. This is only set if the user chooses Apply to All Remaining Files and clicks on Do not Output in the Ask dialog
Enumerator
Ok 
Ask 
Never 
Cancel 

Constructor & Destructor Documentation

◆ CodeGenerationPolicy() [1/2]

CodeGenerationPolicy::CodeGenerationPolicy ( CodeGenerationPolicy clone)
explicit

Constructor.

Parameters
clonegeneration policy to clone
Here is the call graph for this function:

◆ CodeGenerationPolicy() [2/2]

CodeGenerationPolicy::CodeGenerationPolicy ( )

Constructor.

Here is the call graph for this function:

◆ ~CodeGenerationPolicy()

CodeGenerationPolicy::~CodeGenerationPolicy ( )
virtual

Destructor

Member Function Documentation

◆ calculateIndentation()

void CodeGenerationPolicy::calculateIndentation ( )
protected

Calculate the indentation.

Here is the call graph for this function:

◆ createPage()

CodeGenerationPolicyPage * CodeGenerationPolicy::createPage ( QWidget *  pWidget = 0,
const char *  name = 0 
)
virtual

Create a new dialog interface for this object.

Returns
dialog object

◆ emitModifiedCodeContentSig()

void CodeGenerationPolicy::emitModifiedCodeContentSig ( )

Emits the signal 'ModifiedCodeContent'.

Here is the call graph for this function:

◆ getAssociationFieldScope()

Uml::Visibility::Enum CodeGenerationPolicy::getAssociationFieldScope ( )

Get the value of m_associationFieldScope

Returns
the Visibility value of m_associationFieldScope
Here is the call graph for this function:

◆ getAttributeAccessorScope()

Uml::Visibility::Enum CodeGenerationPolicy::getAttributeAccessorScope ( )

Get the value of m_attributeAccessorScope

Returns
the Visibility value of m_attributeAccessorScope
Here is the call graph for this function:

◆ getAutoGenerateConstructors()

bool CodeGenerationPolicy::getAutoGenerateConstructors ( )

Get the value of m_autoGenerateConstructors

Returns
the value of m_autoGenerateConstructors
Here is the call graph for this function:

◆ getCodeVerboseDocumentComments()

bool CodeGenerationPolicy::getCodeVerboseDocumentComments ( ) const

Get the value of m_codeVerboseDocumentComments Whether or not verbose code commenting for documentation is desired. If true, documentation for various code will be written even if no code would normally be created at that point in the file.

Returns
the value of m_codeVerboseDocumentComments
Here is the call graph for this function:

◆ getCodeVerboseSectionComments()

bool CodeGenerationPolicy::getCodeVerboseSectionComments ( ) const

Get the value of m_codeVerboseSectionComments Whether or not verbose code commenting for sections is desired. If true, comments for sections will be written even if the section is empty.

Returns
the flag whether verbose code commenting for sections is desired
Here is the call graph for this function:

◆ getCommentStyle()

CodeGenerationPolicy::CommentStyle CodeGenerationPolicy::getCommentStyle ( )

Get the value of m_commentStyle

Returns
the comment style
Here is the call graph for this function:

◆ getHeadingFile()

QString CodeGenerationPolicy::getHeadingFile ( const QString &  str)

Gets the heading file (as a string) to be inserted at the beginning of the generated file. you give the file type as parameter and get the string. if fileName starts with a period (.) then fileName is the extension (.cpp, .h, .java) if fileName starts with another character you are requesting a specific file (mylicensefile.txt). The files can have parameters which are denoted by parameter%.

current parameters are author% date% time% filepath%

Here is the call graph for this function:

◆ getHeadingFileDir()

QString CodeGenerationPolicy::getHeadingFileDir ( ) const

Get the value of m_headingFileDir location of the header file template.

Returns
the value of m_headingFileDir
Here is the call graph for this function:

◆ getIncludeHeadings()

bool CodeGenerationPolicy::getIncludeHeadings ( ) const

Get the value of m_includeHeadings

Returns
the value of m_includeHeadings
Here is the call graph for this function:

◆ getIndentation()

QString CodeGenerationPolicy::getIndentation ( ) const

Utility method to get the amount (and type of whitespace) to indent with.

Returns
the value of the indentation

◆ getIndentationAmount()

int CodeGenerationPolicy::getIndentationAmount ( )

Get indentation level units.

Here is the call graph for this function:

◆ getIndentationType()

CodeGenerationPolicy::IndentationType CodeGenerationPolicy::getIndentationType ( )

Get the value of m_indentationType

Here is the call graph for this function:

◆ getLineEndingType()

CodeGenerationPolicy::NewLineType CodeGenerationPolicy::getLineEndingType ( )

Get the value of m_lineEndingType What line ending characters to use.

Returns
the value of m_lineEndingType
Here is the call graph for this function:

◆ getModifyPolicy()

CodeGenerationPolicy::ModifyNamePolicy CodeGenerationPolicy::getModifyPolicy ( ) const

Get the value of m_modifyPolicy

Returns
the value of m_modifyPolicy
Here is the call graph for this function:

◆ getNewLineEndingChars()

QString CodeGenerationPolicy::getNewLineEndingChars ( ) const

Utility function to get the actual characters.

Returns
the line ending characters

◆ getOutputDirectory()

QDir CodeGenerationPolicy::getOutputDirectory ( )

Get the value of m_outputDirectory location of where output files will go.

Returns
the value of m_outputDirectory
Here is the call graph for this function:

◆ getOverwritePolicy()

CodeGenerationPolicy::OverwritePolicy CodeGenerationPolicy::getOverwritePolicy ( ) const

Get the value of m_overwritePolicy Policy of how to deal with overwriting existing files. Allowed values are "ask", "yes" and "no".

Returns
the overwrite policy
Here is the call graph for this function:

◆ modifiedCodeContent

void CodeGenerationPolicy::modifiedCodeContent ( )
signal

◆ setAssociationFieldScope()

void CodeGenerationPolicy::setAssociationFieldScope ( Uml::Visibility::Enum  var)

Set the value of m_associationFieldScope

Parameters
varthe new value
Here is the call graph for this function:

◆ setAttributeAccessorScope()

void CodeGenerationPolicy::setAttributeAccessorScope ( Uml::Visibility::Enum  var)

Set the value of m_attributeAccessorScope

Parameters
varthe new value
Here is the call graph for this function:

◆ setAutoGenerateConstructors()

void CodeGenerationPolicy::setAutoGenerateConstructors ( bool  var)

Set the value of m_autoGenerateConstructors

Parameters
varthe new value
Here is the call graph for this function:

◆ setCodeVerboseDocumentComments()

void CodeGenerationPolicy::setCodeVerboseDocumentComments ( bool  new_var)

Set the value of m_codeVerboseDocumentComments Whether or not verbose code commenting for documentation is desired. If true, documentation for various code will be written even if no code would normally be created at that point in the file.

Parameters
new_varthe new value to set verbose code commenting
Here is the call graph for this function:

◆ setCodeVerboseSectionComments()

void CodeGenerationPolicy::setCodeVerboseSectionComments ( bool  new_var)

Set the value of m_codeVerboseSectionComments Whether or not verbose code commenting for sections is desired. If true, comments for sections will be written even if the section is empty.

Parameters
new_varthe new value of m_codeVerboseSectionComments
Here is the call graph for this function:

◆ setCommentStyle()

void CodeGenerationPolicy::setCommentStyle ( CommentStyle  new_var)

Set the value of m_commentStyle

Parameters
new_varthe new value of m_commentStyle
Here is the call graph for this function:

◆ setDefaults() [1/2]

void CodeGenerationPolicy::setDefaults ( bool  emitUpdateSignal = true)
virtual

set the defaults from a config file

Here is the call graph for this function:

◆ setDefaults() [2/2]

void CodeGenerationPolicy::setDefaults ( CodeGenerationPolicy clone,
bool  emitUpdateSignal = true 
)
virtual

set the defaults from a config file

Here is the call graph for this function:

◆ setHeadingFileDir()

void CodeGenerationPolicy::setHeadingFileDir ( const QString &  path)

Set the value of m_headingFileDir location of the header file template.

Parameters
paththe new value of m_headingFileDir
Here is the call graph for this function:

◆ setIncludeHeadings()

void CodeGenerationPolicy::setIncludeHeadings ( bool  new_var)

Set the value of m_includeHeadings

Parameters
new_varthe new value of m_includeHeadings
Here is the call graph for this function:

◆ setIndentationAmount()

void CodeGenerationPolicy::setIndentationAmount ( int  amount)

Set how many units to indent for each indentation level.

Parameters
amountthe amount of indentation units
Here is the call graph for this function:

◆ setIndentationType()

void CodeGenerationPolicy::setIndentationType ( IndentationType  new_var)

Set the value of m_indentationType The amount and type of whitespace to indent with.

Parameters
new_varthe new value of m_indentationType
Here is the call graph for this function:

◆ setLineEndingType()

void CodeGenerationPolicy::setLineEndingType ( NewLineType  type)

Set the value of m_lineEndingType What line ending characters to use.

Parameters
typethe new value of m_lineEndingType
Here is the call graph for this function:

◆ setModifyPolicy()

void CodeGenerationPolicy::setModifyPolicy ( ModifyNamePolicy  new_var)

Set the value of m_modifyPolicy

Parameters
new_varthe new value of m_modifyPolicy
Here is the call graph for this function:

◆ setOutputDirectory()

void CodeGenerationPolicy::setOutputDirectory ( QDir  new_var)

Set the value of m_outputDirectory location of where output files will go.

Parameters
new_varthe new value of m_outputDirectory
Here is the call graph for this function:

◆ setOverwritePolicy()

void CodeGenerationPolicy::setOverwritePolicy ( OverwritePolicy  new_var)

Set the value of m_overwritePolicy Policy of how to deal with overwriting existing files. Allowed values are "ask", "yes" and "no".

Parameters
new_varthe new value of m_overwritePolicy
Here is the call graph for this function:

◆ writeConfig()

void CodeGenerationPolicy::writeConfig ( )
virtual

Write Default params.

Here is the call graph for this function:

Member Data Documentation

◆ m_indentation

QString CodeGenerationPolicy::m_indentation
protected

◆ m_lineEndingChars

QString CodeGenerationPolicy::m_lineEndingChars
protected

The documentation for this class was generated from the following files: