umbrello: TclWriter Class Reference

umbrello 2.38.3 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 Member Functions | Private Member Functions | Private Attributes | List of all members
TclWriter Class Reference

`#include <tclwriter.h>`

Inheritance diagram for TclWriter:

## Public Member Functions
| TclWriter ()
virtual | ~TclWriter ()
virtual void | writeClass (UMLClassifier *c)
virtual Uml::ProgrammingLanguage::Enum | language () const
virtual QStringList | reservedKeywords () const
Public Member Functions inherited from SimpleCodeGenerator
| SimpleCodeGenerator (bool createDirHierarchyForPackages=true)
virtual | ~SimpleCodeGenerator ()
void | writeCodeToFile (UMLClassifierList &concepts)
void | writeCodeToFile ()
virtual void | writeClass (UMLClassifier *c)=0
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 ()
virtual void | initFromParentDocument ()=0

## Private Member Functions
void | writeHeaderFile (UMLClassifier *c, QFile &file)
void | writeSourceFile (UMLClassifier *c, QFile &file)
void | writeCode (const QString &text)
void | writeComm (const QString &text)
void | writeDocu (const QString &text)
void | writeConstructorDecl ()
void | writeDestructorDecl ()
void | writeAttributeDecl (UMLClassifier *c, Uml::Visibility::Enum visibility, bool writeStatic)
void | writeAssociationIncl (UMLAssociationList list, Uml::ID::Type myId, const QString &type)
void | writeAssociationDecl (UMLAssociationList associations, Uml::Visibility::Enum permit, Uml::ID::Type id, const QString &type)
void | writeAssociationRoleDecl (const QString &fieldClassName, const QString &roleName, const QString &multi, const QString &doc, const QString &docname)
void | writeInitAttributeHeader (UMLClassifier *c)
void | writeInitAttributeSource (UMLClassifier *c)
void | writeConstructorHeader ()
void | writeConstructorSource (UMLClassifier *c)
void | writeDestructorHeader ()
void | writeDestructorSource ()
void | writeOperationHeader (UMLClassifier *c, Uml::Visibility::Enum permitScope)
void | writeOperationSource (UMLClassifier *c, Uml::Visibility::Enum permitScope)
void | writeAttributeSource (UMLClassifier *c)
void | writeAssociationSource (UMLAssociationList associations, Uml::ID::Type id)
void | writeAssociationRoleSource (const QString &fieldClassName, const QString &roleName, const QString &multi)
void | writeUse (UMLClassifier *c)
QString | getUMLObjectName (UMLObject *obj)
QString | fixTypeName (const QString &string)

## Private Attributes
QTextStream * | mStream
| current output stream
QString | mNamespace
| namespace information
QString | mClassGlobal
| information about current classifier
QStringList | ObjectFieldVariables
QStringList | VectorFieldVariables

## 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=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 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
UMLDoc * | m_document

## Detailed Description

Class TclWriter is a code generator for UMLClassifier objects. Create an instance of this class, and feed it a UMLClassifier when calling writeClass and it will generate both a header (.h) and source (.tcl) file for that classifier.

## Constructor & Destructor Documentation

## ◆ TclWriter()

TclWriter::TclWriter | ( |  | ) |

Constructor, initialises a couple of variables.

## ◆ ~TclWriter()

TclWriter::~TclWriter | ( |  | ) |
| virtual

Destructor, empty.

## Member Function Documentation

## ◆ fixTypeName()

QString TclWriter::fixTypeName | ( | const QString & | string | ) |
| private

Replaces `string' with STRING_TYPENAME.

## ◆ getUMLObjectName()

QString TclWriter::getUMLObjectName | ( | UMLObject * | obj | ) |
| private

Returns the name of the given object (if it exists). Methods like this _shouldn't_ be needed IF we properly did things thruought the code.

## ◆ language()

Uml::ProgrammingLanguage::Enum TclWriter::language | ( |  | ) | const
| virtual

Returns "Tcl".

Returns
  the programming language identifier

Implements CodeGenerator.

## ◆ reservedKeywords()

QStringList TclWriter::reservedKeywords | ( |  | ) | const
| virtual

Get list of reserved keywords.

Returns
  the list of reserved keywords

Reimplemented from CodeGenerator.

## ◆ writeAssociationDecl()

void TclWriter::writeAssociationDecl | ( | UMLAssociationList | associations,
|  | Uml::Visibility::Enum | permitScope,
|  | Uml::ID::Type | id,
|  | const QString & | type
| ) |  |
| private

Searches a list of associations for appropriate ones to write out as attributes.

## ◆ writeAssociationIncl()

void TclWriter::writeAssociationIncl | ( | UMLAssociationList | list,
|  | Uml::ID::Type | myId,
|  | const QString & | type
| ) |  |
| private

## ◆ writeAssociationRoleDecl()

void TclWriter::writeAssociationRoleDecl | ( | const QString & | fieldClassName,
|  | const QString & | roleName,
|  | const QString & | multi,
|  | const QString & | doc,
|  | const QString & | scope
| ) |  |
| private

Writes out an association as an attribute using Vector.

## ◆ writeAssociationRoleSource()

void TclWriter::writeAssociationRoleSource | ( | const QString & | fieldClassName,
|  | const QString & | roleName,
|  | const QString & | multi
| ) |  |
| private

## ◆ writeAssociationSource()

void TclWriter::writeAssociationSource | ( | UMLAssociationList | associations,
|  | Uml::ID::Type | id
| ) |  |
| private

## ◆ writeAttributeDecl()

void TclWriter::writeAttributeDecl | ( | UMLClassifier * | c,
|  | Uml::Visibility::Enum | visibility,
|  | bool | writeStatic
| ) |  |
| private

Writes the Attribute declarations

Parameters

  c | classifier
  writeStatic | whether to write static or non-static attributes out
  visibility | the visibility of the attribs to print out

## ◆ writeAttributeSource()

void TclWriter::writeAttributeSource | ( | UMLClassifier * | c | ) |
| private

## ◆ writeClass()

void TclWriter::writeClass | ( | UMLClassifier * | c | ) |
| virtual

Call this method to generate tcl code for a UMLClassifier.

Parameters

  c | the class to generate code for

Implements SimpleCodeGenerator.

## ◆ writeCode()

void TclWriter::writeCode | ( | const QString & | text | ) |
| private

Write the source code text.

## ◆ writeComm()

void TclWriter::writeComm | ( | const QString & | text | ) |
| private

Write comment text.

## ◆ writeConstructorDecl()

void TclWriter::writeConstructorDecl | ( |  | ) |
| private

## ◆ writeConstructorHeader()

void TclWriter::writeConstructorHeader | ( |  | ) |
| private

## ◆ writeConstructorSource()

void TclWriter::writeConstructorSource | ( | UMLClassifier * | c | ) |
| private

## ◆ writeDestructorDecl()

void TclWriter::writeDestructorDecl | ( |  | ) |
| private

## ◆ writeDestructorHeader()

void TclWriter::writeDestructorHeader | ( |  | ) |
| private

## ◆ writeDestructorSource()

void TclWriter::writeDestructorSource | ( |  | ) |
| private

## ◆ writeDocu()

void TclWriter::writeDocu | ( | const QString & | text | ) |
| private

Write documentation text.

## ◆ writeHeaderFile()

void TclWriter::writeHeaderFile | ( | UMLClassifier * | c,
|  | QFile & | fileh
| ) |  |
| private

Write the header file for this classifier.

## ◆ writeInitAttributeHeader()

void TclWriter::writeInitAttributeHeader | ( | UMLClassifier * | c | ) |
| private

If needed, write out the declaration for the method to initialize attributes of our class.

## ◆ writeInitAttributeSource()

void TclWriter::writeInitAttributeSource | ( | UMLClassifier * | c | ) |
| private

If needed, write out the declaration for the method to initialize attributes of our class.

## ◆ writeOperationHeader()

void TclWriter::writeOperationHeader | ( | UMLClassifier * | c,
|  | Uml::Visibility::Enum | permitScope
| ) |  |
| private

## ◆ writeOperationSource()

void TclWriter::writeOperationSource | ( | UMLClassifier * | c,
|  | Uml::Visibility::Enum | permitScope
| ) |  |
| private

## ◆ writeSourceFile()

void TclWriter::writeSourceFile | ( | UMLClassifier * | c,
|  | QFile & | filetcl
| ) |  |
| private

Write the source code body file for this classifier.

## ◆ writeUse()

void TclWriter::writeUse | ( | UMLClassifier * | c | ) |
| private

## Member Data Documentation

## ◆ mClassGlobal

QString TclWriter::mClassGlobal
| private

information about current classifier

## ◆ mNamespace

QString TclWriter::mNamespace
| private

namespace information

## ◆ mStream

QTextStream* TclWriter::mStream
| private

current output stream

## ◆ ObjectFieldVariables

QStringList TclWriter::ObjectFieldVariables
| private

## ◆ VectorFieldVariables

QStringList TclWriter::VectorFieldVariables
| private

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

- umbrello/codegenerators/tcl/tclwriter.h
- umbrello/codegenerators/tcl/tclwriter.cpp