/src/serenity/Userland/Libraries/LibJS/Runtime/StringIterator.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <AK/Utf8View.h> |
8 | | #include <LibJS/Runtime/GlobalObject.h> |
9 | | #include <LibJS/Runtime/StringIterator.h> |
10 | | |
11 | | namespace JS { |
12 | | |
13 | | JS_DEFINE_ALLOCATOR(StringIterator); |
14 | | |
15 | | NonnullGCPtr<StringIterator> StringIterator::create(Realm& realm, String string) |
16 | 0 | { |
17 | 0 | return realm.heap().allocate<StringIterator>(realm, move(string), realm.intrinsics().string_iterator_prototype()); |
18 | 0 | } |
19 | | |
20 | | StringIterator::StringIterator(String string, Object& prototype) |
21 | 0 | : Object(ConstructWithPrototypeTag::Tag, prototype) |
22 | 0 | , m_string(move(string)) |
23 | 0 | , m_iterator(Utf8View(m_string).begin()) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | | } |