mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
5e1499d104
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
51 lines
887 B
C++
51 lines
887 B
C++
/*
|
|
* Copyright (c) 2020, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteString.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;
|
|
}
|
|
|
|
ByteString 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 };
|
|
};
|
|
|
|
}
|