[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Feb 9 11:09:34 UTC 2005


CVS commit by okellogg: 

getFullyQualifiedName(): Reimplement from UMLObject.


  M +23 -0     attribute.cpp   1.27
  M +5 -0      attribute.h   1.25


--- kdesdk/umbrello/umbrello/attribute.cpp  #1.26:1.27
@@ -20,4 +20,6 @@
 // app includes
 #include "classifier.h"
+#include "operation.h"
+#include "umlobject.h"
 #include "umldoc.h"
 #include "uml.h"
@@ -114,4 +116,25 @@ QString UMLAttribute::toString(Uml::Sign
 }
 
+QString UMLAttribute::getFullyQualifiedName(const QString &separator) const {
+        UMLOperation *op = NULL;
+        UMLObject *owningObject = static_cast<UMLObject*>(parent());
+        if (owningObject->getBaseType() == Uml::ot_Operation) {
+                op = static_cast<UMLOperation*>(owningObject);
+                owningObject = static_cast<UMLObject*>(owningObject->parent());
+        }
+        UMLClassifier *ownParent = dynamic_cast<UMLClassifier*>(owningObject);
+        if (ownParent == NULL) {
+                kdError() << "UMLAttribute::getFullyQualifiedName(" << m_Name
+                          << "): parent " << owningObject->getName()
+                          << " is not a UMLClassifier" << endl;
+                return "";
+        }
+        QString fqn = ownParent->getFullyQualifiedName(separator);
+        if (op)
+                fqn.append(separator + op->getName());
+        fqn.append(separator + m_Name);
+        return fqn;
+}
+
 bool UMLAttribute::operator==( UMLAttribute &rhs) {
         if( this == &rhs )

--- kdesdk/umbrello/umbrello/attribute.h  #1.24:1.25
@@ -95,4 +95,9 @@ public:
 
         /**
+         * Reimplement method from UMLObject.
+         */
+        QString getFullyQualifiedName(const QString &separator = "::") const;
+
+        /**
          * Creates the <UML:Attribute> XMI element.
          */






More information about the umbrello-devel mailing list