
Along with putting functions in the URL namespace into a DOMURL namespace. This is done as LibWeb is in an awkward situation where it needs two URL classes. AK::URL is the general purpose URL class which is all that is needed in 95% of cases. URL in the Web namespace is needed predominantly for interfacing with the javascript interfaces. Because of two URLs in the same namespace, AK::URL has had to be used throughout LibWeb. If we move AK::URL into a URL namespace, this becomes more painful - where ::URL::URL is required to specify the constructor (and something like ::URL::create_with_url_or_path in other places). To fix this problem - rename the class in LibWeb implementing the URL IDL interface to DOMURL, along with moving the other Web URL related classes into this DOMURL folder. One could argue that this name also makes the situation a little more clear in LibWeb for why these two URL classes need be used in the first place.
36 lines
1 KiB
C++
36 lines
1 KiB
C++
/*
|
|
* Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
#include <LibWeb/DOMURL/URLSearchParams.h>
|
|
|
|
namespace Web::DOMURL {
|
|
|
|
class URLSearchParamsIterator : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(URLSearchParamsIterator, Bindings::PlatformObject);
|
|
JS_DECLARE_ALLOCATOR(URLSearchParamsIterator);
|
|
|
|
public:
|
|
static WebIDL::ExceptionOr<JS::NonnullGCPtr<URLSearchParamsIterator>> create(URLSearchParams const&, JS::Object::PropertyKind iteration_kind);
|
|
|
|
virtual ~URLSearchParamsIterator() override;
|
|
|
|
JS::Object* next();
|
|
|
|
private:
|
|
URLSearchParamsIterator(URLSearchParams const&, JS::Object::PropertyKind iteration_kind);
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
JS::NonnullGCPtr<URLSearchParams const> m_url_search_params;
|
|
JS::Object::PropertyKind m_iteration_kind;
|
|
size_t m_index { 0 };
|
|
};
|
|
|
|
}
|