mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-23 20:14:05 +00:00
opt: smells (#1721)
* opt: remove code smell for loop should avoid change the iterators * opt: remove code smell for loop should avoid change the iterators
This commit is contained in:
parent
388924033a
commit
65ae8f5030
|
@ -282,20 +282,16 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor( QString const &
|
|||
bool ignoreDiacritics ) const
|
||||
{
|
||||
if ( !dictIDs.isEmpty() ) {
|
||||
QStringList ids = dictIDs;
|
||||
std::vector< sptr< Dictionary::Class > > ftsDicts;
|
||||
std::vector< sptr< Dictionary::Class > > dicts;
|
||||
|
||||
// Find dictionaries by ID's
|
||||
for ( unsigned x = 0; x < dictionaries.size(); x++ ) {
|
||||
for ( QStringList::Iterator it = ids.begin(); it != ids.end(); ++it ) {
|
||||
if ( *it == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
|
||||
ftsDicts.push_back( dictionaries[ x ] );
|
||||
ids.erase( it );
|
||||
for ( const auto & dictId : dictIDs ) {
|
||||
for ( unsigned x = 0; x < dictionaries.size(); x++ ) {
|
||||
if ( dictId == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
|
||||
dicts.push_back( dictionaries[ x ] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ids.isEmpty() )
|
||||
break;
|
||||
}
|
||||
|
||||
string header = makeHtmlHeader( word, QString(), true );
|
||||
|
@ -303,7 +299,7 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor( QString const &
|
|||
return std::make_shared< ArticleRequest >( word,
|
||||
Instances::Group{ groupId, "" },
|
||||
contexts,
|
||||
ftsDicts,
|
||||
dicts,
|
||||
header,
|
||||
-1,
|
||||
true );
|
||||
|
|
Loading…
Reference in a new issue