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

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Typedefs | Enumerations | Functions
Model_Utils Namespace Reference

## Classes
struct | NameAndType
struct | OpDescriptor

## Typedefs
typedef QLinkedList< NameAndType > | NameAndType_List
| Auxiliary type for OpDescriptor.
typedef QLinkedList< NameAndType >::iterator | NameAndType_ListIt
| Auxiliary type for OpDescriptor.

## Enumerations
enum | Parse_Status { PS_OK , PS_Empty , PS_Malformed_Arg , PS_Unknown_ArgType , PS_Illegal_MethodName , PS_Unknown_ReturnType , PS_Unspecified_Error }

## Functions
bool | isCloneable (WidgetBase::WidgetType type)
QString | normalize (QString type)
UMLObject * | findObjectInList (Uml::ID::Type id, const UMLObjectList &inList)
UMLObject * | findUMLObject (const UMLObjectList &inList, const QString &inName, UMLObject::ObjectType type, UMLObject *currentObj)
UMLObject * | findUMLObjectRaw (const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type, UMLObject *currentObj)
UMLObject * | findUMLObjectRecursive (const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type)
UMLPackage * | rootPackage (UMLObject *obj)
void | treeViewAddViews (const UMLViewList &viewList)
void | treeViewChangeIcon (UMLObject *object, Icon_Utils::IconType to)
void | treeViewSetCurrentItem (UMLObject *object)
void | treeViewMoveObjectTo (UMLObject *container, UMLObject *object)
UMLObject * | treeViewGetCurrentObject ()
UMLPackage * | treeViewGetPackageFromCurrent ()
QString | treeViewBuildDiagramName (Uml::ID::Type id)
QString | uniqObjectName (UMLObject::ObjectType type, UMLPackage *parentPkg, QString prefix)
QString | newTitle (UMLObject::ObjectType type)
QString | newText (UMLObject::ObjectType type)
QString | renameTitle (UMLObject::ObjectType type)
QString | renameText (UMLObject::ObjectType type)
QString | getXmiId (QDomElement element)
QString | loadCommentFromXMI (QDomElement elem)
bool | isCommonXMI1Attribute (const QString &tag)
bool | isCommonDataType (QString type)
bool | isClassifierListitem (UMLObject::ObjectType type)
Uml::ModelType::Enum | guessContainer (UMLObject *o)
int | stringToDirection (QString input, Uml::ParameterDirection::Enum &result)
Parse_Status | parseTemplate (QString t, NameAndType &nmTp, UMLClassifier *owningScope)
Parse_Status | parseAttribute (QString a, NameAndType &nmTp, UMLClassifier *owningScope, Uml::Visibility::Enum *vis)
Parse_Status | parseOperation (QString m, OpDescriptor &desc, UMLClassifier *owningScope)
Parse_Status | parseConstraint (QString m, QString &name, UMLEntity *owningScope)
QString | psText (Parse_Status value)
bool | typeIsRootView (UMLListViewItem::ListViewType type)
bool | typeIsCanvasWidget (UMLListViewItem::ListViewType type)
bool | typeIsFolder (UMLListViewItem::ListViewType type)
bool | typeIsContainer (UMLListViewItem::ListViewType type)
bool | typeIsClassifierList (UMLListViewItem::ListViewType type)
bool | typeIsClassifier (UMLListViewItem::ListViewType type)
bool | typeIsProperties (UMLListViewItem::ListViewType type)
bool | typeIsAllowedInType (UMLListViewItem::ListViewType childType, UMLListViewItem::ListViewType parentType)
bool | typeIsDiagram (UMLListViewItem::ListViewType type)
Uml::ModelType::Enum | convert_DT_MT (Uml::DiagramType::Enum dt)
UMLListViewItem::ListViewType | convert_MT_LVT (Uml::ModelType::Enum mt)
Uml::ModelType::Enum | convert_LVT_MT (UMLListViewItem::ListViewType lvt)
UMLListViewItem::ListViewType | convert_DT_LVT (Uml::DiagramType::Enum dt)
UMLListViewItem::ListViewType | convert_OT_LVT (UMLObject *o)
UMLObject::ObjectType | convert_LVT_OT (UMLListViewItem::ListViewType lvt)
Icon_Utils::IconType | convert_LVT_IT (UMLListViewItem::ListViewType lvt, UMLObject *o)
Uml::DiagramType::Enum | convert_LVT_DT (UMLListViewItem::ListViewType lvt)
MultiPageDialogBase::PageType | convert_LVT_PT (UMLListViewItem::ListViewType type)
Uml::ModelType::Enum | convert_OT_MT (UMLObject::ObjectType ot)
QString | updateDeleteActionToString (UMLForeignKeyConstraint::UpdateDeleteAction uda)
bool | typeIsAllowedInDiagram (UMLObject *o, UMLScene *scene)
bool | typeIsAllowedInDiagram (UMLWidget *w, UMLScene *scene)
bool | hasAssociations (UMLObject::ObjectType type)

## Detailed Description

General purpose model utilities.

Author
  Oliver Kellogg Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Typedef Documentation

## ◆ NameAndType_List

typedef QLinkedList<NameAndType> Model_Utils::NameAndType_List

Auxiliary type for OpDescriptor.

## ◆ NameAndType_ListIt

typedef QLinkedList<NameAndType>::iterator Model_Utils::NameAndType_ListIt

Auxiliary type for OpDescriptor.

## Enumeration Type Documentation

## ◆ Parse_Status

enum Model_Utils::Parse_Status

Enumerator
PS_OK | Return type of parseOperation().
PS_Empty |
PS_Malformed_Arg |
PS_Unknown_ArgType |
PS_Illegal_MethodName |
PS_Unknown_ReturnType |
PS_Unspecified_Error |

## Function Documentation

## ◆ convert_DT_LVT()

UMLListViewItem::ListViewType Model_Utils::convert_DT_LVT | ( | Uml::DiagramType::Enum | dt | ) |

Convert a diagram type enum to the equivalent list view type.

## ◆ convert_DT_MT()

Uml::ModelType::Enum Model_Utils::convert_DT_MT | ( | Uml::DiagramType::Enum | dt | ) |

Return the Model_Type which corresponds to the given DiagramType.

## ◆ convert_LVT_DT()

Uml::DiagramType::Enum Model_Utils::convert_LVT_DT | ( | UMLListViewItem::ListViewType | lvt | ) |

Return the DiagramType which corresponds to the given listview type.

Parameters

  lvt | ListViewType to convert.

Returns
  The Uml::DiagramType corresponding to the lvt. Returns dt_Undefined in case no mapping to DiagramType exists.

## ◆ convert_LVT_IT()

Icon_Utils::IconType Model_Utils::convert_LVT_IT | ( | UMLListViewItem::ListViewType | lvt,
|  | UMLObject * | o )

Return the IconType which corresponds to the given listview type.

Parameters

  lvt | ListViewType to convert.
  o | Optional UMLObject pointer is only used if `lvt` is lvt_Class: If the stereotype <<class-or-package>> is applied on the object then Icon_Utils::it_ClassOrPackage is returned.

Returns
  The Icon_Utils::IconType corresponding to the lvt. Returns it_Home in case no mapping to IconType exists.

## ◆ convert_LVT_MT()

Uml::ModelType::Enum Model_Utils::convert_LVT_MT | ( | UMLListViewItem::ListViewType | lvt | ) |

Return the Model_Type which corresponds to the given ListViewType. Returns Uml::N_MODELTYPES if the list view type given does not map to a Model_Type.

## ◆ convert_LVT_OT()

UMLObject::ObjectType Model_Utils::convert_LVT_OT | ( | UMLListViewItem::ListViewType | lvt | ) |

Converts a list view type enum to the equivalent object type.

Parameters

  lvt | The ListViewType to convert.

Returns
  The converted ObjectType if the listview type has a UMLObject::ObjectType representation, else 0.

## ◆ convert_LVT_PT()

MultiPageDialogBase::PageType Model_Utils::convert_LVT_PT | ( | UMLListViewItem::ListViewType | type | ) |

Converts a list view type enum to the equivalent settings dialog type.

Parameters

  type | The ListViewType to convert.

Returns
  The converted settings dialog type

## ◆ convert_MT_LVT()

UMLListViewItem::ListViewType Model_Utils::convert_MT_LVT | ( | Uml::ModelType::Enum | mt | ) |

Return the ListViewType which corresponds to the given Model_Type.

## ◆ convert_OT_LVT()

UMLListViewItem::ListViewType Model_Utils::convert_OT_LVT | ( | UMLObject * | o | ) |

Convert an object's type to the equivalent list view type

Parameters

  o | Pointer to the UMLObject whose type shall be converted to the equivalent ListViewType. We cannot just pass in a UMLObject::ObjectType because a UMLFolder is mapped to different ListViewType values, depending on its location in one of the predefined modelviews (Logical/ UseCase/etc.)

Returns
  The equivalent ListViewType.

## ◆ convert_OT_MT()

Uml::ModelType::Enum Model_Utils::convert_OT_MT | ( | UMLObject::ObjectType | ot | ) |

Return the Model_Type which corresponds to the given ObjectType.

## ◆ findObjectInList()

UMLObject * Model_Utils::findObjectInList | ( | Uml::ID::Type | id,
|  | const UMLObjectList & | inList )

Seek the given id in the given list of objects. Each list element may itself contain other objects and the search is done recursively.

Parameters

  id | The unique ID to seek.
  inList | The UMLObjectList in which to search.

Returns
  Pointer to the UMLObject that matches the ID (NULL if none matches).

## ◆ findUMLObject()

UMLObject * Model_Utils::findUMLObject | ( | const UMLObjectList & | inList,
|  | const QString & | inName,
|  | UMLObject::ObjectType | type,
|  | UMLObject * | currentObj )

Find the UML object of the given type and name in the passed-in list.

Parameters

  inList | List in which to seek the object.
  inName | Name of the object to find.
  type | ObjectType of the object to find (optional.) When the given type is ot_UMLObject the type is disregarded, i.e. the given name is the only search criterion.
  currentObj | Object relative to which to search (optional.) If given then the enclosing scope(s) of this object are searched before the global scope.

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRaw()

UMLObject * Model_Utils::findUMLObjectRaw | ( | const UMLObjectList & | inList,
|  | const QString & | name,
|  | UMLObject::ObjectType | type,
|  | UMLObject * | currentObj )

Find the UML object of the given type and name in the passed-in list. This method searches for the raw name.

Parameters

  inList | List in which to seek the object.
  name | Name of the object to find.
  type | ObjectType of the object to find (optional.) When the given type is ot_UMLObject the type is disregarded, i.e. the given name is the only search criterion.
  currentObj | Object relative to which to search (optional.) If given then the enclosing scope(s) of this object are searched before the global scope.

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRecursive()

UMLObject * Model_Utils::findUMLObjectRecursive | ( | const UMLObjectList & | inList,
|  | const QString & | name,
|  | UMLObject::ObjectType | type )

Find the UML object of the given type and name in the passed-in list. This method searches for the raw name.

Parameters

  inList | List in which to seek the object.
  name | Name of the object to find.
  type | ObjectType of the object to find (optional.) When the given type is ot_UMLObject the type is disregarded, i.e. the given name is the only search criterion.

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ getXmiId()

QString Model_Utils::getXmiId | ( | QDomElement | element | ) |

Return the xmi.id (XMI-1) or xmi:id (XMI-2) of a QDomElement.

## ◆ guessContainer()

Uml::ModelType::Enum Model_Utils::guessContainer | ( | UMLObject * | o | ) |

Try to guess the correct container folder type of a UMLObject. Object types that can't be guessed are mapped to Uml::ModelType::Logical. NOTE: This function exists mainly for handling pre-1.5.5 files and should not be used for new code.

## ◆ hasAssociations()

bool Model_Utils::hasAssociations | ( | UMLObject::ObjectType | type | ) |

return true if given object type supports associations

Parameters

  type | uml object type to check

## ◆ isClassifierListitem()

bool Model_Utils::isClassifierListitem | ( | UMLObject::ObjectType | type | ) |

Return true if the given object type is a classifier list item type.

## ◆ isCloneable()

bool Model_Utils::isCloneable | ( | WidgetBase::WidgetType | type | ) |

Determines whether the given widget type is cloneable.

Parameters

  type | The input WidgetType.

Returns
  True if the given type is cloneable.

## ◆ isCommonDataType()

bool Model_Utils::isCommonDataType | ( | QString | type | ) |

Return true if the given type is common among the majority of programming languages, such as "bool" or "boolean".

## ◆ isCommonXMI1Attribute()

bool Model_Utils::isCommonXMI1Attribute | ( | const QString & | tag | ) |

Return true if the given tag is one of the common XMI attributes, such as: "name" | "visibility" | "isRoot" | "isLeaf" | "isAbstract" | "isActive" | "ownerScope"

## ◆ loadCommentFromXMI()

QString Model_Utils::loadCommentFromXMI | ( | QDomElement | elem | ) |

Return the text of an <ownedComment> XMI element from a QDomElement.

## ◆ newText()

QString Model_Utils::newText | ( | UMLObject::ObjectType | type | ) |

Returns translated text string used by uml object related dialogs

Parameters

  type | uml object type

Returns
  translated text string

## ◆ newTitle()

QString Model_Utils::newTitle | ( | UMLObject::ObjectType | type | ) |

Returns translated title string used by uml object related dialogs

Parameters

  type | uml object type

Returns
  translated title string

## ◆ normalize()

QString Model_Utils::normalize | ( | QString | type | ) |

Normalize a type name with respect to interspersed spaces.

Parameters

  type | Input type name e.g. from a user text entry dialog.

Returns
  Normalized type name.

## ◆ parseAttribute()

Parse_Status Model_Utils::parseAttribute | ( | QString | a,
|  | NameAndType & | nmTp,
|  | UMLClassifier * | owningScope,
|  | Uml::Visibility::Enum * | vis )

Parses an attribute given in UML syntax.

Parameters

  a | Input text of the attribute in UML syntax. Example: argname : argtype
  nmTp | NameAndType returned by this method.
  owningScope | Pointer to the owning scope of the attribute.
  vis | Optional pointer to visibility (return value.) The visibility may be given at the beginning of the attribute text in mnemonic form as follows: "+" stands for public "#" stands for protected "-" stands for private "~" stands for implementation level visibility

Returns
  Error status of the parse, PS_OK for success.

## ◆ parseConstraint()

Parse_Status Model_Utils::parseConstraint | ( | QString | m,
|  | QString & | name,
|  | UMLEntity * | owningScope )

Parses a constraint.

Parameters

  m | Input text of the constraint
  name | The name returned by this method
  owningScope | Pointer to the owning scope of the constraint

Returns
  Error status of the parse, PS_OK for success.

## ◆ parseOperation()

Parse_Status Model_Utils::parseOperation | ( | QString | m,
|  | OpDescriptor & | desc,
|  | UMLClassifier * | owningScope )

Parses an operation given in UML syntax.

Parameters

  m | Input text of the operation in UML syntax. Example of a two-argument operation returning "void": methodname (arg1name : arg1type, arg2name : arg2type) : void
  desc | OpDescriptor returned by this method.
  owningScope | Pointer to the owning scope of the operation.

Returns
  Error status of the parse, PS_OK for success.

The search pattern includes everything up to the opening parenthesis because UML also permits non programming-language oriented designs using narrative names, for example "check water temperature".

## ◆ parseTemplate()

Parse_Status Model_Utils::parseTemplate | ( | QString | t,
|  | NameAndType & | nmTp,
|  | UMLClassifier * | owningScope )

Parses a template parameter given in UML syntax.

Parameters

  t | Input text of the template parameter. Example: parname : partype or just: parname (for class type)
  nmTp | NameAndType returned by this method.
  owningScope | Pointer to the owning scope of the template param.

Returns
  Error status of the parse, PS_OK for success.

## ◆ psText()

QString Model_Utils::psText | ( | Parse_Status | value | ) |

Returns the Parse_Status as a text.

## ◆ renameText()

QString Model_Utils::renameText | ( | UMLObject::ObjectType | type | ) |

Returns translated text string used by uml object related dialogs

Parameters

  type | uml object type

Returns
  translated text string

## ◆ renameTitle()

QString Model_Utils::renameTitle | ( | UMLObject::ObjectType | type | ) |

Returns translated title string used by uml object related dialogs

Parameters

  type | uml object type

Returns
  translated title string

## ◆ rootPackage()

UMLPackage * Model_Utils::rootPackage | ( | UMLObject * | obj | ) |

Get the root folder of the given UMLObject.

## ◆ stringToDirection()

int Model_Utils::stringToDirection | ( | QString | input,
|  | Uml::ParameterDirection::Enum & | result )

Parse a direction string into the Uml::ParameterDirection::Enum.

Parameters

  input | The string to parse: "in", "out", or "inout" optionally followed by whitespace.
  result | The corresponding Uml::ParameterDirection::Enum.

Returns
  Length of the string matched, excluding the optional whitespace.

## ◆ treeViewAddViews()

void Model_Utils::treeViewAddViews | ( | const UMLViewList & | viewList | ) |

Add the given list of views to the tree view.

Parameters

  viewList | the list of views to add

## ◆ treeViewBuildDiagramName()

QString Model_Utils::treeViewBuildDiagramName | ( | Uml::ID::Type | id | ) |

Build the diagram name from the tree view.

The function returns a relative path constructed from the folder hierarchy.

Parameters

  id | the id of the diaram

Returns
  the constructed diagram name

## ◆ treeViewChangeIcon()

void Model_Utils::treeViewChangeIcon | ( | UMLObject * | object,
|  | Icon_Utils::IconType | to )

Change an icon of an object in the tree view.

Parameters

  object | the object in the treeViewAddViews
  to | the new icon type for the given object

## ◆ treeViewGetCurrentObject()

UMLObject * Model_Utils::treeViewGetCurrentObject | ( |  | ) |

Return the current UMLObject from the tree view.

Returns
  the UML object of the current item

## ◆ treeViewGetPackageFromCurrent()

UMLPackage * Model_Utils::treeViewGetPackageFromCurrent | ( |  | ) |

Return the UMLPackage if the current item in the tree view is a package. Return the closest package in the tree view or NULL otherwise

Returns
  the package or NULL

## ◆ treeViewMoveObjectTo()

void Model_Utils::treeViewMoveObjectTo | ( | UMLObject * | container,
|  | UMLObject * | object )

Move an object to a new container in the tree view.

Parameters

  container | the new container for the object
  object | the to be moved object

## ◆ treeViewSetCurrentItem()

void Model_Utils::treeViewSetCurrentItem | ( | UMLObject * | object | ) |

Set the given object to the current item in the tree view.

Parameters

  object | the object which will be the current item

## ◆ typeIsAllowedInDiagram() [1/2]

bool Model_Utils::typeIsAllowedInDiagram | ( | UMLObject * | o,
|  | UMLScene * | scene )

Return true if the object type is allowed in the related diagram

Parameters

  o | UML object instance
  scene | diagram instance

Returns
  true type is allowed
  false type is not allowed

## ◆ typeIsAllowedInDiagram() [2/2]

bool Model_Utils::typeIsAllowedInDiagram | ( | UMLWidget * | w,
|  | UMLScene * | scene )

Return true if the widget type is allowed in the related diagram

Parameters

  w | UML widget object
  scene | diagram instance

Returns
  true type is allowed
  false type is not allowed

## ◆ typeIsAllowedInType()

bool Model_Utils::typeIsAllowedInType | ( | UMLListViewItem::ListViewType | childType,
|  | UMLListViewItem::ListViewType | parentType )

Check if a listviewitem of type childType is allowed as child of type parentType

## ◆ typeIsCanvasWidget()

bool Model_Utils::typeIsCanvasWidget | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type also has a widget representation in diagrams.

## ◆ typeIsClassifier()

bool Model_Utils::typeIsClassifier | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is a classifier (Class, Entity, Enum)

## ◆ typeIsClassifierList()

bool Model_Utils::typeIsClassifierList | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is an attribute, operation, or template.

## ◆ typeIsContainer()

bool Model_Utils::typeIsContainer | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type may act as a container for other objects, i.e. if it is a folder, package, subsystem, or component.

## ◆ typeIsDiagram()

bool Model_Utils::typeIsDiagram | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is a diagram.

## ◆ typeIsFolder()

bool Model_Utils::typeIsFolder | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is a logical, usecase or component folder.

## ◆ typeIsProperties()

bool Model_Utils::typeIsProperties | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is a settings entry.

## ◆ typeIsRootView()

bool Model_Utils::typeIsRootView | ( | UMLListViewItem::ListViewType | type | ) |

Return true if the listview type is one of the predefined root views (root, logical, usecase, component, deployment, datatype, or entity- relationship view.)

## ◆ uniqObjectName()

QString Model_Utils::uniqObjectName | ( | UMLObject::ObjectType | type,
|  | UMLPackage * | parentPkg,
|  | QString | prefix )

Returns a name for the new object, appended with a number if the default name is taken e.g. new_actor, new_actor_1 etc.

Parameters

  type | The object type.
  parentPkg | The package in which to compare the name.
  prefix | The prefix to use (optional) If no prefix is given then a type related prefix will be chosen internally.

## ◆ updateDeleteActionToString()

QString Model_Utils::updateDeleteActionToString | ( | UMLForeignKeyConstraint::UpdateDeleteAction | uda | ) |

Converts from the UpdateDeleteAction enum to a QString

Parameters

  uda | The UpdateDeleteAction enum literal