/* * Copyright (c) 2021, Idan Horowitz * Copyright (c) 2021, the SerenityOS developers. * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include namespace Web::URL { class URL : public Bindings::Wrappable , public RefCounted , public Weakable { public: using WrapperType = Bindings::URLWrapper; static NonnullRefPtr create(AK::URL url, NonnullRefPtr query) { return adopt_ref(*new URL(move(url), move(query))); } static DOM::ExceptionOr> create_with_global_object(Bindings::WindowObject&, const String& url, const String& base); String href() const; DOM::ExceptionOr set_href(String const&); String origin() const; String protocol() const; void set_protocol(String const&); String username() const; void set_username(String const&); String password() const; void set_password(String const&); String host() const; void set_host(String const&); String hostname() const; void set_hostname(String const&); String port() const; void set_port(String const&); String pathname() const; void set_pathname(String const&); String search() const; void set_search(String const&); URLSearchParams const* search_params() const; String hash() const; void set_hash(String const&); String to_json() const; void set_query(Badge, String query) { m_url.set_query(move(query)); } private: explicit URL(AK::URL url, NonnullRefPtr query) : m_url(move(url)) , m_query(move(query)) {}; AK::URL m_url; NonnullRefPtr m_query; }; }