[Uml-devel] kdesdk/umbrello/umbrello

Brian Thomas thomas at mail630.gsfc.nasa.gov
Sun Aug 31 15:32:04 UTC 2003


CVS commit by thomas: 

changed so you can only construct this with a parent classifier and added isConstructorMethods method


  M +19 -3     operation.cpp   1.9
  M +5 -2      operation.h   1.7


--- kdesdk/umbrello/umbrello/operation.h  #1.6:1.7
@@ -16,4 +16,5 @@
 // forward declarations
 class UMLAttribute;
+class UMLClassifier;
 
 /**
@@ -39,5 +40,5 @@ public:
          *      @param  rt                              The return type of the operation.
          */
-        UMLOperation(QObject * parent, QString Name, int id, Scope s = Public, QString rt = "void");
+        UMLOperation(UMLClassifier * parent, QString Name, int id, Scope s = Public, QString rt = "void");
 
         /**
@@ -46,5 +47,5 @@ public:
          *      @param  parent          The parent to this operation.
          */
-        UMLOperation(QObject * parent);
+        UMLOperation(UMLClassifier * parent);
 
         /**
@@ -143,4 +144,6 @@ public:
 
         bool loadFromXMI( QDomElement & element );
+
+        bool isConstructorOperation ( );
 
 private:

--- kdesdk/umbrello/umbrello/operation.cpp  #1.8:1.9
@@ -13,7 +13,10 @@
 #include "operation.h"
 #include "attribute.h"
+#include "classifier.h"
 #include "dialogs/umloperationdialog.h"
 
-UMLOperation::UMLOperation(QObject *parent, QString Name, int id, Scope s, QString rt) : UMLClassifierListItem(parent,Name, id) {
+UMLOperation::UMLOperation(UMLClassifier *parent, QString Name, int id, Scope s, QString rt) 
+    : UMLClassifierListItem((UMLObject*)parent,Name, id) 
+{
         m_ReturnType = rt;
         m_Scope = s;
@@ -24,5 +27,7 @@ UMLOperation::UMLOperation(QObject *pare
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-UMLOperation::UMLOperation(QObject * parent) : UMLClassifierListItem(parent) {
+UMLOperation::UMLOperation(UMLClassifier * parent) 
+    : UMLClassifierListItem ((UMLObject*) parent) 
+{
         m_ReturnType = "";
         m_BaseType = ot_Operation;
@@ -184,4 +189,16 @@ bool UMLOperation::loadFromXMI( QDomElem
 }
 
+bool UMLOperation::isConstructorOperation ( ) {
+        UMLClassifier * c = dynamic_cast<UMLClassifier*>(this->parent());
+
+        QString cName = c->getName();
+        QString opName = getName();
+        QString opReturn = getReturnType();
+
+        // its a constructor operation if the operation name and return type
+        // match that of the parent classifier
+        return (cName == opName && cName == opReturn) ? true : false;
+}
+
 bool UMLOperation::showPropertiesDialogue(QWidget* parent) {
         UMLOperationDialog dialogue(parent, this);






More information about the umbrello-devel mailing list