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

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Tue Oct 16 18:32:05 UTC 2007


SVN commit 725963 by chehrlic:

one more q3ptrlist--, this time no autodelete-list :)

 M  +2 -4      classifiercodedocument.cpp  
 M  +3 -3      codeaccessormethodlist.h  
 M  +20 -23    codeclassfield.cpp  
 M  +4 -4      codeclassfield.h  
 M  +0 -1      dialogs/assocpage.h  
 M  +0 -1      dialogs/codegenerationwizard.h  
 M  +0 -1      dialogs/pkgcontentspage.h  
 M  +1 -2      hierarchicalcodeblock.cpp  
 M  +0 -3      import_rose.cpp  


--- trunk/KDE/kdesdk/umbrello/umbrello/classifiercodedocument.cpp #725962:725963
@@ -324,8 +324,7 @@
     {
         CodeClassField * field = *it;
         CodeAccessorMethodList list = field->getMethodList();
-        CodeAccessorMethod * method;
-        for (CodeAccessorMethodListIt it(list); (method = it.current()) != NULL; ++it)
+        Q_FOREACH( CodeAccessorMethod *method, list )
         {
             /*
                                 QString tag = method->getTag();
@@ -726,8 +725,7 @@
             return decl;
         // well, if not in the decl block, then in the methods perhaps?
         CodeAccessorMethodList mlist = cf->getMethodList();
-        CodeAccessorMethod *m;
-        for (CodeAccessorMethodListIt it(mlist); (m = it.current()) != NULL; ++it)
+        Q_FOREACH( CodeAccessorMethod *m, mlist )
             if(m->getTag() == tag)
                 return m;
     }
--- trunk/KDE/kdesdk/umbrello/umbrello/codeaccessormethodlist.h #725962:725963
@@ -12,12 +12,12 @@
 #ifndef _CODEACCESSORMETHODLIST_H
 #define _CODEACCESSORMETHODLIST_H
 
-#include <q3ptrlist.h>
+#include <QList>
 
 // forward declarations
 class CodeAccessorMethod;
 
-typedef Q3PtrList<CodeAccessorMethod> CodeAccessorMethodList;
-typedef Q3PtrListIterator<CodeAccessorMethod> CodeAccessorMethodListIt;
+typedef QList<CodeAccessorMethod*> CodeAccessorMethodList;
+typedef QListIterator<CodeAccessorMethod*> CodeAccessorMethodListIt;
 
 #endif
--- trunk/KDE/kdesdk/umbrello/umbrello/codeclassfield.cpp #725962:725963
@@ -17,7 +17,7 @@
 // own header
 #include "codeclassfield.h"
 // qt/kde includes
-#include <qregexp.h>
+#include <QRegExp>
 #include <kdebug.h>
 // app includes
 #include "association.h"
@@ -53,13 +53,11 @@
 CodeClassField::~CodeClassField ( ) {
 
     // remove methods from parent document
-    CodeAccessorMethodList list = m_methodVector;
-    for(CodeAccessorMethod * m = list.first(); m ; m=list.next())
+    Q_FOREACH( CodeAccessorMethod *m, m_methodVector )
     {
         getParentDocument()->removeTextBlock(m);
         m->forceRelease();
     }
-    list.clear();
 
     // clear the decl block from parent text block list too
     if(m_declCodeBlock)
@@ -119,21 +117,22 @@
 
 // get the type of object that will be added/removed from lists
 // of objects (as per specification of associations)
-QString CodeClassField::getListObjectType() {
-    QString type;
+QString CodeClassField::getListObjectType()
+{
     if (!parentIsAttribute())
     {
         UMLRole * role = dynamic_cast<UMLRole*>(getParentObject());
-        type = getUMLObjectName(role->getObject());
+        return getUMLObjectName(role->getObject());
     }
-    return type;
+    return QString();
 }
 
 /**
  * Get the value of m_isAbstract
  * @return the value of m_isAbstract
  */
-bool CodeClassField::parentIsAttribute ( ) {
+bool CodeClassField::parentIsAttribute ( ) const
+{
     return m_parentIsAttribute;
     //  return (m_classFieldType == Attribute) ? true : false;
 }
@@ -141,7 +140,8 @@
 /**
  * Get the type of classfield this is.
  */
-CodeClassField::ClassFieldType CodeClassField::getClassFieldType() {
+CodeClassField::ClassFieldType CodeClassField::getClassFieldType() const
+{
     return m_classFieldType;
 }
 
@@ -187,7 +187,7 @@
  */
 bool CodeClassField::removeMethod ( CodeAccessorMethod * remove_object ) {
     // m_methodMap->erase(remove_object->getType());
-    m_methodVector.removeRef(remove_object);
+    m_methodVector.removeAll(remove_object);
     getParentDocument()->removeTextBlock(remove_object);
     return true;
 }
@@ -197,7 +197,8 @@
  * @return QPtrList<CodeMethodBlock *> list of Method objects held by
  * m_methodVector
  */
-CodeAccessorMethodList CodeClassField::getMethodList() {
+CodeAccessorMethodList CodeClassField::getMethodList() const
+{
     return m_methodVector;
 }
 
@@ -205,7 +206,7 @@
  * this flag is often used to toggle autogeneration of accessor
  * methods in the code class field.
  */
-bool CodeClassField::getWriteOutMethods ()
+bool CodeClassField::getWriteOutMethods () const
 {
     return m_writeOutMethods;
 }
@@ -254,8 +255,7 @@
     m_declCodeBlock->saveToXMI(doc, cfElem);
 
     // now record the tags on our accessormethods
-    CodeAccessorMethod *method;
-    for (CodeAccessorMethodListIt it(m_methodVector); (method = it.current()) != NULL; ++it)
+    Q_FOREACH( CodeAccessorMethod *method, m_methodVector )
     {
         method->saveToXMI(doc,cfElem);
     }
@@ -379,8 +379,7 @@
 void CodeClassField::synchronize ()
 {
     updateContent();
-    CodeAccessorMethod *method;
-    for (CodeAccessorMethodListIt it(m_methodVector); (method = it.current()) != NULL; ++it)
+    Q_FOREACH( CodeAccessorMethod *method, m_methodVector )
         method->syncToParent();
 
     if(m_declCodeBlock)
@@ -398,13 +397,13 @@
     */
     if(role_id > 1 || role_id < 0)
     {
-        for (CodeAccessorMethod * m = m_methodVector.first(); m ; m= m_methodVector.next())
+        Q_FOREACH( CodeAccessorMethod *m, m_methodVector )
             if( m->getType() == type)
                 return m;
     } else {
         // ugh. forced into this underperforming algorithm because of bad association
         // design.
-        for (CodeAccessorMethod * m = m_methodVector.first(); m ; m= m_methodVector.next())
+        Q_FOREACH( CodeAccessorMethod *m, m_methodVector )
         {
             UMLRole * role = dynamic_cast<UMLRole*>(m->getParentObject());
             if(!role)
@@ -487,8 +486,7 @@
     // all here? -b.t.
     if (parentIsAttribute())
     {
-        for ( CodeAccessorMethod *method = m_methodVector.first(); method;
-                method = m_methodVector.next() )
+        Q_FOREACH( CodeAccessorMethod *method, m_methodVector )
             method->setWriteOutText( m_writeOutMethods );
         return;
     }
@@ -497,7 +495,7 @@
     bool isSingleValue = fieldIsSingleValue();
     bool isEmptyRole = role->getName().isEmpty() ? true : false;
 
-    for (CodeAccessorMethod * method = m_methodVector.first(); method; method=m_methodVector.next())
+    Q_FOREACH( CodeAccessorMethod *method, m_methodVector )
     {
 
         CodeAccessorMethod::AccessorType type = method->getType();
@@ -598,7 +596,6 @@
     m_listClassName = QString ();
     m_declCodeBlock = NULL;
 
-    m_methodVector.setAutoDelete(false);
     // m_methodMap = new QMap<CodeAccessorMethod::AccessorType, CodeAccessorMethod *>;
 
     if (!inConstructor)
--- trunk/KDE/kdesdk/umbrello/umbrello/codeclassfield.h #725962:725963
@@ -95,7 +95,7 @@
      * @return CodeAccessorMethodList list of Method objects held by
      * m_methodVector
      */
-    CodeAccessorMethodList getMethodList();
+    CodeAccessorMethodList getMethodList() const;
 
     /** Utility method to allow finding particular accessor method of this
          *  code class field by its type identifier.
@@ -111,10 +111,10 @@
     /**
      * Get the type of classfield this is.
      */
-    ClassFieldType getClassFieldType();
+    ClassFieldType getClassFieldType() const;
 
     // quick utility call to figure out if parent is an attribute or not
-    bool parentIsAttribute ( );
+    bool parentIsAttribute ( ) const;
 
     // get the type of object that will be added/removed from lists
     // of objects (as per specification of associations)
@@ -124,7 +124,7 @@
      * this flag is often used to toggle autogeneration of accessor
      * methods in the code class field.
      */
-    bool getWriteOutMethods ();
+    bool getWriteOutMethods () const;
 
     /** determine if we will *allow* methods to be viewable.
      * this flag is often used to toggle autogeneration of accessor
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/assocpage.h #725962:725963
@@ -16,7 +16,6 @@
 #include <qwidget.h>
 #include <q3groupbox.h>
 #include <q3listbox.h>
-#include <q3ptrlist.h>
 
 #include "../umlobject.h"
 #include "../umlview.h"
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/codegenerationwizard.h #725962:725963
@@ -22,7 +22,6 @@
 #define CODEGENERATIONWIZARD_H
 
 #include <qwidget.h>
-#include <q3ptrlist.h>
 #include "ui_codegenerationwizardbase.h"
 #include "settingsdlg.h"
 #include "../umlclassifierlist.h"
--- trunk/KDE/kdesdk/umbrello/umbrello/dialogs/pkgcontentspage.h #725962:725963
@@ -15,7 +15,6 @@
 #include <qwidget.h>
 #include <q3groupbox.h>
 #include <q3listbox.h>
-#include <q3ptrlist.h>
 
 #include "../package.h"
 #include "../listpopupmenu.h"
--- trunk/KDE/kdesdk/umbrello/umbrello/hierarchicalcodeblock.cpp #725962:725963
@@ -219,8 +219,7 @@
     {
         CodeClassField * field = *it;
         CodeAccessorMethodList list = field->getMethodList();
-        CodeAccessorMethod * method;
-        for (CodeAccessorMethodListIt it(list); (method = it.current()) != NULL; ++it)
+        Q_FOREACH( CodeAccessorMethod *method, list )
         {
             QString tag = method->getTag();
             if(tag.isEmpty())
--- trunk/KDE/kdesdk/umbrello/umbrello/import_rose.cpp #725962:725963
@@ -15,7 +15,6 @@
 // qt includes
 #include <qstring.h>
 #include <qtextstream.h>
-#include <q3ptrlist.h>
 #include <qstringlist.h>
 #include <qregexp.h>
 #include <qmessagebox.h>
@@ -28,8 +27,6 @@
 
 namespace Import_Rose {
 
-typedef Q3PtrList<PetalNode> PetalNodeList;
-
 uint nClosures; // Multiple closing parentheses may appear on a single
                 // line. The parsing is done line-by-line and using
                 // recursive descent. This means that we can only handle




More information about the umbrello-devel mailing list