2022-01-30 01:08:42 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2022-01-31 18:41:44 +02:00
|
|
|
#include <AK/Utf16View.h>
|
2022-01-30 01:08:42 +02:00
|
|
|
#include <LibJS/Runtime/Intl/Segmenter.h>
|
|
|
|
#include <LibJS/Runtime/Object.h>
|
2024-06-23 09:14:27 -04:00
|
|
|
#include <LibUnicode/Segmenter.h>
|
2022-01-30 01:08:42 +02:00
|
|
|
|
|
|
|
namespace JS::Intl {
|
|
|
|
|
|
|
|
class Segments final : public Object {
|
|
|
|
JS_OBJECT(Segments, Object);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(Segments);
|
2022-01-30 01:08:42 +02:00
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<Segments> create(Realm&, Unicode::Segmenter const&, Utf16String);
|
2022-01-30 01:08:42 +02:00
|
|
|
|
|
|
|
virtual ~Segments() override = default;
|
|
|
|
|
2024-06-23 09:14:27 -04:00
|
|
|
Unicode::Segmenter& segments_segmenter() const { return *m_segments_segmenter; }
|
2022-01-30 01:08:42 +02:00
|
|
|
|
2025-07-09 14:13:22 -04:00
|
|
|
Utf16String const& segments_string() const { return m_segments_string; }
|
2022-01-30 01:08:42 +02:00
|
|
|
|
|
|
|
private:
|
2024-06-23 09:14:27 -04:00
|
|
|
Segments(Realm&, Unicode::Segmenter const&, Utf16String);
|
2022-08-28 23:51:28 +02:00
|
|
|
|
2024-06-23 09:14:27 -04:00
|
|
|
NonnullOwnPtr<Unicode::Segmenter> m_segments_segmenter; // [[SegmentsSegmenter]]
|
|
|
|
Utf16String m_segments_string; // [[SegmentsString]]
|
2022-01-30 01:08:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|