mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-19 15:58:56 +00:00
LibWeb: Add from_string function for request priority
This commit is contained in:
parent
2fde20adf9
commit
956106c6d8
Notes:
sideshowbarker
2024-07-17 18:38:54 +09:00
Author: https://github.com/jamierocks
Commit: 956106c6d8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/24
Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 13 additions and 0 deletions
|
@ -437,4 +437,15 @@ StringView request_mode_to_string(Request::Mode mode)
|
|||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Optional<Request::Priority> request_priority_from_string(StringView string)
|
||||
{
|
||||
if (string.equals_ignoring_ascii_case("high"sv))
|
||||
return Request::Priority::High;
|
||||
if (string.equals_ignoring_ascii_case("low"sv))
|
||||
return Request::Priority::Low;
|
||||
if (string.equals_ignoring_ascii_case("auto"sv))
|
||||
return Request::Priority::Auto;
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -532,4 +532,6 @@ private:
|
|||
StringView request_destination_to_string(Request::Destination);
|
||||
StringView request_mode_to_string(Request::Mode);
|
||||
|
||||
Optional<Request::Priority> request_priority_from_string(StringView);
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue