From 372b97ff31270f84da06b2a8e3929749e32a4ba6 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 4 May 2006 19:22:17 +0000 Subject: [PATCH] some more speedness and removing return temporary issues, one of them CID: 1760 svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=537421 --- kdeeducore/leitnersystem.cpp | 15 +++++++++------ kdeeducore/leitnersystem.h | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/kdeeducore/leitnersystem.cpp b/kdeeducore/leitnersystem.cpp index 0a55bf4..c196c4e 100644 --- a/kdeeducore/leitnersystem.cpp +++ b/kdeeducore/leitnersystem.cpp @@ -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::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++ ) { diff --git a/kdeeducore/leitnersystem.h b/kdeeducore/leitnersystem.h index 95a953a..0b670ed 100644 --- a/kdeeducore/leitnersystem.h +++ b/kdeeducore/leitnersystem.h @@ -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" -- 2.47.3