mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +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
|
bool ignoreDiacritics ) const
|
||||||
{
|
{
|
||||||
if ( !dictIDs.isEmpty() ) {
|
if ( !dictIDs.isEmpty() ) {
|
||||||
QStringList ids = dictIDs;
|
std::vector< sptr< Dictionary::Class > > dicts;
|
||||||
std::vector< sptr< Dictionary::Class > > ftsDicts;
|
|
||||||
|
|
||||||
// Find dictionaries by ID's
|
// Find dictionaries by ID's
|
||||||
for ( unsigned x = 0; x < dictionaries.size(); x++ ) {
|
for ( const auto & dictId : dictIDs ) {
|
||||||
for ( QStringList::Iterator it = ids.begin(); it != ids.end(); ++it ) {
|
for ( unsigned x = 0; x < dictionaries.size(); x++ ) {
|
||||||
if ( *it == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
|
if ( dictId == QString::fromStdString( dictionaries[ x ]->getId() ) ) {
|
||||||
ftsDicts.push_back( dictionaries[ x ] );
|
dicts.push_back( dictionaries[ x ] );
|
||||||
ids.erase( it );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( ids.isEmpty() )
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string header = makeHtmlHeader( word, QString(), true );
|
string header = makeHtmlHeader( word, QString(), true );
|
||||||
|
@ -303,7 +299,7 @@ sptr< Dictionary::DataRequest > ArticleMaker::makeDefinitionFor( QString const &
|
||||||
return std::make_shared< ArticleRequest >( word,
|
return std::make_shared< ArticleRequest >( word,
|
||||||
Instances::Group{ groupId, "" },
|
Instances::Group{ groupId, "" },
|
||||||
contexts,
|
contexts,
|
||||||
ftsDicts,
|
dicts,
|
||||||
header,
|
header,
|
||||||
-1,
|
-1,
|
||||||
true );
|
true );
|
||||||
|
|
Loading…
Reference in a new issue