mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:37:45 +00:00
Applications: 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
6be75bd5e4
commit
160bda7228
195 changed files with 335 additions and 638 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -55,9 +55,4 @@ void CellSyntaxHighlighter::rehighlight(const Palette& palette)
|
|||
}
|
||||
m_client->do_update();
|
||||
}
|
||||
|
||||
CellSyntaxHighlighter::~CellSyntaxHighlighter()
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -13,8 +13,8 @@ namespace Spreadsheet {
|
|||
|
||||
class CellSyntaxHighlighter final : public JS::SyntaxHighlighter {
|
||||
public:
|
||||
CellSyntaxHighlighter() { }
|
||||
virtual ~CellSyntaxHighlighter() override;
|
||||
CellSyntaxHighlighter() = default;
|
||||
virtual ~CellSyntaxHighlighter() override = default;
|
||||
|
||||
virtual void rehighlight(const Palette&) override;
|
||||
void set_cell(const Cell* cell) { m_cell = cell; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,10 +17,6 @@ DateCell::DateCell()
|
|||
{
|
||||
}
|
||||
|
||||
DateCell::~DateCell()
|
||||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<String> DateCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
||||
{
|
||||
return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<String> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -15,7 +15,7 @@ class DateCell : public CellType {
|
|||
|
||||
public:
|
||||
DateCell();
|
||||
virtual ~DateCell() override;
|
||||
virtual ~DateCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -15,10 +15,6 @@ IdentityCell::IdentityCell()
|
|||
{
|
||||
}
|
||||
|
||||
IdentityCell::~IdentityCell()
|
||||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<String> IdentityCell::display(Cell& cell, const CellTypeMetadata&) const
|
||||
{
|
||||
return cell.js_data().to_string(cell.sheet().global_object());
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ class IdentityCell : public CellType {
|
|||
|
||||
public:
|
||||
IdentityCell();
|
||||
virtual ~IdentityCell() override;
|
||||
virtual ~IdentityCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,10 +17,6 @@ NumericCell::NumericCell()
|
|||
{
|
||||
}
|
||||
|
||||
NumericCell::~NumericCell()
|
||||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<String> NumericCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
||||
{
|
||||
return propagate_failure(cell, [&]() -> JS::ThrowCompletionOr<String> {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ class NumericCell : public CellType {
|
|||
|
||||
public:
|
||||
NumericCell();
|
||||
virtual ~NumericCell() override;
|
||||
virtual ~NumericCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -15,10 +15,6 @@ StringCell::StringCell()
|
|||
{
|
||||
}
|
||||
|
||||
StringCell::~StringCell()
|
||||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<String> StringCell::display(Cell& cell, const CellTypeMetadata& metadata) const
|
||||
{
|
||||
auto string = TRY(cell.js_data().to_string(cell.sheet().global_object()));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ class StringCell : public CellType {
|
|||
|
||||
public:
|
||||
StringCell();
|
||||
virtual ~StringCell() override;
|
||||
virtual ~StringCell() override = default;
|
||||
virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const override;
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -30,7 +30,7 @@ public:
|
|||
|
||||
virtual JS::ThrowCompletionOr<String> display(Cell&, const CellTypeMetadata&) const = 0;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> js_value(Cell&, const CellTypeMetadata&) const = 0;
|
||||
virtual ~CellType() { }
|
||||
virtual ~CellType() = default;
|
||||
|
||||
const String& name() const { return m_name; }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -23,7 +23,7 @@ class HelpListModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<HelpListModel> create() { return adopt_ref(*new HelpListModel); }
|
||||
|
||||
virtual ~HelpListModel() override { }
|
||||
virtual ~HelpListModel() override = default;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_keys.size(); }
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return 1; }
|
||||
|
@ -198,8 +198,4 @@ void HelpWindow::set_docs(JsonObject&& docs)
|
|||
static_cast<HelpListModel*>(m_listview->model())->set_from(m_docs);
|
||||
m_listview->update();
|
||||
}
|
||||
|
||||
HelpWindow::~HelpWindow()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@ public:
|
|||
return *(s_the = adopt_ref(*new HelpWindow(window)));
|
||||
}
|
||||
|
||||
virtual ~HelpWindow() override;
|
||||
virtual ~HelpWindow() override = default;
|
||||
|
||||
void set_docs(JsonObject&& docs);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -97,10 +97,6 @@ SheetGlobalObject::SheetGlobalObject(Sheet& sheet)
|
|||
{
|
||||
}
|
||||
|
||||
SheetGlobalObject::~SheetGlobalObject()
|
||||
{
|
||||
}
|
||||
|
||||
JS::ThrowCompletionOr<bool> SheetGlobalObject::internal_has_property(JS::PropertyKey const& name) const
|
||||
{
|
||||
if (name.is_string()) {
|
||||
|
@ -362,10 +358,6 @@ WorkbookObject::WorkbookObject(Workbook& workbook, JS::GlobalObject& global_obje
|
|||
{
|
||||
}
|
||||
|
||||
WorkbookObject::~WorkbookObject()
|
||||
{
|
||||
}
|
||||
|
||||
void WorkbookObject::initialize(JS::GlobalObject& global_object)
|
||||
{
|
||||
Object::initialize(global_object);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@ class SheetGlobalObject final : public JS::GlobalObject {
|
|||
public:
|
||||
SheetGlobalObject(Sheet&);
|
||||
|
||||
virtual ~SheetGlobalObject() override;
|
||||
virtual ~SheetGlobalObject() override = default;
|
||||
|
||||
virtual JS::ThrowCompletionOr<bool> internal_has_property(JS::PropertyKey const& name) const override;
|
||||
virtual JS::ThrowCompletionOr<JS::Value> internal_get(JS::PropertyKey const&, JS::Value receiver) const override;
|
||||
|
@ -51,7 +51,7 @@ class WorkbookObject final : public JS::Object {
|
|||
public:
|
||||
WorkbookObject(Workbook&, JS::GlobalObject&);
|
||||
|
||||
virtual ~WorkbookObject() override;
|
||||
virtual ~WorkbookObject() override = default;
|
||||
|
||||
virtual void initialize(JS::GlobalObject&) override;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -68,7 +68,7 @@ public:
|
|||
parse_preview();
|
||||
}
|
||||
|
||||
virtual ~XSV() { }
|
||||
virtual ~XSV() = default;
|
||||
|
||||
void parse();
|
||||
bool has_error() const { return m_error != ReadError::None; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -81,10 +81,6 @@ Sheet::Sheet(Workbook& workbook)
|
|||
}
|
||||
}
|
||||
|
||||
Sheet::~Sheet()
|
||||
{
|
||||
}
|
||||
|
||||
JS::Interpreter& Sheet::interpreter() const
|
||||
{
|
||||
return const_cast<JS::Interpreter&>(*m_interpreter);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2021, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -29,7 +29,7 @@ public:
|
|||
constexpr static size_t default_row_count = 100;
|
||||
constexpr static size_t default_column_count = 26;
|
||||
|
||||
~Sheet();
|
||||
virtual ~Sheet() override = default;
|
||||
|
||||
Optional<Position> parse_cell_name(StringView) const;
|
||||
Optional<size_t> column_index(StringView column_name) const;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -13,10 +13,6 @@
|
|||
|
||||
namespace Spreadsheet {
|
||||
|
||||
SheetModel::~SheetModel()
|
||||
{
|
||||
}
|
||||
|
||||
GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const
|
||||
{
|
||||
if (!index.is_valid())
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -14,7 +14,7 @@ namespace Spreadsheet {
|
|||
class SheetModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<SheetModel> create(Sheet& sheet) { return adopt_ref(*new SheetModel(sheet)); }
|
||||
virtual ~SheetModel() override;
|
||||
virtual ~SheetModel() override = default;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); }
|
||||
virtual int column_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->column_count(); }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -20,10 +20,6 @@
|
|||
|
||||
namespace Spreadsheet {
|
||||
|
||||
SpreadsheetView::~SpreadsheetView()
|
||||
{
|
||||
}
|
||||
|
||||
void SpreadsheetView::EditingDelegate::set_value(GUI::Variant const& value, GUI::ModelEditingDelegate::SelectionBehavior selection_behavior)
|
||||
{
|
||||
if (value.as_string().is_null()) {
|
||||
|
|
|
@ -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 CellEditor final : public GUI::TextEditor {
|
|||
C_OBJECT(CellEditor);
|
||||
|
||||
public:
|
||||
virtual ~CellEditor() { }
|
||||
virtual ~CellEditor() = default;
|
||||
|
||||
Function<void(GUI::KeyEvent&)> on_cursor_key_pressed;
|
||||
|
||||
|
@ -89,7 +89,7 @@ class SpreadsheetView final : public GUI::Widget {
|
|||
C_OBJECT(SpreadsheetView);
|
||||
|
||||
public:
|
||||
~SpreadsheetView();
|
||||
~SpreadsheetView() = default;
|
||||
|
||||
Sheet* sheet_if_available() { return m_sheet; }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -540,8 +540,4 @@ void SpreadsheetWidget::initialize_menubar(GUI::Window& window)
|
|||
help_menu.add_action(*m_functions_help_action);
|
||||
help_menu.add_action(*m_about_action);
|
||||
}
|
||||
|
||||
SpreadsheetWidget::~SpreadsheetWidget()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -17,7 +17,7 @@ class SpreadsheetWidget final : public GUI::Widget {
|
|||
C_OBJECT(SpreadsheetWidget);
|
||||
|
||||
public:
|
||||
~SpreadsheetWidget();
|
||||
virtual ~SpreadsheetWidget() override = default;
|
||||
|
||||
void save(StringView filename);
|
||||
void load_file(Core::File&);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2020-2022, the SerenityOS developers.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -75,7 +75,7 @@ public:
|
|||
generate();
|
||||
}
|
||||
|
||||
virtual ~XSV() { }
|
||||
virtual ~XSV() = default;
|
||||
|
||||
bool has_error() const { return m_error != WriteError::None; }
|
||||
WriteError error() const { return m_error; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue