addMatchesTo() -> moveMatchesTo() (move is better than copy)

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=800650
This commit is contained in:
Davide Bettio 2008-04-24 15:37:12 +00:00
parent 2127d62ae6
commit 8418bb6fc7
3 changed files with 6 additions and 6 deletions

View File

@ -136,7 +136,7 @@ void AbstractRunner::performMatch( Plasma::SearchContext &globalContext )
}
//If matches were not added, delete items on the heap
if (localContext.addMatchesTo(globalContext) &&
if (localContext.moveMatchesTo(globalContext) &&
slowed && runtime < fastEnoughTime) {
++d->fastRuns;

View File

@ -279,9 +279,9 @@ bool SearchContext::addMatch(const QString &term, SearchMatch *match)
return true;
}
bool SearchContext::addMatchesTo(SearchContext &other)
bool SearchContext::moveMatchesTo(SearchContext &other)
{
//NOTE: we have addMatchesTo instead of the more 'natural' addMatches
//NOTE: we have moveMatchesTo instead of the more 'natural' addMatches
// because we can get away with one write lock on the local object
// this way, otherwise we'd need to lock once for searchTerm, once
// for matches() and again for clearMatches() (2 read, one write)

View File

@ -141,14 +141,14 @@ class PLASMA_EXPORT SearchContext : public QObject
bool addMatch(const QString &term, SearchMatch *match);
/**
* Takes the matches from this SearchContext and adds to them another.
* Takes the matches from this SearchContext and copies to them another.
* If successful, the matches are removed from this SearchContext and
* ownership passed to the other SearchContext
*
* @arg other the SearchContext to add this object's Matches to
* @arg other the SearchContext to move this object's Matches to
* @return true if matches were added, false if matches were e.g. outdated
*/
bool addMatchesTo(SearchContext &other);
bool moveMatchesTo(SearchContext &other);
/**
* Retrieves all available matches for the current search term.