mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:07:46 +00:00
Spreadsheet: Store the column index in a Position instead of its name
This will make constructing (and destructing) Positions a lot cheaper (as it no longer needs to ref() and unref() a String). Resulted from #5483, but doesn't fix it.
This commit is contained in:
parent
98f08a8bad
commit
6a6f19a72f
7 changed files with 99 additions and 66 deletions
|
@ -51,7 +51,7 @@ public:
|
|||
|
||||
~Sheet();
|
||||
|
||||
static Optional<Position> parse_cell_name(const StringView&);
|
||||
Optional<Position> parse_cell_name(const StringView&) const;
|
||||
Optional<size_t> column_index(const StringView& column_name) const;
|
||||
Optional<String> column_arithmetic(const StringView& column_name, int offset);
|
||||
|
||||
|
@ -179,9 +179,7 @@ struct Traits<Spreadsheet::Position> : public GenericTraits<Spreadsheet::Positio
|
|||
static constexpr bool is_trivial() { return false; }
|
||||
static unsigned hash(const Spreadsheet::Position& p)
|
||||
{
|
||||
return pair_int_hash(
|
||||
string_hash(p.column.characters(), p.column.length()),
|
||||
u64_hash(p.row));
|
||||
return p.hash();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue