Demos: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
This commit is contained in:
parent
ab14abc40f
commit
0ec688f86e
Notes:
sideshowbarker
2024-07-17 18:45:04 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/0ec688f86e Pull-request: https://github.com/SerenityOS/serenity/pull/12557 Reviewed-by: https://github.com/IdanHo ✅
11 changed files with 23 additions and 48 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -31,7 +32,7 @@ static bool flag_hide_window_frame = false;
|
|||
class Cube final : public GUI::Widget {
|
||||
C_OBJECT(Cube)
|
||||
public:
|
||||
virtual ~Cube() override;
|
||||
virtual ~Cube() override = default;
|
||||
void set_stat_label(RefPtr<GUI::Label> l) { m_stats = l; };
|
||||
void set_show_window_frame(bool);
|
||||
bool show_window_frame() const { return m_show_window_frame; }
|
||||
|
@ -72,10 +73,6 @@ Cube::Cube()
|
|||
start_timer(20);
|
||||
}
|
||||
|
||||
Cube::~Cube()
|
||||
{
|
||||
}
|
||||
|
||||
void Cube::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Sergey Bugaev <bugaevc@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -10,10 +11,6 @@
|
|||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
EyesWidget::~EyesWidget()
|
||||
{
|
||||
}
|
||||
|
||||
void EyesWidget::track_mouse_move(Gfx::IntPoint const& point)
|
||||
{
|
||||
m_mouse_position = point - window()->position();
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Sergey Bugaev <bugaevc@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,7 +15,7 @@ class EyesWidget final : public GUI::Widget
|
|||
C_OBJECT(EyesWidget)
|
||||
|
||||
public:
|
||||
virtual ~EyesWidget();
|
||||
virtual ~EyesWidget() override = default;
|
||||
|
||||
private:
|
||||
EyesWidget(int num_eyes, int full_rows, int extra)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -61,7 +62,7 @@ class Fire : public GUI::Frame {
|
|||
C_OBJECT(Fire);
|
||||
|
||||
public:
|
||||
virtual ~Fire() override;
|
||||
virtual ~Fire() override = default;
|
||||
void set_stat_label(RefPtr<GUI::Label> l) { stats = l; };
|
||||
|
||||
private:
|
||||
|
@ -110,10 +111,6 @@ Fire::Fire()
|
|||
// update();
|
||||
}
|
||||
|
||||
Fire::~Fire()
|
||||
{
|
||||
}
|
||||
|
||||
void Fire::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Frame::paint_event(event);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Linus Groh <linusg@serenityos.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -26,7 +27,7 @@ const int HEIGHT = 600;
|
|||
class Canvas final : public GUI::Widget {
|
||||
C_OBJECT(Canvas)
|
||||
public:
|
||||
virtual ~Canvas() override;
|
||||
virtual ~Canvas() override = default;
|
||||
|
||||
private:
|
||||
Canvas();
|
||||
|
@ -42,10 +43,6 @@ Canvas::Canvas()
|
|||
draw();
|
||||
}
|
||||
|
||||
Canvas::~Canvas()
|
||||
{
|
||||
}
|
||||
|
||||
void Canvas::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2020, Nico Weber <thakis@chromium.org>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -29,7 +30,7 @@ const int HEIGHT = 200;
|
|||
class Canvas final : public GUI::Widget {
|
||||
C_OBJECT(Canvas)
|
||||
public:
|
||||
virtual ~Canvas() override;
|
||||
virtual ~Canvas() override = default;
|
||||
|
||||
private:
|
||||
Canvas();
|
||||
|
@ -62,10 +63,6 @@ Canvas::Canvas()
|
|||
update();
|
||||
}
|
||||
|
||||
Canvas::~Canvas()
|
||||
{
|
||||
}
|
||||
|
||||
void Canvas::paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
GUI::Painter painter(*this);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -20,7 +20,7 @@
|
|||
class Screensaver final : public GUI::Widget {
|
||||
C_OBJECT(Screensaver)
|
||||
public:
|
||||
virtual ~Screensaver() override;
|
||||
virtual ~Screensaver() override = default;
|
||||
|
||||
private:
|
||||
Screensaver(int width = 64, int height = 48, int interval = 10000);
|
||||
|
@ -44,10 +44,6 @@ Screensaver::Screensaver(int width, int height, int interval)
|
|||
draw();
|
||||
}
|
||||
|
||||
Screensaver::~Screensaver()
|
||||
{
|
||||
}
|
||||
|
||||
void Screensaver::mousemove_event(GUI::MouseEvent& event)
|
||||
{
|
||||
constexpr float max_distance_move = 10;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Jagger De Leo <jcdl@fastmail.com>
|
||||
* Copyright (c) 2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -32,7 +33,7 @@ struct Coordinate {
|
|||
class Starfield final : public GUI::Widget {
|
||||
C_OBJECT(Starfield)
|
||||
public:
|
||||
virtual ~Starfield() override;
|
||||
virtual ~Starfield() override = default;
|
||||
ErrorOr<void> create_stars(int, int, int);
|
||||
|
||||
void set_speed(unsigned speed) { m_speed = speed; }
|
||||
|
@ -74,10 +75,6 @@ ErrorOr<void> Starfield::create_stars(int width, int height, int stars)
|
|||
return {};
|
||||
}
|
||||
|
||||
Starfield::~Starfield()
|
||||
{
|
||||
}
|
||||
|
||||
void Starfield::mousemove_event(GUI::MouseEvent&)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@
|
|||
class MouseCursorModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<MouseCursorModel> create() { return adopt_ref(*new MouseCursorModel); }
|
||||
virtual ~MouseCursorModel() override { }
|
||||
virtual ~MouseCursorModel() override = default;
|
||||
|
||||
enum Column {
|
||||
Bitmap,
|
||||
|
@ -86,7 +86,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
MouseCursorModel() { }
|
||||
MouseCursorModel() = default;
|
||||
|
||||
struct Cursor {
|
||||
RefPtr<Gfx::Bitmap> bitmap;
|
||||
|
@ -101,7 +101,7 @@ private:
|
|||
class FileIconsModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<FileIconsModel> create() { return adopt_ref(*new FileIconsModel); }
|
||||
virtual ~FileIconsModel() override { }
|
||||
virtual ~FileIconsModel() override = default;
|
||||
|
||||
enum Column {
|
||||
BigIcon,
|
||||
|
@ -189,7 +189,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
FileIconsModel() { }
|
||||
FileIconsModel() = default;
|
||||
|
||||
struct IconSet {
|
||||
RefPtr<Gfx::Bitmap> big_icon;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -328,7 +328,3 @@ GalleryWidget::GalleryWidget()
|
|||
m_icons_tableview->set_column_width(0, 36);
|
||||
m_icons_tableview->set_column_width(1, 20);
|
||||
}
|
||||
|
||||
GalleryWidget::~GalleryWidget()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* Copyright (c) 2021-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -19,7 +19,7 @@
|
|||
class GalleryWidget final : public GUI::Widget {
|
||||
C_OBJECT(GalleryWidget)
|
||||
public:
|
||||
virtual ~GalleryWidget() override;
|
||||
virtual ~GalleryWidget() override = default;
|
||||
|
||||
private:
|
||||
GalleryWidget();
|
||||
|
|
Loading…
Add table
Reference in a new issue