umbrello: ClassifierCodeDocument 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 Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
ClassifierCodeDocument Class Referenceabstract

`#include <classifiercodedocument.h>`

Inheritance diagram for ClassifierCodeDocument:

## Public Slots
void | addAttributeClassField (UMLClassifierListItem *at, bool syncToParentIfAdded=true)
void | addAssociationClassField (UMLAssociation *assoc, bool syncToParentIfAdded=true)
void | removeAttributeClassField (UMLClassifierListItem *at)
void | removeAssociationClassField (UMLAssociation *assoc)
void | addOperation (UMLClassifierListItem *obj)
void | removeOperation (UMLClassifierListItem *obj)
void | syncToParent ()

## Public Member Functions
| ClassifierCodeDocument (UMLClassifier *parent)
virtual | ~ClassifierCodeDocument ()
bool | addCodeClassField (CodeClassField *add_object)
bool | removeCodeClassField (CodeClassField *remove_object)
CodeClassFieldList * | getCodeClassFieldList ()
bool | parentIsInterface () const
bool | parentIsClass () const
bool | hasAssociationClassFields () const
bool | hasAttributeClassFields () const
bool | hasObjectVectorClassFields () const
bool | hasClassFields () const
QList< const CodeOperation * > | getCodeOperations () const
CodeClassFieldList | getSpecificClassFields (CodeClassField::ClassFieldType cfType) const
CodeClassFieldList | getSpecificClassFields (CodeClassField::ClassFieldType cfType, bool isStatic) const
CodeClassFieldList | getSpecificClassFields (CodeClassField::ClassFieldType cfType, Uml::Visibility::Enum visibility) const
CodeClassFieldList | getSpecificClassFields (CodeClassField::ClassFieldType cfType, bool isStatic, Uml::Visibility::Enum visibility) const
CodeClassField * | findCodeClassFieldFromParentID (Uml::ID::Type id, int role_id=-1)
UMLClassifier * | getParentClassifier () const
void | addCodeClassFieldMethods (CodeClassFieldList &list)
virtual void | initCodeClassFields ()
virtual void | synchronize ()
virtual bool | addCodeOperation (CodeOperation *opBlock)=0
virtual void | updateContent ()=0
virtual void | saveToXMI (QXmlStreamWriter &writer)
virtual void | loadFromXMI (QDomElement &root)
Public Member Functions inherited from CodeDocument
| CodeDocument ()
virtual | ~CodeDocument ()
void | setFileExtension (const QString &new_var)
QString | getFileExtension () const
void | setFileName (const QString &new_var)
QString | getFileName () const
void | setPackage (UMLPackage *new_var)
QString | getPackage () const
virtual QString | getPath () const
void | setID (const QString &new_id)
QString | ID () const
void | setWriteOutCode (bool new_var)
bool | getWriteOutCode () const
void | setHeader (CodeComment *comment)
CodeComment * | getHeader () const
bool | insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
TextBlock * | findTextBlockByTag (const QString &tag, bool descendIntoChildren=false) const
virtual QString | toString () const
virtual void | saveToXMI (QXmlStreamWriter &writer)
virtual void | loadFromXMI (QDomElement &root)
virtual CodeBlock * | newCodeBlock ()
virtual HierarchicalCodeBlock * | newHierarchicalCodeBlock ()
virtual CodeBlockWithComments * | newCodeBlockWithComments ()
virtual QString | getUniqueTag (const QString &prefix=QString())
QString | cleanName (const QString &name)
virtual void | synchronize ()
virtual void | updateContent ()
Public Member Functions inherited from CodeGenObjectWithTextBlocks
| CodeGenObjectWithTextBlocks (CodeDocument *parent)
virtual | ~CodeGenObjectWithTextBlocks ()
virtual bool | addTextBlock (TextBlock *add_object)
virtual bool | removeTextBlock (TextBlock *remove_object)
virtual bool | insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after)=0
TextBlockList * | getTextBlockList () const
virtual HierarchicalCodeBlock * | getHierarchicalCodeBlock (const QString &tag, const QString &comment, int indentLevel)
virtual CodeBlockWithComments * | getCodeBlockWithComments (const QString &tag, const QString &comment, int indentLevel)
CodeComment * | addOrUpdateTaggedCodeComment (const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
CodeBlockWithComments * | addOrUpdateTaggedCodeBlockWithComments (const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
TextBlock * | findTextBlockByTag (const QString &tag)
virtual QString | getUniqueTag (const QString &prefix=QString())=0
virtual CodeBlock * | newCodeBlock ()=0
virtual CodeBlockWithComments * | newCodeBlockWithComments ()=0
virtual HierarchicalCodeBlock * | newHierarchicalCodeBlock ()=0
CodeGenObjectWithTextBlocks * | findParentObjectForTaggedTextBlock (const QString &tag)

## Protected Member Functions
void | loadClassFieldsFromXMI (QDomElement &childElem)
virtual void | setAttributesOnNode (QXmlStreamWriter &writer)
virtual void | setAttributesFromNode (QDomElement &element)
TextBlock * | findCodeClassFieldTextBlockByTag (const QString &tag)
void | declareClassFields (CodeClassFieldList &list, CodeGenObjectWithTextBlocks *parent)
void | syncClassFields ()
void | syncNamesToParent ()
Protected Member Functions inherited from CodeDocument
virtual void | setAttributesOnNode (QXmlStreamWriter &writer)
virtual void | setAttributesFromNode (QDomElement &element)
void | addChildTagToMap (const QString &tag, TextBlock *tb)
void | removeChildTagFromMap (const QString &tag)
void | updateHeader ()
void | resetTextBlocks ()
virtual TextBlock * | findCodeClassFieldTextBlockByTag (const QString &tag)
Protected Member Functions inherited from CodeGenObjectWithTextBlocks
virtual void | setAttributesOnNode (QXmlStreamWriter &writer)
virtual void | setAttributesFromNode (QDomElement &element)
void | setAttributesFromObject (CodeGenObjectWithTextBlocks *obj)
virtual void | loadChildTextBlocksFromNode (QDomElement &root)
virtual void | resetTextBlocks ()
virtual TextBlock * | findCodeClassFieldTextBlockByTag (const QString &tag)=0

## Private Member Functions
void | updateAssociationClassFields (UMLAssociationList &assocList)
void | updateOperations ()
void | init (UMLClassifier *classifier)

## Private Attributes
CodeClassFieldList | m_classfieldVector
UMLClassifier * | m_parentclassifier
QMap< UMLObject *, CodeClassField * > | m_classFieldMap

## Friends
class | HierarchicalCodeBlock

## Additional Inherited Members
Protected Attributes inherited from CodeGenObjectWithTextBlocks
QMap< QString, TextBlock * > | m_textBlockTagMap
TextBlockList | m_textblockVector

## Detailed Description

class ClassifierCodeDocument A CodeDocument which represents a UMLClassifier (e.g. a Class or Interface)

## Constructor & Destructor Documentation

## ◆ ClassifierCodeDocument()

ClassifierCodeDocument::ClassifierCodeDocument | ( | UMLClassifier * | parent | ) |
| explicit

Constructor.

## ◆ ~ClassifierCodeDocument()

ClassifierCodeDocument::~ClassifierCodeDocument | ( |  | ) |
| virtual

Destructor.

## Member Function Documentation

## ◆ addAssociationClassField

void ClassifierCodeDocument::addAssociationClassField | ( | UMLAssociation * | assoc,
|  | bool | syncToParentIfAdded = `true`
| ) |  |
| slot

## ◆ addAttributeClassField

void ClassifierCodeDocument::addAttributeClassField | ( | UMLClassifierListItem * | obj,
|  | bool | syncToParentIfAdded = `true`
| ) |  |
| slot

Synchronize this document to the attributes/associations of the parent classifier. This is a slot..should only be called from a signal.

## ◆ addCodeClassField()

bool ClassifierCodeDocument::addCodeClassField | ( | CodeClassField * | add_object | ) |

Add a CodeClassField object to the m_classfieldVector List We DON'T add methods of the code classfield here because we need to allow the codegenerator writer the liberty to organize their document as they desire.

Returns
  boolean true if successful in adding

## ◆ addCodeClassFieldMethods()

void ClassifierCodeDocument::addCodeClassFieldMethods | ( | CodeClassFieldList & | list | ) |

A utility method that allows user to easily add classfield methods to this document.

## ◆ addCodeOperation()

virtual bool ClassifierCodeDocument::addCodeOperation | ( | CodeOperation * | opBlock | ) |
| pure virtual

Will add the code operation in the correct place in the document.

Returns
  bool which is true IF the code operation was added successfully

Implemented in CPPHeaderCodeDocument, CPPSourceCodeDocument, DClassifierCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

## ◆ addOperation

void ClassifierCodeDocument::addOperation | ( | UMLClassifierListItem * | o | ) |
| slot

Parameters

  o | The Operation to add

## ◆ declareClassFields()

void ClassifierCodeDocument::declareClassFields | ( | CodeClassFieldList & | list,
|  | CodeGenObjectWithTextBlocks * | parent
| ) |  |
| protected

Add declaration blocks for the passed classfields.

## ◆ findCodeClassFieldFromParentID()

CodeClassField * ClassifierCodeDocument::findCodeClassFieldFromParentID | ( | Uml::ID::Type | id,
|  | int | role_id = `-1`
| ) |  |

## ◆ findCodeClassFieldTextBlockByTag()

TextBlock * ClassifierCodeDocument::findCodeClassFieldTextBlockByTag | ( | const QString & | tag | ) |
| protectedvirtual

Find a specific textblock held by any code class field in this document by its tag.

Reimplemented from CodeDocument.

## ◆ getCodeClassFieldList()

CodeClassFieldList * ClassifierCodeDocument::getCodeClassFieldList | ( |  | ) |

Get the list of CodeClassField objects held by m_classfieldVector

Returns
  CodeClassFieldList list of CodeClassField objects held by m_classfieldVector

## ◆ getCodeOperations()

QList< const CodeOperation * > ClassifierCodeDocument::getCodeOperations | ( |  | ) | const

Get a list of codeoperation objects held by this classifiercodedocument.

Returns
  QList<CodeOperation>

## ◆ getParentClassifier()

UMLClassifier * ClassifierCodeDocument::getParentClassifier | ( |  | ) | const

Get the value of m_parentclassifier

Returns
  the value of m_parentclassifier

## ◆ getSpecificClassFields() [1/4]

CodeClassFieldList ClassifierCodeDocument::getSpecificClassFields | ( | CodeClassField::ClassFieldType | cfType | ) | const

Get a list of codeclassifier objects held by this classifiercodedocument that meet the passed criteria.

## ◆ getSpecificClassFields() [2/4]

CodeClassFieldList ClassifierCodeDocument::getSpecificClassFields | ( | CodeClassField::ClassFieldType | cfType,
|  | bool | isStatic
| ) |  | const

Get a list of codeclassifier objects held by this classifiercodedocument that meet the passed criteria.

## ◆ getSpecificClassFields() [3/4]

CodeClassFieldList ClassifierCodeDocument::getSpecificClassFields | ( | CodeClassField::ClassFieldType | cfType,
|  | bool | isStatic,
|  | Uml::Visibility::Enum | visibility
| ) |  | const

Get a list of codeclassifier objects held by this classifiercodedocument that meet the passed criteria.

## ◆ getSpecificClassFields() [4/4]

CodeClassFieldList ClassifierCodeDocument::getSpecificClassFields | ( | CodeClassField::ClassFieldType | cfType,
|  | Uml::Visibility::Enum | visibility
| ) |  | const

Get a list of codeclassifier objects held by this classifiercodedocument that meet the passed criteria.

## ◆ hasAssociationClassFields()

bool ClassifierCodeDocument::hasAssociationClassFields | ( |  | ) | const

Tell if one or more codeclassfields are derived from associations.

## ◆ hasAttributeClassFields()

bool ClassifierCodeDocument::hasAttributeClassFields | ( |  | ) | const

Tell if one or more codeclassfields are derived from attributes.

## ◆ hasClassFields()

bool ClassifierCodeDocument::hasClassFields | ( |  | ) | const

Does this object have any classfields declared?

## ◆ hasObjectVectorClassFields()

bool ClassifierCodeDocument::hasObjectVectorClassFields | ( |  | ) | const

Tell if any of the accessor classfields will be of lists of objects.

## ◆ init()

void ClassifierCodeDocument::init | ( | UMLClassifier * | c | ) |
| private

Initialize from a UMLClassifier object.

Parameters

  c | Classifier from which to initialize this CodeDocument

## ◆ initCodeClassFields()

void ClassifierCodeDocument::initCodeClassFields | ( |  | ) |
| virtual

Add codeclassfields to this classifiercodedocument. If a codeclassfield already exists, it is not added.

## ◆ loadClassFieldsFromXMI()

void ClassifierCodeDocument::loadClassFieldsFromXMI | ( | QDomElement & | elem | ) |
| protected

Load CodeClassFields from XMI element node.

## ◆ loadFromXMI()

void ClassifierCodeDocument::loadFromXMI | ( | QDomElement & | root | ) |
| virtual

Load params from the appropriate XMI element node.

Reimplemented from CodeDocument.

## ◆ parentIsClass()

bool ClassifierCodeDocument::parentIsClass | ( |  | ) | const

Return if the parent classifier is a class

## ◆ parentIsInterface()

bool ClassifierCodeDocument::parentIsInterface | ( |  | ) | const

Return if the parent classifier is an interface

## ◆ removeAssociationClassField

void ClassifierCodeDocument::removeAssociationClassField | ( | UMLAssociation * | assoc | ) |
| slot

## ◆ removeAttributeClassField

void ClassifierCodeDocument::removeAttributeClassField | ( | UMLClassifierListItem * | at | ) |
| slot

## ◆ removeCodeClassField()

bool ClassifierCodeDocument::removeCodeClassField | ( | CodeClassField * | remove_object | ) |

Remove a CodeClassField object from m_classfieldVector List

## ◆ removeOperation

void ClassifierCodeDocument::removeOperation | ( | UMLClassifierListItem * | op | ) |
| slot

Parameters

  op |

## ◆ saveToXMI()

void ClassifierCodeDocument::saveToXMI | ( | QXmlStreamWriter & | writer | ) |
| virtual

Save the XMI representation of this object.

Reimplemented from CodeDocument.

## ◆ setAttributesFromNode()

void ClassifierCodeDocument::setAttributesFromNode | ( | QDomElement & | elem | ) |
| protectedvirtual

Set the class attributes of this object from the passed element node.

Reimplemented from CodeDocument.

## ◆ setAttributesOnNode()

void ClassifierCodeDocument::setAttributesOnNode | ( | QXmlStreamWriter & | writer | ) |
| protectedvirtual

Set attributes of the node that represents this class in the XMI document.

Reimplemented from CodeDocument.

## ◆ syncClassFields()

void ClassifierCodeDocument::syncClassFields | ( |  | ) |
| protected

Force synchronization of child classfields to their parent objects.

## ◆ synchronize()

void ClassifierCodeDocument::synchronize | ( |  | ) |
| virtual

Cause this classifier code document to synchronize to current policy.

Reimplemented from CodeDocument.

## ◆ syncNamesToParent()

void ClassifierCodeDocument::syncNamesToParent | ( |  | ) |
| protected

IF the classifier object is modified, this will get called.

Todo:
  we cannot make this virtual as long as the ClassifierCodeDocument constructor calls it because that gives a call-before-construction error. Example of the problem: CPPSourceCodeDocument reimplementing syncNamesToParent() CPPCodeGenerator::initFromParentDocument() CodeDocument * codeDoc = new CPPSourceCodeDocument(c); CPPSourceCodeDocument::CPPSourceCodeDocument(UMLClassifier * concept) : ClassifierCodeDocument(concept) ClassifierCodeDocument::ClassifierCodeDocument(concept) init(concept); syncNamesToParent(); dispatches to CPPSourceCodeDocument::syncNamesToParent() but that object is not yet constructed.

## ◆ syncToParent

void ClassifierCodeDocument::syncToParent | ( |  | ) |
| slot

## ◆ updateAssociationClassFields()

void ClassifierCodeDocument::updateAssociationClassFields | ( | UMLAssociationList & | assocList | ) |
| private

Using the passed list, update our inventory of CodeClassFields which are based on UMLRoles (e.g. derived from associations with other classifiers).

## ◆ updateContent()

virtual void ClassifierCodeDocument::updateContent | ( |  | ) |
| pure virtual

Update the content of this code document. This is where you should lay out your code document structure of textblocks in the inheriting class, should it have any text in it. Vanilla code documents don't have much to do.. override this with a different version for your own documents.

Reimplemented from CodeDocument.

Implemented in CPPHeaderCodeDocument, CPPSourceCodeDocument, DClassifierCodeDocument, JavaClassifierCodeDocument, and RubyClassifierCodeDocument.

## ◆ updateOperations()

void ClassifierCodeDocument::updateOperations | ( |  | ) |
| private

Update code operations in this document using the parent classifier.

## Friends And Related Function Documentation

## ◆ HierarchicalCodeBlock

friend class HierarchicalCodeBlock
| friend

## Member Data Documentation

## ◆ m_classFieldMap

QMap<UMLObject *, CodeClassField *> ClassifierCodeDocument::m_classFieldMap
| private

Maps CodeClassFields to UMLObjects. Used to prevent re-adding a class field.

## ◆ m_classfieldVector

CodeClassFieldList ClassifierCodeDocument::m_classfieldVector
| private

## ◆ m_parentclassifier

UMLClassifier* ClassifierCodeDocument::m_parentclassifier
| private

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

- umbrello/codegenerators/classifiercodedocument.h
- umbrello/codegenerators/classifiercodedocument.cpp