umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
|
#include <cppwriter.h>
Public Member Functions | |
CppWriter () | |
virtual | ~CppWriter () |
virtual void | writeClass (UMLClassifier *c) |
virtual Uml::ProgrammingLanguage::Enum | language () const |
QStringList | defaultDatatypes () const |
virtual QStringList | reservedKeywords () const |
![]() | |
SimpleCodeGenerator (bool createDirHierarchyForPackages=true) | |
virtual | ~SimpleCodeGenerator () |
void | writeCodeToFile (UMLClassifierList &concepts) |
void | writeCodeToFile () |
![]() | |
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) |
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) |
CodeDocument * | findCodeDocumentByClassifier (UMLClassifier *classifier) |
virtual bool | isReservedKeyword (const QString &keyword) |
virtual void | createDefaultStereotypes () |
Private Member Functions | |
void | writeIncludes (UMLClassifier *c, QTextStream &cpp) |
void | writeClassDecl (UMLClassifier *c, QTextStream &cpp) |
void | writeConstructorDecls (QTextStream &h) |
void | writeConstructorMethods (UMLClassifier *c, QTextStream &cpp) |
void | writeOperations (UMLClassifier *c, bool isHeaderMethod, Uml::Visibility::Enum permitScope, QTextStream &cpp) |
void | writeOperations (UMLClassifier *c, UMLOperationList &oplist, bool isHeaderMethod, QTextStream &cpp) |
void | writeAttributeDecls (UMLClassifier *c, Uml::Visibility::Enum visibility, bool writeStatic, QTextStream &stream) |
void | writeHeaderFieldDecl (UMLClassifier *c, Uml::Visibility::Enum permitVisibility, QTextStream &stream) |
void | writeHeaderAttributeAccessorMethods (UMLClassifier *c, Uml::Visibility::Enum visibility, bool writeStatic, QTextStream &stream) |
void | writeHeaderAttributeAccessorMethodDecls (UMLClassifier *c, Uml::Visibility::Enum permitVisibility, QTextStream &stream) |
void | writeHeaderAccessorMethodDecl (UMLClassifier *c, Uml::Visibility::Enum permitScope, QTextStream &stream) |
void | writeAssociationDecls (UMLAssociationList associations, Uml::Visibility::Enum permit, Uml::ID::Type id, QTextStream &stream) |
void | writeAssociationRoleDecl (QString fieldClassName, QString roleName, QString multi, QString doc, QTextStream &stream) |
void | writeAttributeMethods (UMLAttributeList attribs, Uml::Visibility::Enum visib, bool isHeaderMethod, bool isStatic, bool writeMethodBody, QTextStream &stream) |
void | writeAssociationMethods (UMLAssociationList associations, Uml::Visibility::Enum permitVisib, bool isHeaderMethod, bool writeMethodBody, bool writePointerVar, Uml::ID::Type id, QTextStream &stream) |
void | writeAssociationRoleMethod (const QString &fieldClassName, bool isHeaderMethod, bool writeMethodBody, const QString &roleName, const QString &multi, const QString &description, Uml::Changeability::Enum change, QTextStream &stream) |
void | writeSingleAttributeAccessorMethods (const QString &fieldClassName, const QString &Name, const QString &fieldName, const QString &description, Uml::Changeability::Enum change, bool isHeaderMethod, bool isStatic, bool writeMethodBody, QTextStream &cpp) |
void | writeVectorAttributeAccessorMethods (const QString &fieldClassName, const QString &fieldVarName, const QString &fieldName, const QString &description, Uml::Changeability::Enum change, bool isHeaderMethod, bool writeMethodBody, QTextStream &stream) |
void | writeComment (const QString &text, const QString &indent, QTextStream &cpp) |
void | writeDocumentation (QString header, QString body, QString end, QTextStream &cpp) |
void | writeHeaderFile (UMLClassifier *c, QFile &file) |
void | writeSourceFile (UMLClassifier *c, QFile &file) |
void | printTextAsSeparateLinesWithIndent (const QString &text, const QString &indent, QTextStream &stream) |
void | printAssociationIncludeDecl (UMLAssociationList list, Uml::ID::Type this_id, QTextStream &stream) |
void | writeInitAttributeMethod (UMLClassifier *c, QTextStream &stream) |
void | writeInitAttributeDecl (UMLClassifier *c, QTextStream &stream) |
void | writeDataTypes (UMLClassifier *c, Uml::Visibility::Enum permitScope, QTextStream &stream) |
QString | umlObjectName (UMLObject *obj) |
QString | fixTypeName (const QString &string) |
QString | fixInitialStringDeclValue (const QString &value, const QString &type) |
QString | getAttributeVariableName (UMLAttribute *at) |
QString | getAttributeMethodBaseName (const QString &fieldName) |
void | writeBlankLine (QTextStream &stream) |
CPPCodeGenerationPolicy * | policyExt () |
Private Attributes | |
QString | VECTOR_METHOD_APPEND |
QString | VECTOR_METHOD_REMOVE |
QString | VECTOR_METHOD_INIT |
QString | OBJECT_METHOD_INIT |
bool | INLINE_ASSOCIATION_METHODS |
QStringList | ObjectFieldVariables |
QStringList | VectorFieldVariables |
bool | m_stringIncludeRequired |
Additional Inherited Members | |
![]() | |
enum | GenerationState { Generated , Failed , Skipped } |
![]() | |
virtual void | syncCodeToDocument () |
![]() | |
virtual void | syncCodeToDocument () |
![]() | |
void | codeGenerated (UMLClassifier *concept, bool generated) |
void | codeGenerated (UMLClassifier *concept, CodeGenerator::GenerationState result) |
void | showGeneratedFile (const QString &filename) |
![]() | |
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) |
![]() | |
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 () |
![]() | |
QString | overwritableName (const QString &name, const QString &extension) |
bool | openFile (QFile &file, const QString &name) |
void | writeListedCodeDocsToFile (CodeDocumentList *docs) |
virtual void | finalizeRun () |
![]() | |
QString | className_ |
QString | fileName_ |
QMap< UMLPackage *, QString > | m_fileMap |
bool | m_createDirHierarchyForPackages |
QString | m_indentation |
int | m_indentLevel |
QString | m_endl |
![]() | |
QHash< QString, CodeDocument * > | m_codeDocumentDictionary |
bool | m_applyToAllRemaining |
UMLDoc * | m_document |
Class CppWriter 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 (.cpp) file for that classifier. Note: This is the "old" code generator that does not support code editing in the Modeller but uses significantly less file space because the source code is not replicated in the XMI file.
CppWriter::CppWriter | ( | ) |
Constructor, initialises a couple of variables.
|
virtual |
Destructor, empty.
|
virtual |
Add C++ primitives as datatypes.
Reimplemented from CodeGenerator.
|
private |
Check that initial values of strings have quotes around them.
|
private |
Replaces `string' with STRING_TYPENAME.
|
private |
|
private |
Determine what the variable name of this attribute should be.
|
virtual |
|
private |
Return the policy object.
|
private |
Intelligently print out header include/forward decl. for associated classes. Note: To prevent circular including when both classifiers on either end of an association have roles we need to have forward declaration of the other class...but only IF it is not THIS class (as could happen in self-association relationship).
|
private |
Utility method to break up a block of text, which has embedded newline chars, and print them to a stream as separate lines of text, indented as directed.
|
virtual |
Get list of reserved keywords.
Reimplemented from CodeGenerator.
|
private |
Returns the name of the given object (if it exists). Note: Methods like this _shouldn't_ be needed IF we properly did things thruought the code.
|
private |
Searches a list of associations for appropriate ones to write out as attributes.
|
private |
Calls writeAssociationRoleMethod() on each of the associations in the given list for either source or header files.
|
private |
Writes out an association as an attribute using Vector.
|
private |
Calls writeSingleAttributeAccessorMethods() or writeVectorAttributeAccessorMethods() on the association role.
|
private |
Writes the attribute declarations.
c | the classifier |
visibility | the visibility of the attribs to print out |
writeStatic | whether to write static or non-static attributes out |
stream | text stream |
|
private |
This is for writing *source* or *header* file attribute methods. Calls writeSingleAttributeAccessorMethods() on each of the attributes in attribs list.
|
private |
Write a blank line.
|
virtual |
Call this method to generate cpp code for a UMLClassifier.
c | the class to generate code for |
Implements SimpleCodeGenerator.
|
private |
Writes class's documentation to the class header "public abstract class Foo extents {".
|
private |
Writes a // style comment.
|
private |
Writes the comment and class constructor declaration or methods. Note: One day, this should print out non-empty constructor operations too.
|
private |
|
private |
Write all datatypes for a given class.
c | the class for which we are generating code |
permitScope | what type of method to write (by Scope) |
stream | QTextStream serialization target |
|
private |
Writes a documentation comment.
|
private |
|
private |
|
private |
|
private |
Write out fields and operations for this class selected on a particular visibility.
|
private |
Write the header file for this classifier.
|
private |
write includes
c | uml classifier |
stream | text stream |
|
private |
If needed, write out the declaration for the method to initialize attributes of our class.
|
private |
If needed, write out the method to initialize attributes of our class.
|
private |
Write all ooperations for a given class.
c | the class for which we are generating code |
isHeaderMethod | true when writing to a header file, false for body file |
permitScope | what type of method to write (by Scope) |
cpp | the stream associated with the output file |
|
private |
Write a list of operations for a given class. Writes operation in either header or source file.
c | the class for which we are generating code |
oplist | the list of operations you want to write |
isHeaderMethod | true when writing to a header file, false for body file |
cpp | the stream associated with the output file |
|
private |
Writes getFoo() and setFoo() accessor methods for the attribute.
|
private |
Write the source code body file for this classifier.
|
private |
Writes addFoo() and removeFoo() accessor methods for the Vector attribute.
|
private |
Create association methods for class attributes/associations/operations as inline decl in header.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |