mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
1682f0b760
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
56 lines
975 B
C++
56 lines
975 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/String.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==(const Position& other) const
|
|
{
|
|
return row == other.row && column == other.column;
|
|
}
|
|
|
|
bool operator!=(const Position& other) const
|
|
{
|
|
return !(other == *this);
|
|
}
|
|
|
|
String to_cell_identifier(const Sheet& sheet) const;
|
|
URL to_url(const Sheet& sheet) const;
|
|
|
|
size_t column { 0 };
|
|
size_t row { 0 };
|
|
|
|
private:
|
|
mutable u32 m_hash { 0 };
|
|
};
|
|
|
|
}
|