umbrello: CodeClassField Class Reference

umbrello 25.04.0 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

Public Types | Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CodeClassField Class Reference

`#include <codeclassfield.h>`

Inheritance diagram for CodeClassField:

## Public Types
enum | ClassFieldType { Attribute , PlainAssociation , Self , Aggregation , Composition , Unknown_Assoc }

## Signals
void | modified ()

## Public Member Functions
| CodeClassField (ClassifierCodeDocument *parentDoc, UMLAttribute *attrib)
| CodeClassField (ClassifierCodeDocument *parentDoc, UMLRole *role)
void | finishInitialization ()
virtual | ~CodeClassField ()
QString | getTypeName ()
CodeClassFieldDeclarationBlock * | getDeclarationCodeBlock ()
CodeAccessorMethodList | getMethodList () const
CodeAccessorMethod * | findMethodByType (CodeAccessorMethod::AccessorType type, int role_id=-1)
bool | fieldIsSingleValue ()
ClassFieldType | getClassFieldType () const
bool | parentIsAttribute () const
QString | getListObjectType ()
bool | getWriteOutMethods () const
void | setWriteOutMethods (bool val)
int | minimumListOccurances ()
int | maximumListOccurances ()
virtual void | saveToXMI (QXmlStreamWriter &writer)
virtual void | loadFromXMI (QDomElement &root)
virtual void | synchronize ()
void | updateContent ()
Public Member Functions inherited from CodeParameter
| CodeParameter (ClassifierCodeDocument *doc, UMLObject *parentObj)
virtual | ~CodeParameter ()
ClassifierCodeDocument * | getParentDocument ()
UMLObject * | getParentObject ()
bool | getAbstract ()
bool | getStatic ()
QString | getName () const
Uml::Visibility::Enum | getVisibility () const
virtual void | setInitialValue (const QString &new_var)
virtual QString | getInitialValue ()
void | setComment (CodeComment *comment)
CodeComment * | getComment ()
QString | ID () const

## Protected Member Functions
void | setParentUMLObject (UMLObject *obj)
QString | cleanName (const QString &name)
QString | fixInitialStringDeclValue (const QString &val, const QString &type)
void | setListClassName (const QString &className)
bool | addMethod (CodeAccessorMethod *add)
QString | getUMLObjectName (UMLObject *obj)
bool | removeMethod (CodeAccessorMethod *remove)

## Private Member Functions
virtual void | setAttributesOnNode (QXmlStreamWriter &writer)
virtual void | setAttributesFromNode (QDomElement &element)
void | initFields (bool inConstructor=false)
void | initAccessorMethods ()

## Private Attributes
QString | m_listClassName
ClassFieldType | m_classFieldType
CodeClassFieldDeclarationBlock * | m_declCodeBlock
CodeAccessorMethodList | m_methodVector
bool | m_parentIsAttribute
bool | m_writeOutMethods

## Additional Inherited Members
Public Slots inherited from CodeParameter
void | syncToParent ()

## Detailed Description

class CodeClassField a special type of parameter.. occurs on class declarations.

## Member Enumeration Documentation

## ◆ ClassFieldType

enum CodeClassField::ClassFieldType

Enumerator
Attribute |
PlainAssociation |
Self |
Aggregation |
Composition |
Unknown_Assoc |

## Constructor & Destructor Documentation

## ◆ CodeClassField() [1/2]

CodeClassField::CodeClassField | ( | ClassifierCodeDocument * | doc,
|  | UMLAttribute * | attrib )

Constructor.

## ◆ CodeClassField() [2/2]

CodeClassField::CodeClassField | ( | ClassifierCodeDocument * | doc,
|  | UMLRole * | role )

Constructor.

## ◆ ~CodeClassField()

CodeClassField::~CodeClassField | ( |  | ) |
| virtual

Empty Destructor.

## Member Function Documentation

## ◆ addMethod()

bool CodeClassField::addMethod | ( | CodeAccessorMethod * | add_object | ) |
| protected

Add a Method object to the m_methodVector List.

## ◆ cleanName()

QString CodeClassField::cleanName | ( | const QString & | name | ) |
| protected

A little utility method to make life easier for code document programmers

## ◆ fieldIsSingleValue()

bool CodeClassField::fieldIsSingleValue | ( |  | ) |

Determine whether the parent object in this classfield indicates that it is a single variable or a List (Vector). One day this will be done correctly with special multiplicity object.

## ◆ findMethodByType()

CodeAccessorMethod * CodeClassField::findMethodByType | ( | CodeAccessorMethod::AccessorType | type,
|  | int | role_id = -1 )

Utility method to allow finding particular accessor method of this code class field by its type identifier.

## ◆ finishInitialization()

void CodeClassField::finishInitialization | ( |  | ) |

Finish off initializations of the object. This is necessary as a separate method because we cannot call virtual methods that are reimplemented in a language specific class during our own construction (the own object is not finished being constructed and therefore the C++ dispatch mechanism does not yet work as expected.)

## ◆ fixInitialStringDeclValue()

QString CodeClassField::fixInitialStringDeclValue | ( | const QString & | val,
|  | const QString & | type )
| protected

Another utility method to make life easier for code document programmers this one fixes the initial declared value of string attributes so that if it is empty or lacking quotations, it comes out as ""

## ◆ getClassFieldType()

CodeClassField::ClassFieldType CodeClassField::getClassFieldType | ( |  | ) | const

Get the type of classfield this is.

## ◆ getDeclarationCodeBlock()

CodeClassFieldDeclarationBlock * CodeClassField::getDeclarationCodeBlock | ( |  | ) |

Return the declaration statement for this class field object. will be empty until this (abstract) class is inherited in elsewhere.

## ◆ getListObjectType()

QString CodeClassField::getListObjectType | ( |  | ) |

## ◆ getMethodList()

CodeAccessorMethodList CodeClassField::getMethodList | ( |  | ) | const

Get the list of Method objects held by m_methodVector.

Returns
  QPtrList<CodeMethodBlock *> list of Method objects held by m_methodVector

## ◆ getTypeName()

QString CodeClassField::getTypeName | ( |  | ) |
| virtual

Get the value of m_dialog

Returns
  the value of m_dialog

Reimplemented from CodeParameter.

Reimplemented in DCodeClassField, JavaCodeClassField, and RubyCodeClassField.

## ◆ getUMLObjectName()

QString CodeClassField::getUMLObjectName | ( | UMLObject * | obj | ) |
| protected

## ◆ getWriteOutMethods()

bool CodeClassField::getWriteOutMethods | ( |  | ) | const

Determine if we will *allow* methods to be viewable. this flag is often used to toggle autogeneration of accessor methods in the code class field.

## ◆ initAccessorMethods()

void CodeClassField::initAccessorMethods | ( |  | ) |
| private

## ◆ initFields()

void CodeClassField::initFields | ( | bool | inConstructor = false | ) |
| private

Init class fields.

## ◆ loadFromXMI()

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

Load params from the appropriate XMI element node.

## ◆ maximumListOccurances()

int CodeClassField::maximumListOccurances | ( |  | ) |

Find the maximum number of things that can occur in an association If mistakenly called on attribute CF's the default value of is "1" is returned. If the association (role) CF doesn't have a multiplicity or has a "*" specified then '-1' (unbounded) is returned.

## ◆ minimumListOccurances()

int CodeClassField::minimumListOccurances | ( |  | ) |

Find the minimum number of things that can occur in an association If mistakenly called on attribute CF's the default value of is "0" is returned. Similarly, if the association (role) CF doesn't have a multiplicity 0 is returned.

## ◆ modified

void CodeClassField::modified | ( |  | ) |
| signal

## ◆ parentIsAttribute()

bool CodeClassField::parentIsAttribute | ( |  | ) | const

Get the value of m_isAbstract.

Returns
  the value of m_isAbstract

## ◆ removeMethod()

bool CodeClassField::removeMethod | ( | CodeAccessorMethod * | remove_object | ) |
| protected

Remove a Method object from m_methodVector List.

## ◆ saveToXMI()

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

Save the XMI representation of this object.

## ◆ setAttributesFromNode()

void CodeClassField::setAttributesFromNode | ( | QDomElement & | root | ) |
| privatevirtual

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

Reimplemented from CodeParameter.

## ◆ setAttributesOnNode()

void CodeClassField::setAttributesOnNode | ( | QXmlStreamWriter & | writer | ) |
| privatevirtual

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

Reimplemented from CodeParameter.

## ◆ setListClassName()

void CodeClassField::setListClassName | ( | const QString & | className | ) |
| protected

## ◆ setParentUMLObject()

void CodeClassField::setParentUMLObject | ( | UMLObject * | obj | ) |
| protected

Set the parent UMLobject appropriately.

## ◆ setWriteOutMethods()

void CodeClassField::setWriteOutMethods | ( | bool | val | ) |

Determine if we will *allow* methods to be viewable. this flag is often used to toggle autogeneration of accessor methods in the code class field.

## ◆ synchronize()

void CodeClassField::synchronize | ( |  | ) |
| virtual

Force the synchronization of the content (methods and declarations) of this class field.

## ◆ updateContent()

void CodeClassField::updateContent | ( |  | ) |
| virtual

Updates the status of the accessor methods as to whether or not they should be written out.

Implements CodeParameter.

## Member Data Documentation

## ◆ m_classFieldType

ClassFieldType CodeClassField::m_classFieldType
| private

## ◆ m_declCodeBlock

CodeClassFieldDeclarationBlock* CodeClassField::m_declCodeBlock
| private

## ◆ m_listClassName

QString CodeClassField::m_listClassName
| private

## ◆ m_methodVector

CodeAccessorMethodList CodeClassField::m_methodVector
| private

## ◆ m_parentIsAttribute

bool CodeClassField::m_parentIsAttribute
| private

## ◆ m_writeOutMethods

bool CodeClassField::m_writeOutMethods
| private

This flag tells if we want the methods to have the possibility of being written out. IF the value is false, then all methods are never written out.

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

- umbrello/codegenerators/codeclassfield.h
- umbrello/codegenerators/codeclassfield.cpp