umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Classes | Typedefs | Enumerations | Functions
Model_Utils Namespace Reference

Classes

struct  NameAndType
 
struct  OpDescriptor
 

Typedefs

typedef QLinkedList< NameAndTypeNameAndType_List
 Auxiliary type for OpDescriptor. More...
 
typedef QLinkedList< NameAndType >::iterator NameAndType_ListIt
 Auxiliary type for OpDescriptor. More...
 

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)
 
UMLObjectfindObjectInList (Uml::ID::Type id, const UMLObjectList &inList)
 
UMLObjectfindUMLObject (const UMLObjectList &inList, const QString &inName, UMLObject::ObjectType type, UMLObject *currentObj)
 
UMLObjectfindUMLObjectRaw (const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type, UMLObject *currentObj)
 
UMLObjectfindUMLObjectRecursive (const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type)
 
UMLPackagerootPackage (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)
 
UMLObjecttreeViewGetCurrentObject ()
 
UMLPackagetreeViewGetPackageFromCurrent ()
 
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)
 
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

Auxiliary type for OpDescriptor.

◆ NameAndType_ListIt

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

Auxiliary type for OpDescriptor.

Enumeration Type Documentation

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

◆ 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
lvtThe ListViewType to convert.
Returns
The converted ObjectType if the listview type has a UMLObject::ObjectType representation, else 0.
Here is the call graph for this function:

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

◆ 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
idThe unique ID to seek.
inListThe UMLObjectList in which to search.
Returns
Pointer to the UMLObject that matches the ID (NULL if none matches).
Here is the call graph for this function:

◆ 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
inListList in which to seek the object.
inNameName of the object to find.
typeObjectType 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.
currentObjObject 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.
Here is the call graph for this function:

◆ 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
inListList in which to seek the object.
nameName of the object to find.
typeObjectType 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.
currentObjObject 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.
Here is the call graph for this function:

◆ 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
inListList in which to seek the object.
nameName of the object to find.
typeObjectType 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.
Here is the call graph for this function:

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

Here is the call graph for this function:

◆ hasAssociations()

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

return true if given object type supports associations

Parameters
typeuml 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
typeThe 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".

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ newText()

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

Returns translated text string used by uml object related dialogs

Parameters
typeuml object type
Returns
translated text string
Here is the call graph for this function:

◆ newTitle()

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

Returns translated title string used by uml object related dialogs

Parameters
typeuml object type
Returns
translated title string
Here is the call graph for this function:

◆ normalize()

QString Model_Utils::normalize ( QString  type)

Normalize a type name with respect to interspersed spaces.

Parameters
typeInput 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
aInput text of the attribute in UML syntax. Example: argname : argtype
nmTpNameAndType returned by this method.
owningScopePointer to the owning scope of the attribute.
visOptional 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.
Here is the call graph for this function:

◆ parseConstraint()

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

Parses a constraint.

Parameters
mInput text of the constraint
nameThe name returned by this method
owningScopePointer 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
mInput text of the operation in UML syntax. Example of a two-argument operation returning "void": methodname (arg1name : arg1type, arg2name : arg2type) : void
descOpDescriptor returned by this method.
owningScopePointer 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".

Here is the call graph for this function:

◆ parseTemplate()

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

Parses a template parameter given in UML syntax.

Parameters
tInput text of the template parameter. Example: parname : partype or just: parname (for class type)
nmTpNameAndType returned by this method.
owningScopePointer to the owning scope of the template param.
Returns
Error status of the parse, PS_OK for success.
Here is the call graph for this function:

◆ 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
typeuml object type
Returns
translated text string
Here is the call graph for this function:

◆ renameTitle()

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

Returns translated title string used by uml object related dialogs

Parameters
typeuml object type
Returns
translated title string
Here is the call graph for this function:

◆ rootPackage()

UMLPackage * Model_Utils::rootPackage ( UMLObject obj)

Get the root folder of the given UMLObject.

Here is the call graph for this function:

◆ stringToDirection()

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

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

Parameters
inputThe string to parse: "in", "out", or "inout" optionally followed by whitespace.
resultThe 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
viewListthe list of views to add
Here is the call graph for this function:

◆ 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
idthe id of the diaram
Returns
the constructed diagram name
Here is the call graph for this function:

◆ treeViewChangeIcon()

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

Change an icon of an object in the tree view.

Parameters
objectthe object in the treeViewAddViews
tothe new icon type for the given object
Here is the call graph for this function:

◆ treeViewGetCurrentObject()

UMLObject * Model_Utils::treeViewGetCurrentObject ( )

Return the current UMLObject from the tree view.

Returns
the UML object of the current item
Here is the call graph for this function:

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

◆ treeViewMoveObjectTo()

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

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

Parameters
containerthe new container for the object
objectthe to be moved object
Here is the call graph for this function:

◆ treeViewSetCurrentItem()

void Model_Utils::treeViewSetCurrentItem ( UMLObject object)

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

Parameters
objectthe object which will be the current item
Here is the call graph for this function:

◆ typeIsAllowedInDiagram() [1/2]

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

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

Parameters
oUML object instance
scenediagram instance
Returns
true type is allowed
false type is not allowed
Here is the call graph for this function:

◆ typeIsAllowedInDiagram() [2/2]

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

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

Parameters
wUML widget object
scenediagram instance
Returns
true type is allowed
false type is not allowed
Here is the call graph for this function:

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

Here is the call graph for this function:

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

Here is the call graph for this function:

◆ 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
typeThe object type.
parentPkgThe package in which to compare the name.
prefixThe prefix to use (optional) If no prefix is given then a type related prefix will be chosen internally.
Here is the call graph for this function:

◆ updateDeleteActionToString()

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

Converts from the UpdateDeleteAction enum to a QString

Parameters
udaThe UpdateDeleteAction enum literal