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

Oliver Kellogg okellogg at users.sourceforge.net
Wed Apr 18 17:05:02 UTC 2007


SVN commit 655532 by okellogg:

insertMethod(): Pass the op pointer by reference.  If an operation of equivalent
signature already exists then the incoming op is deleted and the op pointer is
returned pointing to the existing UMLOperation.


 M  +3 -5      import_utils.cpp  
 M  +9 -2      import_utils.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/import_utils.cpp #655531:655532
@@ -23,7 +23,6 @@
 #include "../umllistview.h"
 #include "../umllistviewitem.h"
 #include "../umlobject.h"
-#include "../docwindow.h"
 #include "../package.h"
 #include "../folder.h"
 #include "../enum.h"
@@ -244,7 +243,6 @@
     QString strippedComment = formatComment(comment);
     if (! strippedComment.isEmpty()) {
         o->setDoc(strippedComment);
-        //UMLApp::app()->getDocWindow()->showDocumentation(o, true);
     }
     if (!stereotype.isEmpty()) {
         o->setStereotype(stereotype);
@@ -304,7 +302,6 @@
     QString strippedComment = formatComment(comment);
     if (! strippedComment.isEmpty()) {
         attr->setDoc(strippedComment);
-        //UMLApp::app()->getDocWindow()->showDocumentation(attr, true);
     }
 
     UMLApp::app()->getDocument()->setModified(true);
@@ -329,7 +326,7 @@
                             comment, isStatic);
 }
 
-void insertMethod(UMLClassifier *klass, UMLOperation *op,
+void insertMethod(UMLClassifier *klass, UMLOperation* &op,
                   Uml::Visibility scope, const QString& type,
                   bool isStatic, bool isAbstract,
                   bool isFriend, bool isConstructor,
@@ -388,8 +385,9 @@
             exParam->setInitialValue(param->getInitialValue());
             exParam->setParmKind(param->getParmKind());
         }
-        // delete temporary UMLOperation
+        // delete incoming UMLOperation and pass out the existing one
         delete op;
+        op = exist;
     } else {
         klass->addOperation(op);
     }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeimport/import_utils.h #655531:655532
@@ -93,9 +93,16 @@
     UMLOperation* makeOperation(UMLClassifier *parent, const QString &name);
 
     /**
-     * Insert the UMLOperation into the document.
+     * Insert the UMLOperation into the given classifier.
+     *
+     * @param klass  The classifier into which the operation shall be added.
+     * @param op     Reference to pointer to the temporary UMLOperation
+     *               for insertion. If an UMLOperation of same signature
+     *               already exists at the classifier then the incoming
+     *               UMLOperation is deleted and the pointer is set to
+     *               the existing UMLOperation.
      */
-    void insertMethod(UMLClassifier *klass, UMLOperation *op,
+    void insertMethod(UMLClassifier *klass, UMLOperation* &op,
                       Uml::Visibility scope, const QString& type,
                       bool isStatic, bool isAbstract,
                       bool isFriend = false, bool isConstructor = false,




More information about the umbrello-devel mailing list