mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:27:34 +00:00
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
This commit is contained in:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -30,7 +30,7 @@ ConsoleWidget::ConsoleWidget()
|
|||
set_fill_with_background_color(true);
|
||||
|
||||
auto base_document = Web::DOM::Document::create();
|
||||
base_document->append_child(adopt(*new Web::DOM::DocumentType(base_document)));
|
||||
base_document->append_child(adopt_ref(*new Web::DOM::DocumentType(base_document)));
|
||||
auto html_element = base_document->create_element("html");
|
||||
base_document->append_child(html_element);
|
||||
auto head_element = base_document->create_element("head");
|
||||
|
|
|
@ -32,7 +32,7 @@ private:
|
|||
__Count,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<MonthListModel> create() { return adopt(*new MonthListModel); }
|
||||
static NonnullRefPtr<MonthListModel> create() { return adopt_ref(*new MonthListModel); }
|
||||
virtual ~MonthListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override;
|
||||
|
|
|
@ -118,7 +118,7 @@ NonnullRefPtrVector<LauncherHandler> DirectoryView::get_launch_handlers(const UR
|
|||
{
|
||||
NonnullRefPtrVector<LauncherHandler> handlers;
|
||||
for (auto& h : Desktop::Launcher::get_handlers_with_details_for_url(url)) {
|
||||
handlers.append(adopt(*new LauncherHandler(h)));
|
||||
handlers.append(adopt_ref(*new LauncherHandler(h)));
|
||||
}
|
||||
return handlers;
|
||||
}
|
||||
|
|
|
@ -481,7 +481,7 @@ void FontEditorWidget::initialize(const String& path, RefPtr<Gfx::BitmapFont>&&
|
|||
});
|
||||
|
||||
m_undo_stack = make<GUI::UndoStack>();
|
||||
m_undo_glyph = adopt(*new UndoGlyph(m_glyph_map_widget->selected_glyph(), *m_edited_font));
|
||||
m_undo_glyph = adopt_ref(*new UndoGlyph(m_glyph_map_widget->selected_glyph(), *m_edited_font));
|
||||
did_change_undo_stack();
|
||||
|
||||
if (on_initialize)
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
}
|
||||
RefPtr<UndoGlyph> save_state() const
|
||||
{
|
||||
auto state = adopt(*new UndoGlyph(m_code_point, *m_font));
|
||||
auto state = adopt_ref(*new UndoGlyph(m_code_point, *m_font));
|
||||
auto glyph = font().glyph(m_code_point).glyph_bitmap();
|
||||
for (int x = 0; x < glyph.width(); x++)
|
||||
for (int y = 0; y < glyph.height(); y++)
|
||||
|
|
|
@ -16,7 +16,7 @@ class ManualModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<ManualModel> create()
|
||||
{
|
||||
return adopt(*new ManualModel);
|
||||
return adopt_ref(*new ManualModel);
|
||||
}
|
||||
|
||||
virtual ~ManualModel() override {};
|
||||
|
|
|
@ -25,7 +25,7 @@ IRCChannel::~IRCChannel()
|
|||
|
||||
NonnullRefPtr<IRCChannel> IRCChannel::create(IRCClient& client, const String& name)
|
||||
{
|
||||
return adopt(*new IRCChannel(client, name));
|
||||
return adopt_ref(*new IRCChannel(client, name));
|
||||
}
|
||||
|
||||
void IRCChannel::add_member(const String& name, char prefix)
|
||||
|
|
|
@ -16,7 +16,7 @@ public:
|
|||
enum Column {
|
||||
Name
|
||||
};
|
||||
static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt(*new IRCChannelMemberListModel(channel)); }
|
||||
static NonnullRefPtr<IRCChannelMemberListModel> create(IRCChannel& channel) { return adopt_ref(*new IRCChannelMemberListModel(channel)); }
|
||||
virtual ~IRCChannelMemberListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -15,19 +15,19 @@
|
|||
|
||||
NonnullRefPtr<IRCLogBuffer> IRCLogBuffer::create()
|
||||
{
|
||||
return adopt(*new IRCLogBuffer);
|
||||
return adopt_ref(*new IRCLogBuffer);
|
||||
}
|
||||
|
||||
IRCLogBuffer::IRCLogBuffer()
|
||||
{
|
||||
m_document = Web::DOM::Document::create();
|
||||
m_document->append_child(adopt(*new Web::DOM::DocumentType(document())));
|
||||
m_document->append_child(adopt_ref(*new Web::DOM::DocumentType(document())));
|
||||
auto html_element = m_document->create_element("html");
|
||||
m_document->append_child(html_element);
|
||||
auto head_element = m_document->create_element("head");
|
||||
html_element->append_child(head_element);
|
||||
auto style_element = m_document->create_element("style");
|
||||
style_element->append_child(adopt(*new Web::DOM::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
style_element->append_child(adopt_ref(*new Web::DOM::Text(document(), "div { font-family: Csilla; font-weight: lighter; }")));
|
||||
head_element->append_child(style_element);
|
||||
auto body_element = m_document->create_element("body");
|
||||
html_element->append_child(body_element);
|
||||
|
|
|
@ -23,7 +23,7 @@ IRCQuery::~IRCQuery()
|
|||
|
||||
NonnullRefPtr<IRCQuery> IRCQuery::create(IRCClient& client, const String& name)
|
||||
{
|
||||
return adopt(*new IRCQuery(client, name));
|
||||
return adopt_ref(*new IRCQuery(client, name));
|
||||
}
|
||||
|
||||
void IRCQuery::add_message(char prefix, const String& name, const String& text, Color color)
|
||||
|
|
|
@ -18,7 +18,7 @@ public:
|
|||
Name,
|
||||
};
|
||||
|
||||
static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt(*new IRCWindowListModel(client)); }
|
||||
static NonnullRefPtr<IRCWindowListModel> create(IRCClient& client) { return adopt_ref(*new IRCWindowListModel(client)); }
|
||||
virtual ~IRCWindowListModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -13,7 +13,7 @@ class CharacterMapFileListModel final : public GUI::Model {
|
|||
public:
|
||||
static NonnullRefPtr<CharacterMapFileListModel> create(Vector<String>& file_names)
|
||||
{
|
||||
return adopt(*new CharacterMapFileListModel(file_names));
|
||||
return adopt_ref(*new CharacterMapFileListModel(file_names));
|
||||
}
|
||||
|
||||
virtual ~CharacterMapFileListModel() override { }
|
||||
|
|
|
@ -27,7 +27,7 @@ RefPtr<Image> Image::create_with_size(const Gfx::IntSize& size)
|
|||
if (size.width() > 16384 || size.height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Image(size));
|
||||
return adopt_ref(*new Image(size));
|
||||
}
|
||||
|
||||
Image::Image(const Gfx::IntSize& size)
|
||||
|
|
|
@ -18,7 +18,7 @@ RefPtr<Layer> Layer::create_with_size(Image& image, const Gfx::IntSize& size, co
|
|||
if (size.width() > 16384 || size.height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Layer(image, size, name));
|
||||
return adopt_ref(*new Layer(image, size, name));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap, const String& name)
|
||||
|
@ -29,7 +29,7 @@ RefPtr<Layer> Layer::create_with_bitmap(Image& image, const Gfx::Bitmap& bitmap,
|
|||
if (bitmap.size().width() > 16384 || bitmap.size().height() > 16384)
|
||||
return nullptr;
|
||||
|
||||
return adopt(*new Layer(image, bitmap, name));
|
||||
return adopt_ref(*new Layer(image, bitmap, name));
|
||||
}
|
||||
|
||||
RefPtr<Layer> Layer::create_snapshot(Image& image, const Layer& layer)
|
||||
|
|
|
@ -35,7 +35,7 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window
|
|||
set_layout<GUI::VerticalBoxLayout>();
|
||||
m_splitter = add<GUI::HorizontalSplitter>();
|
||||
m_player_view = m_splitter->add<GUI::Widget>();
|
||||
m_playlist_model = adopt(*new PlaylistModel());
|
||||
m_playlist_model = adopt_ref(*new PlaylistModel());
|
||||
|
||||
m_player_view->set_layout<GUI::VerticalBoxLayout>();
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
auto app = GUI::Application::construct(argc, argv);
|
||||
|
||||
RefPtr<Tree> tree = adopt(*new Tree(""));
|
||||
RefPtr<Tree> tree = adopt_ref(*new Tree(""));
|
||||
|
||||
// Configure application window.
|
||||
auto app_icon = GUI::Icon::default_icon("app-space-analyzer");
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace Spreadsheet {
|
|||
|
||||
class HelpListModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<HelpListModel> create() { return adopt(*new HelpListModel); }
|
||||
static NonnullRefPtr<HelpListModel> create() { return adopt_ref(*new HelpListModel); }
|
||||
|
||||
virtual ~HelpListModel() override { }
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ public:
|
|||
if (s_the)
|
||||
return *s_the;
|
||||
|
||||
return *(s_the = adopt(*new HelpWindow(window)));
|
||||
return *(s_the = adopt_ref(*new HelpWindow(window)));
|
||||
}
|
||||
|
||||
virtual ~HelpWindow() override;
|
||||
|
|
|
@ -359,7 +359,7 @@ void Sheet::copy_cells(Vector<Position> from, Vector<Position> to, Optional<Posi
|
|||
|
||||
RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
||||
{
|
||||
auto sheet = adopt(*new Sheet(workbook));
|
||||
auto sheet = adopt_ref(*new Sheet(workbook));
|
||||
auto rows = object.get("rows").to_u32(default_row_count);
|
||||
auto columns = object.get("columns");
|
||||
auto name = object.get("name").as_string_or("Sheet");
|
||||
|
@ -617,7 +617,7 @@ RefPtr<Sheet> Sheet::from_xsv(const Reader::XSV& xsv, Workbook& workbook)
|
|||
auto cols = xsv.headers();
|
||||
auto rows = xsv.size();
|
||||
|
||||
auto sheet = adopt(*new Sheet(workbook));
|
||||
auto sheet = adopt_ref(*new Sheet(workbook));
|
||||
if (xsv.has_explicit_headers()) {
|
||||
sheet->m_columns = cols;
|
||||
} else {
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Spreadsheet {
|
|||
|
||||
class SheetModel final : public GUI::Model {
|
||||
public:
|
||||
static NonnullRefPtr<SheetModel> create(Sheet& sheet) { return adopt(*new SheetModel(sheet)); }
|
||||
static NonnullRefPtr<SheetModel> create(Sheet& sheet) { return adopt_ref(*new SheetModel(sheet)); }
|
||||
virtual ~SheetModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override { return m_sheet->row_count(); }
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
NonnullRefPtr<DevicesModel> DevicesModel::create()
|
||||
{
|
||||
return adopt(*new DevicesModel);
|
||||
return adopt_ref(*new DevicesModel);
|
||||
}
|
||||
|
||||
DevicesModel::DevicesModel()
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
|
||||
static ProcessModel& the();
|
||||
|
||||
static NonnullRefPtr<ProcessModel> create() { return adopt(*new ProcessModel); }
|
||||
static NonnullRefPtr<ProcessModel> create() { return adopt_ref(*new ProcessModel); }
|
||||
virtual ~ProcessModel() override;
|
||||
|
||||
virtual int row_count(const GUI::ModelIndex&) const override;
|
||||
|
|
|
@ -88,7 +88,7 @@ ProcessStateWidget::ProcessStateWidget(pid_t pid)
|
|||
m_table_view = add<GUI::TableView>();
|
||||
m_table_view->column_header().set_visible(false);
|
||||
m_table_view->column_header().set_section_size(0, 90);
|
||||
m_table_view->set_model(adopt(*new ProcessStateModel(ProcessModel::the(), pid)));
|
||||
m_table_view->set_model(adopt_ref(*new ProcessStateModel(ProcessModel::the(), pid)));
|
||||
}
|
||||
|
||||
ProcessStateWidget::~ProcessStateWidget()
|
||||
|
|
|
@ -95,7 +95,7 @@ int main(int argc, char** argv)
|
|||
#undef __ENUMERATE_COLOR_ROLE
|
||||
|
||||
combo_box.set_only_allow_values_from_model(true);
|
||||
combo_box.set_model(adopt(*new ColorRoleModel(color_roles)));
|
||||
combo_box.set_model(adopt_ref(*new ColorRoleModel(color_roles)));
|
||||
combo_box.on_change = [&](auto&, auto& index) {
|
||||
auto role = static_cast<const ColorRoleModel*>(index.model())->color_role(index);
|
||||
color_input.set_color(preview_palette.color(role));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue