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

Sharan Rao sharanrao at gmail.com
Wed Jul 11 17:30:47 UTC 2007


SVN commit 686568 by sharan:

Fixes for EBN Krazy #18 ( pass-by-value )


 M  +7 -6      attribute.cpp  
 M  +1 -1      attribute.h  
 M  +5 -5      codedocument.cpp  
 M  +1 -1      codedocument.h  
 M  +2 -3      codegenerationpolicy.cpp  
 M  +1 -1      codegenerationpolicy.h  
 M  +1 -1      codegenobjectwithtextblocks.h  
 M  +1 -1      hierarchicalcodeblock.cpp  
 M  +1 -1      hierarchicalcodeblock.h  
 M  +13 -11    umlobject.cpp  
 M  +2 -2      umlobject.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.cpp #686567:686568
@@ -114,7 +114,7 @@
     return s + getName();
 }
 
-QString UMLAttribute::getFullyQualifiedName( QString separator,
+QString UMLAttribute::getFullyQualifiedName( const QString& separator,
                                             bool includeRoot /* = false */) const {
     UMLOperation *op = NULL;
     UMLObject *owningObject = static_cast<UMLObject*>(parent());
@@ -129,12 +129,13 @@
         << " is not a UMLClassifier" << endl;
         return "";
     }
-    if (separator.isEmpty())
-        separator = UMLApp::app()->activeLanguageScopeSeparator();
-    QString fqn = ownParent->getFullyQualifiedName(separator, includeRoot);
+    QString tempSeparator = separator;
+    if (tempSeparator.isEmpty())
+        tempSeparator = UMLApp::app()->activeLanguageScopeSeparator();
+    QString fqn = ownParent->getFullyQualifiedName(tempSeparator, includeRoot);
     if (op)
-        fqn.append(separator + op->getName());
-    fqn.append(separator + m_Name);
+        fqn.append(tempSeparator + op->getName());
+    fqn.append(tempSeparator + m_Name);
     return fqn;
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.h #686567:686568
@@ -96,7 +96,7 @@
     /**
      * Reimplement method from UMLObject.
      */
-    QString getFullyQualifiedName( QString separator = QString(),
+    QString getFullyQualifiedName( const QString& separator = QString(),
                                   bool includeRoot = false) const;
 
     /**
--- trunk/KDE/kdesdk/umbrello/umbrello/codedocument.cpp #686567:686568
@@ -186,13 +186,13 @@
 // Other methods
 //
 
-QString CodeDocument::getUniqueTag ( QString prefix )
+QString CodeDocument::getUniqueTag ( const QString& prefix )
 {
+    QString tag = prefix ;
+    if(tag.isEmpty())
+        tag += "tblock";
 
-    if(prefix.isEmpty())
-        prefix = "tblock";
-
-    QString tag = prefix + "_0";
+    tag = tag + "_0";
     int number = lastTagIndex;
     for ( ; findTextBlockByTag(tag, true); number++) {
         tag = prefix + '_' + QString::number(number);
--- trunk/KDE/kdesdk/umbrello/umbrello/codedocument.h #686567:686568
@@ -197,7 +197,7 @@
     virtual CodeBlockWithComments * newCodeBlockWithComments ( );
 
     // return a unique, and currently unallocated, text block tag for this document
-    virtual QString getUniqueTag( QString prefix = QString("") );
+    virtual QString getUniqueTag( const QString& prefix = QString("") );
 
     /** a little utility method to make life easier for the code document programmer
      */
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerationpolicy.cpp #686567:686568
@@ -461,7 +461,7 @@
 }
 
 // return the actual text
-QString CodeGenerationPolicy::getHeadingFile(QString str) {
+QString CodeGenerationPolicy::getHeadingFile(const QString& str) {
 
     if(!getIncludeHeadings() || str.isEmpty())
         return QString("");
@@ -478,8 +478,7 @@
         if(QFile::exists(headingFiles.absoluteFilePath("heading"+str)))
             filename = headingFiles.absoluteFilePath("heading"+str);
         else {
-            str.prepend('*');
-            headingFiles.setNameFilter(str);
+            headingFiles.setNameFilter('*' + str);
             //if there is more than one match we just take the first one
             QStringList fileList = headingFiles.entryList();
             if ( !fileList.isEmpty() )
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerationpolicy.h #686567:686568
@@ -292,7 +292,7 @@
       *  %time%
       *  %filepath%
       */
-    QString getHeadingFile(QString str);
+    QString getHeadingFile(const QString& str);
 
     /**
      * set the defaults for this code generator from the passed generator.
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenobjectwithtextblocks.h #686567:686568
@@ -132,7 +132,7 @@
      * @return  QString
      * @param   prefix
      */
-    virtual QString getUniqueTag (QString prefix = "" ) = 0;
+    virtual QString getUniqueTag (const QString& prefix = "" ) = 0;
 
     /** Virtual methods that return a new code document objects.
      */
--- trunk/KDE/kdesdk/umbrello/umbrello/hierarchicalcodeblock.cpp #686567:686568
@@ -68,7 +68,7 @@
     return getUniqueTag("hblock_tag");
 }
 
-QString HierarchicalCodeBlock::getUniqueTag( QString prefix )
+QString HierarchicalCodeBlock::getUniqueTag( const QString& prefix )
 {
     return getParentDocument()->getUniqueTag(prefix);
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/hierarchicalcodeblock.h #686567:686568
@@ -106,7 +106,7 @@
 
     // return a unique, and currently unallocated, text block tag for this hblock
     QString getUniqueTag();
-    QString getUniqueTag( QString prefix );
+    QString getUniqueTag( const QString& prefix );
 
     /**
      * Utility method to add accessormethods in this object
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.cpp #686567:686568
@@ -116,7 +116,7 @@
     return m_Name;
 }
 
-QString UMLObject::getFullyQualifiedName(QString separator,
+QString UMLObject::getFullyQualifiedName(const QString& separator,
                                          bool includeRoot /* = false */) const {
     QString fqn;
     if (m_pUMLPackage) {
@@ -128,10 +128,11 @@
                 skipPackage = true;
         }
         if (!skipPackage) {
-            if (separator.isEmpty())
-                separator = UMLApp::app()->activeLanguageScopeSeparator();
-            fqn = m_pUMLPackage->getFullyQualifiedName(separator, includeRoot);
-            fqn.append(separator);
+            QString tempSeparator = separator;
+            if (tempSeparator.isEmpty())
+                tempSeparator = UMLApp::app()->activeLanguageScopeSeparator();
+            fqn = m_pUMLPackage->getFullyQualifiedName(tempSeparator, includeRoot);
+            fqn.append(tempSeparator);
         }
     }
     fqn.append(m_Name);
@@ -359,13 +360,14 @@
     return name;
 }
 
-QString UMLObject::getPackage(QString separator, bool includeRoot) {
-    if (separator.isEmpty())
-        separator = UMLApp::app()->activeLanguageScopeSeparator();
-    QString fqn = getFullyQualifiedName(separator, includeRoot);
-    if (!fqn.contains(separator))
+QString UMLObject::getPackage(const QString& separator, bool includeRoot) {
+    QString tempSeparator = separator;
+    if (tempSeparator.isEmpty())
+        tempSeparator = UMLApp::app()->activeLanguageScopeSeparator();
+    QString fqn = getFullyQualifiedName(tempSeparator, includeRoot);
+    if (!fqn.contains(tempSeparator))
         return "";
-    QString scope = fqn.left(fqn.length() - separator.length() - m_Name.length());
+    QString scope = fqn.left(fqn.length() - tempSeparator.length() - m_Name.length());
     return scope;
 }
 
--- trunk/KDE/kdesdk/umbrello/umbrello/umlobject.h #686567:686568
@@ -206,7 +206,7 @@
      *                     Default: false.
      * @return  The UMLObject's enclosing package(s) as a text.
      */
-    QString getPackage(QString separator = QString(),
+    QString getPackage(const QString& separator = QString(),
                        bool includeRoot = false);
 
     /**
@@ -258,7 +258,7 @@
      *                     See UMLDoc::getRootFolder(). Default: false.
      * @return  The fully qualified name of this UMLObject.
      */
-    virtual QString getFullyQualifiedName(QString separator = QString(),
+    virtual QString getFullyQualifiedName(const QString& separator = QString(),
                                           bool includeRoot = false) const;
 
     /**




More information about the umbrello-devel mailing list