[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/kdevelop/3.4/languages/cpp
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2007-01-20 15:27:04
Message-ID: 1169306824.524237.9908.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 625617 by zwabel:

make the removal of problems from the problem-list efficient, using the already \
available EfficientKListView. Parsing used to become extremely slow with a long \
problem-list, because a linear search over all problems was done when removing all \
problems of a file.

 M  +7 -12     problemreporter.cpp  
 M  +1 -4      problemreporter.h  


--- branches/kdevelop/3.4/languages/cpp/problemreporter.cpp #625616:625617
@@ -244,16 +244,14 @@
 	initCurrentList();
 }
 
-void ProblemReporter::removeAllItems( QListView* listview, const QString& filename )
-{
-	QListViewItem* current = listview->firstChild();
-	while( current ){
-		QListViewItem* i = current;
-		current = current->nextSibling();
-
-		if( i->text(0) == filename )
-			delete( i );
+void EfficientKListView::removeAllItems( const QString& str ) {
+	std::pair<Map::iterator, Map::iterator> p = m_map.equal_range( str );
+	
+	for( Map::iterator it = p.first; it != p.second; ++it ) {
+		m_list->removeItem( (*p.first).second );
 	}
+
+	m_map.erase( p.first, p.second );
 }
 
 void ProblemReporter::removeAllProblems( const QString& filename )
@@ -262,9 +260,6 @@
 	
 	kdDebug(9007) << "ProblemReporter::removeAllProblems()" << relFileName << endl;
 
-	removeAllItems( m_errorList, relFileName );
-	removeAllItems( m_fixmeList, relFileName );
-	removeAllItems( m_todoList, relFileName );
 	m_errorList.removeAllItems( relFileName );
 	m_fixmeList.removeAllItems( relFileName );
 	m_todoList.removeAllItems( relFileName );
--- branches/kdevelop/3.4/languages/cpp/problemreporter.h #625616:625617
@@ -70,9 +70,7 @@
         return m_map.equal_range( str );
     }
     
-    void removeAllItems( const QString& str ) {
-        m_map.erase( str );
-    }
+    void removeAllItems( const QString& str );
     
     bool hasItem( const QString& str ) const {
         Map::const_iterator it = m_map.find( str );
@@ -118,7 +116,6 @@
 	QString levelToString( int level ) const;
 	int levelToMarkType( int level ) const;
 	void InitListView( KListView* listview );
-	void removeAllItems( QListView* listview, const QString& filename );
 	void filterList( KListView* listview, const QString& level );
     void updateCurrentWith( EfficientKListView& listview, const QString& level, \
const QString& filename );  void initCurrentList();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic