Botcraft 1.21.4
Loading...
Searching...
No Matches
BaseMessage.hpp
Go to the documentation of this file.
1#pragma once
2
4
5namespace ProtocolCraft
6{
7 class Handler;
8
9 template<typename TDerived>
10 class BaseMessage : public Message
11 {
12 public:
13 virtual ~BaseMessage() override {};
14
15 virtual int GetId() const override;
16 virtual std::string_view GetName() const override { return TDerived::packet_name; }
17#ifdef PROTOCOLCRAFT_DETAILED_PARSING
18 virtual std::shared_ptr<Message> CopyTypeOnly() const override { return std::make_shared<TDerived>(); }
19#endif
20
21 protected:
22 // We can't have definition in hpp file as Handler is still an incomplete class at this point
23 virtual void DispatchImpl(Handler* handler) override;
24
25 // Convenience to access "current" class when implementing TDerived
26 using THIS = TDerived;
27 };
28}
virtual int GetId() const override
virtual void DispatchImpl(Handler *handler) override
virtual ~BaseMessage() override
virtual std::string_view GetName() const override