mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 17:10:23 +00:00
LibManual: Compare nodes by path
This makes them suited for hash map usage.
This commit is contained in:
parent
a9053618a8
commit
f53aa959df
Notes:
sideshowbarker
2024-07-17 21:26:19 +09:00
Author: https://github.com/kleinesfilmroellchen Commit: https://github.com/SerenityOS/serenity/commit/f53aa959df Pull-request: https://github.com/SerenityOS/serenity/pull/19753 Reviewed-by: https://github.com/linusg
1 changed files with 18 additions and 0 deletions
|
@ -38,6 +38,24 @@ public:
|
|||
// Finds a page via the help://man/<number>/<subsections...>/page URLs.
|
||||
// This will automatically start discovering pages by inspecting the filesystem.
|
||||
static ErrorOr<NonnullRefPtr<Node const>> try_find_from_help_url(URL const&);
|
||||
|
||||
bool operator==(Node const& other) const
|
||||
{
|
||||
if (auto this_path = this->path(), other_path = other.path();
|
||||
!this_path.is_error() && !other_path.is_error()) {
|
||||
return this_path.release_value() == other_path.release_value();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace AK {
|
||||
|
||||
template<typename T>
|
||||
requires(IsBaseOf<Manual::Node, T>) struct Traits<T> : public GenericTraits<T> {
|
||||
static unsigned hash(T p) { return Traits::hash(p.path()); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue