From e0b5ca79233a7dd03bba3be118e36572ca7f41f0 Mon Sep 17 00:00:00 2001 From: Joshua Scott Date: Tue, 3 Apr 2018 17:02:30 +0100 Subject: [PATCH] protocol: Add override specifier I thought final implied it --- include/ki/protocol/Packet.h | 8 +-- include/ki/protocol/control/ClientHello.h | 8 +-- include/ki/protocol/control/Ping.h | 76 +++++++++++------------ include/ki/protocol/control/ServerHello.h | 8 +-- include/ki/protocol/dml/Message.h | 8 +-- 5 files changed, 54 insertions(+), 54 deletions(-) diff --git a/include/ki/protocol/Packet.h b/include/ki/protocol/Packet.h index f49a8cd..e877c8b 100644 --- a/include/ki/protocol/Packet.h +++ b/include/ki/protocol/Packet.h @@ -9,7 +9,7 @@ namespace ki { namespace protocol { - class Packet : public util::Serializable + class Packet final : public util::Serializable { public: Packet(bool control = false, uint8_t opcode = 0); @@ -45,9 +45,9 @@ namespace protocol return data; } - virtual void write_to(std::ostream &ostream) const final; - virtual void read_from(std::istream &istream) final; - virtual size_t get_size() const final; + void write_to(std::ostream &ostream) const override final; + void read_from(std::istream &istream) override final; + size_t get_size() const override final; private: bool m_control; uint8_t m_opcode; diff --git a/include/ki/protocol/control/ClientHello.h b/include/ki/protocol/control/ClientHello.h index ee00b66..05b96ec 100644 --- a/include/ki/protocol/control/ClientHello.h +++ b/include/ki/protocol/control/ClientHello.h @@ -11,7 +11,7 @@ namespace protocol { namespace control { - class ClientHello : public util::Serializable + class ClientHello final : public util::Serializable { public: ClientHello(uint16_t session_id = 0, @@ -27,9 +27,9 @@ namespace control uint32_t get_milliseconds() const; void set_milliseconds(uint32_t milliseconds); - void write_to(std::ostream &ostream) const final; - void read_from(std::istream &istream) final; - size_t get_size() const final; + void write_to(std::ostream &ostream) const override final; + void read_from(std::istream &istream) override final; + size_t get_size() const override final; static Packet *create_packet(uint16_t session_id = 0, uint64_t timestamp = 0, uint32_t milliseconds = 0) diff --git a/include/ki/protocol/control/Ping.h b/include/ki/protocol/control/Ping.h index dff0ed9..494e38c 100644 --- a/include/ki/protocol/control/Ping.h +++ b/include/ki/protocol/control/Ping.h @@ -6,45 +6,45 @@ namespace ki { - namespace protocol +namespace protocol +{ +namespace control +{ + class Ping final : public util::Serializable { - namespace control + public: + Ping(uint16_t session_id = 0, + uint16_t milliseconds = 0, uint8_t minutes = 0); + virtual ~Ping() = default; + + uint16_t get_session_id() const; + void set_session_id(uint16_t session_id); + + uint16_t get_milliseconds() const; + void set_milliseconds(uint16_t milliseconds); + + uint8_t get_minutes() const; + void set_minutes(uint8_t minutes); + + void write_to(std::ostream &ostream) const override final; + void read_from(std::istream &istream) override final; + size_t get_size() const override final; + + static Packet *create_packet(uint16_t session_id = 0, + uint16_t milliseconds = 0, uint8_t minutes = 0, + bool response = false) { - class Ping : public util::Serializable - { - public: - Ping(uint16_t session_id = 0, - uint16_t milliseconds = 0, uint8_t minutes = 0); - virtual ~Ping() = default; - - uint16_t get_session_id() const; - void set_session_id(uint16_t session_id); - - uint16_t get_milliseconds() const; - void set_milliseconds(uint16_t milliseconds); - - uint8_t get_minutes() const; - void set_minutes(uint8_t minutes); - - void write_to(std::ostream &ostream) const final; - void read_from(std::istream &istream) final; - size_t get_size() const final; - - static Packet *create_packet(uint16_t session_id = 0, - uint16_t milliseconds = 0, uint8_t minutes = 0, - bool response = false) - { - Ping data(session_id, milliseconds, minutes); - auto *packet = new Packet(true, - (uint8_t)(response ? Opcode::PING_RSP : Opcode::PING)); - packet->set_payload_data(data); - return packet; - } - private: - uint16_t m_session_id; - uint16_t m_milliseconds; - uint8_t m_minutes; - }; + Ping data(session_id, milliseconds, minutes); + auto *packet = new Packet(true, + (uint8_t)(response ? Opcode::PING_RSP : Opcode::PING)); + packet->set_payload_data(data); + return packet; } - } + private: + uint16_t m_session_id; + uint16_t m_milliseconds; + uint8_t m_minutes; + }; +} +} } diff --git a/include/ki/protocol/control/ServerHello.h b/include/ki/protocol/control/ServerHello.h index 2c0d50e..123a7b6 100644 --- a/include/ki/protocol/control/ServerHello.h +++ b/include/ki/protocol/control/ServerHello.h @@ -11,7 +11,7 @@ namespace protocol { namespace control { - class ServerHello : public util::Serializable + class ServerHello final : public util::Serializable { public: ServerHello(uint16_t session_id = 0, @@ -27,9 +27,9 @@ namespace control uint32_t get_milliseconds() const; void set_milliseconds(uint32_t milliseconds); - void write_to(std::ostream &ostream) const final; - void read_from(std::istream &istream) final; - size_t get_size() const final; + void write_to(std::ostream &ostream) const override final; + void read_from(std::istream &istream) override final; + size_t get_size() const override final; static Packet *create_packet(uint16_t session_id = 0, uint64_t timestamp = 0, uint32_t milliseconds = 0) diff --git a/include/ki/protocol/dml/Message.h b/include/ki/protocol/dml/Message.h index 397b848..4709198 100644 --- a/include/ki/protocol/dml/Message.h +++ b/include/ki/protocol/dml/Message.h @@ -9,7 +9,7 @@ namespace protocol { namespace dml { - class Message : public util::Serializable + class Message final : public util::Serializable { public: Message(uint8_t service_id = 0, uint8_t type = 0); @@ -25,9 +25,9 @@ namespace dml const ki::dml::Record &get_record() const; void set_record(const ki::dml::Record &record); - void write_to(std::ostream &ostream) const final; - void read_from(std::istream &istream) final; - size_t get_size() const final; + void write_to(std::ostream &ostream) const override final; + void read_from(std::istream &istream) override final; + size_t get_size() const override final; private: uint8_t m_service_id; uint8_t m_type;