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

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."
This commit is contained in:
Lenny Maiorani 2022-02-26 10:55:15 -07:00 committed by Andreas Kling
parent c1e6fc67a1
commit 97fcbdd199
8 changed files with 19 additions and 59 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -20,7 +20,7 @@ public:
{ {
} }
virtual ~Line(); virtual ~Line() = default;
virtual String render_to_html() const = 0; virtual String render_to_html() const = 0;
@ -56,14 +56,14 @@ public:
: Line(move(line)) : Line(move(line))
{ {
} }
virtual ~Text() override; virtual ~Text() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
}; };
class Link : public Line { class Link : public Line {
public: public:
Link(String line, const Document&); Link(String line, const Document&);
virtual ~Link() override; virtual ~Link() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
private: private:
@ -77,7 +77,7 @@ public:
: Line(move(line)) : Line(move(line))
{ {
} }
virtual ~Preformatted() override; virtual ~Preformatted() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
}; };
@ -87,7 +87,7 @@ public:
: Line(move(line)) : Line(move(line))
{ {
} }
virtual ~UnorderedList() override; virtual ~UnorderedList() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
}; };
@ -104,7 +104,7 @@ public:
, m_kind(kind) , m_kind(kind)
{ {
} }
virtual ~Control() override; virtual ~Control() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
private: private:
@ -118,7 +118,7 @@ public:
, m_level(level) , m_level(level)
{ {
} }
virtual ~Heading() override; virtual ~Heading() override = default;
virtual String render_to_html() const override; virtual String render_to_html() const override;
private: private:

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -10,14 +10,6 @@
namespace Gemini { namespace Gemini {
GeminiRequest::GeminiRequest()
{
}
GeminiRequest::~GeminiRequest()
{
}
ByteBuffer GeminiRequest::to_raw_request() const ByteBuffer GeminiRequest::to_raw_request() const
{ {
StringBuilder builder; StringBuilder builder;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -15,8 +15,8 @@ namespace Gemini {
class GeminiRequest { class GeminiRequest {
public: public:
GeminiRequest(); GeminiRequest() = default;
~GeminiRequest(); ~GeminiRequest() = default;
const URL& url() const { return m_url; } const URL& url() const { return m_url; }
void set_url(const URL& url) { m_url = url; } void set_url(const URL& url) { m_url = url; }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -14,8 +14,4 @@ GeminiResponse::GeminiResponse(int status, String meta)
{ {
} }
GeminiResponse::~GeminiResponse()
{
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -13,7 +13,7 @@ namespace Gemini {
class GeminiResponse : public Core::NetworkResponse { class GeminiResponse : public Core::NetworkResponse {
public: public:
virtual ~GeminiResponse() override; virtual ~GeminiResponse() override = default;
static NonnullRefPtr<GeminiResponse> create(int status, String meta) static NonnullRefPtr<GeminiResponse> create(int status, String meta)
{ {
return adopt_ref(*new GeminiResponse(status, meta)); return adopt_ref(*new GeminiResponse(status, meta));

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * 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) void Job::start(Core::Stream::Socket& socket)
{ {
VERIFY(!m_socket); VERIFY(!m_socket);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -18,7 +18,7 @@ class Job : public Core::NetworkJob {
public: public:
explicit Job(const GeminiRequest&, Core::Stream::Stream&); explicit Job(const GeminiRequest&, Core::Stream::Stream&);
virtual ~Job() override; virtual ~Job() override = default;
virtual void start(Core::Stream::Socket&) override; virtual void start(Core::Stream::Socket&) override;
virtual void shutdown(ShutdownMode) override; virtual void shutdown(ShutdownMode) override;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2020, the SerenityOS developers. * Copyright (c) 2020-2022, the SerenityOS developers.
* *
* SPDX-License-Identifier: BSD-2-Clause * SPDX-License-Identifier: BSD-2-Clause
*/ */
@ -17,19 +17,11 @@ String Text::render_to_html() const
return builder.build(); return builder.build();
} }
Text::~Text()
{
}
String Heading::render_to_html() const 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); 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 String UnorderedList::render_to_html() const
{ {
// 1.3.5.4.2 "Advanced clients can take the space of the bullet symbol into account" // 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>"); builder.append("</li>");
return builder.build(); return builder.build();
} }
UnorderedList::~UnorderedList()
{
}
String Control::render_to_html() const String Control::render_to_html() const
{ {
@ -62,9 +51,6 @@ String Control::render_to_html() const
return ""; return "";
} }
} }
Control::~Control()
{
}
Link::Link(String text, const Document& document) Link::Link(String text, const Document& document)
: Line(move(text)) : Line(move(text))
@ -86,9 +72,6 @@ Link::Link(String text, const Document& document)
if (m_name.is_null()) if (m_name.is_null())
m_name = m_url.to_string(); m_name = m_url.to_string();
} }
Link::~Link()
{
}
String Link::render_to_html() const String Link::render_to_html() const
{ {
@ -109,12 +92,5 @@ String Preformatted::render_to_html() const
return builder.build(); return builder.build();
} }
Preformatted::~Preformatted()
{
}
Line::~Line()
{
}
} }