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

#include <valawriter.h>

Inheritance diagram for ValaWriter:
Collaboration diagram for ValaWriter:

Public Member Functions

 ValaWriter ()
 
virtual ~ValaWriter ()
 
virtual void writeClass (UMLClassifier *c)
 
virtual Uml::ProgrammingLanguage::Enum language () const
 
virtual QStringList reservedKeywords () const
 
QStringList defaultDatatypes () const
 
- Public Member Functions inherited from SimpleCodeGenerator
 SimpleCodeGenerator (bool createDirHierarchyForPackages=true)
 
virtual ~SimpleCodeGenerator ()
 
void writeCodeToFile (UMLClassifierList &concepts)
 
void writeCodeToFile ()
 
- Public Member Functions inherited from CodeGenerator
 CodeGenerator ()
 
virtual ~CodeGenerator ()
 
bool addCodeDocument (CodeDocument *add_object)
 
bool removeCodeDocument (CodeDocument *remove_object)
 
CodeDocumentListgetCodeDocumentList ()
 
QString getUniqueID (CodeDocument *codeDoc)
 
virtual void saveToXMI (QXmlStreamWriter &writer)
 
CodeDocumentfindCodeDocumentByID (const QString &id)
 
void setIncludeHeadings (bool i)
 
bool includeHeadings () const
 
void setHeadingFileDir (const QString &)
 
QString headingFileDir () const
 
void setForceDoc (bool f)
 
bool forceDoc () const
 
void setForceSections (bool f)
 
bool forceSections () const
 
virtual QString getHeadingFile (const QString &file)
 
QString findFileName (CodeDocument *codeDocument)
 
virtual void loadFromXMI (QDomElement &element)
 
CodeDocumentfindCodeDocumentByClassifier (UMLClassifier *classifier)
 
virtual bool isReservedKeyword (const QString &keyword)
 
virtual void createDefaultStereotypes ()
 

Private Member Functions

void writeRealizationsRecursive (UMLClassifier *currentClass, UMLAssociationList *realizations, QTextStream &cs)
 
void writeOperations (UMLClassifier *c, QTextStream &cs)
 
void writeOperations (UMLOperationList opList, QTextStream &cs, bool interface=false, bool isOverride=false, bool generateErrorStub=false)
 
void writeOverridesRecursive (UMLClassifierList *superclasses, QTextStream &cs)
 
void writeAttributes (UMLClassifier *c, QTextStream &cs)
 
void writeAttributes (UMLAttributeList &atList, QTextStream &cs)
 
void writeAssociatedAttributes (UMLAssociationList &associated, UMLClassifier *c, QTextStream &cs)
 
void writeAttribute (const QString &doc, Uml::Visibility::Enum visibility, bool isStatic, const QString &typeName, const QString &name, const QString &initialValue, bool asProperty, QTextStream &cs)
 
QString makeLocalTypeName (UMLClassifierListItem *cl)
 

Private Attributes

QString m_container_indent
 Adds extra indenting if the class is in a container (namespace). More...
 
UMLPackageList m_seenIncludes
 Collection of included namespaces, to skip them from variable types. More...
 
int m_unnamedRoles
 Counts associations without a role name for giving a default name. More...
 

Additional Inherited Members

- Public Types inherited from CodeGenerator
enum  GenerationState { Generated , Failed , Skipped }
 
- Public Slots inherited from SimpleCodeGenerator
virtual void syncCodeToDocument ()
 
- Public Slots inherited from CodeGenerator
virtual void syncCodeToDocument ()
 
- Signals inherited from CodeGenerator
void codeGenerated (UMLClassifier *concept, bool generated)
 
void codeGenerated (UMLClassifier *concept, 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=QLatin1String(" *"), int lineWidth=80)
 
static QString formatSourceCode (const QString &code, const QString &indentation)
 
static void findObjectsRelated (UMLClassifier *c, UMLPackageList &cList)
 
- Protected Member Functions inherited from SimpleCodeGenerator
QString findFileName (UMLPackage *concept, const QString &ext)
 
QString overwritableName (UMLPackage *concept, const QString &name, const QString &ext)
 
bool hasDefaultValueAttr (UMLClassifier *c)
 
bool hasAbstractOps (UMLClassifier *c)
 
QString indent ()
 
virtual void initFromParentDocument ()
 
- 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 ()
 
- Protected Attributes inherited from SimpleCodeGenerator
QString className_
 
QString fileName_
 
QMap< UMLPackage *, QString > m_fileMap
 
bool m_createDirHierarchyForPackages
 
QString m_indentation
 
int m_indentLevel
 
QString m_endl
 
- Protected Attributes inherited from CodeGenerator
QHash< QString, CodeDocument * > m_codeDocumentDictionary
 
bool m_applyToAllRemaining
 
UMLDocm_document
 

Detailed Description

Class ValaWriter is a Vala code generator for UMLClassifier objects Just call writeClass and feed it a UMLClassifier;

Constructor & Destructor Documentation

◆ ValaWriter()

ValaWriter::ValaWriter ( )

Constructor.

◆ ~ValaWriter()

ValaWriter::~ValaWriter ( )
virtual

Destructor.

Member Function Documentation

◆ defaultDatatypes()

QStringList ValaWriter::defaultDatatypes ( ) const
virtual

Get list of predefined data types.

Returns
the list of default data types

Reimplemented from CodeGenerator.

◆ language()

Uml::ProgrammingLanguage::Enum ValaWriter::language ( ) const
virtual

Returns "Vala".

Returns
programming language id

Implements CodeGenerator.

◆ makeLocalTypeName()

QString ValaWriter::makeLocalTypeName ( UMLClassifierListItem cl)
private

Find the type in used namespaces, if namespace found return short name, complete otherwise.

Parameters
clOperation or Attribute to check type
Returns
the local type name
Here is the call graph for this function:

◆ reservedKeywords()

QStringList ValaWriter::reservedKeywords ( ) const
virtual

Get list of reserved keywords.

Returns
list of reserved keywords

Reimplemented from CodeGenerator.

◆ writeAssociatedAttributes()

void ValaWriter::writeAssociatedAttributes ( UMLAssociationList associated,
UMLClassifier c,
QTextStream &  cs 
)
private

Write attributes from associated objects (compositions, aggregations).

Parameters
associatedlist of associated objects
ccurrently written class, to see association direction
csoutput stream
Here is the call graph for this function:

◆ writeAttribute()

void ValaWriter::writeAttribute ( const QString &  doc,
Uml::Visibility::Enum  visibility,
bool  isStatic,
const QString &  typeName,
const QString &  name,
const QString &  initialValue,
bool  asProperty,
QTextStream &  cs 
)
private

Write a single attribute to the output stream.

Parameters
docattribute documentation
visibilityattribute visibility
isStaticstatic attribute
typeNameclass/type of the attribute
namename of the attribute
initialValueinitial value given to the attribute at declaration
asPropertytrue writes as property (get/set), false writes single line variable
csoutput stream
Here is the call graph for this function:

◆ writeAttributes() [1/2]

void ValaWriter::writeAttributes ( UMLAttributeList atList,
QTextStream &  cs 
)
private

Write a list of class attributes.

Parameters
atListthe list of attributes
csoutput stream
Here is the call graph for this function:

◆ writeAttributes() [2/2]

void ValaWriter::writeAttributes ( UMLClassifier c,
QTextStream &  cs 
)
private

Write all the attributes of a class.

Parameters
cthe class we are generating code for
csoutput stream
Here is the call graph for this function:

◆ writeClass()

void ValaWriter::writeClass ( UMLClassifier c)
virtual

Call this method to generate Vala code for a UMLClassifier

Parameters
cthe class you want to generate code for.

Implements SimpleCodeGenerator.

Here is the call graph for this function:

◆ writeOperations() [1/2]

void ValaWriter::writeOperations ( UMLClassifier c,
QTextStream &  cs 
)
private

Write all operations for a given class.

Parameters
cthe concept we are generating code for
csoutput stream
Here is the call graph for this function:

◆ writeOperations() [2/2]

void ValaWriter::writeOperations ( UMLOperationList  opList,
QTextStream &  cs,
bool  isInterface = false,
bool  isOverride = false,
bool  generateErrorStub = false 
)
private

Write a list of class operations.

Parameters
opListthe list of operations
csoutput stream
isInterfaceindicates if the operation is an interface member
isOverrideimplementation of an inherited abstract function
generateErrorStubtrue generates a comment "The method or operation is not implemented"
Here is the call graph for this function:

◆ writeOverridesRecursive()

void ValaWriter::writeOverridesRecursive ( UMLClassifierList superclasses,
QTextStream &  cs 
)
private

Write superclasses' abstract methods.

Parameters
superclassesList of superclasses to start recursing on
csoutput stream
Here is the call graph for this function:

◆ writeRealizationsRecursive()

void ValaWriter::writeRealizationsRecursive ( UMLClassifier currentClass,
UMLAssociationList realizations,
QTextStream &  cs 
)
private

Write realizations of a class and recurse to parent classes.

Parameters
currentClassclass to start with
realizationsrealizations of this class
csoutput stream
Here is the call graph for this function:

Member Data Documentation

◆ m_container_indent

QString ValaWriter::m_container_indent
private

Adds extra indenting if the class is in a container (namespace).

◆ m_seenIncludes

UMLPackageList ValaWriter::m_seenIncludes
private

Collection of included namespaces, to skip them from variable types.

◆ m_unnamedRoles

int ValaWriter::m_unnamedRoles
private

Counts associations without a role name for giving a default name.


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