mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 14:45:14 +00:00
Simplified ranges::find_if with ranges::any_of and ranges::none_of.
This commit is contained in:
@@ -205,7 +205,7 @@ void AppendLegacySuggestions(
|
||||
&& (ch != '-')
|
||||
&& (ch != '+');
|
||||
};
|
||||
if (ranges::find_if(query, badSuggestionChar) != query.end()) {
|
||||
if (ranges::any_of(query, badSuggestionChar)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -101,8 +101,7 @@ auto SuggestionsWidget::getRowsByQuery() const -> std::vector<Row> {
|
||||
return false;
|
||||
}
|
||||
// Suggest :D and :-P only as exact matches.
|
||||
return ranges::find_if(_query, [](QChar ch) { return ch.isLower(); })
|
||||
== _query.end();
|
||||
return ranges::none_of(_query, [](QChar ch) { return ch.isLower(); });
|
||||
}();
|
||||
const auto exact = !middle || simple;
|
||||
const auto list = Core::App().emojiKeywords().query(real, exact);
|
||||
|
@@ -119,9 +119,9 @@ void EnsurePath() {
|
||||
}
|
||||
|
||||
bool IsGoodPartName(const QString &name) {
|
||||
return ranges::find_if(kDictExtensions, [&](const auto &ext) {
|
||||
return ranges::any_of(kDictExtensions, [&](const auto &ext) {
|
||||
return name.endsWith(ext);
|
||||
}) != end(kDictExtensions);
|
||||
});
|
||||
}
|
||||
|
||||
using DictLoaderPtr = std::shared_ptr<base::unique_qptr<DictLoader>>;
|
||||
@@ -268,11 +268,10 @@ bool DictionaryExists(int langId) {
|
||||
return true;
|
||||
}
|
||||
const auto folder = DictPathByLangId(langId) + '/';
|
||||
const auto bad = ranges::find_if(kDictExtensions, [&](const auto &ext) {
|
||||
return ranges::none_of(kDictExtensions, [&](const auto &ext) {
|
||||
const auto name = Spellchecker::LocaleFromLangId(langId).name();
|
||||
return !QFile(folder + name + '.' + ext).exists();
|
||||
});
|
||||
return (bad == end(kDictExtensions));
|
||||
}
|
||||
|
||||
bool RemoveDictionary(int langId) {
|
||||
|
Reference in New Issue
Block a user