1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:37:35 +00:00

Services: 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:
Lenny Maiorani 2022-03-23 20:58:03 -06:00 committed by Brian Gianforcaro
parent 5550905c00
commit 0b7baa7e5a
80 changed files with 50 additions and 202 deletions

View file

@ -25,10 +25,6 @@ AppletManager::AppletManager()
order_vector = order.split(',');
}
AppletManager::~AppletManager()
{
}
AppletManager& AppletManager::the()
{
VERIFY(s_the);

View file

@ -14,7 +14,7 @@ namespace WindowServer {
class AppletManager : public Core::Object {
C_OBJECT(AppletManager)
public:
~AppletManager();
~AppletManager() = default;
static AppletManager& the();

View file

@ -20,9 +20,7 @@ Button::Button(WindowFrame& frame, Function<void(Button&)>&& on_click_handler)
{
}
Button::~Button()
{
}
Button::~Button() = default;
void Button::paint(Screen& screen, Gfx::Painter& painter)
{

View file

@ -46,7 +46,7 @@ public:
Gfx::IntSize size() const { return m_rect.size(); }
private:
Cursor() { }
Cursor() = default;
Cursor(NonnullRefPtr<Gfx::Bitmap>&&, int, const Gfx::CursorParams&);
bool load(StringView, StringView);

View file

@ -37,12 +37,12 @@ public:
WindowResized,
};
Event() { }
Event() = default;
explicit Event(Type type)
: Core::Event(type)
{
}
virtual ~Event() { }
virtual ~Event() = default;
bool is_mouse_event() const { return type() == MouseMove || type() == MouseDown || type() == MouseDoubleClick || type() == MouseUp || type() == MouseWheel; }
bool is_key_event() const { return type() == KeyUp || type() == KeyDown; }

View file

@ -41,10 +41,6 @@ EventLoop::EventLoop()
}
}
EventLoop::~EventLoop()
{
}
void EventLoop::drain_mouse()
{
auto& screen_input = ScreenInput::the();

View file

@ -20,7 +20,7 @@ class ConnectionFromClient;
class EventLoop {
public:
EventLoop();
virtual ~EventLoop();
virtual ~EventLoop() = default;
int exec() { return m_event_loop.exec(); }

View file

@ -26,10 +26,6 @@ KeymapSwitcher::KeymapSwitcher()
refresh();
}
KeymapSwitcher::~KeymapSwitcher()
{
}
void KeymapSwitcher::refresh()
{
m_keymaps.clear();

View file

@ -19,7 +19,7 @@ namespace WindowServer {
class KeymapSwitcher final : public Core::Object {
C_OBJECT(KeymapSwitcher)
public:
virtual ~KeymapSwitcher() override;
virtual ~KeymapSwitcher() override = default;
void next_keymap();

View file

@ -47,10 +47,6 @@ Menu::Menu(ConnectionFromClient* client, int menu_id, String name)
m_alt_shortcut_character = find_ampersand_shortcut_character(m_name);
}
Menu::~Menu()
{
}
const Gfx::Font& Menu::font() const
{
return Gfx::FontDatabase::default_font();

View file

@ -28,7 +28,7 @@ class Menu final : public Core::Object {
C_OBJECT(Menu);
public:
virtual ~Menu() override;
virtual ~Menu() override = default;
ConnectionFromClient* client() { return m_client; }
const ConnectionFromClient* client() const { return m_client; }

View file

@ -31,10 +31,6 @@ MenuItem::MenuItem(Menu& menu, Type type)
{
}
MenuItem::~MenuItem()
{
}
void MenuItem::set_enabled(bool enabled)
{
if (m_enabled == enabled)

View file

@ -25,7 +25,7 @@ public:
MenuItem(Menu&, unsigned identifier, const String& text, const String& shortcut_text = {}, bool enabled = true, bool checkable = false, bool checked = false, const Gfx::Bitmap* icon = nullptr);
MenuItem(Menu&, Type);
~MenuItem();
~MenuItem() = default;
Type type() const { return m_type; }

View file

@ -26,10 +26,6 @@ MenuManager::MenuManager()
s_the = this;
}
MenuManager::~MenuManager()
{
}
bool MenuManager::is_open(const Menu& menu) const
{
for (size_t i = 0; i < m_open_menu_stack.size(); ++i) {

View file

@ -20,7 +20,7 @@ class MenuManager final : public Core::Object {
public:
static MenuManager& the();
virtual ~MenuManager() override;
virtual ~MenuManager() override = default;
bool is_open(const Menu&) const;
bool has_open_menu() const { return !m_open_menu_stack.is_empty(); }

View file

@ -112,9 +112,7 @@ void WindowFrame::window_was_constructed(Badge<Window>)
m_has_alpha_channel = Gfx::WindowTheme::current().frame_uses_alpha(window_state_for_theme(), WindowManager::the().palette());
}
WindowFrame::~WindowFrame()
{
}
WindowFrame::~WindowFrame() = default;
void WindowFrame::set_button_icons()
{

View file

@ -68,10 +68,6 @@ WindowManager::WindowManager(Gfx::PaletteImpl const& palette)
Compositor::the().did_construct_window_manager({});
}
WindowManager::~WindowManager()
{
}
void WindowManager::reload_config()
{
m_config = Core::ConfigFile::open("/etc/WindowServer.ini", Core::ConfigFile::AllowWriting::Yes).release_value_but_fixme_should_propagate_errors();

View file

@ -69,7 +69,7 @@ public:
static WindowManager& the();
virtual ~WindowManager() override;
virtual ~WindowManager() override = default;
Palette palette() const { return Palette(*m_palette); }

View file

@ -15,10 +15,6 @@ WindowStack::WindowStack(unsigned row, unsigned column)
{
}
WindowStack::~WindowStack()
{
}
void WindowStack::add(Window& window)
{
VERIFY(!window.is_on_any_window_stack({}));

View file

@ -16,7 +16,7 @@ class Compositor;
class WindowStack {
public:
WindowStack(unsigned row, unsigned column);
~WindowStack();
~WindowStack() = default;
bool is_empty() const { return m_windows.is_empty(); }
void add(Window&);

View file

@ -28,10 +28,6 @@ WindowSwitcher::WindowSwitcher()
s_the = this;
}
WindowSwitcher::~WindowSwitcher()
{
}
void WindowSwitcher::set_visible(bool visible)
{
if (m_visible == visible)

View file

@ -26,7 +26,7 @@ public:
};
static WindowSwitcher& the();
virtual ~WindowSwitcher() override;
virtual ~WindowSwitcher() override = default;
bool is_visible() const { return m_visible; }
void set_visible(bool);