diff --git a/td/telegram/logevent/LogEvent.h b/td/telegram/logevent/LogEvent.h index e8f5195c2..980571b4f 100644 --- a/td/telegram/logevent/LogEvent.h +++ b/td/telegram/logevent/LogEvent.h @@ -136,12 +136,6 @@ int32 magic(EventT &event) { return static_cast(event.get_type()); } -template -void store(const EventT &event, StorerT &storer) { - EventT::downcast_call(event.get_type(), - [&](auto *ptr) { static_cast &>(event).store(storer); }); -} - template Result> from_parser(T &&parser) { auto version = parser.fetch_int(); @@ -163,11 +157,6 @@ Result> from_parser(T &&parser) { return Status::Error(PSLICE() << "Unknown SecretChatEvent type: " << format::as_hex(magic)); } -template -Result> from_buffer_slice(BufferSlice slice) { - return from_parser(WithVersion>{&slice}); -} - template class StorerImpl final : public Storer { public: @@ -199,18 +188,6 @@ class StorerImpl final : public Storer { } // namespace detail -template -class LogEventBase : public LogEvent { - public: - template - void store(StorerT &storer) const { - detail::store(static_cast(*this), storer); - } - static Result> from_buffer_slice(BufferSlice slice) { - return detail::from_buffer_slice(std::move(slice)); - } -}; - class LogEventParser final : public WithVersion> { public: explicit LogEventParser(Slice data) : WithVersion>(data) { diff --git a/td/telegram/logevent/SecretChatEvent.h b/td/telegram/logevent/SecretChatEvent.h index 128070151..dfb0ed300 100644 --- a/td/telegram/logevent/SecretChatEvent.h +++ b/td/telegram/logevent/SecretChatEvent.h @@ -6,7 +6,11 @@ // #pragma once +#include "td/telegram/Global.h" #include "td/telegram/logevent/LogEvent.h" +#include "td/telegram/secret_api.h" +#include "td/telegram/telegram_api.h" +#include "td/telegram/UserId.h" #include "td/actor/PromiseFuture.h" @@ -15,15 +19,14 @@ #include "td/utils/format.h" #include "td/utils/StringBuilder.h" #include "td/utils/tl_helpers.h" +#include "td/utils/tl_parsers.h" -#include "td/telegram/secret_api.h" -#include "td/telegram/telegram_api.h" -#include "td/telegram/UserId.h" +#include namespace td { namespace log_event { -class SecretChatEvent : public LogEventBase { +class SecretChatEvent : public LogEvent { public: // append only enum enum class Type : int32 { @@ -41,6 +44,16 @@ class SecretChatEvent : public LogEventBase { template static void downcast_call(Type type, F &&f); + + template + void store(StorerT &storer) const { + downcast_call(get_type(), + [&](auto *ptr) { static_cast *>(this)->store(storer); }); + } + + static Result> from_buffer_slice(BufferSlice slice) { + return detail::from_parser(WithVersion>{&slice}); + } }; template