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

Oliver Kellogg okellogg at users.sourceforge.net
Sun Aug 14 08:39:06 UTC 2005


SVN commit 449175 by okellogg:

UMLApp::activeLanguageScopeSeparator(): New.
UML{Object,Attribute}::getFullyQualifiedName(), UMLObject::getPackage(): 
 Use the above.


 M  +3 -1      attribute.cpp  
 M  +1 -1      attribute.h  
 M  +8 -0      uml.cpp  
 M  +5 -0      uml.h  
 M  +6 -2      umlobject.cpp  
 M  +6 -3      umlobject.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.cpp #449174:449175
@@ -115,7 +115,7 @@
         return s + getName();
 }
 
-QString UMLAttribute::getFullyQualifiedName(const QString &separator) const {
+QString UMLAttribute::getFullyQualifiedName(QString separator) const {
     UMLOperation *op = NULL;
     UMLObject *owningObject = static_cast<UMLObject*>(parent());
     if (owningObject->getBaseType() == Uml::ot_Operation) {
@@ -129,6 +129,8 @@
         << " is not a UMLClassifier" << endl;
         return "";
     }
+    if (separator.isEmpty())
+        separator = UMLApp::app()->activeLanguageScopeSeparator();
     QString fqn = ownParent->getFullyQualifiedName(separator);
     if (op)
         fqn.append(separator + op->getName());
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/attribute.h #449174:449175
@@ -96,7 +96,7 @@
     /**
      * Reimplement method from UMLObject.
      */
-    QString getFullyQualifiedName(const QString &separator = ".") const;
+    QString getFullyQualifiedName(QString separator = QString::null) const;
 
     /**
      * Creates the <UML:Attribute> XMI element.
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.cpp #449174:449175
@@ -1345,6 +1345,14 @@
     return (m_activeLanguage != "Ada");
 }
 
+QString UMLApp::activeLanguageScopeSeparator() const {
+    if (m_activeLanguage == "Ada" ||
+        m_activeLanguage == "Java" ||
+        m_activeLanguage == "JavaScript")  // CHECK: more?
+        return ".";
+    return "::";
+}
+
 void UMLApp::slotCurrentViewClearDiagram() {
     m_doc->getCurrentView()->clearDiagram();
 }
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/uml.h #449174:449175
@@ -604,6 +604,11 @@
     bool activeLanguageIsCaseSensitive() const;
 
     /**
+     * Return the target language depedent scope separator.
+     */
+    QString activeLanguageScopeSeparator() const;
+
+    /**
      * Menu selection for clear current view.
      */
     void slotCurrentViewClearDiagram();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.cpp #449174:449175
@@ -117,9 +117,11 @@
     return m_Name;
 }
 
-QString UMLObject::getFullyQualifiedName(const QString &separator /* = "::" */) const {
+QString UMLObject::getFullyQualifiedName(QString separator) const {
     QString fqn;
     if (m_pUMLPackage) {
+        if (separator.isEmpty())
+            separator = UMLApp::app()->activeLanguageScopeSeparator();
         fqn = m_pUMLPackage->getFullyQualifiedName(separator);
         fqn.append(separator);
     }
@@ -328,7 +330,7 @@
     return name;
 }
 
-QString UMLObject::getPackage(const QString &separator /* ="." */) {
+QString UMLObject::getPackage(QString separator) {
     if (m_pUMLPackage == NULL)
         return "";
     QStringList pkgList;
@@ -337,6 +339,8 @@
         pkgList.prepend(pkg->getName());
         pkg = pkg->getUMLPackage();
     }
+    if (separator.isEmpty())
+        separator = UMLApp::app()->activeLanguageScopeSeparator();
     return pkgList.join(separator);
 }
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/umlobject.h #449174:449175
@@ -188,7 +188,7 @@
      *			individual package prefixes (optional.)
      * @return	The UMLObject's enclosing package(s) as a text.
      */
-    QString getPackage(const QString &separator = ".");
+    QString getPackage(QString separator = QString::null);
 
     /**
      * Return a list of the packages in which this class is embedded.
@@ -223,10 +223,13 @@
     /**
      * Returns the fully qualified name, i.e. all package prefixes and then m_Name.
      *
-     * @param separator	The separator string to use.
+     * @param separator	The separator string to use (optional.)
+     *                  If not given then the separator is chosen according
+     *                  to the currently selected active programming language
+     *                  of import and code generation.
      * @return	The fully qualified name of this UMLObject.
      */
-    virtual QString getFullyQualifiedName(const QString &separator = "::" ) const;
+    virtual QString getFullyQualifiedName(QString separator = QString::null) const;
 
     /**
      * Returns the abstract state of the object.




More information about the umbrello-devel mailing list