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

Spreadsheet: struct Cell => class Cell

Hide private members, and make the odd update() -> sheet->update(cell)
-> update(Badge<Sheet>) -> update_data() less odd by removing the
update(Badge<Sheet>) step.
This commit is contained in:
AnotherTest 2020-12-20 12:58:14 +03:30 committed by Andreas Kling
parent 28428beb5c
commit f1f9fd1c60
8 changed files with 110 additions and 93 deletions

View file

@ -57,8 +57,8 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
if (!cell)
return String::empty();
if (cell->kind == Spreadsheet::Cell::Formula) {
if (auto object = as_error(cell->evaluated_data)) {
if (cell->kind() == Spreadsheet::Cell::Formula) {
if (auto object = as_error(cell->evaluated_data())) {
StringBuilder builder;
auto error = object->get("message").to_string_without_side_effects();
builder.append("Error: ");
@ -86,8 +86,8 @@ GUI::Variant SheetModel::data(const GUI::ModelIndex& index, GUI::ModelRole role)
if (!cell)
return {};
if (cell->kind == Spreadsheet::Cell::Formula) {
if (as_error(cell->evaluated_data))
if (cell->kind() == Spreadsheet::Cell::Formula) {
if (as_error(cell->evaluated_data()))
return Color(Color::Red);
}