From 43d31e73c4b97a37017757232c4ef1db355fee3a Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Sun, 27 Nov 2022 11:56:52 +0200 Subject: [PATCH] Use the override specifier where appropriate --- source/graphics/bmploader.h | 4 ++-- source/graphics/devil/devilloader.h | 6 +++--- source/graphics/errordialog.h | 2 +- source/graphics/imageloader.h | 6 +++--- source/graphics/jpeg/jpegloader.h | 6 +++--- source/graphics/png/pngloader.h | 6 +++--- source/graphics/quartz/quartzloader.h | 6 +++--- source/input/binarycontrol.h | 8 ++++---- source/input/bindings.h | 4 ++-- source/input/gamecontroller.h | 2 +- source/input/gesturedetector.h | 4 ++-- source/input/hub.h | 8 ++++---- source/input/keyboard.h | 4 ++-- source/input/linux/gamecontroller_platform.h | 12 ++++++------ source/input/mouse.h | 5 +++-- source/input/smoothcontrol.h | 8 ++++---- source/input/touchscreen.h | 4 ++-- source/input/windows/gamecontroller_platform.h | 2 +- 18 files changed, 49 insertions(+), 48 deletions(-) diff --git a/source/graphics/bmploader.h b/source/graphics/bmploader.h index 60be2dc..60d4a2e 100644 --- a/source/graphics/bmploader.h +++ b/source/graphics/bmploader.h @@ -19,8 +19,8 @@ public: static unsigned get_signature_size() { return 2; } static bool detect(const std::string &); - virtual void load_headers_(Image::Data &); - virtual void load_pixels_(Image::Data &); + void load_headers_(Image::Data &) override; + void load_pixels_(Image::Data &) override; }; } // namespace Graphics diff --git a/source/graphics/devil/devilloader.h b/source/graphics/devil/devilloader.h index 01c26b1..2a8e28d 100644 --- a/source/graphics/devil/devilloader.h +++ b/source/graphics/devil/devilloader.h @@ -14,13 +14,13 @@ private: public: DevilLoader(IO::Seekable &); - virtual ~DevilLoader(); + ~DevilLoader(); static unsigned get_signature_size() { return 128; } static bool detect(const std::string &); - virtual void load_headers_(Image::Data &); - virtual void load_pixels_(Image::Data &); + void load_headers_(Image::Data &) override; + void load_pixels_(Image::Data &) override; }; } // namespace Graphics diff --git a/source/graphics/errordialog.h b/source/graphics/errordialog.h index 7ece72e..562883c 100644 --- a/source/graphics/errordialog.h +++ b/source/graphics/errordialog.h @@ -16,7 +16,7 @@ private: public: ErrorDialog(Display *d): display(d) { } - virtual bool report_uncaught_exception(const std::exception &) const; + bool report_uncaught_exception(const std::exception &) const override; }; } // namespace Graphics diff --git a/source/graphics/imageloader.h b/source/graphics/imageloader.h index 9a69aca..9645f11 100644 --- a/source/graphics/imageloader.h +++ b/source/graphics/imageloader.h @@ -46,9 +46,9 @@ protected: class RegisteredLoader: public RegisterBase { public: - virtual unsigned get_signature_size() const { return T::get_signature_size(); } - virtual bool detect(const std::string &s) const { return T::detect(s); } - virtual ImageLoader *create(IO::Seekable &io) const { return new T(io); } + unsigned get_signature_size() const override { return T::get_signature_size(); } + bool detect(const std::string &s) const override { return T::detect(s); } + ImageLoader *create(IO::Seekable &io) const override { return new T(io); } }; struct Registry diff --git a/source/graphics/jpeg/jpegloader.h b/source/graphics/jpeg/jpegloader.h index a18d37e..793951a 100644 --- a/source/graphics/jpeg/jpegloader.h +++ b/source/graphics/jpeg/jpegloader.h @@ -15,13 +15,13 @@ private: public: JpegLoader(IO::Seekable &); - virtual ~JpegLoader(); + ~JpegLoader(); static unsigned get_signature_size() { return 3; } static bool detect(const std::string &); - virtual void load_headers_(Image::Data &); - virtual void load_pixels_(Image::Data &); + void load_headers_(Image::Data &) override; + void load_pixels_(Image::Data &) override; }; } // namespace Graphics diff --git a/source/graphics/png/pngloader.h b/source/graphics/png/pngloader.h index 7c9390f..8023b01 100644 --- a/source/graphics/png/pngloader.h +++ b/source/graphics/png/pngloader.h @@ -15,13 +15,13 @@ private: public: PngLoader(IO::Base &, unsigned = 0); - virtual ~PngLoader(); + ~PngLoader(); static unsigned get_signature_size() { return 8; } static bool detect(const std::string &); - virtual void load_headers_(Image::Data &); - virtual void load_pixels_(Image::Data &); + void load_headers_(Image::Data &) override; + void load_pixels_(Image::Data &) override; }; } // namespace Graphics diff --git a/source/graphics/quartz/quartzloader.h b/source/graphics/quartz/quartzloader.h index 3e856a9..2aa0588 100644 --- a/source/graphics/quartz/quartzloader.h +++ b/source/graphics/quartz/quartzloader.h @@ -15,15 +15,15 @@ private: public: QuartzLoader(IO::Seekable &); - virtual ~QuartzLoader(); + ~QuartzLoader(); /* Experimentally found value, works for png and jpeg at least. 8 bytes is not enough for Quartz to recognize png. */ static unsigned get_signature_size() { return 12; } static bool detect(const std::string &); - virtual void load_headers_(Image::Data &); - virtual void load_pixels_(Image::Data &); + void load_headers_(Image::Data &) override; + void load_pixels_(Image::Data &) override; }; } // namespace Graphics diff --git a/source/input/binarycontrol.h b/source/input/binarycontrol.h index ff773b8..e71f4c3 100644 --- a/source/input/binarycontrol.h +++ b/source/input/binarycontrol.h @@ -25,7 +25,7 @@ public: BinaryControl(); BinaryControl(const ControlSource &); BinaryControl(Device &, ControlSrcType, unsigned); - virtual ~BinaryControl(); + ~BinaryControl(); /** Sets the threshold between states for axis sources. No effect on button sources */ @@ -36,9 +36,9 @@ public: bool was_released() const { return falling_edge; } private: - virtual void on_press(); - virtual void on_release(); - virtual void on_motion(float, float); + void on_press() override; + void on_release() override; + void on_motion(float, float) override; }; } // namespace Input diff --git a/source/input/bindings.h b/source/input/bindings.h index 879a516..b5e3a3b 100644 --- a/source/input/bindings.h +++ b/source/input/bindings.h @@ -24,7 +24,7 @@ public: Loader(Bindings &); private: - virtual void init_actions(); + void init_actions() override; void binding(const std::string &); void device_type(DeviceType); @@ -59,7 +59,7 @@ public: Loader(Binding &); private: - virtual void init_actions(); + void init_actions() override; void axis(unsigned, AxisSide); void button(unsigned); diff --git a/source/input/gamecontroller.h b/source/input/gamecontroller.h index 863f66f..19f98d5 100644 --- a/source/input/gamecontroller.h +++ b/source/input/gamecontroller.h @@ -21,7 +21,7 @@ private: public: GameController(unsigned); - virtual ~GameController(); + ~GameController(); static unsigned detect(); static bool is_available(unsigned = 0); diff --git a/source/input/gesturedetector.h b/source/input/gesturedetector.h index 51af312..5f7c4af 100644 --- a/source/input/gesturedetector.h +++ b/source/input/gesturedetector.h @@ -58,8 +58,8 @@ private: public: GestureDetector(Touchscreen &); - virtual std::string get_button_name(unsigned) const; - virtual std::string get_axis_name(unsigned) const; + std::string get_button_name(unsigned) const override; + std::string get_axis_name(unsigned) const override; private: void touch_down(unsigned); diff --git a/source/input/hub.h b/source/input/hub.h index 55d5876..1abff37 100644 --- a/source/input/hub.h +++ b/source/input/hub.h @@ -23,11 +23,11 @@ public: /// Attaches an input device to the hub. void attach(Device &dev); - virtual Device *find_subdevice(DeviceType, unsigned = 0); - virtual Device *find_subdevice(const std::string &); + Device *find_subdevice(DeviceType, unsigned = 0) override; + Device *find_subdevice(const std::string &) override; - virtual std::string get_button_name(unsigned) const; - virtual std::string get_axis_name(unsigned) const; + std::string get_button_name(unsigned) const override; + std::string get_axis_name(unsigned) const override; protected: void button_press(unsigned, unsigned); void button_release(unsigned, unsigned); diff --git a/source/input/keyboard.h b/source/input/keyboard.h index 15fe4f9..30ec39c 100644 --- a/source/input/keyboard.h +++ b/source/input/keyboard.h @@ -23,9 +23,9 @@ private: public: Keyboard(Graphics::Window &); - virtual ~Keyboard(); + ~Keyboard(); - virtual std::string get_button_name(unsigned) const; + std::string get_button_name(unsigned) const override; private: void input_event(const Graphics::Window::Event &); }; diff --git a/source/input/linux/gamecontroller_platform.h b/source/input/linux/gamecontroller_platform.h index 9bc6f58..58313b6 100644 --- a/source/input/linux/gamecontroller_platform.h +++ b/source/input/linux/gamecontroller_platform.h @@ -18,16 +18,16 @@ public: std::string get_name() const; - virtual void set_block(bool) { } - virtual void set_inherit(bool) { } + void set_block(bool) override { } + void set_inherit(bool) override { } protected: - virtual std::size_t do_read(char *, std::size_t); - virtual std::size_t do_write(const char *, std::size_t); + std::size_t do_read(char *, std::size_t) override; + std::size_t do_write(const char *, std::size_t) override; public: - virtual const IO::Handle &get_handle(IO::Mode) { return handle; } - virtual const IO::Handle &get_event_handle() { return handle; } + const IO::Handle &get_handle(IO::Mode) override { return handle; } + const IO::Handle &get_event_handle() override { return handle; } }; diff --git a/source/input/mouse.h b/source/input/mouse.h index 622a783..647da7c 100644 --- a/source/input/mouse.h +++ b/source/input/mouse.h @@ -21,8 +21,9 @@ private: public: Mouse(Graphics::Window &); - virtual std::string get_button_name(unsigned) const; - virtual std::string get_axis_name(unsigned) const; + + std::string get_button_name(unsigned) const override; + std::string get_axis_name(unsigned) const override; private: void input_event(const Graphics::Window::Event &); }; diff --git a/source/input/smoothcontrol.h b/source/input/smoothcontrol.h index f16177b..11744dd 100644 --- a/source/input/smoothcontrol.h +++ b/source/input/smoothcontrol.h @@ -29,7 +29,7 @@ public: SmoothControl(); SmoothControl(const ControlSource &); SmoothControl(Device &, ControlSrcType, unsigned); - virtual ~SmoothControl(); + ~SmoothControl(); /// Sets the dead zone value. Any value below this will be treated as 0. void set_dead_zone(float); @@ -45,9 +45,9 @@ public: float get_value() const { return value; } private: - virtual void on_press(); - virtual void on_release(); - virtual void on_motion(float, float); + void on_press() override; + void on_release() override; + void on_motion(float, float) override; }; } // namespace Input diff --git a/source/input/touchscreen.h b/source/input/touchscreen.h index 0c96406..487a91c 100644 --- a/source/input/touchscreen.h +++ b/source/input/touchscreen.h @@ -27,8 +27,8 @@ public: Graphics::Window &get_window() const { return window; } - virtual std::string get_button_name(unsigned) const; - virtual std::string get_axis_name(unsigned) const; + std::string get_button_name(unsigned) const override; + std::string get_axis_name(unsigned) const override; private: void input_event(const Graphics::Window::Event &); diff --git a/source/input/windows/gamecontroller_platform.h b/source/input/windows/gamecontroller_platform.h index 46c2dd8..928ad67 100644 --- a/source/input/windows/gamecontroller_platform.h +++ b/source/input/windows/gamecontroller_platform.h @@ -25,7 +25,7 @@ public: static void remove_slot(Time::Timer::Slot &); private: - virtual void main(); + void main() override; }; -- 2.45.2