2021-07-15 12:58:27 +00:00
|
|
|
/*
|
2022-01-31 18:07:22 +00:00
|
|
|
* Copyright (c) 2021, Tim Flynn <trflynn89@serenityos.org>
|
2021-07-15 12:58:27 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-07-22 14:19:27 +00:00
|
|
|
#include <AK/Utf16View.h>
|
2021-07-15 12:58:27 +00:00
|
|
|
#include <LibJS/Runtime/Object.h>
|
2021-08-09 13:06:45 +00:00
|
|
|
#include <LibJS/Runtime/Utf16String.h>
|
2021-07-15 12:58:27 +00:00
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
class RegExpStringIterator final : public Object {
|
|
|
|
JS_OBJECT(RegExpStringIterator, Object);
|
2024-11-14 15:01:23 +00:00
|
|
|
GC_DECLARE_ALLOCATOR(RegExpStringIterator);
|
2021-07-15 12:58:27 +00:00
|
|
|
|
|
|
|
public:
|
2024-11-14 15:01:23 +00:00
|
|
|
static GC::Ref<RegExpStringIterator> create(Realm&, Object& regexp_object, Utf16String string, bool global, bool unicode);
|
2021-07-15 12:58:27 +00:00
|
|
|
|
|
|
|
virtual ~RegExpStringIterator() override = default;
|
|
|
|
|
|
|
|
Object& regexp_object() { return m_regexp_object; }
|
2021-08-09 16:55:08 +00:00
|
|
|
Utf16String string() const { return m_string; }
|
2021-07-15 12:58:27 +00:00
|
|
|
bool global() const { return m_global; }
|
|
|
|
bool unicode() const { return m_unicode; }
|
|
|
|
|
|
|
|
bool done() const { return m_done; }
|
|
|
|
void set_done() { m_done = true; }
|
|
|
|
|
|
|
|
private:
|
2022-08-28 21:51:28 +00:00
|
|
|
explicit RegExpStringIterator(Object& prototype, Object& regexp_object, Utf16String string, bool global, bool unicode);
|
|
|
|
|
2021-07-16 18:36:52 +00:00
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
2024-11-14 15:01:23 +00:00
|
|
|
GC::Ref<Object> m_regexp_object;
|
2021-08-09 13:06:45 +00:00
|
|
|
Utf16String m_string;
|
2021-07-15 12:58:27 +00:00
|
|
|
bool m_global { false };
|
|
|
|
bool m_unicode { false };
|
|
|
|
bool m_done { false };
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|