1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 21:03:13 +02:00

Start migrating to range-based for loops.

This commit is contained in:
Sadie Powell
2023-10-10 21:14:50 +01:00
parent dc371aad6d
commit a3241065c5
146 changed files with 1157 additions and 1459 deletions
+11 -9
View File
@@ -34,32 +34,34 @@ namespace SQL
std::set<Anope::string> KeySet() const override
{
std::set<Anope::string> keys;
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
keys.insert(it->first);
for (const auto &[key, _] : this->data)
keys.insert(key);
return keys;
}
size_t Hash() const override
{
size_t hash = 0;
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
if (!it->second->str().empty())
hash ^= Anope::hash_cs()(it->second->str());
for (const auto &[_, value] : this->data)
{
if (!value->str().empty())
hash ^= Anope::hash_cs()(value->str());
}
return hash;
}
std::map<Anope::string, std::iostream *> GetData() const
{
std::map<Anope::string, std::iostream *> d;
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
d[it->first] = it->second;
for (const auto &[key, value] : this->data)
d[key] = value;
return d;
}
void Clear()
{
for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
delete it->second;
for (const auto &[_, value] : this->data)
delete value;
this->data.clear();
}