mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-21 08:48:57 +00:00
LibGUI: Add fallible factories to ItemListModel
This commit is contained in:
parent
023c1dffab
commit
8dda4e4ab5
Notes:
sideshowbarker
2024-07-17 05:00:08 +09:00
Author: https://github.com/thankyouverycool
Commit: 8dda4e4ab5
Pull-request: https://github.com/SerenityOS/serenity/pull/18764
Reviewed-by: https://github.com/caoimhebyrne ✅
1 changed files with 11 additions and 0 deletions
|
@ -36,6 +36,17 @@ public:
|
||||||
return adopt_ref(*new ItemListModel<T, Container>(data, row_count));
|
return adopt_ref(*new ItemListModel<T, Container>(data, row_count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ErrorOr<NonnullRefPtr<ItemListModel>> try_create(Container const& data, ColumnNamesT const& column_names, Optional<size_t> const& row_count = {})
|
||||||
|
requires(IsTwoDimensional)
|
||||||
|
{
|
||||||
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ItemListModel<T, Container, ColumnNameListType>(data, column_names, row_count));
|
||||||
|
}
|
||||||
|
static ErrorOr<NonnullRefPtr<ItemListModel>> try_create(Container const& data, Optional<size_t> const& row_count = {})
|
||||||
|
requires(!IsTwoDimensional)
|
||||||
|
{
|
||||||
|
return adopt_nonnull_ref_or_enomem(new (nothrow) ItemListModel<T, Container>(data, row_count));
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~ItemListModel() override = default;
|
virtual ~ItemListModel() override = default;
|
||||||
|
|
||||||
virtual int row_count(ModelIndex const& index) const override
|
virtual int row_count(ModelIndex const& index) const override
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue