OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // limitations under the License. | 4 // limitations under the License. |
5 | 5 |
6 #ifndef V8_I18N_H_ | 6 #ifndef V8_I18N_H_ |
7 #define V8_I18N_H_ | 7 #define V8_I18N_H_ |
8 | 8 |
9 #include "src/base/timezone-cache.h" | |
10 #include "src/objects.h" | 9 #include "src/objects.h" |
11 #include "unicode/uversion.h" | 10 #include "unicode/uversion.h" |
12 | 11 |
13 namespace U_ICU_NAMESPACE { | 12 namespace U_ICU_NAMESPACE { |
14 class BreakIterator; | 13 class BreakIterator; |
15 class Collator; | 14 class Collator; |
16 class DecimalFormat; | 15 class DecimalFormat; |
17 class SimpleDateFormat; | 16 class SimpleDateFormat; |
18 class TimeZone; | |
19 } | 17 } |
20 | 18 |
21 namespace v8 { | 19 namespace v8 { |
22 namespace internal { | 20 namespace internal { |
23 | 21 |
24 template <typename T> | 22 template <typename T> |
25 class Handle; | 23 class Handle; |
26 | 24 |
27 class DateFormat { | 25 class DateFormat { |
28 public: | 26 public: |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, | 131 const UChar* GetUCharBufferFromFlat(const String::FlatContent& flat, |
134 std::unique_ptr<uc16[]>* dest, | 132 std::unique_ptr<uc16[]>* dest, |
135 int32_t length); | 133 int32_t length); |
136 MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate, | 134 MUST_USE_RESULT Object* LocaleConvertCase(Handle<String> s, Isolate* isolate, |
137 bool is_to_upper, const char* lang); | 135 bool is_to_upper, const char* lang); |
138 MUST_USE_RESULT Object* ConvertToLower(Handle<String> s, Isolate* isolate); | 136 MUST_USE_RESULT Object* ConvertToLower(Handle<String> s, Isolate* isolate); |
139 MUST_USE_RESULT Object* ConvertToUpper(Handle<String> s, Isolate* isolate); | 137 MUST_USE_RESULT Object* ConvertToUpper(Handle<String> s, Isolate* isolate); |
140 MUST_USE_RESULT Object* ConvertCase(Handle<String> s, bool is_upper, | 138 MUST_USE_RESULT Object* ConvertCase(Handle<String> s, bool is_upper, |
141 Isolate* isolate); | 139 Isolate* isolate); |
142 | 140 |
143 // ICUTimezoneCache calls out to ICU for TimezoneCache | |
144 // functionality in a straightforward way. | |
145 class ICUTimezoneCache : public base::TimezoneCache { | |
146 public: | |
147 ICUTimezoneCache(); | |
148 | |
149 ~ICUTimezoneCache() override; | |
150 | |
151 const char* LocalTimezone(double time_ms) override; | |
152 | |
153 double DaylightSavingsOffset(double time_ms) override; | |
154 | |
155 double LocalTimeOffset() override; | |
156 | |
157 void Clear() override; | |
158 | |
159 private: | |
160 icu::TimeZone* GetTimeZone(); | |
161 | |
162 bool GetOffsets(double time_ms, int32_t* raw_offset, int32_t* dst_offset); | |
163 | |
164 icu::TimeZone* timezone_; | |
165 | |
166 static const int32_t kMaxTimezoneChars = 100; | |
167 char timezone_name_[kMaxTimezoneChars]; | |
168 char dst_timezone_name_[kMaxTimezoneChars]; | |
169 }; | |
170 | |
171 } // namespace internal | 141 } // namespace internal |
172 } // namespace v8 | 142 } // namespace v8 |
173 | 143 |
174 #endif // V8_I18N_H_ | 144 #endif // V8_I18N_H_ |
OLD | NEW |