V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
js-collator.h
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/heap/factory.h"
16 #include "src/isolate.h"
17 #include "src/objects.h"
18 #include "src/objects/intl-objects.h"
19 #include "src/objects/managed.h"
20 
21 // Has to be the last include (doesn't have include guards):
22 #include "src/objects/object-macros.h"
23 
24 namespace U_ICU_NAMESPACE {
25 class Collator;
26 } // namespace U_ICU_NAMESPACE
27 
28 namespace v8 {
29 namespace internal {
30 
31 class JSCollator : public JSObject {
32  public:
33  // ecma402/#sec-initializecollator
34  V8_WARN_UNUSED_RESULT static MaybeHandle<JSCollator> Initialize(
35  Isolate* isolate, Handle<JSCollator> collator, Handle<Object> locales,
36  Handle<Object> options);
37 
38  // ecma402/#sec-intl.collator.prototype.resolvedoptions
39  static Handle<JSObject> ResolvedOptions(Isolate* isolate,
40  Handle<JSCollator> collator);
41 
42  static std::set<std::string> GetAvailableLocales();
43 
44  DECL_CAST(JSCollator)
45  DECL_PRINTER(JSCollator)
46  DECL_VERIFIER(JSCollator)
47 
48 // Layout description.
49 #define JS_COLLATOR_FIELDS(V) \
50  V(kICUCollatorOffset, kTaggedSize) \
51  V(kBoundCompareOffset, kTaggedSize) \
52  /* Total size. */ \
53  V(kSize, 0)
54 
55  DEFINE_FIELD_OFFSET_CONSTANTS(JSObject::kHeaderSize, JS_COLLATOR_FIELDS)
56 #undef JS_COLLATOR_FIELDS
57 
58  DECL_ACCESSORS(icu_collator, Managed<icu::Collator>)
59  DECL_ACCESSORS(bound_compare, Object);
60 
61  private:
62  DISALLOW_IMPLICIT_CONSTRUCTORS(JSCollator);
63 };
64 
65 } // namespace internal
66 } // namespace v8
67 
68 #include "src/objects/object-macros-undef.h"
69 
70 #endif // V8_OBJECTS_JS_COLLATOR_H_
Definition: libplatform.h:13