umbrello: CodeGenerationPolicy Class Reference

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

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:

## 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 CodeGenerationPolicyPage * | createPage (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

enum CodeGenerationPolicy::CommentStyle

Enumerator
SingleLine |
MultiLine |

## ◆ IndentationType

enum CodeGenerationPolicy::IndentationType

Enumerator
NONE |
TAB |
SPACE |

## ◆ ModifyNamePolicy

enum CodeGenerationPolicy::ModifyNamePolicy

Enumerator
No |
Underscore |
Capitalise |

## ◆ NewLineType

enum CodeGenerationPolicy::NewLineType

Enumerator
UNIX |
DOS |
MAC |

## ◆ OverwritePolicy

enum CodeGenerationPolicy::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

  clone | generation policy to clone

## ◆ CodeGenerationPolicy() [2/2]

CodeGenerationPolicy::CodeGenerationPolicy | ( |  | ) |

Constructor.

## ◆ ~CodeGenerationPolicy()

CodeGenerationPolicy::~CodeGenerationPolicy | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ calculateIndentation()

void CodeGenerationPolicy::calculateIndentation | ( |  | ) |
| protected

Calculate the indentation.

## ◆ 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'.

## ◆ getAssociationFieldScope()

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

Get the value of m_associationFieldScope

Returns
  the Visibility value of m_associationFieldScope

## ◆ getAttributeAccessorScope()

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

Get the value of m_attributeAccessorScope

Returns
  the Visibility value of m_attributeAccessorScope

## ◆ getAutoGenerateConstructors()

bool CodeGenerationPolicy::getAutoGenerateConstructors | ( |  | ) |

Get the value of m_autoGenerateConstructors

Returns
  the value of m_autoGenerateConstructors

## ◆ 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

## ◆ 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

## ◆ getCommentStyle()

CodeGenerationPolicy::CommentStyle CodeGenerationPolicy::getCommentStyle | ( |  | ) |

Get the value of m_commentStyle

Returns
  the comment style

## ◆ 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%

## ◆ getHeadingFileDir()

QString CodeGenerationPolicy::getHeadingFileDir | ( |  | ) | const

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

Returns
  the value of m_headingFileDir

## ◆ getIncludeHeadings()

bool CodeGenerationPolicy::getIncludeHeadings | ( |  | ) | const

Get the value of m_includeHeadings

Returns
  the value of m_includeHeadings

## ◆ 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.

## ◆ getIndentationType()

CodeGenerationPolicy::IndentationType CodeGenerationPolicy::getIndentationType | ( |  | ) |

Get the value of m_indentationType

## ◆ getLineEndingType()

CodeGenerationPolicy::NewLineType CodeGenerationPolicy::getLineEndingType | ( |  | ) |

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

Returns
  the value of m_lineEndingType

## ◆ getModifyPolicy()

CodeGenerationPolicy::ModifyNamePolicy CodeGenerationPolicy::getModifyPolicy | ( |  | ) | const

Get the value of m_modifyPolicy

Returns
  the value of m_modifyPolicy

## ◆ 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

## ◆ 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

## ◆ modifiedCodeContent

void CodeGenerationPolicy::modifiedCodeContent | ( |  | ) |
| signal

## ◆ setAssociationFieldScope()

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

Set the value of m_associationFieldScope

Parameters

  var | the new value

## ◆ setAttributeAccessorScope()

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

Set the value of m_attributeAccessorScope

Parameters

  var | the new value

## ◆ setAutoGenerateConstructors()

void CodeGenerationPolicy::setAutoGenerateConstructors | ( | bool | var | ) |

Set the value of m_autoGenerateConstructors

Parameters

  var | the new value

## ◆ 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_var | the new value to set verbose code commenting

## ◆ 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_var | the new value of m_codeVerboseSectionComments

## ◆ setCommentStyle()

void CodeGenerationPolicy::setCommentStyle | ( | CommentStyle | new_var | ) |

Set the value of m_commentStyle

Parameters

  new_var | the new value of m_commentStyle

## ◆ setDefaults() [1/2]

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

set the defaults from a config file

## ◆ setDefaults() [2/2]

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

set the defaults from a config file

## ◆ setHeadingFileDir()

void CodeGenerationPolicy::setHeadingFileDir | ( | const QString & | path | ) |

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

Parameters

  path | the new value of m_headingFileDir

## ◆ setIncludeHeadings()

void CodeGenerationPolicy::setIncludeHeadings | ( | bool | new_var | ) |

Set the value of m_includeHeadings

Parameters

  new_var | the new value of m_includeHeadings

## ◆ setIndentationAmount()

void CodeGenerationPolicy::setIndentationAmount | ( | int | amount | ) |

Set how many units to indent for each indentation level.

Parameters

  amount | the amount of indentation units

## ◆ setIndentationType()

void CodeGenerationPolicy::setIndentationType | ( | IndentationType | new_var | ) |

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

Parameters

  new_var | the new value of m_indentationType

## ◆ setLineEndingType()

void CodeGenerationPolicy::setLineEndingType | ( | NewLineType | type | ) |

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

Parameters

  type | the new value of m_lineEndingType

## ◆ setModifyPolicy()

void CodeGenerationPolicy::setModifyPolicy | ( | ModifyNamePolicy | new_var | ) |

Set the value of m_modifyPolicy

Parameters

  new_var | the new value of m_modifyPolicy

## ◆ setOutputDirectory()

void CodeGenerationPolicy::setOutputDirectory | ( | QDir | new_var | ) |

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

Parameters

  new_var | the new value of m_outputDirectory

## ◆ 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_var | the new value of m_overwritePolicy

## ◆ writeConfig()

void CodeGenerationPolicy::writeConfig | ( |  | ) |
| virtual

Write Default params.

## 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:

- umbrello/codegenerators/codegenerationpolicy.h
- umbrello/codegenerators/codegenerationpolicy.cpp