• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_COLLATOR_H_
10 #define V8_OBJECTS_JS_COLLATOR_H_
11 
12 #include <set>
13 #include <string>
14 
15 #include "src/execution/isolate.h"
16 #include "src/heap/factory.h"
17 #include "src/objects/intl-objects.h"
18 #include "src/objects/js-objects.h"
19 #include "src/objects/managed.h"
20 #include "src/objects/objects.h"
21 
22 // Has to be the last include (doesn't have include guards):
23 #include "src/objects/object-macros.h"
24 
25 namespace U_ICU_NAMESPACE {
26 class Collator;
27 }  // namespace U_ICU_NAMESPACE
28 
29 namespace v8 {
30 namespace internal {
31 
32 #include "torque-generated/src/objects/js-collator-tq.inc"
33 
34 class JSCollator : public TorqueGeneratedJSCollator<JSCollator, JSObject> {
35  public:
36   // ecma402/#sec-initializecollator
37   V8_WARN_UNUSED_RESULT static MaybeHandle<JSCollator> New(
38       Isolate* isolate, Handle<Map> map, Handle<Object> locales,
39       Handle<Object> options, const char* service);
40 
41   // ecma402/#sec-intl.collator.prototype.resolvedoptions
42   static Handle<JSObject> ResolvedOptions(Isolate* isolate,
43                                           Handle<JSCollator> collator);
44 
45   V8_EXPORT_PRIVATE static const std::set<std::string>& GetAvailableLocales();
46 
47   DECL_PRINTER(JSCollator)
48 
49   DECL_ACCESSORS(icu_collator, Managed<icu::Collator>)
50 
51   TQ_OBJECT_CONSTRUCTORS(JSCollator)
52 };
53 
54 }  // namespace internal
55 }  // namespace v8
56 
57 #include "src/objects/object-macros-undef.h"
58 
59 #endif  // V8_OBJECTS_JS_COLLATOR_H_
60