v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-segments.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_OBJECTS_JS_SEGMENTS_H_
6#define V8_OBJECTS_JS_SEGMENTS_H_
7
8#ifndef V8_INTL_SUPPORT
9#error Internationalization is expected to be enabled.
10#endif // V8_INTL_SUPPORT
11
12#include "src/base/bit-field.h"
14#include "src/heap/factory.h"
16#include "src/objects/managed.h"
17#include "src/objects/objects.h"
18#include "unicode/uversion.h"
19
20// Has to be the last include (doesn't have include guards):
22
23namespace U_ICU_NAMESPACE {
24class BreakIterator;
25class UnicodeString;
26} // namespace U_ICU_NAMESPACE
27
28namespace v8 {
29namespace internal {
30
31#include "torque-generated/src/objects/js-segments-tq.inc"
32
33class JSSegments : public TorqueGeneratedJSSegments<JSSegments, JSObject> {
34 public:
35 // ecma402 #sec-createsegmentsobject
37 Isolate* isolate, DirectHandle<JSSegmenter> segmenter,
39
40 // ecma402 #sec-%segmentsprototype%.containing
42 Isolate* isolate, DirectHandle<JSSegments> segments_holder, double n);
43
44 // ecma402 #sec-createsegmentdataobject
48 icu::BreakIterator* break_iterator,
49 DirectHandle<String> input_string,
50 const icu::UnicodeString& unicode_string,
51 int32_t start_index, int32_t end_index);
52
54
55 // SegmentIterator accessors.
59
61
64
65 // Bit positions in |flags|.
66 DEFINE_TORQUE_GENERATED_JS_SEGMENT_ITERATOR_FLAGS()
67
68 static_assert(GranularityBits::is_valid(JSSegmenter::Granularity::GRAPHEME));
69 static_assert(GranularityBits::is_valid(JSSegmenter::Granularity::WORD));
70 static_assert(GranularityBits::is_valid(JSSegmenter::Granularity::SENTENCE));
71
73};
74
75} // namespace internal
76} // namespace v8
77
79
80#endif // V8_OBJECTS_JS_SEGMENTS_H_
void set_granularity(JSSegmenter::Granularity granularity)
JSSegmenter::Granularity granularity() const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSSegmentDataObject > CreateSegmentDataObject(Isolate *isolate, JSSegmenter::Granularity granularity, icu::BreakIterator *break_iterator, DirectHandle< String > input_string, const icu::UnicodeString &unicode_string, int32_t start_index, int32_t end_index)
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > Containing(Isolate *isolate, DirectHandle< JSSegments > segments_holder, double n)
Handle< String > GranularityAsString(Isolate *isolate) const
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSSegments > Create(Isolate *isolate, DirectHandle< JSSegmenter > segmenter, DirectHandle< String > string)
#define DECL_ACCESSORS(name,...)
#define DECL_PRINTER(Name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671