[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Jan 10 23:02:25 UTC 2007


SVN commit 622187 by okellogg:

Object_Factory::createAttribute(): Pass in type object to defeat creation of
dummy data type "int".


 M  +1 -2      codeimport/import_utils.cpp  
 M  +7 -2      object_factory.cpp  
 M  +2 -1      object_factory.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/import_utils.cpp #622186:622187
@@ -337,8 +337,7 @@
         typeObj = createUMLObject(Uml::ot_UMLObject, type, owner);
         bPutAtGlobalScope = false;
     }
-    UMLAttribute *attr = Object_Factory::createAttribute(method, name);
-    attr->setType(typeObj);
+    UMLAttribute *attr = Object_Factory::createAttribute(method, name, typeObj);
     method->addParm(attr);
     return attr;
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/object_factory.cpp #622186:622187
@@ -43,6 +43,7 @@
 #include "uml.h"
 #include "codegenerator.h"
 #include "model_utils.h"
+#include "uniqueid.h"
 
 namespace Object_Factory {
 
@@ -169,8 +170,12 @@
     return o;
 }
 
-UMLAttribute *createAttribute(UMLObject *parent, const QString& name) {
-    UMLAttribute *attr = new UMLAttribute(parent, name, g_predefinedId);
+UMLAttribute *createAttribute(UMLObject *parent, const QString& name, UMLObject *type) {
+    UMLAttribute *attr = new UMLAttribute(parent);
+    attr->setName(name);
+    attr->setType(type);
+    if (g_predefinedId == Uml::id_None)
+        attr->setID(UniqueID::gen());
     return attr;
 }
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/object_factory.h #622186:622187
@@ -53,7 +53,8 @@
  */
 UMLClassifierListItem* createChildObject(UMLClassifier *parent, Uml::Object_Type type);
 
-UMLAttribute *createAttribute(UMLObject *parent, const QString& name);
+UMLAttribute *createAttribute(UMLObject *parent, const QString& name,
+                              UMLObject *type = 0);
 
 UMLOperation *createOperation(UMLClassifier *parent, const QString& name);
 




More information about the umbrello-devel mailing list