1// Copyright 2018 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_INTL_SUPPORT
6#error Internationalization is expected to be enabled.
7#endif  // V8_INTL_SUPPORT
8
9#ifndef V8_OBJECTS_JS_BREAK_ITERATOR_H_
10#define V8_OBJECTS_JS_BREAK_ITERATOR_H_
11
12#include <set>
13#include <string>
14
15#include "src/objects/intl-objects.h"
16#include "src/objects/managed.h"
17#include "src/objects/objects.h"
18
19// Has to be the last include (doesn't have include guards):
20#include "src/objects/object-macros.h"
21
22namespace U_ICU_NAMESPACE {
23class BreakIterator;
24}  // namespace U_ICU_NAMESPACE
25
26namespace v8 {
27namespace internal {
28
29#include "torque-generated/src/objects/js-break-iterator-tq.inc"
30
31class JSV8BreakIterator
32    : public TorqueGeneratedJSV8BreakIterator<JSV8BreakIterator, JSObject> {
33 public:
34  V8_WARN_UNUSED_RESULT static MaybeHandle<JSV8BreakIterator> New(
35      Isolate* isolate, Handle<Map> map, Handle<Object> input_locales,
36      Handle<Object> input_options, const char* service);
37
38  static Handle<JSObject> ResolvedOptions(
39      Isolate* isolate, Handle<JSV8BreakIterator> break_iterator);
40
41  V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
42
43  static void AdoptText(Isolate* isolate,
44                        Handle<JSV8BreakIterator> break_iterator,
45                        Handle<String> text);
46
47  static Handle<Object> Current(Isolate* isolate,
48                                Handle<JSV8BreakIterator> break_iterator);
49  static Handle<Object> First(Isolate* isolate,
50                              Handle<JSV8BreakIterator> break_iterator);
51  static Handle<Object> Next(Isolate* isolate,
52                             Handle<JSV8BreakIterator> break_iterator);
53  static String BreakType(Isolate* isolate,
54                          Handle<JSV8BreakIterator> break_iterator);
55
56  DECL_PRINTER(JSV8BreakIterator)
57
58  DECL_ACCESSORS(break_iterator, Managed<icu::BreakIterator>)
59  DECL_ACCESSORS(unicode_string, Managed<icu::UnicodeString>)
60
61  TQ_OBJECT_CONSTRUCTORS(JSV8BreakIterator)
62};
63
64}  // namespace internal
65}  // namespace v8
66
67#include "src/objects/object-macros-undef.h"
68
69#endif  // V8_OBJECTS_JS_BREAK_ITERATOR_H_
70