mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibURL: Add representations of URLPattern{Init,Options,Input}
The URLPattern spec is intended to be implemented inside of LibURL, with LibWeb only responsible for the IDL conversion layer, in a similar manner to how URL is implemented.
This commit is contained in:
parent
05351dfe45
commit
46bfced9ad
27
Libraries/LibURL/Pattern/Init.h
Normal file
27
Libraries/LibURL/Pattern/Init.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/String.h>
|
||||
|
||||
namespace URL::Pattern {
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterninit
|
||||
struct Init {
|
||||
Optional<String> protocol;
|
||||
Optional<String> username;
|
||||
Optional<String> password;
|
||||
Optional<String> hostname;
|
||||
Optional<String> port;
|
||||
Optional<String> pathname;
|
||||
Optional<String> search;
|
||||
Optional<String> hash;
|
||||
Optional<String> base_url;
|
||||
};
|
||||
|
||||
}
|
||||
22
Libraries/LibURL/Pattern/Pattern.h
Normal file
22
Libraries/LibURL/Pattern/Pattern.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Variant.h>
|
||||
#include <LibURL/Pattern/Init.h>
|
||||
|
||||
namespace URL::Pattern {
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#typedefdef-urlpatterninput
|
||||
using Input = Variant<String, Init>;
|
||||
|
||||
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatternoptions
|
||||
struct Options {
|
||||
bool ignore_case { false };
|
||||
};
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user