2025-01-11 22:54:57 +13:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-01-13 22:24:18 +13:00
|
|
|
#include <AK/HashMap.h>
|
|
|
|
|
#include <AK/String.h>
|
2025-01-11 22:54:57 +13:00
|
|
|
#include <AK/Variant.h>
|
2025-01-13 22:24:18 +13:00
|
|
|
#include <AK/Vector.h>
|
2025-01-11 22:54:57 +13:00
|
|
|
#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 };
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-13 22:24:18 +13:00
|
|
|
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatterncomponentresult
|
|
|
|
|
struct ComponentResult {
|
|
|
|
|
String input;
|
|
|
|
|
OrderedHashMap<String, Variant<String, Empty>> groups;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://urlpattern.spec.whatwg.org/#dictdef-urlpatternresult
|
|
|
|
|
struct Result {
|
|
|
|
|
Vector<Input> inputs;
|
|
|
|
|
|
|
|
|
|
ComponentResult protocol;
|
|
|
|
|
ComponentResult username;
|
|
|
|
|
ComponentResult password;
|
|
|
|
|
ComponentResult hostname;
|
|
|
|
|
ComponentResult port;
|
|
|
|
|
ComponentResult pathname;
|
|
|
|
|
ComponentResult search;
|
|
|
|
|
ComponentResult hash;
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-11 22:54:57 +13:00
|
|
|
}
|