umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
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:
Collaboration 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)
 
CodeClassFieldListgetCodeClassFieldList ()
 
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
 
CodeClassFieldfindCodeClassFieldFromParentID (Uml::ID::Type id, int role_id=-1)
 
UMLClassifiergetParentClassifier () 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)
 
CodeCommentgetHeader () const
 
bool insertTextBlock (TextBlock *newBlock, TextBlock *existingBlock, bool after=true)
 
TextBlockfindTextBlockByTag (const QString &tag, bool descendIntoChildren=false) const
 
virtual QString toString () const
 
virtual CodeBlocknewCodeBlock ()
 
virtual HierarchicalCodeBlocknewHierarchicalCodeBlock ()
 
virtual CodeBlockWithCommentsnewCodeBlockWithComments ()
 
virtual QString getUniqueTag (const QString &prefix=QString())
 
QString cleanName (const QString &name)
 
- Public Member Functions inherited from CodeGenObjectWithTextBlocks
 CodeGenObjectWithTextBlocks (CodeDocument *parent)
 
virtual ~CodeGenObjectWithTextBlocks ()
 
virtual bool addTextBlock (TextBlock *add_object)
 
virtual bool removeTextBlock (TextBlock *remove_object)
 
TextBlockListgetTextBlockList () const
 
virtual HierarchicalCodeBlockgetHierarchicalCodeBlock (const QString &tag, const QString &comment, int indentLevel)
 
virtual CodeBlockWithCommentsgetCodeBlockWithComments (const QString &tag, const QString &comment, int indentLevel)
 
CodeCommentaddOrUpdateTaggedCodeComment (const QString &tag=QString(), const QString &text=QString(), int indentationLevel=0)
 
CodeBlockWithCommentsaddOrUpdateTaggedCodeBlockWithComments (const QString &tag, const QString &text, const QString &ctext, int indentLevel, bool forceUserBlockUpdate)
 
TextBlockfindTextBlockByTag (const QString &tag)
 
CodeGenObjectWithTextBlocksfindParentObjectForTaggedTextBlock (const QString &tag)
 

Protected Member Functions

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

Private Member Functions

void updateAssociationClassFields (UMLAssociationList &assocList)
 
void updateOperations ()
 
void init (UMLClassifier *classifier)
 

Private Attributes

CodeClassFieldList m_classfieldVector
 
UMLClassifierm_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.

Here is the call graph for this function:

◆ ~ClassifierCodeDocument()

ClassifierCodeDocument::~ClassifierCodeDocument ( )
virtual

Destructor.

Member Function Documentation

◆ addAssociationClassField

void ClassifierCodeDocument::addAssociationClassField ( UMLAssociation assoc,
bool  syncToParentIfAdded = true 
)
slot
Here is the call graph for this function:

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

Here is the call graph for this function:

◆ 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
Here is the call graph for this function:

◆ addCodeClassFieldMethods()

void ClassifierCodeDocument::addCodeClassFieldMethods ( CodeClassFieldList list)

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

Here is the call graph for this function:

◆ 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
oThe Operation to add
Here is the call graph for this function:

◆ declareClassFields()

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

Add declaration blocks for the passed classfields.

Here is the call graph for this function:

◆ findCodeClassFieldFromParentID()

CodeClassField * ClassifierCodeDocument::findCodeClassFieldFromParentID ( Uml::ID::Type  id,
int  role_id = -1 
)
Here is the call graph for this function:

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

Here is the call graph for this function:

◆ 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>
Here is the call graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ hasAssociationClassFields()

bool ClassifierCodeDocument::hasAssociationClassFields ( ) const

Tell if one or more codeclassfields are derived from associations.

Here is the call graph for this function:

◆ hasAttributeClassFields()

bool ClassifierCodeDocument::hasAttributeClassFields ( ) const

Tell if one or more codeclassfields are derived from attributes.

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ init()

void ClassifierCodeDocument::init ( UMLClassifier c)
private

Initialize from a UMLClassifier object.

Parameters
cClassifier from which to initialize this CodeDocument
Here is the call graph for this function:

◆ initCodeClassFields()

void ClassifierCodeDocument::initCodeClassFields ( )
virtual

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

Here is the call graph for this function:

◆ loadClassFieldsFromXMI()

void ClassifierCodeDocument::loadClassFieldsFromXMI ( QDomElement &  elem)
protected

Load CodeClassFields from XMI element node.

Here is the call graph for this function:

◆ loadFromXMI()

void ClassifierCodeDocument::loadFromXMI ( QDomElement &  root)
virtual

Load params from the appropriate XMI element node.

Reimplemented from CodeDocument.

Here is the call graph for this function:

◆ parentIsClass()

bool ClassifierCodeDocument::parentIsClass ( ) const

Return if the parent classifier is a class

Here is the call graph for this function:

◆ parentIsInterface()

bool ClassifierCodeDocument::parentIsInterface ( ) const

Return if the parent classifier is an interface

Here is the call graph for this function:

◆ removeAssociationClassField

void ClassifierCodeDocument::removeAssociationClassField ( UMLAssociation assoc)
slot
Here is the call graph for this function:

◆ removeAttributeClassField

void ClassifierCodeDocument::removeAttributeClassField ( UMLClassifierListItem at)
slot
Here is the call graph for this function:

◆ removeCodeClassField()

bool ClassifierCodeDocument::removeCodeClassField ( CodeClassField remove_object)

Remove a CodeClassField object from m_classfieldVector List

Here is the call graph for this function:

◆ removeOperation

void ClassifierCodeDocument::removeOperation ( UMLClassifierListItem op)
slot
Parameters
op
Here is the call graph for this function:

◆ saveToXMI()

void ClassifierCodeDocument::saveToXMI ( QXmlStreamWriter &  writer)
virtual

Save the XMI representation of this object.

Reimplemented from CodeDocument.

Here is the call graph for this function:

◆ setAttributesFromNode()

void ClassifierCodeDocument::setAttributesFromNode ( QDomElement &  elem)
protectedvirtual

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

Reimplemented from CodeDocument.

Here is the call graph for this function:

◆ setAttributesOnNode()

void ClassifierCodeDocument::setAttributesOnNode ( QXmlStreamWriter &  writer)
protectedvirtual

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

Reimplemented from CodeDocument.

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ 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.
Here is the call graph for this function:

◆ syncToParent

void ClassifierCodeDocument::syncToParent ( )
slot
Here is the call graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

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: