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

- File List
- File Members

model_utils.h
Go to the documentation of this file.
1/*
2 SPDX-License-Identifier: GPL-2.0-or-later
3 SPDX-FileCopyrightText: 2004-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4*/
5
6#ifndef MODEL_UTILS_H
7#define MODEL_UTILS_H
8
9#include "basictypes.h"
10#include "umllistviewitem.h"
11#include "umlobjectlist.h"
12#include "umlviewlist.h"
13#include "foreignkeyconstraint.h"
14#include "icon_utils.h"
15#include "multipagedialogbase.h"
16#include "widgetbase.h"
17
18#include <QLinkedList>
19#include <QString>
20
21// forward declarations
22 class UMLClassifier;
23 class UMLPackage;
24 class UMLEntity;
25
31 namespace Model_Utils {
32
33 bool isCloneable(WidgetBase::WidgetType type);
34
35QString normalize(QString type);
36
37 UMLObject* findObjectInList(Uml::ID::Type id, const UMLObjectList& inList);
38
39 UMLObject* findUMLObject(const UMLObjectList& inList,
40 const QString& name,
41 UMLObject::ObjectType type = UMLObject::ot_UMLObject,
42 UMLObject *currentObj = 0);
43
44 UMLObject* findUMLObjectRaw(const UMLObjectList& inList,
45 const QString& name,
46 UMLObject::ObjectType type = UMLObject::ot_UMLObject,
47 UMLObject *currentObj = 0);
48
49 UMLObject* findUMLObjectRecursive(const UMLObjectList& inList,
50 const QString& name,
51 UMLObject::ObjectType type = UMLObject::ot_UMLObject);
52
53 UMLPackage* rootPackage(UMLObject* obj);
54
55 void treeViewAddViews(const UMLViewList& viewList);
56 void treeViewChangeIcon(UMLObject* object, Icon_Utils::IconType to);
57 void treeViewSetCurrentItem(UMLObject* object);
58 void treeViewMoveObjectTo(UMLObject* container, UMLObject* object);
59 UMLObject* treeViewGetCurrentObject();
60 UMLPackage* treeViewGetPackageFromCurrent();
61QString treeViewBuildDiagramName(Uml::ID::Type id);
62
63QString uniqObjectName(UMLObject::ObjectType type,
64 UMLPackage *parentPkg,
65 QString prefix = QString());
66QString newTitle(UMLObject::ObjectType type);
67QString newText(UMLObject::ObjectType type);
68QString renameTitle(UMLObject::ObjectType type);
69QString renameText(UMLObject::ObjectType type);
70
71QString getXmiId(QDomElement element);
72QString loadCommentFromXMI(QDomElement elem);
73 bool isCommonXMI1Attribute(const QString &tag);
74 bool isCommonDataType(QString type);
75 bool isClassifierListitem(UMLObject::ObjectType ot);
76
77 bool typeIsCanvasWidget(UMLListViewItem::ListViewType type);
78 bool typeIsRootView(UMLListViewItem::ListViewType type);
79 bool typeIsFolder(UMLListViewItem::ListViewType type);
80 bool typeIsContainer(UMLListViewItem::ListViewType type);
81 bool typeIsDiagram(UMLListViewItem::ListViewType type);
82 bool typeIsClassifierList(UMLListViewItem::ListViewType type);
83 bool typeIsClassifier(UMLListViewItem::ListViewType type);
84 bool typeIsProperties(UMLListViewItem::ListViewType type);
85 bool typeIsAllowedInType(UMLListViewItem::ListViewType childType,
86 UMLListViewItem::ListViewType parentType);
87 bool typeIsAllowedInDiagram(UMLObject *o, UMLScene *scene);
88 bool typeIsAllowedInDiagram(UMLWidget *w, UMLScene *scene);
89 bool hasAssociations(UMLObject::ObjectType type);
90
91 Uml::ModelType::Enum convert_DT_MT(Uml::DiagramType::Enum dt);
92 UMLListViewItem::ListViewType convert_MT_LVT(Uml::ModelType::Enum mt);
93 Uml::ModelType::Enum convert_LVT_MT(UMLListViewItem::ListViewType lvt);
94 UMLListViewItem::ListViewType convert_DT_LVT(Uml::DiagramType::Enum dt);
95 UMLObject::ObjectType convert_LVT_OT(UMLListViewItem::ListViewType lvt);
96 UMLListViewItem::ListViewType convert_OT_LVT(UMLObject *o);
97 Icon_Utils::IconType convert_LVT_IT(UMLListViewItem::ListViewType lvt, UMLObject *o=0);
98 Uml::DiagramType::Enum convert_LVT_DT(UMLListViewItem::ListViewType lvt);
99 MultiPageDialogBase::PageType convert_LVT_PT(UMLListViewItem::ListViewType type);
100 Uml::ModelType::Enum convert_OT_MT(UMLObject::ObjectType ot);
101
102 Uml::ModelType::Enum guessContainer(UMLObject *o); // deprecated !
103
104 int stringToDirection(QString input, Uml::ParameterDirection::Enum & result);
105
106 enum Parse_Status {
107 PS_OK, PS_Empty, PS_Malformed_Arg, PS_Unknown_ArgType,
108 PS_Illegal_MethodName, PS_Unknown_ReturnType, PS_Unspecified_Error
109};
110
111 struct NameAndType {
112 QString m_name;
113 UMLObject *m_type;
114 Uml::ParameterDirection::Enum m_direction;
115 QString m_initialValue;
116 NameAndType() : m_type(0), m_direction(Uml::ParameterDirection::In) {}
117 NameAndType(QString name, UMLObject *type,
118 Uml::ParameterDirection::Enum direction = Uml::ParameterDirection::In,
119 QString initialValue = QString())
120 : m_name(name), m_type(type),
121 m_direction(direction), m_initialValue(initialValue) {}
122};
123
124 typedef QLinkedList<NameAndType> NameAndType_List;
125 typedef QLinkedList<NameAndType>::iterator NameAndType_ListIt;
126
127 struct OpDescriptor {
128 QString m_name;
129 NameAndType_List m_args;
130 UMLObject *m_pReturnType;
131};
132
133 Parse_Status parseTemplate(QString t, NameAndType& nmTp, UMLClassifier *owningScope);
134 Parse_Status parseAttribute(QString a, NameAndType& nmTp, UMLClassifier *owningScope,
135 Uml::Visibility::Enum *vis = 0);
136 Parse_Status parseOperation(QString m, OpDescriptor& desc, UMLClassifier *owningScope);
137 Parse_Status parseConstraint(QString m, QString& name, UMLEntity* owningScope);
138
139QString psText(Parse_Status value);
140
141QString updateDeleteActionToString(UMLForeignKeyConstraint::UpdateDeleteAction uda);
142
143}
144
145#endif
basictypes.h
MultiPageDialogBase::PageType
PageType
Available page types.
Definition multipagedialogbase.h:52
UMLClassifier
Information for a non-graphical Concept/Class.
Definition classifier.h:35
UMLEntity
Non-graphical Information for an Entity.
Definition entity.h:30
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition foreignkeyconstraint.h:37
UMLListViewItem::ListViewType
ListViewType
Definition umllistviewitem.h:39
UMLObjectList
Definition umlobjectlist.h:25
UMLObject
The base class for UML objects.
Definition umlobject.h:70
UMLObject::ObjectType
ObjectType
Definition umlobject.h:76
UMLObject::ot_UMLObject
@ ot_UMLObject
Definition umlobject.h:78
UMLPackage
Non-graphical information for a Package.
Definition package.h:28
UMLScene
Definition umlscene.h:65
UMLWidget
The base class for graphical UML objects.
Definition umlwidget.h:36
WidgetBase::WidgetType
WidgetType
Definition widgetbase.h:107
foreignkeyconstraint.h
icon_utils.h
multipagedialogbase.h
Icon_Utils::IconType
IconType
Definition icon_utils.h:25
Model_Utils
Definition model_utils.cpp:44
Model_Utils::convert_MT_LVT
UMLListViewItem::ListViewType convert_MT_LVT(Uml::ModelType::Enum mt)
Definition model_utils.cpp:1508
Model_Utils::typeIsClassifier
bool typeIsClassifier(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1322
Model_Utils::Parse_Status
Parse_Status
Definition model_utils.h:106
Model_Utils::PS_Illegal_MethodName
@ PS_Illegal_MethodName
Definition model_utils.h:108
Model_Utils::PS_Unknown_ReturnType
@ PS_Unknown_ReturnType
Definition model_utils.h:108
Model_Utils::PS_Unspecified_Error
@ PS_Unspecified_Error
Definition model_utils.h:108
Model_Utils::PS_Empty
@ PS_Empty
Definition model_utils.h:107
Model_Utils::PS_Unknown_ArgType
@ PS_Unknown_ArgType
Definition model_utils.h:107
Model_Utils::PS_OK
@ PS_OK
Return type of parseOperation().
Definition model_utils.h:107
Model_Utils::PS_Malformed_Arg
@ PS_Malformed_Arg
Definition model_utils.h:107
Model_Utils::loadCommentFromXMI
QString loadCommentFromXMI(QDomElement elem)
Definition model_utils.cpp:783
Model_Utils::convert_LVT_PT
MultiPageDialogBase::PageType convert_LVT_PT(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:2128
Model_Utils::typeIsAllowedInDiagram
bool typeIsAllowedInDiagram(UMLObject *o, UMLScene *scene)
Definition model_utils.cpp:2229
Model_Utils::parseTemplate
Parse_Status parseTemplate(QString t, NameAndType &nmTp, UMLClassifier *owningScope)
Definition model_utils.cpp:993
Model_Utils::typeIsClassifierList
bool typeIsClassifierList(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1300
Model_Utils::getXmiId
QString getXmiId(QDomElement element)
Definition model_utils.cpp:772
Model_Utils::treeViewMoveObjectTo
void treeViewMoveObjectTo(UMLObject *container, UMLObject *object)
Definition model_utils.cpp:463
Model_Utils::convert_LVT_OT
UMLObject::ObjectType convert_LVT_OT(UMLListViewItem::ListViewType lvt)
Definition model_utils.cpp:1785
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition model_utils.cpp:648
Model_Utils::isCommonDataType
bool isCommonDataType(QString type)
Definition model_utils.cpp:832
Model_Utils::newTitle
QString newTitle(UMLObject::ObjectType type)
Definition model_utils.cpp:606
Model_Utils::psText
QString psText(Parse_Status value)
Definition model_utils.cpp:1198
Model_Utils::treeViewGetPackageFromCurrent
UMLPackage * treeViewGetPackageFromCurrent()
Definition model_utils.cpp:492
Model_Utils::uniqObjectName
QString uniqObjectName(UMLObject::ObjectType type, UMLPackage *parentPkg, QString prefix)
Definition model_utils.cpp:555
Model_Utils::findUMLObjectRecursive
UMLObject * findUMLObjectRecursive(const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type)
Definition model_utils.cpp:386
Model_Utils::NameAndType_List
QLinkedList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition model_utils.h:124
Model_Utils::typeIsDiagram
bool typeIsDiagram(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1452
Model_Utils::isCommonXMI1Attribute
bool isCommonXMI1Attribute(const QString &tag)
Definition model_utils.cpp:808
Model_Utils::typeIsContainer
bool typeIsContainer(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1286
Model_Utils::convert_DT_MT
Uml::ModelType::Enum convert_DT_MT(Uml::DiagramType::Enum dt)
Definition model_utils.cpp:1473
Model_Utils::convert_OT_LVT
UMLListViewItem::ListViewType convert_OT_LVT(UMLObject *o)
Definition model_utils.cpp:1627
Model_Utils::treeViewAddViews
void treeViewAddViews(const UMLViewList &viewList)
Definition model_utils.cpp:425
Model_Utils::treeViewGetCurrentObject
UMLObject * treeViewGetCurrentObject()
Definition model_utils.cpp:476
Model_Utils::normalize
QString normalize(QString type)
Definition model_utils.cpp:79
Model_Utils::findObjectInList
UMLObject * findObjectInList(Uml::ID::Type id, const UMLObjectList &inList)
Definition model_utils.cpp:113
Model_Utils::treeViewSetCurrentItem
void treeViewSetCurrentItem(UMLObject *object)
Definition model_utils.cpp:451
Model_Utils::convert_LVT_DT
Uml::DiagramType::Enum convert_LVT_DT(UMLListViewItem::ListViewType lvt)
Definition model_utils.cpp:2082
Model_Utils::convert_LVT_IT
Icon_Utils::IconType convert_LVT_IT(UMLListViewItem::ListViewType lvt, UMLObject *o)
Definition model_utils.cpp:1904
Model_Utils::renameTitle
QString renameTitle(UMLObject::ObjectType type)
Definition model_utils.cpp:690
Model_Utils::treeViewBuildDiagramName
QString treeViewBuildDiagramName(Uml::ID::Type id)
Definition model_utils.cpp:518
Model_Utils::NameAndType_ListIt
QLinkedList< NameAndType >::iterator NameAndType_ListIt
Auxiliary type for OpDescriptor.
Definition model_utils.h:125
Model_Utils::parseAttribute
Parse_Status parseAttribute(QString a, NameAndType &nmTp, UMLClassifier *owningScope, Uml::Visibility::Enum *vis)
Definition model_utils.cpp:1033
Model_Utils::typeIsAllowedInType
bool typeIsAllowedInType(UMLListViewItem::ListViewType childType, UMLListViewItem::ListViewType parentType)
Definition model_utils.cpp:1360
Model_Utils::findUMLObjectRaw
UMLObject * findUMLObjectRaw(const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type, UMLObject *currentObj)
Definition model_utils.cpp:360
Model_Utils::convert_DT_LVT
UMLListViewItem::ListViewType convert_DT_LVT(Uml::DiagramType::Enum dt)
Definition model_utils.cpp:1566
Model_Utils::typeIsRootView
bool typeIsRootView(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1213
Model_Utils::isClassifierListitem
bool isClassifierListitem(UMLObject::ObjectType type)
Definition model_utils.cpp:860
Model_Utils::convert_LVT_MT
Uml::ModelType::Enum convert_LVT_MT(UMLListViewItem::ListViewType lvt)
Definition model_utils.cpp:1538
Model_Utils::findUMLObject
UMLObject * findUMLObject(const UMLObjectList &inList, const QString &inName, UMLObject::ObjectType type, UMLObject *currentObj)
Definition model_utils.cpp:185
Model_Utils::typeIsFolder
bool typeIsFolder(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1267
Model_Utils::guessContainer
Uml::ModelType::Enum guessContainer(UMLObject *o)
Definition model_utils.cpp:884
Model_Utils::convert_OT_MT
Uml::ModelType::Enum convert_OT_MT(UMLObject::ObjectType ot)
Definition model_utils.cpp:2168
Model_Utils::rootPackage
UMLPackage * rootPackage(UMLObject *obj)
Definition model_utils.cpp:406
Model_Utils::updateDeleteActionToString
QString updateDeleteActionToString(UMLForeignKeyConstraint::UpdateDeleteAction uda)
Definition model_utils.cpp:2204
Model_Utils::renameText
QString renameText(UMLObject::ObjectType type)
Definition model_utils.cpp:732
Model_Utils::parseConstraint
Parse_Status parseConstraint(QString m, QString &name, UMLEntity *owningScope)
Definition model_utils.cpp:1178
Model_Utils::isCloneable
bool isCloneable(WidgetBase::WidgetType type)
Definition model_utils.cpp:52
Model_Utils::stringToDirection
int stringToDirection(QString input, Uml::ParameterDirection::Enum &result)
Definition model_utils.cpp:964
Model_Utils::typeIsCanvasWidget
bool typeIsCanvasWidget(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1233
Model_Utils::parseOperation
Parse_Status parseOperation(QString m, OpDescriptor &desc, UMLClassifier *owningScope)
Definition model_utils.cpp:1108
Model_Utils::typeIsProperties
bool typeIsProperties(UMLListViewItem::ListViewType type)
Definition model_utils.cpp:1336
Model_Utils::treeViewChangeIcon
void treeViewChangeIcon(UMLObject *object, Icon_Utils::IconType to)
Definition model_utils.cpp:441
Model_Utils::hasAssociations
bool hasAssociations(UMLObject::ObjectType type)
Definition model_utils.cpp:2364
Uml::DiagramType::Enum
Enum
Definition basictypes.h:63
Uml::ID::Type
std::string Type
Definition basictypes.h:371
Uml::ModelType::Enum
Enum
Definition basictypes.h:27
Uml::ParameterDirection::Enum
Enum
Definition basictypes.h:254
Uml::ParameterDirection::In
@ In
Definition basictypes.h:255
Uml::Visibility::Enum
Enum
Definition basictypes.h:45
Uml
Definition basictypes.cpp:18
a
QString a
Definition petalnode.cpp:13
Model_Utils::NameAndType
Definition model_utils.h:111
Model_Utils::NameAndType::m_direction
Uml::ParameterDirection::Enum m_direction
Definition model_utils.h:114
Model_Utils::NameAndType::NameAndType
NameAndType()
Definition model_utils.h:116
Model_Utils::NameAndType::m_type
UMLObject * m_type
Definition model_utils.h:113
Model_Utils::NameAndType::m_initialValue
QString m_initialValue
Definition model_utils.h:115
Model_Utils::NameAndType::NameAndType
NameAndType(QString name, UMLObject *type, Uml::ParameterDirection::Enum direction=Uml::ParameterDirection::In, QString initialValue=QString())
Definition model_utils.h:117
Model_Utils::NameAndType::m_name
QString m_name
< Data structure filled by parseAttribute().
Definition model_utils.h:112
Model_Utils::OpDescriptor
Definition model_utils.h:127
Model_Utils::OpDescriptor::m_name
QString m_name
< Data structure filled by parseOperation().
Definition model_utils.h:128
Model_Utils::OpDescriptor::m_pReturnType
UMLObject * m_pReturnType
Definition model_utils.h:130
Model_Utils::OpDescriptor::m_args
NameAndType_List m_args
Definition model_utils.h:129
umllistviewitem.h
umlobjectlist.h
umlviewlist.h
UMLViewList
QList< QPointer< UMLView > > UMLViewList
Definition umlviewlist.h:16
widgetbase.h