umbrello API Documentation

SimpleCodeGenerator Class Reference

A simple code generator interface designed to work with the existing codewriters. More...

#include <simplecodegenerator.h>

Inheritance diagram for SimpleCodeGenerator:

CodeGenerator AdaWriter ASWriter CppWriter CSharpWriter DWriter IDLWriter JavaWriter JSWriter PascalWriter PerlWriter Php5Writer PhpWriter PythonWriter RubyWriter SQLWriter TclWriter XMLSchemaWriter List of all members.

Public Slots

void syncCodeToDocument ()
 Force a synchronize of this code generator, and its present contents, to that of the parent UMLDocument.

Public Member Functions

 SimpleCodeGenerator (bool createDirHierarchyForPackages=true)
 Empty Constructor.
virtual ~SimpleCodeGenerator ()
 Empty Destructor.
void writeCodeToFile (UMLClassifierList &concepts)
void writeCodeToFile ()
 Write out all code documents to file as appropriate.
virtual void writeClass (UMLClassifier *c)=0
 call this method to generate code for a UMLClassifier
CodeDocumentnewClassifierCodeDocument (UMLClassifier *classifier)
 This is implemented only because we HAVE to.

Protected Member Functions

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 getIndent ()
 Returns the current indent string based on m_indentLevel and m_indentation.
void initFromParentDocument ()
 Initialize this code generator from its parent UMLDoc.

Protected Attributes

QMap< UMLPackage *, QString > m_fileMap
 Maps UMLObjects to filenames.
UMLDocm_doc
bool m_createDirHierarchyForPackages
 For some code generators, it does not make much sense to create a directory for each package because that would lead to a rather sparsely populated directory tree (maximum of just one source file per directory.).
QString m_indentation
int m_indentLevel
QString m_endl

Detailed Description

A simple code generator interface designed to work with the existing codewriters.

Definition at line 38 of file simplecodegenerator.h.


Constructor & Destructor Documentation

SimpleCodeGenerator::SimpleCodeGenerator bool  createDirHierarchyForPackages = true  ) 
 

Empty Constructor.

Definition at line 47 of file simplecodegenerator.cpp.

References UMLApp::getDocument(), and m_createDirHierarchyForPackages.

SimpleCodeGenerator::~SimpleCodeGenerator  )  [virtual]
 

Empty Destructor.

Definition at line 56 of file simplecodegenerator.cpp.


Member Function Documentation

void SimpleCodeGenerator::writeCodeToFile  )  [virtual]
 

Write out all code documents to file as appropriate.

Reimplemented from CodeGenerator.

Definition at line 243 of file simplecodegenerator.cpp.

References UMLDoc::getClassesAndInterfaces(), m_fileMap, and writeClass().

virtual void SimpleCodeGenerator::writeClass UMLClassifier c  )  [pure virtual]
 

call this method to generate code for a UMLClassifier

Parameters:
c the class you want to generate code for.

Implemented in AdaWriter, ASWriter, CppWriter, CSharpWriter, DWriter, IDLWriter, JavaWriter, JSWriter, PascalWriter, PerlWriter, Php5Writer, PhpWriter, PythonWriter, RubyWriter, SQLWriter, TclWriter, and XMLSchemaWriter.

Referenced by writeCodeToFile().

CodeDocument * SimpleCodeGenerator::newClassifierCodeDocument UMLClassifier classifier  )  [virtual]
 

This is implemented only because we HAVE to.

Returns:
ClassifierCodeDocument
Parameters:
classifier 

Implements CodeGenerator.

Definition at line 237 of file simplecodegenerator.cpp.

QString SimpleCodeGenerator::getIndent  )  [protected]
 

Returns the current indent string based on m_indentLevel and m_indentation.

Definition at line 69 of file simplecodegenerator.cpp.

Referenced by XMLSchemaWriter::writeClass(), PascalWriter::writeClass(), IDLWriter::writeClass(), and AdaWriter::writeClass().

void SimpleCodeGenerator::initFromParentDocument  )  [protected, virtual]
 

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.

Reimplemented from CodeGenerator.

Definition at line 286 of file simplecodegenerator.cpp.

void SimpleCodeGenerator::syncCodeToDocument  )  [virtual, slot]
 

Force a synchronize of this code generator, and its present contents, to that of the parent UMLDocument.

"UserGenerated" code will be preserved, but Autogenerated contents will be updated/replaced or removed as is apppropriate.

Reimplemented from CodeGenerator.

Definition at line 275 of file simplecodegenerator.cpp.

References UMLApp::getCommonPolicy(), CodeGenerationPolicy::getIndentation(), and CodeGenerationPolicy::getNewLineEndingChars().


Member Data Documentation

QMap<UMLPackage*,QString> SimpleCodeGenerator::m_fileMap [protected]
 

Maps UMLObjects to filenames.

Used for finding out which file each class was written to.

Definition at line 92 of file simplecodegenerator.h.

Referenced by writeCodeToFile().

bool SimpleCodeGenerator::m_createDirHierarchyForPackages [protected]
 

For some code generators, it does not make much sense to create a directory for each package because that would lead to a rather sparsely populated directory tree (maximum of just one source file per directory.).

Definition at line 103 of file simplecodegenerator.h.

Referenced by SimpleCodeGenerator().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:05 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003