diff options
author | Lenny Maiorani <lenny@serenityos.org> | 2022-02-26 10:55:15 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-03-13 22:34:38 +0100 |
commit | 97fcbdd19925baf15355d9a4f492f8df67ed584a (patch) | |
tree | 4dad163dd814ca014da7dacacf3edf93f7edc24c /Userland/Libraries | |
parent | c1e6fc67a1f20ada1b4ef881ac1d3bdabf360f34 (diff) | |
download | serenity-97fcbdd19925baf15355d9a4f492f8df67ed584a.zip |
Libraries: Use default constructors/destructors in LibGemini
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."
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGemini/Document.h | 16 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiRequest.cpp | 10 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiRequest.h | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiResponse.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/GeminiResponse.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/Job.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/Job.h | 4 | ||||
-rw-r--r-- | Userland/Libraries/LibGemini/Line.cpp | 26 |
8 files changed, 19 insertions, 59 deletions
diff --git a/Userland/Libraries/LibGemini/Document.h b/Userland/Libraries/LibGemini/Document.h index 3dbbd8825a..493dbc73fd 100644 --- a/Userland/Libraries/LibGemini/Document.h +++ b/Userland/Libraries/LibGemini/Document.h @@ -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 @@ public: { } - virtual ~Line(); + virtual ~Line() = default; virtual String render_to_html() const = 0; @@ -56,14 +56,14 @@ public: : Line(move(line)) { } - virtual ~Text() override; + virtual ~Text() override = default; virtual String render_to_html() const override; }; class Link : public Line { public: Link(String line, const Document&); - virtual ~Link() override; + virtual ~Link() override = default; virtual String render_to_html() const override; private: @@ -77,7 +77,7 @@ public: : Line(move(line)) { } - virtual ~Preformatted() override; + virtual ~Preformatted() override = default; virtual String render_to_html() const override; }; @@ -87,7 +87,7 @@ public: : Line(move(line)) { } - virtual ~UnorderedList() override; + virtual ~UnorderedList() override = default; virtual String render_to_html() const override; }; @@ -104,7 +104,7 @@ public: , m_kind(kind) { } - virtual ~Control() override; + virtual ~Control() override = default; virtual String render_to_html() const override; private: @@ -118,7 +118,7 @@ public: , m_level(level) { } - virtual ~Heading() override; + virtual ~Heading() override = default; virtual String render_to_html() const override; private: diff --git a/Userland/Libraries/LibGemini/GeminiRequest.cpp b/Userland/Libraries/LibGemini/GeminiRequest.cpp index f1ffa98c63..4059ddec1b 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.cpp +++ b/Userland/Libraries/LibGemini/GeminiRequest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -10,14 +10,6 @@ namespace Gemini { -GeminiRequest::GeminiRequest() -{ -} - -GeminiRequest::~GeminiRequest() -{ -} - ByteBuffer GeminiRequest::to_raw_request() const { StringBuilder builder; diff --git a/Userland/Libraries/LibGemini/GeminiRequest.h b/Userland/Libraries/LibGemini/GeminiRequest.h index 201598b2d9..206ab2ad79 100644 --- a/Userland/Libraries/LibGemini/GeminiRequest.h +++ b/Userland/Libraries/LibGemini/GeminiRequest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -15,8 +15,8 @@ namespace Gemini { class GeminiRequest { public: - GeminiRequest(); - ~GeminiRequest(); + GeminiRequest() = default; + ~GeminiRequest() = default; const URL& url() const { return m_url; } void set_url(const URL& url) { m_url = url; } diff --git a/Userland/Libraries/LibGemini/GeminiResponse.cpp b/Userland/Libraries/LibGemini/GeminiResponse.cpp index 8efd522290..cabb53964b 100644 --- a/Userland/Libraries/LibGemini/GeminiResponse.cpp +++ b/Userland/Libraries/LibGemini/GeminiResponse.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -14,8 +14,4 @@ GeminiResponse::GeminiResponse(int status, String meta) { } -GeminiResponse::~GeminiResponse() -{ -} - } diff --git a/Userland/Libraries/LibGemini/GeminiResponse.h b/Userland/Libraries/LibGemini/GeminiResponse.h index c10b3e7482..791ac3c5c6 100644 --- a/Userland/Libraries/LibGemini/GeminiResponse.h +++ b/Userland/Libraries/LibGemini/GeminiResponse.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -13,7 +13,7 @@ namespace Gemini { class GeminiResponse : public Core::NetworkResponse { public: - virtual ~GeminiResponse() override; + virtual ~GeminiResponse() override = default; static NonnullRefPtr<GeminiResponse> create(int status, String meta) { return adopt_ref(*new GeminiResponse(status, meta)); diff --git a/Userland/Libraries/LibGemini/Job.cpp b/Userland/Libraries/LibGemini/Job.cpp index 9cb02f454b..3051b626eb 100644 --- a/Userland/Libraries/LibGemini/Job.cpp +++ b/Userland/Libraries/LibGemini/Job.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -18,10 +18,6 @@ Job::Job(const GeminiRequest& request, Core::Stream::Stream& output_stream) { } -Job::~Job() -{ -} - void Job::start(Core::Stream::Socket& socket) { VERIFY(!m_socket); diff --git a/Userland/Libraries/LibGemini/Job.h b/Userland/Libraries/LibGemini/Job.h index 7505903433..ca9342eb0c 100644 --- a/Userland/Libraries/LibGemini/Job.h +++ b/Userland/Libraries/LibGemini/Job.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -18,7 +18,7 @@ class Job : public Core::NetworkJob { public: explicit Job(const GeminiRequest&, Core::Stream::Stream&); - virtual ~Job() override; + virtual ~Job() override = default; virtual void start(Core::Stream::Socket&) override; virtual void shutdown(ShutdownMode) override; diff --git a/Userland/Libraries/LibGemini/Line.cpp b/Userland/Libraries/LibGemini/Line.cpp index 8e5dde59a7..8cfbe91344 100644 --- a/Userland/Libraries/LibGemini/Line.cpp +++ b/Userland/Libraries/LibGemini/Line.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, the SerenityOS developers. + * Copyright (c) 2020-2022, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ @@ -17,19 +17,11 @@ String Text::render_to_html() const return builder.build(); } -Text::~Text() -{ -} - String Heading::render_to_html() const { return String::formatted("<h{}>{}</h{}>", m_level, escape_html_entities(m_text.substring_view(m_level, m_text.length() - m_level)), m_level); } -Heading::~Heading() -{ -} - String UnorderedList::render_to_html() const { // 1.3.5.4.2 "Advanced clients can take the space of the bullet symbol into account" @@ -41,9 +33,6 @@ String UnorderedList::render_to_html() const builder.append("</li>"); return builder.build(); } -UnorderedList::~UnorderedList() -{ -} String Control::render_to_html() const { @@ -62,9 +51,6 @@ String Control::render_to_html() const return ""; } } -Control::~Control() -{ -} Link::Link(String text, const Document& document) : Line(move(text)) @@ -86,9 +72,6 @@ Link::Link(String text, const Document& document) if (m_name.is_null()) m_name = m_url.to_string(); } -Link::~Link() -{ -} String Link::render_to_html() const { @@ -109,12 +92,5 @@ String Preformatted::render_to_html() const return builder.build(); } -Preformatted::~Preformatted() -{ -} - -Line::~Line() -{ -} } |