umbrello: AdvancedCodeGenerator Class Reference

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

Public Slots | Public Member Functions | Protected Member Functions | List of all members
AdvancedCodeGenerator Class Referenceabstract

`#include <advancedcodegenerator.h>`

Inheritance diagram for AdvancedCodeGenerator:

## Public Slots
virtual void | checkAddUMLObject (UMLObject *obj)
virtual void | checkRemoveUMLObject (UMLObject *obj)
Public Slots inherited from CodeGenerator
virtual void | syncCodeToDocument ()

## Public Member Functions
| AdvancedCodeGenerator ()
virtual | ~AdvancedCodeGenerator ()
virtual CodeDocument * | newClassifierCodeDocument (UMLClassifier *classifier)=0
virtual CodeViewerDialog * | getCodeViewerDialog (QWidget *parent, CodeDocument *doc, Settings::CodeViewerState &state)
Public Member Functions inherited from CodeGenerator
| CodeGenerator ()
virtual | ~CodeGenerator ()
bool | addCodeDocument (CodeDocument *add_object)
bool | removeCodeDocument (CodeDocument *remove_object)
CodeDocumentList * | getCodeDocumentList ()
QString | getUniqueID (CodeDocument *codeDoc)
virtual void | saveToXMI (QXmlStreamWriter &writer)
CodeDocument * | findCodeDocumentByID (const QString &id)
virtual void | writeCodeToFile ()
virtual void | writeCodeToFile (UMLClassifierList &list)
void | setIncludeHeadings (bool i)
bool | includeHeadings () const
void | setHeadingFileDir (const QString &)
QString | headingFileDir () const
void | setForceDoc (bool f)
bool | forceDoc () const
void | setSectionCommentPolicy (CodeGenerationPolicy::WriteSectionCommentsPolicy f)
bool | forceSections () const
virtual QString | getHeadingFile (const QString &file)
QString | findFileName (CodeDocument *codeDocument)
virtual void | loadFromXMI (QDomElement &element)
virtual Uml::ProgrammingLanguage::Enum | language () const =0
CodeDocument * | findCodeDocumentByClassifier (UMLClassifier *classifier)
virtual QStringList | defaultDatatypes () const
virtual bool | isReservedKeyword (const QString &keyword)
virtual QStringList | reservedKeywords () const
virtual void | createDefaultStereotypes ()

## Protected Member Functions
virtual void | initFromParentDocument ()
void | connectSlots ()
Protected Member Functions inherited from CodeGenerator
QString | overwritableName (const QString &name, const QString &extension)
bool | openFile (QFile &file, const QString &name)
void | writeListedCodeDocsToFile (CodeDocumentList *docs)
virtual void | finalizeRun ()

## Additional Inherited Members
Public Types inherited from CodeGenerator
enum | GenerationState { Generated , Failed , Skipped }
Signals inherited from CodeGenerator
void | codeGenerated (UMLClassifier *classifier, bool generated)
void | codeGenerated (UMLClassifier *classifier, CodeGenerator::GenerationState result)
void | showGeneratedFile (const QString &filename)
Static Public Member Functions inherited from CodeGenerator
static QString | cleanName (const QString &name)
static QString | formatDoc (const QString &text, const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatFullDocBlock (const QString &text, const QString &blockHeader=QStringLiteral("/* "), const QString &blockFooter=QStringLiteral(" */"), const QString &linePrefix=QStringLiteral(" *"), int lineWidth=80)
static QString | formatSourceCode (const QString &code, const QString &indentation)
static void | findObjectsRelated (UMLClassifier *c, UMLPackageList &cList)
Protected Attributes inherited from CodeGenerator
QHash< QString, CodeDocument * > | m_codeDocumentDictionary
bool | m_applyToAllRemaining
UMLDoc * | m_document

## Detailed Description

AdvancedCodeGenerator is the base class for advanced cocde generators like CPPCodeGenerator, JavaCodeGenerator and so on.

## Constructor & Destructor Documentation

## ◆ AdvancedCodeGenerator()

AdvancedCodeGenerator::AdvancedCodeGenerator | ( |  | ) |

Constructor

## ◆ ~AdvancedCodeGenerator()

AdvancedCodeGenerator::~AdvancedCodeGenerator | ( |  | ) |
| virtual

Destructor

## Member Function Documentation

## ◆ checkAddUMLObject

void AdvancedCodeGenerator::checkAddUMLObject | ( | UMLObject * | obj | ) |
| virtualslot

This function checks for adding objects to the UMLDocument.

## ◆ checkRemoveUMLObject

void AdvancedCodeGenerator::checkRemoveUMLObject | ( | UMLObject * | obj | ) |
| virtualslot

This function checks for removing objects from the UMLDocument.

## ◆ connectSlots()

void AdvancedCodeGenerator::connectSlots | ( |  | ) |
| protected

Connect additional slots. To be called after constructing the code generator.

## ◆ getCodeViewerDialog()

CodeViewerDialog * AdvancedCodeGenerator::getCodeViewerDialog | ( | QWidget * | parent,
|  | CodeDocument * | doc,
|  | Settings::CodeViewerState & | state )
| virtual

Get the editing dialog for this code document.

Reimplemented in CPPCodeGenerator, DCodeGenerator, JavaCodeGenerator, and RubyCodeGenerator.

## ◆ initFromParentDocument()

void AdvancedCodeGenerator::initFromParentDocument | ( |  | ) |
| protectedvirtual

Initialize this code generator from its parent UMLDoc. When this is called, it will (re-)generate the list of code documents for this project (generator) by checking for new objects/attributes which have been added or changed in the document. One or more CodeDocuments will be created/overwritten/amended as is appropriate for the given language.

ClassifierCodeDocument In this 'generic' version a ClassifierCodeDocument will exist for each and every classifier that exists in our UMLDoc. IF when this is called, a code document doesn't exist for the given classifier, then we will created and add a new code document to our generator.

IF you want to add non-classifier related code documents at this step, you will need to overload this method in the appropriate code generatator (see JavaCodeGenerator for an example of this).

Implements CodeGenerator.

Reimplemented in CPPCodeGenerator.

## ◆ newClassifierCodeDocument()

virtual CodeDocument * AdvancedCodeGenerator::newClassifierCodeDocument | ( | UMLClassifier * | classifier | ) |
| pure virtual

Implemented in CPPCodeGenerator, DCodeGenerator, JavaCodeGenerator, and RubyCodeGenerator.

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

- umbrello/codegenerators/advancedcodegenerator.h
- umbrello/codegenerators/advancedcodegenerator.cpp