Chromium Code Reviews| Index: src/i18n.h |
| diff --git a/src/i18n.h b/src/i18n.h |
| index f89d005b00c844309d925768f231c0bde94ca514..e3258dbe661d71d2ca7217537a450a234f4a6f59 100644 |
| --- a/src/i18n.h |
| +++ b/src/i18n.h |
| @@ -14,6 +14,7 @@ class BreakIterator; |
| class Collator; |
| class DecimalFormat; |
| class SimpleDateFormat; |
| +class PluralRules; |
| } |
| namespace v8 { |
| @@ -101,6 +102,43 @@ class Collator { |
| Collator(); |
| }; |
| +class PluralRules { |
| + public: |
| + // Create a PluralRules and DecimalFormat for the specificied locale and |
| + // options. Returns false on an ICU failure. |
| + static bool InitializePluralRules(Isolate* isolate, Handle<String> locale, |
| + Handle<JSObject> options, |
| + Handle<JSObject> resolved, |
| + icu::PluralRules** plural_rules, |
| + icu::DecimalFormat** decimal_format); |
| + |
| + // Unpacks PluralRules object from corresponding JavaScript object. |
| + static icu::PluralRules* UnpackPluralRules(Isolate* isolate, |
| + Handle<JSObject> obj); |
| + |
| + // Unpacks NumberFormat object from corresponding JavaScript PluralRUles |
| + // object. |
| + static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate, |
| + Handle<JSObject> obj); |
| + |
| + // Release memory we allocated for the Collator once the JS object that holds |
|
jungshik at Google
2017/05/08 19:16:54
Collator? You mean PluralRules, don't you?
|
| + // the pointer gets garbage collected. |
| + static void DeletePluralRules(const v8::WeakCallbackInfo<void>& data); |
| + |
| + // Layout description. |
| + static const int kPluralRules = JSObject::kHeaderSize; |
| + // Values are formatted with this NumberFormat and then parsed as a Number |
| + // to round them based on the options passed into the PluralRules objct. |
| + // TODO(littledan): If a future version of ICU supports the rounding |
| + // built-in to PluralRules, switch to that, see this bug: |
| + // http://bugs.icu-project.org/trac/ticket/12763 |
|
jungshik at Google
2017/05/08 19:16:54
That bug was fixed and is a part of ICU 59. I'll
jungshik at Google
2017/05/19 05:28:34
FYI, ICU in Chromium tree was updated to 59.1.
|
| + static const int kNumberFormat = kPluralRules + kPointerSize; |
| + static const int kSize = kNumberFormat + kPointerSize; |
| + |
| + private: |
| + PluralRules(); |
| +}; |
| + |
| class V8BreakIterator { |
| public: |
| // Create a BreakIterator for the specificied locale and options. Returns the |