umbrello API Documentation

Model_Utils Namespace Reference

General purpose model utilities. More...


Classes

struct  NameAndType
 Data structure filled by parseAttribute(). More...
struct  OpDescriptor
 Data structure filled by parseOperation(). More...

Typedefs

typedef QValueList< NameAndTypeNameAndType_List
 Auxiliary type for OpDescriptor.
typedef QValueListIterator<
NameAndType
NameAndType_ListIt

Enumerations

enum  Parse_Status {
  PS_OK, PS_Empty, PS_Malformed_Arg, PS_Unknown_ArgType,
  PS_Illegal_MethodName, PS_Unknown_ReturnType, PS_Unspecified_Error
}
 Return type of parseOperation(). More...

Functions

bool isCloneable (Uml::Widget_Type type)
 Determines whether the given widget type is cloneable.
UMLObjectfindObjectInList (Uml::IDType id, const UMLObjectList &inList)
 Seek the given id in the given list of objects.
UMLObjectfindUMLObject (const UMLObjectList &inList, const QString &inName, Uml::Object_Type type, UMLObject *currentObj)
 Find the UML object of the given type and name in the passed-in list.
QString uniqObjectName (Uml::Object_Type type, UMLPackage *parentPkg, QString prefix)
 Returns a name for the new object, appended with a number if the default name is taken e.g.
bool isCommonXMIAttribute (const QString &tag)
 Return true if the given tag is a one of the common XMI attributes, such as: "name" | "visibility" | "isRoot" | "isLeaf" | "isAbstract" | "isActive" | "ownerScope".
bool isCommonDataType (QString type)
 Return true if the given type is common among the majority of programming languages, such as "bool" or "boolean".
bool isClassifierListitem (Uml::Object_Type type)
 Return true if the given object type is a classifier list item type.
Uml::Model_Type guessContainer (UMLObject *o)
 Try to guess the correct container folder type of an UMLObject.
int stringToDirection (QString input, Uml::Parameter_Direction &result)
 Parse a direction string into the Uml::Parameter_Direction.
Parse_Status parseTemplate (QString t, NameAndType &nmTp, UMLClassifier *owningScope)
 Parses a template parameter given in UML syntax.
Parse_Status parseAttribute (QString a, NameAndType &nmTp, UMLClassifier *owningScope, Uml::Visibility *vis)
 Parses an attribute given in UML syntax.
Parse_Status parseOperation (QString m, OpDescriptor &desc, UMLClassifier *owningScope)
 Parses an operation given in UML syntax.
QString psText (Parse_Status value)
 Returns the Parse_Status as a text.
QString progLangToString (Uml::Programming_Language pl)
 Return string corresponding to the given Uml::Programming_Language.
Uml::Programming_Language stringToProgLang (QString str)
 Return Uml::Programming_Language corresponding to the given string.
bool typeIsRootView (Uml::ListView_Type type)
 Return true if the listview type is one of the predefined root views (root, logical, usecase, component, deployment, datatype, or entity- relationship view.).
bool typeIsCanvasWidget (Uml::ListView_Type type)
 Return true if the listview type also has a widget representation in diagrams.
bool typeIsFolder (Uml::ListView_Type type)
 Return true if the listview type is a logical, usecase or component folder.
bool typeIsContainer (Uml::ListView_Type type)
 Return true if the listview type may act as a container for other objects, i.e.
bool typeIsClassifierList (Uml::ListView_Type type)
 Return true if the listview type is an attribute, operation, or template.
bool typeIsDiagram (Uml::ListView_Type type)
 Return true if the listview type is a diagram.
Uml::Model_Type convert_DT_MT (Uml::Diagram_Type dt)
 Return the Model_Type which corresponds to the given Diagram_Type.
Uml::ListView_Type convert_MT_LVT (Uml::Model_Type mt)
 Return the ListView_Type which corresponds to the given Model_Type.
Uml::Model_Type convert_LVT_MT (Uml::ListView_Type lvt)
 Return the Model_Type which corresponds to the given ListView_Type.
Uml::ListView_Type convert_DT_LVT (Uml::Diagram_Type dt)
 Convert a diagram type enum to the equivalent list view type.
Uml::ListView_Type convert_OT_LVT (UMLObject *o)
 Convert an object's type to the equivalent list view type.
Uml::Object_Type convert_LVT_OT (Uml::ListView_Type lvt)
 Converts a list view type enum to the equivalent object type.
Uml::Icon_Type convert_LVT_IT (Uml::ListView_Type lvt)
 Return the Icon_Type which corresponds to the given listview type.
Uml::Diagram_Type convert_LVT_DT (Uml::ListView_Type lvt)
 Return the Diagram_Type which corresponds to the given listview type.
Uml::Model_Type convert_OT_MT (Uml::Object_Type ot)
 Return the Model_Type which corresponds to the given Object_Type.


Detailed Description

General purpose model utilities.

Author:
Oliver Kellogg Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org


Typedef Documentation

typedef QValueList<NameAndType> Model_Utils::NameAndType_List
 

Auxiliary type for OpDescriptor.

Definition at line 265 of file model_utils.h.


Enumeration Type Documentation

enum Model_Utils::Parse_Status
 

Return type of parseOperation().

Definition at line 239 of file model_utils.h.


Function Documentation

bool Model_Utils::isCloneable Uml::Widget_Type  type  ) 
 

Determines whether the given widget type is cloneable.

Parameters:
type The input Widget_Type.
Returns:
True if the given type is cloneable.

Definition at line 41 of file model_utils.cpp.

UMLObject * Model_Utils::findObjectInList Uml::IDType  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.)

Definition at line 59 of file model_utils.cpp.

References UMLObject::getBaseType(), UMLObject::getID(), and UMLAssociation::getUMLRole().

Referenced by UMLPackage::findObjectById().

UMLObject * Model_Utils::findUMLObject const UMLObjectList inList,
const QString &  name,
Uml::Object_Type  type = Uml::ot_UMLObject,
UMLObject currentObj = NULL
 

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

Parameters:
inList List in which to seek the object.
name Name of the object to find.
type Object_Type 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.

Definition at line 103 of file model_utils.cpp.

References UMLApp::activeLanguageIsCaseSensitive(), UMLPackage::containedObjects(), UMLObject::getBaseType(), UMLObject::getName(), and UMLObject::getUMLPackage().

Referenced by UMLDoc::createDatatype(), and UMLDoc::findUMLObject().

QString Model_Utils::uniqObjectName Uml::Object_Type  type,
UMLPackage parentPkg,
QString  prefix = QString::null
 

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.

Definition at line 238 of file model_utils.cpp.

References UMLApp::getDocument(), and UMLDoc::isUnique().

Referenced by UMLListView::addNewItem(), UMLObject::copyInto(), and UMLDrag::decodeClip1().

bool Model_Utils::isCommonXMIAttribute const QString &  tag  ) 
 

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

Definition at line 280 of file model_utils.cpp.

References Uml::tagEq().

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

TODO: Make this depend on the active programming language.

Definition at line 298 of file model_utils.cpp.

References UMLApp::activeLanguageIsCaseSensitive(), CodeGenerator::defaultDatatypes(), and UMLApp::getGenerator().

bool Model_Utils::isClassifierListitem Uml::Object_Type  ot  ) 
 

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

Definition at line 316 of file model_utils.cpp.

Uml::Model_Type Model_Utils::guessContainer UMLObject o  ) 
 

Try to guess the correct container folder type of an UMLObject.

Object types that can't be guessed are mapped to Uml::mt_Logical. NOTE: This function exists mainly for handling pre-1.5.5 files and should not be used for new code.

Definition at line 328 of file model_utils.cpp.

References UMLApp::getDocument(), UMLAssociation::getObject(), UMLObject::getUMLPackage(), and UMLDoc::rootFolderType().

Referenced by UMLListView::determineParentItem(), and UMLDoc::loadUMLObjectsFromXMI().

int Model_Utils::stringToDirection QString  input,
Uml::Parameter_Direction result
 

Parse a direction string into the Uml::Parameter_Direction.

Parameters:
input The string to parse: "in", "out", or "inout" optionally followed by whitespace.
result The corresponding Uml::Parameter_Direction.
Returns:
Length of the string matched, excluding the optional whitespace.

Definition at line 391 of file model_utils.cpp.

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.

Definition at line 409 of file model_utils.cpp.

References UMLDoc::findUMLObject(), and UMLApp::getDocument().

Referenced by UMLListView::createChildUMLObject(), and UMLListViewItem::okRename().

Parse_Status Model_Utils::parseAttribute QString  a,
NameAndType &  nmTp,
UMLClassifier owningScope,
Uml::Visibility *  vis = 0
 

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.

Definition at line 432 of file model_utils.cpp.

References UMLDoc::findUMLObject(), and UMLApp::getDocument().

Referenced by UMLListView::createChildUMLObject(), UMLListViewItem::okRename(), and parseOperation().

Parse_Status Model_Utils::parseOperation QString  m,
OpDescriptor &  desc,
UMLClassifier owningScope
 

Parses an operation given in UML syntax.

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

Definition at line 496 of file model_utils.cpp.

References UMLDoc::findUMLObject(), UMLApp::getDocument(), and parseAttribute().

Referenced by UMLListView::createChildUMLObject(), UMLListViewItem::okRename(), and FloatingTextWidget::showOpDlg().

QString Model_Utils::psText Parse_Status  value  ) 
 

Returns the Parse_Status as a text.

Definition at line 556 of file model_utils.cpp.

Referenced by UMLListView::createChildUMLObject(), and UMLListViewItem::okRename().

QString Model_Utils::progLangToString Uml::Programming_Language  pl  ) 
 

Return string corresponding to the given Uml::Programming_Language.

Definition at line 565 of file model_utils.cpp.

Referenced by CodeGenerator::loadFromXMI(), CodeGenerator::saveToXMI(), and UMLApp::updateLangSelectMenu().

Uml::Programming_Language Model_Utils::stringToProgLang QString  str  ) 
 

Return Uml::Programming_Language corresponding to the given string.

Definition at line 607 of file model_utils.cpp.

Referenced by UMLApp::getDefaultLanguage(), UMLDoc::loadExtensionsFromXMI(), and UMLApp::slotApplyPrefs().

bool Model_Utils::typeIsRootView Uml::ListView_Type  type  ) 
 

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

Definition at line 643 of file model_utils.cpp.

Referenced by UMLListView::findFolderForDiagram(), and typeIsFolder().

bool Model_Utils::typeIsCanvasWidget Uml::ListView_Type  type  ) 
 

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

Definition at line 659 of file model_utils.cpp.

bool Model_Utils::typeIsFolder Uml::ListView_Type  type  ) 
 

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

Definition at line 686 of file model_utils.cpp.

References typeIsRootView().

Referenced by convert_LVT_OT(), and typeIsContainer().

bool Model_Utils::typeIsContainer Uml::ListView_Type  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.

Definition at line 700 of file model_utils.cpp.

References typeIsFolder().

bool Model_Utils::typeIsClassifierList Uml::ListView_Type  type  ) 
 

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

Definition at line 708 of file model_utils.cpp.

Referenced by UMLListViewItem::compare().

bool Model_Utils::typeIsDiagram Uml::ListView_Type  type  ) 
 

Return true if the listview type is a diagram.

Definition at line 720 of file model_utils.cpp.

Referenced by UMLListView::popupMenuSel().

Uml::Model_Type Model_Utils::convert_DT_MT Uml::Diagram_Type  dt  ) 
 

Return the Model_Type which corresponds to the given Diagram_Type.

Definition at line 736 of file model_utils.cpp.

Referenced by UMLDoc::findView(), UMLDoc::loadDiagramsFromXMI(), and UMLDoc::newDocument().

Uml::ListView_Type Model_Utils::convert_MT_LVT Uml::Model_Type  mt  ) 
 

Return the ListView_Type which corresponds to the given Model_Type.

Definition at line 766 of file model_utils.cpp.

Referenced by UMLListView::init().

Uml::Model_Type Model_Utils::convert_LVT_MT Uml::ListView_Type  lvt  ) 
 

Return the Model_Type which corresponds to the given ListView_Type.

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

Definition at line 790 of file model_utils.cpp.

Uml::ListView_Type Model_Utils::convert_DT_LVT Uml::Diagram_Type  dt  ) 
 

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

Definition at line 814 of file model_utils.cpp.

Referenced by UMLListView::createDiagramItem(), UMLListView::createItem(), UMLListView::findView(), and UMLListView::slotDiagramCreated().

Uml::ListView_Type 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 Uml::ListView_Type. We cannot just pass in a Uml::Object_Type because a UMLFolder is mapped to different Uml::ListView_Type values, depending on its location in one of the predefined modelviews (Logical/ UseCase/etc.)
Returns:
The equivalent Uml::ListView_Type.

Definition at line 859 of file model_utils.cpp.

References UMLObject::getBaseType(), UMLApp::getDocument(), UMLDoc::getName(), UMLObject::getUMLPackage(), and UMLDoc::rootFolderType().

Referenced by UMLListView::childObjectAdded(), UMLView::removeAssocInViewAndDoc(), and UMLListView::slotObjectCreated().

Uml::Object_Type Model_Utils::convert_LVT_OT Uml::ListView_Type  lvt  ) 
 

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

Parameters:
lvt The ListView_Type to convert.
Returns:
The converted Object_Type if the listview type has a Uml::Object_Type representation, else 0.

Definition at line 967 of file model_utils.cpp.

References typeIsFolder().

Referenced by UMLListView::addNewItem(), and UMLListView::itemRenamed().

Uml::Icon_Type Model_Utils::convert_LVT_IT Uml::ListView_Type  lvt  ) 
 

Return the Icon_Type which corresponds to the given listview type.

Parameters:
lvt ListView_Type to convert.
Returns:
The Uml::Icon_Type corresponding to the lvt. Returns it_Home in case no mapping to Uml::Icon_Type exists.

Definition at line 1043 of file model_utils.cpp.

Referenced by UMLListView::addNewItem(), UMLListView::slotObjectCreated(), UMLListViewItem::updateFolder(), and UMLListViewItem::updateObject().

Uml::Diagram_Type Model_Utils::convert_LVT_DT Uml::ListView_Type  lvt  ) 
 

Return the Diagram_Type which corresponds to the given listview type.

Parameters:
lvt ListView_Type to convert.
Returns:
The Uml::Diagram_Type corresponding to the lvt. Returns dt_Undefined in case no mapping to Diagram_Type exists.

Definition at line 1156 of file model_utils.cpp.

Referenced by UMLListView::addNewItem().

Uml::Model_Type Model_Utils::convert_OT_MT Uml::Object_Type  ot  ) 
 

Return the Model_Type which corresponds to the given Object_Type.

Definition at line 1192 of file model_utils.cpp.

Referenced by UMLAssociation::load().

KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:09 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003