blob: f798640a1217facc12f1e5dd768c13bab14f625f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* Copyright (c) 2020, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/DeprecatedString.h>
#include <AK/Types.h>
#include <AK/URL.h>
namespace Spreadsheet {
class Sheet;
struct Position {
Position() = default;
Position(size_t column, size_t row)
: column(column)
, row(row)
, m_hash(pair_int_hash(column, row))
{
}
ALWAYS_INLINE u32 hash() const
{
if (m_hash == 0)
return m_hash = int_hash(column * 65537 + row);
return m_hash;
}
bool operator==(Position const& other) const
{
return row == other.row && column == other.column;
}
DeprecatedString to_cell_identifier(Sheet const& sheet) const;
URL to_url(Sheet const& sheet) const;
size_t column { 0 };
size_t row { 0 };
private:
mutable u32 m_hash { 0 };
};
}
|