mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 12:17:44 +00:00
LibWeb: Allow using Origin as a HashMap key
This commit is contained in:
parent
5dceba29a4
commit
a856cf8d4c
1 changed files with 13 additions and 0 deletions
|
@ -33,6 +33,9 @@ public:
|
||||||
&& port() == other.port();
|
&& port() == other.port();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool operator==(Origin const& other) const { return is_same(other); }
|
||||||
|
bool operator!=(Origin const& other) const { return !is_same(other); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
String m_protocol;
|
String m_protocol;
|
||||||
String m_host;
|
String m_host;
|
||||||
|
@ -40,3 +43,13 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace AK {
|
||||||
|
template<>
|
||||||
|
struct Traits<Web::Origin> : public GenericTraits<Web::Origin> {
|
||||||
|
static unsigned hash(Web::Origin const& origin)
|
||||||
|
{
|
||||||
|
return pair_int_hash(origin.protocol().hash(), pair_int_hash(int_hash(origin.port()), origin.host().hash()));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} // namespace AK
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue