v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
js-locale.h
Go to the documentation of this file.
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_OBJECTS_JS_LOCALE_H_
6#define V8_OBJECTS_JS_LOCALE_H_
7
8#ifndef V8_INTL_SUPPORT
9#error Internationalization is expected to be enabled.
10#endif // V8_INTL_SUPPORT
11
14#include "src/heap/factory.h"
15#include "src/objects/managed.h"
16#include "src/objects/objects.h"
17
18// Has to be the last include (doesn't have include guards):
20
21namespace U_ICU_NAMESPACE {
22class Locale;
23} // namespace U_ICU_NAMESPACE
24
25namespace v8 {
26namespace internal {
27
28#include "torque-generated/src/objects/js-locale-tq.inc"
29
30class JSLocale : public TorqueGeneratedJSLocale<JSLocale, JSObject> {
31 public:
32 // Creates locale object with properties derived from input locale string
33 // and options.
38
43
45 Isolate* isolate, DirectHandle<JSLocale> locale);
47 Isolate* isolate, DirectHandle<JSLocale> locale);
49 Isolate* isolate, DirectHandle<JSLocale> locale);
51 Isolate* isolate, DirectHandle<JSLocale> locale);
53 Isolate* isolate, DirectHandle<JSLocale> locale);
55 Isolate* isolate, DirectHandle<JSLocale> locale);
57 Isolate* isolate, DirectHandle<JSLocale> locale);
58
61 static DirectHandle<Object> Script(Isolate* isolate,
63 static DirectHandle<Object> Region(Isolate* isolate,
77 static DirectHandle<Object> Numeric(Isolate* isolate,
83 static std::string ToString(DirectHandle<JSLocale> locale);
84
85 // Help function to validate locale by other Intl objects.
86 static bool StartsWithUnicodeLanguageId(const std::string& value);
87
88 // Help function to check well-formed
89 // "(3*8alphanum) *("-" (3*8alphanum)) sequence" sequence
90 static bool Is38AlphaNumList(const std::string& value);
91
92 // Help function to check well-formed "3alpha"
93 static bool Is3Alpha(const std::string& value);
94
96
98
100};
101
102} // namespace internal
103} // namespace v8
104
106
107#endif // V8_OBJECTS_JS_LOCALE_H_
static DirectHandle< String > BaseName(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:800
static DirectHandle< Object > Region(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:792
static bool Is38AlphaNumList(const std::string &value)
Definition js-locale.cc:206
static DirectHandle< Object > HourCycle(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:827
static DirectHandle< Object > Calendar(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:808
static bool StartsWithUnicodeLanguageId(const std::string &value)
Definition js-locale.cc:224
static MaybeDirectHandle< JSLocale > Maximize(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:434
static DirectHandle< Object > Language(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:773
static DirectHandle< String > ToString(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:852
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSObject > GetTextInfo(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:683
static bool Is3Alpha(const std::string &value)
Definition js-locale.cc:218
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< Object > GetTimeZones(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:644
static DirectHandle< Object > NumberingSystem(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:842
static MaybeDirectHandle< JSLocale > New(Isolate *isolate, DirectHandle< Map > map, DirectHandle< String > locale, DirectHandle< JSReceiver > options)
Definition js-locale.cc:370
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSArray > GetNumberingSystems(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:614
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSObject > GetWeekInfo(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:712
static DirectHandle< Object > Script(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:784
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSArray > GetCalendars(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:538
static MaybeDirectHandle< JSLocale > Minimize(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:468
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSArray > GetHourCycles(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:557
static DirectHandle< Object > FirstDayOfWeek(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:823
static DirectHandle< Object > Collation(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:818
static V8_WARN_UNUSED_RESULT MaybeDirectHandle< JSArray > GetCollations(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:549
static DirectHandle< Object > CaseFirst(Isolate *isolate, DirectHandle< JSLocale > locale)
Definition js-locale.cc:813
Union< Smi, HeapNumber, BigInt > Numeric
Definition globals.h:1183
#define DECL_ACCESSORS(name,...)
#define DECL_PRINTER(Name)
#define TQ_OBJECT_CONSTRUCTORS(Type)
#define V8_WARN_UNUSED_RESULT
Definition v8config.h:671