5 #ifndef V8_INTL_SUPPORT 6 #error Internationalization is expected to be enabled. 7 #endif // V8_INTL_SUPPORT 9 #ifndef V8_OBJECTS_INTL_OBJECTS_H_ 10 #define V8_OBJECTS_INTL_OBJECTS_H_ 16 #include "src/base/timezone-cache.h" 17 #include "src/contexts.h" 18 #include "src/objects.h" 19 #include "src/objects/managed.h" 20 #include "unicode/locid.h" 21 #include "unicode/uversion.h" 23 #define V8_MINIMUM_ICU_VERSION 63 29 class SimpleDateFormat;
42 enum class BoundFunctionContextSlot {
43 kBoundFunction = Context::MIN_CONTEXT_SLOTS,
51 static std::set<std::string> BuildLocaleSet(
52 const icu::Locale* icu_available_locales, int32_t count);
58 static std::string GetNumberingSystem(
const icu::Locale& icu_locale);
61 Isolate* isolate,
const char* method,
62 const std::set<std::string>& available_locales,
Handle<Object> locales_in,
65 static std::string DefaultLocale(
Isolate* isolate);
82 V8_WARN_UNUSED_RESULT
static Maybe<bool> GetStringOption(
84 std::vector<const char*> values,
const char* service,
85 std::unique_ptr<
char[]>* result);
92 V8_WARN_UNUSED_RESULT
static Maybe<T> GetStringOption(
94 const char* method,
const std::vector<const char*>& str_values,
95 const std::vector<T>& enum_values,
T default_value) {
96 DCHECK_EQ(str_values.size(), enum_values.size());
97 std::unique_ptr<char[]> cstr;
98 Maybe<bool> found = Intl::GetStringOption(isolate, options, name,
99 str_values, method, &cstr);
100 MAYBE_RETURN(found, Nothing<T>());
102 DCHECK_NOT_NULL(cstr.get());
103 for (
size_t i = 0;
i < str_values.size();
i++) {
104 if (strcmp(cstr.get(), str_values[
i]) == 0) {
105 return Just(enum_values[
i]);
110 return Just(default_value);
125 V8_WARN_UNUSED_RESULT
static Maybe<bool> GetBoolOption(
127 const char* service,
bool* result);
140 bool only_return_one_result =
false);
171 V8_WARN_UNUSED_RESULT
static Maybe<bool> SetNumberFormatDigitOptions(
172 Isolate* isolate, icu::DecimalFormat* number_format,
175 static icu::Locale CreateICULocale(
const std::string& bcp47_locale);
179 Isolate* isolate,
const icu::UnicodeString&
string);
183 Isolate* isolate,
const icu::UnicodeString&
string, int32_t begin,
217 enum class CaseFirst { kUpper, kLower, kFalse, kUndefined };
224 enum class HourCycle { kH11, kH12, kH23, kH24, kUndefined };
231 enum class MatcherOption { kBestFit, kLookup };
239 icu::Locale icu_locale;
240 std::map<std::string, std::string> extensions;
244 Isolate* isolate,
const std::set<std::string>& available_locales,
245 const std::vector<std::string>& requested_locales, MatcherOption options,
246 const std::set<std::string>& relevant_extension_keys);
251 icu::BreakIterator* break_iterator);
259 static icu::UnicodeString ToICUUnicodeString(
Isolate* isolate,
262 static const uint8_t* ToLatin1LowerTable();
270 #endif // V8_OBJECTS_INTL_OBJECTS_H_
V8_INLINE T FromJust() const