mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
Use std::sort in suitable places
This commit is contained in:
parent
73ec1b5950
commit
278c143a05
|
@ -1418,7 +1418,7 @@ void BtreeIndex::getHeadwordsFromOffsets( QList<uint32_t> & offsets,
|
|||
uint32_t nextLeaf = 0;
|
||||
uint32_t leafEntries;
|
||||
|
||||
qSort( offsets );
|
||||
std::sort( offsets.begin(), offsets.end() );
|
||||
|
||||
Mutex::Lock _( *idxFileMutex );
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
#include <QVector>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
|
@ -195,7 +196,7 @@ public:
|
|||
// Default - simple sorting in increase order
|
||||
virtual void sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets,
|
||||
QAtomicInt & isCancelled )
|
||||
{ Q_UNUSED( isCancelled ); qSort( offsets ); }
|
||||
{ Q_UNUSED( isCancelled ); std::sort( offsets.begin(), offsets.end() ); }
|
||||
|
||||
/// Called before each matching operation to ensure that any child init
|
||||
/// has completed. Mainly used for deferred init. The default implementation
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <QMessageBox>
|
||||
#include <QtAlgorithms>
|
||||
#include <QMap>
|
||||
#include <algorithm>
|
||||
|
||||
#include "favoritespanewidget.hh"
|
||||
#include "gddebug.hh"
|
||||
|
@ -906,7 +907,7 @@ void FavoritesModel::removeItemsForIndexes( const QModelIndexList & idxList )
|
|||
for( int i = lowestLevel; i >= 0; i-- )
|
||||
{
|
||||
QModelIndexList idxSublist = itemsToDelete[ i ];
|
||||
qSort( idxSublist.begin(), idxSublist.end(), qGreater< QModelIndex >() );
|
||||
std::sort( idxSublist.begin(), idxSublist.end(), qGreater< QModelIndex >() );
|
||||
|
||||
it = idxSublist.begin();
|
||||
for( ; it != idxSublist.end(); ++it )
|
||||
|
|
|
@ -665,7 +665,7 @@ Q_UNUSED( parent );
|
|||
}
|
||||
|
||||
headwords.append( temp );
|
||||
qSort( headwords );
|
||||
std::sort( headwords.begin(), headwords.end() );
|
||||
|
||||
endResetModel();
|
||||
emit contentChanged();
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
#include <QDockWidget>
|
||||
#include <QKeyEvent>
|
||||
#include <QClipboard>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
#include "historypanewidget.hh"
|
||||
|
||||
|
@ -137,7 +139,7 @@ void HistoryPaneWidget::deleteSelectedItems()
|
|||
|
||||
// Need to sort indexes in the decreasing order so that
|
||||
// the first deletions won't affect the indexes for subsequent deletions.
|
||||
qSort( idxsToDelete.begin(), idxsToDelete.end(), qGreater<int>() );
|
||||
std::sort( idxsToDelete.begin(), idxsToDelete.end(), std::greater<int>() );
|
||||
|
||||
QListIterator<int> idxs( idxsToDelete );
|
||||
while ( idxs.hasNext() )
|
||||
|
|
3
slob.cc
3
slob.cc
|
@ -43,6 +43,7 @@
|
|||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Slob {
|
||||
|
||||
|
@ -414,7 +415,7 @@ const SlobFile::RefOffsetsVector & SlobFile::getSortedRefOffsets()
|
|||
refsOffsetVector.append( RefEntryOffsetItem( base + qFromBigEndian( tmp ), i ) );
|
||||
}
|
||||
|
||||
qSort( refsOffsetVector );
|
||||
std::sort( refsOffsetVector.begin(), refsOffsetVector.end() );
|
||||
return refsOffsetVector;
|
||||
}
|
||||
QString error = fileName + ": " + file.errorString();
|
||||
|
|
7
zim.cc
7
zim.cc
|
@ -42,6 +42,7 @@
|
|||
#include <string>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Zim {
|
||||
|
||||
|
@ -290,7 +291,7 @@ bool ZimFile::open()
|
|||
for( quint32 i = 0; i < zimHeader.clusterCount; i++ )
|
||||
clusterOffsets[ i ] = QPair< quint64, quint32 >( offs.at( i ), i );
|
||||
|
||||
qSort( clusterOffsets );
|
||||
std::sort( clusterOffsets.begin(), clusterOffsets.end() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1027,7 +1028,7 @@ void ZimDictionary::makeFTSIndex( QAtomicInt & isCancelled, bool firstIteration
|
|||
if( Qt4x5::AtomicInt::loadAcquire( isCancelled ) )
|
||||
throw exUserAbort();
|
||||
|
||||
qSort( offsetsWithClusters );
|
||||
std::sort( offsetsWithClusters.begin(), offsetsWithClusters.end() );
|
||||
|
||||
QVector< uint32_t > offsets;
|
||||
offsets.resize( offsetsWithClusters.size() );
|
||||
|
@ -1134,7 +1135,7 @@ void ZimDictionary::sortArticlesOffsetsForFTS( QVector< uint32_t > & offsets,
|
|||
offsetsWithClusters.append( QPair< uint32_t, quint32 >( getArticleCluster( df, *it ), *it ) );
|
||||
}
|
||||
|
||||
qSort( offsetsWithClusters );
|
||||
std::sort( offsetsWithClusters.begin(), offsetsWithClusters.end() );
|
||||
|
||||
for( int i = 0; i < offsetsWithClusters.size(); i++ )
|
||||
offsets[ i ] = offsetsWithClusters.at( i ).second;
|
||||
|
|
Loading…
Reference in a new issue