瀏覽代碼

Libraries: Use default constructors/destructors in LibVT

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."
Lenny Maiorani 3 年之前
父節點
當前提交
8b334248e4

+ 1 - 5
Userland/Libraries/LibVT/EscapeSequenceParser.cpp

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021, the SerenityOS developers.
+ * Copyright (c) 2022, the SerenityOS developers.
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
@@ -16,10 +16,6 @@ EscapeSequenceParser::EscapeSequenceParser(EscapeSequenceExecutor& executor)
 {
 }
 
-EscapeSequenceParser::~EscapeSequenceParser()
-{
-}
-
 Vector<EscapeSequenceParser::OscParameter> EscapeSequenceParser::osc_parameters() const
 {
     VERIFY(m_osc_raw.size() >= m_osc_parameter_indexes.last());

+ 3 - 3
Userland/Libraries/LibVT/EscapeSequenceParser.h

@@ -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 @@
 namespace VT {
 class EscapeSequenceExecutor {
 public:
-    virtual ~EscapeSequenceExecutor() { }
+    virtual ~EscapeSequenceExecutor() = default;
 
     using Parameters = Span<const unsigned>;
     using Intermediates = Span<const u8>;
@@ -37,7 +37,7 @@ public:
 class EscapeSequenceParser {
 public:
     explicit EscapeSequenceParser(EscapeSequenceExecutor&);
-    ~EscapeSequenceParser();
+    ~EscapeSequenceParser() = default;
 
     ALWAYS_INLINE void on_input(u8 byte)
     {

+ 1 - 4
Userland/Libraries/LibVT/Line.cpp

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2022, the SerenityOS developers.
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
@@ -13,10 +14,6 @@ Line::Line(size_t length)
     set_length(length);
 }
 
-Line::~Line()
-{
-}
-
 void Line::rewrap(size_t new_length, Line* next_line, CursorPosition* cursor, bool cursor_is_on_next_line)
 {
     size_t old_length = length();

+ 2 - 1
Userland/Libraries/LibVT/Line.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
+ * Copyright (c) 2022, the SerenityOS developers.
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
@@ -21,7 +22,7 @@ class Line {
 
 public:
     explicit Line(size_t length);
-    ~Line();
+    ~Line() = default;
 
     struct Cell {
         u32 code_point { ' ' };

+ 2 - 2
Userland/Libraries/LibVT/Range.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020, the SerenityOS developers.
+ * Copyright (c) 2020-2022, the SerenityOS developers.
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
@@ -12,7 +12,7 @@ namespace VT {
 
 class Range {
 public:
-    Range() { }
+    Range() = default;
     Range(const VT::Position& start, const VT::Position& end)
         : m_start(start)
         , m_end(end)

+ 2 - 1
Userland/Libraries/LibVT/Terminal.h

@@ -1,6 +1,7 @@
 /*
  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  * Copyright (c) 2021, Daniel Bertalan <dani@danielbertalan.dev>
+ * Copyright (c) 2022, the SerenityOS developers.
  *
  * SPDX-License-Identifier: BSD-2-Clause
  */
@@ -45,7 +46,7 @@ enum CursorKeysMode {
 
 class TerminalClient {
 public:
-    virtual ~TerminalClient() { }
+    virtual ~TerminalClient() = default;
 
     virtual void beep() = 0;
     virtual void set_window_title(StringView) = 0;

+ 1 - 4
Userland/Libraries/LibVT/TerminalWidget.cpp

@@ -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
  */
@@ -149,10 +150,6 @@ TerminalWidget::TerminalWidget(int ptm_fd, bool automatic_size_policy)
     set_color_scheme(Config::read_string("Terminal", "Window", "ColorScheme", "Default"));
 }
 
-TerminalWidget::~TerminalWidget()
-{
-}
-
 Gfx::IntRect TerminalWidget::glyph_rect(u16 row, u16 column)
 {
     int y = row * m_line_height;

+ 2 - 1
Userland/Libraries/LibVT/TerminalWidget.h

@@ -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
  */
@@ -27,7 +28,7 @@ class TerminalWidget final
     C_OBJECT(TerminalWidget);
 
 public:
-    virtual ~TerminalWidget() override;
+    virtual ~TerminalWidget() override = default;
 
     void set_pty_master_fd(int fd);
     void inject_string(StringView string)