umbrello 26.03.70-1a62d36 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Modules
- 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 "umlforeignkeyconstraint.h"
14#include "icon_utils.h"
15#include "multipagedialogbase.h"
16#include "widgetbase.h"
17
18#include <QList>
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 = nullptr);
43
44 UMLObject* findUMLObjectRaw(const UMLObjectList& inList,
45 const QString& name,
46 UMLObject::ObjectType type = UMLObject::ot_UMLObject,
47 UMLObject *currentObj = nullptr);
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= nullptr);
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(nullptr), 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 QList<NameAndType> NameAndType_List;
125 typedef QList<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 = nullptr);
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: umlclassifier.h:35
UMLEntity
Non-graphical Information for an Entity.
Definition: umlentity.h:30
UMLForeignKeyConstraint::UpdateDeleteAction
UpdateDeleteAction
Definition: umlforeignkeyconstraint.h:37
UMLListViewItem::ListViewType
ListViewType
Definition: umllistviewitem.h:39
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
UMLObjectList
Definition: umlobjectlist.h:25
UMLPackage
Non-graphical information for a Package.
Definition: umlpackage.h:28
UMLScene
Definition: umlscene.h:66
UMLWidget
The base class for graphical UML objects.
Definition: umlwidget.h:36
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:107
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:1514
Model_Utils::typeIsClassifier
bool typeIsClassifier(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1328
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:784
Model_Utils::convert_LVT_PT
MultiPageDialogBase::PageType convert_LVT_PT(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:2134
Model_Utils::typeIsAllowedInDiagram
bool typeIsAllowedInDiagram(UMLObject *o, UMLScene *scene)
Definition: model_utils.cpp:2235
Model_Utils::parseTemplate
Parse_Status parseTemplate(QString t, NameAndType &nmTp, UMLClassifier *owningScope)
Definition: model_utils.cpp:995
Model_Utils::typeIsClassifierList
bool typeIsClassifierList(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1306
Model_Utils::getXmiId
QString getXmiId(QDomElement element)
Definition: model_utils.cpp:773
Model_Utils::treeViewMoveObjectTo
void treeViewMoveObjectTo(UMLObject *container, UMLObject *object)
Definition: model_utils.cpp:464
Model_Utils::convert_LVT_OT
UMLObject::ObjectType convert_LVT_OT(UMLListViewItem::ListViewType lvt)
Definition: model_utils.cpp:1791
Model_Utils::NameAndType_List
QList< NameAndType > NameAndType_List
Auxiliary type for OpDescriptor.
Definition: model_utils.h:124
Model_Utils::newText
QString newText(UMLObject::ObjectType type)
Definition: model_utils.cpp:649
Model_Utils::isCommonDataType
bool isCommonDataType(QString type)
Definition: model_utils.cpp:833
Model_Utils::newTitle
QString newTitle(UMLObject::ObjectType type)
Definition: model_utils.cpp:607
Model_Utils::psText
QString psText(Parse_Status value)
Definition: model_utils.cpp:1204
Model_Utils::treeViewGetPackageFromCurrent
UMLPackage * treeViewGetPackageFromCurrent()
Definition: model_utils.cpp:493
Model_Utils::uniqObjectName
QString uniqObjectName(UMLObject::ObjectType type, UMLPackage *parentPkg, QString prefix)
Definition: model_utils.cpp:556
Model_Utils::findUMLObjectRecursive
UMLObject * findUMLObjectRecursive(const UMLObjectList &inList, const QString &name, UMLObject::ObjectType type)
Definition: model_utils.cpp:386
Model_Utils::typeIsDiagram
bool typeIsDiagram(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1458
Model_Utils::isCommonXMI1Attribute
bool isCommonXMI1Attribute(const QString &tag)
Definition: model_utils.cpp:809
Model_Utils::NameAndType_ListIt
QList< NameAndType >::iterator NameAndType_ListIt
Auxiliary type for OpDescriptor.
Definition: model_utils.h:125
Model_Utils::typeIsContainer
bool typeIsContainer(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1292
Model_Utils::convert_DT_MT
Uml::ModelType::Enum convert_DT_MT(Uml::DiagramType::Enum dt)
Definition: model_utils.cpp:1479
Model_Utils::convert_OT_LVT
UMLListViewItem::ListViewType convert_OT_LVT(UMLObject *o)
Definition: model_utils.cpp:1633
Model_Utils::treeViewAddViews
void treeViewAddViews(const UMLViewList &viewList)
Definition: model_utils.cpp:426
Model_Utils::treeViewGetCurrentObject
UMLObject * treeViewGetCurrentObject()
Definition: model_utils.cpp:477
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:452
Model_Utils::convert_LVT_DT
Uml::DiagramType::Enum convert_LVT_DT(UMLListViewItem::ListViewType lvt)
Definition: model_utils.cpp:2088
Model_Utils::convert_LVT_IT
Icon_Utils::IconType convert_LVT_IT(UMLListViewItem::ListViewType lvt, UMLObject *o)
Definition: model_utils.cpp:1910
Model_Utils::renameTitle
QString renameTitle(UMLObject::ObjectType type)
Definition: model_utils.cpp:691
Model_Utils::treeViewBuildDiagramName
QString treeViewBuildDiagramName(Uml::ID::Type id)
Definition: model_utils.cpp:519
Model_Utils::parseAttribute
Parse_Status parseAttribute(QString a, NameAndType &nmTp, UMLClassifier *owningScope, Uml::Visibility::Enum *vis)
Definition: model_utils.cpp:1035
Model_Utils::typeIsAllowedInType
bool typeIsAllowedInType(UMLListViewItem::ListViewType childType, UMLListViewItem::ListViewType parentType)
Definition: model_utils.cpp:1366
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:1572
Model_Utils::typeIsRootView
bool typeIsRootView(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1219
Model_Utils::isClassifierListitem
bool isClassifierListitem(UMLObject::ObjectType type)
Definition: model_utils.cpp:861
Model_Utils::convert_LVT_MT
Uml::ModelType::Enum convert_LVT_MT(UMLListViewItem::ListViewType lvt)
Definition: model_utils.cpp:1544
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:1273
Model_Utils::guessContainer
Uml::ModelType::Enum guessContainer(UMLObject *o)
Definition: model_utils.cpp:885
Model_Utils::convert_OT_MT
Uml::ModelType::Enum convert_OT_MT(UMLObject::ObjectType ot)
Definition: model_utils.cpp:2174
Model_Utils::rootPackage
UMLPackage * rootPackage(UMLObject *obj)
Definition: model_utils.cpp:407
Model_Utils::updateDeleteActionToString
QString updateDeleteActionToString(UMLForeignKeyConstraint::UpdateDeleteAction uda)
Definition: model_utils.cpp:2210
Model_Utils::renameText
QString renameText(UMLObject::ObjectType type)
Definition: model_utils.cpp:733
Model_Utils::parseConstraint
Parse_Status parseConstraint(QString m, QString &name, UMLEntity *owningScope)
Definition: model_utils.cpp:1184
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:965
Model_Utils::typeIsCanvasWidget
bool typeIsCanvasWidget(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1239
Model_Utils::parseOperation
Parse_Status parseOperation(QString m, OpDescriptor &desc, UMLClassifier *owningScope)
Definition: model_utils.cpp:1111
Model_Utils::typeIsProperties
bool typeIsProperties(UMLListViewItem::ListViewType type)
Definition: model_utils.cpp:1342
Model_Utils::treeViewChangeIcon
void treeViewChangeIcon(UMLObject *object, Icon_Utils::IconType to)
Definition: model_utils.cpp:442
Model_Utils::hasAssociations
bool hasAssociations(UMLObject::ObjectType type)
Definition: model_utils.cpp:2370
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:17
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
umlforeignkeyconstraint.h
umllistviewitem.h
umlobjectlist.h
umlviewlist.h
UMLViewList
QList< QPointer< UMLView > > UMLViewList
Definition: umlviewlist.h:16
widgetbase.h