indent with tabs

This commit is contained in:
2023-01-02 13:05:43 +01:00
parent 8f95b1a750
commit 222b79b40a
100 changed files with 4783 additions and 4781 deletions

View File

@@ -4,33 +4,33 @@ namespace td {
namespace protocol {
void PacketDispatcher::RegisterHandler(PacketType type, PacketHandler* handler) {
auto found = std::find(m_Handlers[type].begin(), m_Handlers[type].end(), handler);
if (found == m_Handlers[type].end())
m_Handlers[type].push_back(handler);
auto found = std::find(m_Handlers[type].begin(), m_Handlers[type].end(), handler);
if (found == m_Handlers[type].end())
m_Handlers[type].push_back(handler);
}
void PacketDispatcher::UnregisterHandler(PacketType type, PacketHandler* handler) {
auto found = std::find(m_Handlers[type].begin(), m_Handlers[type].end(), handler);
if (found != m_Handlers[type].end())
m_Handlers[type].erase(found);
auto found = std::find(m_Handlers[type].begin(), m_Handlers[type].end(), handler);
if (found != m_Handlers[type].end())
m_Handlers[type].erase(found);
}
void PacketDispatcher::UnregisterHandler(PacketHandler* handler) {
for (auto& pair : m_Handlers) {
if (pair.second.empty()) continue;
for (auto& pair : m_Handlers) {
if (pair.second.empty()) continue;
PacketType type = pair.first;
PacketType type = pair.first;
m_Handlers[type].erase(std::remove(m_Handlers[type].begin(), m_Handlers[type].end(), handler), m_Handlers[type].end());
}
m_Handlers[type].erase(std::remove(m_Handlers[type].begin(), m_Handlers[type].end(), handler), m_Handlers[type].end());
}
}
void PacketDispatcher::Dispatch(const PacketPtr& packet) {
if (!packet) return;
if (!packet) return;
PacketType type = packet->GetType();
for (PacketHandler* handler : m_Handlers[type])
packet->Dispatch(handler);
PacketType type = packet->GetType();
for (PacketHandler* handler : m_Handlers[type])
packet->Dispatch(handler);
}
} // namespace protocol