[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello
Oliver Kellogg
okellogg at users.sourceforge.net
Wed Nov 8 22:26:54 UTC 2006
SVN commit 603433 by okellogg:
guessContainer(): Return Uml::N_MODELTYPES when guessing is impossible.
convert_OT_MT(): New. Guesses the Model_Type based on the Object_Type.
M +26 -1 model_utils.cpp
M +4 -0 model_utils.h
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/model_utils.cpp #603432:603433
@@ -340,7 +340,7 @@
UMLObject *roleObj = assoc->getObject((Uml::Role_Type)r);
if (roleObj == NULL) {
// Ouch! we have been called while types are not yet resolved
- break;
+ return Uml::N_MODELTYPES;
}
UMLPackage *pkg = roleObj->getUMLPackage();
if (pkg) {
@@ -1133,5 +1133,30 @@
return dt;
}
+Uml::Model_Type convert_OT_MT(Uml::Object_Type ot) {
+ Uml::Model_Type mt = Uml::N_MODELTYPES;
+ switch (ot) {
+ case Uml::ot_Actor:
+ case Uml::ot_UseCase:
+ mt = Uml::mt_UseCase;
+ break;
+ case Uml::ot_Component:
+ case Uml::ot_Artifact:
+ mt = Uml::mt_Component;
+ break;
+ case Uml::ot_Node:
+ mt = Uml::mt_Deployment;
+ break;
+ case Uml::ot_Entity:
+ case Uml::ot_EntityAttribute:
+ mt = Uml::mt_EntityRelationship;
+ break;
+ default:
+ mt = Uml::mt_Logical;
+ break;
+ }
+ return mt;
+}
+
} // namespace Model_Utils
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/model_utils.h #603432:603433
@@ -198,6 +198,10 @@
*/
Uml::Diagram_Type convert_LVT_DT(Uml::ListView_Type lvt);
+/**
+ * Return the Model_Type which corresponds to the given Object_Type.
+ */
+Uml::Model_Type convert_OT_MT(Uml::Object_Type ot);
/**
* Try to guess the correct container folder type of an UMLObject.
More information about the umbrello-devel
mailing list