]> Git trees. - libqmvoc.git/commitdiff
some more speedness and removing return temporary issues, one of them CID: 1760
authorAlbert Astals Cid <tsdgeos@terra.es>
Thu, 4 May 2006 19:22:17 +0000 (19:22 +0000)
committerAlbert Astals Cid <tsdgeos@terra.es>
Thu, 4 May 2006 19:22:17 +0000 (19:22 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=537421

kdeeducore/leitnersystem.cpp
kdeeducore/leitnersystem.h

index 0a55bf4e18a8a4c552d2574b89f98fc7d34de7c1..c196c4e00a71faaf1d448a43a52787c851b07550 100644 (file)
@@ -34,7 +34,7 @@ QStringList LeitnerSystem::getBoxNameList()
 {
        QStringList boxNameList;
 
-       foreach( LeitnerBox box, m_boxes )
+       foreach( const LeitnerBox &box, m_boxes )
                boxNameList.append( box.boxName() );
        
        return boxNameList;
@@ -50,12 +50,15 @@ LeitnerBox* LeitnerSystem::boxWithNumber( int number )
        return &m_boxes[ number ];
 }
 
-LeitnerBox* LeitnerSystem::boxWithName( const QString& name ) const
+LeitnerBox* LeitnerSystem::boxWithName( const QString& name )
 {
-       foreach( LeitnerBox box, m_boxes )
+       QList<LeitnerBox>::iterator it, it2;
+       it = m_boxes.begin();
+       it2 = m_boxes.end();
+       for ( ; it != it2; ++it)
        {
-               if ( box.boxName() == name )
-                       return &box;
+               if ( (*it).boxName() == name )
+                       return &(*it);
        }
 
        return 0;
@@ -66,7 +69,7 @@ QString& LeitnerSystem::systemName()
        return m_systemName;
 }
 
-const QString& LeitnerSystem::nextBox( QString& previousBox )
+QString LeitnerSystem::nextBox( QString& previousBox )
 {
        for( int i = 0; i < m_boxes.count(); i++ )
        {
index 95a953ad3071dc72afd39eaffb9e5b03b5167c89..0b670edbf45f3a575593d6d462fffa9785ad010d 100644 (file)
@@ -69,7 +69,7 @@ public:
         * @return a pointer to the LeitnerBox with the name,
         *         or 0 if no such box exists.
         */
-       LeitnerBox* boxWithName( const QString& name ) const;
+       LeitnerBox* boxWithName( const QString& name );
 
        /**Returns the number of the given LeitnerBox
         * @param box a pointer to the LeitnerBox
@@ -87,7 +87,7 @@ public:
         * @param previousBox the name of the LeitnerBox
         * @return the name of the LeitnerBox following previousBox
         */
-       const QString& nextBox( QString& previousBox );
+       QString nextBox( QString& previousBox );
 
        const QString& correctBox( int box );   //returns the correct word box of "int box"
        const QString& wrongBox( int box );             //returns the wrong word box of "int box"