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

Andi Fischer andi.fischer at hispeed.ch
Wed Aug 13 20:17:36 UTC 2008


SVN commit 846658 by fischer:

Collection of smaller fixes like formatting, foreach loops with const &, etc.

 M  +1 -1      attribute.cpp  
 M  +4 -4      attribute.h  
 M  +0 -1      classifier.cpp  
 M  +2 -1      codegenerators/d/dwriter.cpp  
 M  +15 -16    codegenerators/ruby/rubywriter.cpp  
 M  +1 -1      codegenerators/ruby/rubywriter.h  
 M  +1 -1      dialogs/umloperationdialog.h  
 M  +28 -24    dialogs/umlroleproperties.cpp  
 M  +1 -3      dialogs/umlroleproperties.h  
 M  +1 -1      operation.cpp  
 M  +3 -4      operation.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.cpp #846657:846658
@@ -64,7 +64,7 @@
     UMLObject::emitModified();
 }
 
-QString UMLAttribute::getInitialValue() 
+QString UMLAttribute::getInitialValue() const
 {
     return m_InitialValue;
 }
--- trunk/KDE/kdesdk/umbrello/umbrello/attribute.h #846657:846658
@@ -1,11 +1,10 @@
 /***************************************************************************
- *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2006                                               *
+ *   copyright (C) 2002-2008                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -25,7 +24,8 @@
  * @see UMLObject
  * Bugs and comments to uml-devel at lists.sf.net or http://bugs.kde.org
  */
-class UMLAttribute : public UMLClassifierListItem {
+class UMLAttribute : public UMLClassifierListItem
+{
     Q_OBJECT
 public:
     /**
@@ -88,7 +88,7 @@
      *
      * @return  The initial value of the Atrtibute.
      */
-    QString getInitialValue();
+    QString getInitialValue() const;
 
     /**
      * Sets the initial value of the UMLAttribute.
--- trunk/KDE/kdesdk/umbrello/umbrello/classifier.cpp #846657:846658
@@ -1,5 +1,4 @@
 /***************************************************************************
- *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/d/dwriter.cpp #846657:846658
@@ -604,9 +604,10 @@
 
 void DWriter::writeVectorAttributeAccessorMethods (QString fieldClassName, QString fieldVarName,
         QString fieldName, QString description,
-        Uml::Visibility /*visibility*/, Uml::Changeability_Type changeType,
+        Uml::Visibility visibility, Uml::Changeability_Type changeType,
         QTextStream &d)
 {
+    Q_UNUSED(visibility);
     fieldClassName = fixTypeName(fieldClassName);
     QString fieldNameUP = unPluralize(fieldName);
     QString fieldNameUC = Codegen_Utils::capitalizeFirstLetter(fieldNameUP);
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/ruby/rubywriter.cpp #846657:846658
@@ -197,11 +197,11 @@
     }
 }
 
-void RubyWriter::writeOperations(const QString &classname, UMLOperationList &opList,
+void RubyWriter::writeOperations(const QString &classname, const UMLOperationList &opList,
                                  Uml::Visibility permitScope, QTextStream &h)
 {
-    UMLOperation *op;
-    UMLAttribute *at;
+//    UMLOperation *op;
+//    UMLAttribute *at;
 
     switch (permitScope) {
     case Uml::Visibility::Public:
@@ -217,7 +217,7 @@
         break;
     }
 
-    foreach (op ,  opList ) {
+    foreach (const UMLOperation* op, opList) {
         QString methodName = cleanName(op->getName());
         QStringList commentedParams;
 
@@ -245,7 +245,7 @@
         // Always write out the docs for ruby as the type of the
         // arguments and return value of the methods is useful
         writeDoc = true;
-//        for (at = atl.first(); at; at = atl.next())
+//        for (UMLAttribute& at = atl.first(); at; at = atl.next())
 //            writeDoc |= !at->getDoc().isEmpty();
 
         if (writeDoc) {
@@ -271,15 +271,15 @@
             docStr.replace('\n', QString("\n") + m_indentation + "# ");
 
             // Write parameter documentation
-            foreach ( at , atl ) {
+            foreach (const UMLAttribute& at , atl) {
                 // Only write an individual @param entry if one hasn't been found already
                 // in the main doc comment
-                if (commentedParams.contains(cppToRubyName(at->getName())) == 0) {
-                    docStr += (m_endl + m_indentation + "# @param _" + cppToRubyName(at->getName()) + '_');
-                    if (at->getDoc().isEmpty()) {
-                        docStr += (' ' + cppToRubyType(at->getTypeName()));
+                if (commentedParams.contains(cppToRubyName(at.getName())) == 0) {
+                    docStr += (m_endl + m_indentation + "# @param _" + cppToRubyName(at.getName()) + '_');
+                    if (at.getDoc().isEmpty()) {
+                        docStr += (' ' + cppToRubyType(at.getTypeName()));
                     } else {
-                        docStr += (' ' + at->getDoc().replace(QRegExp("[\\n\\r]+[\\t ]*"), m_endl + "   "));
+                        docStr += (' ' + at.getDoc().replace(QRegExp("[\\n\\r]+[\\t ]*"), m_endl + "   "));
                     }
                 }
             }
@@ -313,15 +313,15 @@
         h<< m_indentation << "def " + methodName << "(";
 
         int j=0;
-        foreach (at , atl ) {
-            QString nameStr = cppToRubyName(at->getName());
+        foreach (const UMLAttribute& at , atl) {
+            QString nameStr = cppToRubyName(at.getName());
             if (j > 0) {
                 h << ", " << nameStr;
             } else {
                 h << nameStr;
             }
-            h << (!(at->getInitialValue().isEmpty()) ?
-                (QString(" = ") + cppToRubyType(at->getInitialValue())) :
+            h << (!(at.getInitialValue().isEmpty()) ?
+                (QString(" = ") + cppToRubyType(at.getInitialValue())) :
                 QString(""));
             j++;
         }
@@ -340,7 +340,6 @@
         h << m_indentation << "end" << m_endl << m_endl;
 
     }//end for
-
 }
 
 void RubyWriter::writeAttributeMethods(UMLAttributeList attribs,
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/ruby/rubywriter.h #846657:846658
@@ -98,7 +98,7 @@
      * @param opList      the list of operations
      * @param h           output stream for the header file
      */
-    void writeOperations(const QString &classname, UMLOperationList &opList,
+    void writeOperations(const QString &classname, const UMLOperationList &opList,
                          Uml::Visibility permitScope, QTextStream &h);
 
 };
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umloperationdialog.h #846657:846658
@@ -15,7 +15,7 @@
 #include <kdialog.h>
 
 //qt includes
-#include <QListWidgetItem>
+#include <QtGui/QListWidgetItem>
 
 class UMLOperation;
 class ListPopupMenu;
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlroleproperties.cpp #846657:846658
@@ -11,17 +11,11 @@
 // own header
 #include "umlroleproperties.h"
 
-// qt includes
-//#include <QtGui/QRadioButton>
-//#include <q3textedit.h>
-//#include <qlineedit.h>
-
 // kde includes
 #include <klocale.h>
 #include <kmessagebox.h>
 #include <kdebug.h>
 
-
 UMLRoleProperties::UMLRoleProperties ( QWidget *parent, UMLRole *role)
         : UMLRolePropertiesBase (parent)
 {
@@ -44,27 +38,38 @@
     ui_pMultiLE->setText(m_pRole->getMultiplicity());
 
     // Visibility
-    Uml::Visibility scope = m_pRole->getVisibility();
-    if ( scope == Uml::Visibility::Public )
-        ui_pPublicRB -> setChecked( true );
-    else if ( scope == Uml::Visibility::Private )
-        ui_pPrivateRB -> setChecked( true );
-    else if ( scope == Uml::Visibility::Protected )
-        ui_pProtectedRB -> setChecked( true );
-    else if ( scope == Uml::Visibility::Implementation )
-        ui_pImplementationRB -> setChecked( true );
+    switch (m_pRole->getVisibility()) {
+    case Uml::Visibility::Public:
+        ui_pPublicRB->setChecked( true );
+        break;
+    case Uml::Visibility::Private:
+        ui_pPrivateRB->setChecked( true );
+        break;
+    case Uml::Visibility::Protected:
+        ui_pProtectedRB->setChecked( true );
+        break;
+    case Uml::Visibility::Implementation:
+        ui_pImplementationRB->setChecked( true );
+        break;
+    default:
+        break;
+    }
 
     // Changeability
-    Uml::Changeability_Type changeability = m_pRole->getChangeability();
-    if ( changeability == Uml::chg_Changeable )
-        ui_pChangeableRB -> setChecked( true );
-    else if ( changeability == Uml::chg_Frozen )
-        ui_pFrozenRB -> setChecked( true );
-    else
-        ui_pAddOnlyRB -> setChecked( true );
+    switch (m_pRole->getChangeability()) {
+    case Uml::chg_Changeable:
+        ui_pChangeableRB->setChecked( true );
+        break;
+    case Uml::chg_Frozen:
+        ui_pFrozenRB->setChecked( true );
+        break;
+    default:
+        ui_pAddOnlyRB->setChecked( true );
+        break;
+    }
 
     // Documentation
-    ui_pDocTE-> setText(m_pRole-> getDoc());
+    ui_pDocTE->setText(m_pRole-> getDoc());
     //ui_pDocTE->setWordWrap(QMultiLineEdit::WidgetWidth);
 }
 
@@ -108,5 +113,4 @@
     } //end if m_pRole
 }
 
-
 #include "umlroleproperties.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/umlroleproperties.h #846657:846658
@@ -4,7 +4,7 @@
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2003-2006                                               *
+ *   copyright (C) 2003-2008                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 #ifndef UMLROLEPROPERTIES_H
@@ -13,7 +13,6 @@
 #include "ui_umlrolepropertiesbase.h"
 #include "umlrole.h"
 
-
 class UMLRolePropertiesBase : public QWidget, public Ui::UMLRolePropertiesBase
 {
 public:
@@ -22,7 +21,6 @@
   }
 };
 
-
 /**
  * Displays properties of a UMLRole in a widget which may be used as
  * a properties page or a stand-alone dialog.
--- trunk/KDE/kdesdk/umbrello/umbrello/operation.cpp #846657:846658
@@ -56,7 +56,7 @@
 {
 }
 
-void UMLOperation::setType(UMLObject *type)
+void UMLOperation::setType(UMLObject* type)
 {
     UMLClassifierListItem::setType(type);
     if (m_returnId == Uml::id_None)
--- trunk/KDE/kdesdk/umbrello/umbrello/operation.h #846657:846658
@@ -1,11 +1,10 @@
 /***************************************************************************
- *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
  *   (at your option) any later version.                                   *
  *                                                                         *
- *   copyright (C) 2002-2007                                               *
+ *   copyright (C) 2002-2008                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -81,7 +80,7 @@
      *
      * @param type      pointer to the type object
      */
-    void setType(UMLObject *type);
+    void setType(UMLObject* type);
 
     /**
      * Move a parameter one position to the left.
@@ -112,7 +111,7 @@
      *
      * @return a list of the parameters in the operation
      */
-    UMLAttributeList getParmList() {
+    UMLAttributeList getParmList() const {
         return m_List;
     }
 




More information about the umbrello-devel mailing list