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
TclWriter Class Reference

#include <tclwriter.h>

Inheritance diagram for TclWriter:
Collaboration 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 ()
 
- 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 QStringList defaultDatatypes () const
 
virtual bool isReservedKeyword (const QString &keyword)
 
virtual void createDefaultStereotypes ()
 

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 More...
 
QString mNamespace
 namespace information More...
 
QString mClassGlobal
 information about current classifier More...
 
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=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 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.

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ writeAssociationIncl()

void TclWriter::writeAssociationIncl ( UMLAssociationList  list,
Uml::ID::Type  myId,
const QString &  type 
)
private
Here is the call graph for this function:

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

Here is the call graph for this function:

◆ writeAssociationRoleSource()

void TclWriter::writeAssociationRoleSource ( const QString &  fieldClassName,
const QString &  roleName,
const QString &  multi 
)
private
Here is the call graph for this function:

◆ writeAssociationSource()

void TclWriter::writeAssociationSource ( UMLAssociationList  associations,
Uml::ID::Type  id 
)
private
Here is the call graph for this function:

◆ writeAttributeDecl()

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

Writes the Attribute declarations

Parameters
cclassifier
writeStaticwhether to write static or non-static attributes out
visibilitythe visibility of the attribs to print out
Here is the call graph for this function:

◆ writeAttributeSource()

void TclWriter::writeAttributeSource ( UMLClassifier c)
private
Here is the call graph for this function:

◆ writeClass()

void TclWriter::writeClass ( UMLClassifier c)
virtual

Call this method to generate tcl code for a UMLClassifier.

Parameters
cthe class to generate code for

Implements SimpleCodeGenerator.

Here is the call graph for this function:

◆ writeCode()

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

Write the source code text.

Here is the call graph for this function:

◆ writeComm()

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

Write comment text.

Here is the call graph for this function:

◆ writeConstructorDecl()

void TclWriter::writeConstructorDecl ( )
private

◆ writeConstructorHeader()

void TclWriter::writeConstructorHeader ( )
private
Here is the call graph for this function:

◆ writeConstructorSource()

void TclWriter::writeConstructorSource ( UMLClassifier c)
private
Here is the call graph for this function:

◆ writeDestructorDecl()

void TclWriter::writeDestructorDecl ( )
private

◆ writeDestructorHeader()

void TclWriter::writeDestructorHeader ( )
private
Here is the call graph for this function:

◆ writeDestructorSource()

void TclWriter::writeDestructorSource ( )
private
Here is the call graph for this function:

◆ writeDocu()

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

Write documentation text.

Here is the call graph for this function:

◆ writeHeaderFile()

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

Write the header file for this classifier.

Here is the call graph for this function:

◆ writeInitAttributeHeader()

void TclWriter::writeInitAttributeHeader ( UMLClassifier c)
private

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

Here is the call graph for this function:

◆ writeInitAttributeSource()

void TclWriter::writeInitAttributeSource ( UMLClassifier c)
private

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

Here is the call graph for this function:

◆ writeOperationHeader()

void TclWriter::writeOperationHeader ( UMLClassifier c,
Uml::Visibility::Enum  permitScope 
)
private
Here is the call graph for this function:

◆ writeOperationSource()

void TclWriter::writeOperationSource ( UMLClassifier c,
Uml::Visibility::Enum  permitScope 
)
private
Here is the call graph for this function:

◆ writeSourceFile()

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

Write the source code body file for this classifier.

Here is the call graph for this function:

◆ writeUse()

void TclWriter::writeUse ( UMLClassifier c)
private
Here is the call graph for this function:

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: