]> Git trees. - libqmvoc.git/commitdiff
* Remove strange code and Qt4-ify it
authorCarsten Niehaus <cniehaus@gmx.de>
Thu, 19 Oct 2006 17:09:45 +0000 (17:09 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Thu, 19 Oct 2006 17:09:45 +0000 (17:09 +0000)
* One leak less (in the parser)
* one more qDebugAll

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=597227

kdeeduui/kdeeduglossary.cpp
libscience/moleculeparser.cpp
libscience/moleculeparser.h

index 952a06fc48cbb6719d4a32d6b626306c3d63c90e..0b991fa2606dd9cd80cc369b5f50cea2f6cd8ebe 100644 (file)
@@ -44,10 +44,7 @@ Glossary::Glossary()
 
 Glossary::~Glossary()
 {
-    foreach ( GlossaryItem * item, m_itemlist ) {
-        delete item;
-        item = 0;
-    }
+    qDeleteAll(m_itemlist);
 }
 
 void Glossary::init( const KUrl& url, const QString& path )
index 614cbb8ff664063135d41b65171a5fdc716a65af..f56576395909553385e785d8206e1a86a832e2f7 100644 (file)
@@ -87,11 +87,9 @@ ElementCountMap::add(Element *_element, int _count)
 void
 ElementCountMap::multiply(int _factor)
 {
-       Iterator  it    = begin();
-       Iterator  itEnd = end();
-
-       for (; it != itEnd; ++it)
-               (*it)->multiply(_factor);
+  foreach (ElementCount * count, m_map) {
+      count->multiply(_factor);
+  }
 }
 
 
@@ -114,7 +112,7 @@ MoleculeParser::MoleculeParser(const QString& _str)
 
 MoleculeParser::~MoleculeParser()
 {
-    //Parser::~Parser();
+    qDeleteAll(m_elementList);
 }
 
 
index 3b39a21c5f2a73c4140c6e5ab1748cd88506fc9f..2f07e3bca314c275f27d4021bcf54dfe5bd41869 100644 (file)
@@ -104,7 +104,9 @@ class EDUSCIENCE_EXPORT ElementCountMap
                /**
                 * Clear the map of ElementCount pointers
                 */
-               void  clear()          { m_map.clear(); }
+               void  clear(){ 
+        m_map.clear(); 
+    }
 
                /**
                 * @param _element the searched Element
@@ -135,20 +137,9 @@ class EDUSCIENCE_EXPORT ElementCountMap
                 */
                void           multiply(int _factor);
 
-               /**
-                * typedef
-                */
-               typedef QList<ElementCount*>::Iterator  Iterator;
-
-               /**
-                *
-                */
-               Iterator   begin() { return  m_map.begin(); }
-
-               /**
-                *
-                */
-               Iterator   end()   { return  m_map.end();   }
+               QList<ElementCount*>  map(){
+        return m_map;
+    }
 
        private:
                QList<ElementCount*>  m_map;