umbrello/umbrello
SimpleCodeGenerator Class Reference
A simple code generator interface designed to work with the existing codewriters. More...
#include <simplecodegenerator.h>

Public Slots | |
| void | syncCodeToDocument () |
Public Member Functions | |
| SimpleCodeGenerator (bool createDirHierarchyForPackages=true) | |
| virtual | ~SimpleCodeGenerator () |
| CodeDocument * | newClassifierCodeDocument (UMLClassifier *classifier) |
| virtual void | writeClass (UMLClassifier *c)=0 |
| void | writeCodeToFile () |
| void | writeCodeToFile (UMLClassifierList &concepts) |
Protected Member Functions | |
| QString | findFileName (UMLPackage *concept, const QString &ext) |
| QString | getIndent () |
| bool | hasAbstractOps (UMLClassifier *c) |
| bool | hasDefaultValueAttr (UMLClassifier *c) |
| void | initFromParentDocument () |
| QString | overwritableName (UMLPackage *concept, const QString &name, const QString &ext) |
Protected Attributes | |
| QString | className_ |
| QString | fileName_ |
| bool | m_createDirHierarchyForPackages |
| UMLDoc * | m_doc |
| QString | m_endl |
| QMap< UMLPackage *, QString > | m_fileMap |
| QString | m_indentation |
| int | m_indentLevel |
Detailed Description
A simple code generator interface designed to work with the existing codewriters.
Definition at line 28 of file simplecodegenerator.h.
Constructor & Destructor Documentation
| SimpleCodeGenerator::SimpleCodeGenerator | ( | bool | createDirHierarchyForPackages = true |
) |
Constructor.
Definition at line 46 of file simplecodegenerator.cpp.
| SimpleCodeGenerator::~SimpleCodeGenerator | ( | ) | [virtual] |
Destructor.
Definition at line 58 of file simplecodegenerator.cpp.
Member Function Documentation
| QString SimpleCodeGenerator::findFileName | ( | UMLPackage * | concept, | |
| const QString & | ext | |||
| ) | [protected] |
Determine the file name.
- Parameters:
-
concept the package ext the file extension
- Returns:
- the valid file name
Definition at line 81 of file simplecodegenerator.cpp.
| QString SimpleCodeGenerator::getIndent | ( | ) | [protected] |
Returns the current indent string based on m_indentLevel and m_indentation.
- Returns:
- indentation string
Definition at line 66 of file simplecodegenerator.cpp.
| bool SimpleCodeGenerator::hasAbstractOps | ( | UMLClassifier * | c | ) | [protected] |
Check whether classifier has abstract operations.
- Parameters:
-
c the classifier to check
- Returns:
- true when classifier has abstract operations
Definition at line 245 of file simplecodegenerator.cpp.
| bool SimpleCodeGenerator::hasDefaultValueAttr | ( | UMLClassifier * | c | ) | [protected] |
Check whether classifier has default values for attributes.
- Parameters:
-
c the classifier to check
- Returns:
- true when classifier attributes has default values
Definition at line 230 of file simplecodegenerator.cpp.
| void SimpleCodeGenerator::initFromParentDocument | ( | ) | [protected, virtual] |
Override parent method.
Reimplemented from CodeGenerator.
Definition at line 325 of file simplecodegenerator.cpp.
| CodeDocument * SimpleCodeGenerator::newClassifierCodeDocument | ( | UMLClassifier * | classifier | ) | [virtual] |
Create a new classifier code document.
TODO: Not yet implemented.
- Parameters:
-
classifier UML classifier
- Returns:
- classifier code document object
Implements CodeGenerator.
Definition at line 261 of file simplecodegenerator.cpp.
| QString SimpleCodeGenerator::overwritableName | ( | UMLPackage * | concept, | |
| const QString & | name, | |||
| const QString & | ext | |||
| ) | [protected] |
Check if a file named "name" with extension "ext" already exists.
- Parameters:
-
concept the package name the name of the file ext the extension of the file
- Returns:
- the valid filename or null
Definition at line 157 of file simplecodegenerator.cpp.
| void SimpleCodeGenerator::syncCodeToDocument | ( | ) | [virtual, slot] |
A little method to provide some compatibility between the newer codegenpolicy object and the older class fields.
Reimplemented from CodeGenerator.
Definition at line 314 of file simplecodegenerator.cpp.
| 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, ValaWriter, and XMLSchemaWriter.
| void SimpleCodeGenerator::writeCodeToFile | ( | ) | [virtual] |
Write all concepts in project to file.
Reimplemented from CodeGenerator.
Definition at line 270 of file simplecodegenerator.cpp.
| void SimpleCodeGenerator::writeCodeToFile | ( | UMLClassifierList & | concepts | ) | [virtual] |
Write only selected concepts to file.
- Parameters:
-
concepts the selected concepts
Reimplemented from CodeGenerator.
Definition at line 284 of file simplecodegenerator.cpp.
Member Data Documentation
QString SimpleCodeGenerator::className_ [protected] |
Definition at line 49 of file simplecodegenerator.h.
QString SimpleCodeGenerator::fileName_ [protected] |
Definition at line 50 of file simplecodegenerator.h.
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 74 of file simplecodegenerator.h.
UMLDoc* SimpleCodeGenerator::m_doc [protected] |
Definition at line 66 of file simplecodegenerator.h.
QString SimpleCodeGenerator::m_endl [protected] |
Definition at line 79 of file simplecodegenerator.h.
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 63 of file simplecodegenerator.h.
QString SimpleCodeGenerator::m_indentation [protected] |
Definition at line 77 of file simplecodegenerator.h.
int SimpleCodeGenerator::m_indentLevel [protected] |
Definition at line 78 of file simplecodegenerator.h.
The documentation for this class was generated from the following files:
KDE 4.4 API Reference