| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 // limitations under the License. | 27 // limitations under the License. |
| 28 | 28 |
| 29 #ifndef V8_I18N_H_ | 29 #ifndef V8_I18N_H_ |
| 30 #define V8_I18N_H_ | 30 #define V8_I18N_H_ |
| 31 | 31 |
| 32 #include "unicode/uversion.h" | 32 #include "unicode/uversion.h" |
| 33 #include "v8.h" | 33 #include "v8.h" |
| 34 | 34 |
| 35 namespace U_ICU_NAMESPACE { | 35 namespace U_ICU_NAMESPACE { |
| 36 class BreakIterator; |
| 37 class Collator; |
| 36 class DecimalFormat; | 38 class DecimalFormat; |
| 37 class SimpleDateFormat; | 39 class SimpleDateFormat; |
| 38 } | 40 } |
| 39 | 41 |
| 40 namespace v8 { | 42 namespace v8 { |
| 41 namespace internal { | 43 namespace internal { |
| 42 | 44 |
| 43 class I18N { | 45 class I18N { |
| 44 public: | 46 public: |
| 45 // Creates an ObjectTemplate with one internal field. | 47 // Creates an ObjectTemplate with one internal field. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 63 Handle<JSObject> options, | 65 Handle<JSObject> options, |
| 64 Handle<JSObject> resolved); | 66 Handle<JSObject> resolved); |
| 65 | 67 |
| 66 // Unpacks date format object from corresponding JavaScript object. | 68 // Unpacks date format object from corresponding JavaScript object. |
| 67 static icu::SimpleDateFormat* UnpackDateFormat(Isolate* isolate, | 69 static icu::SimpleDateFormat* UnpackDateFormat(Isolate* isolate, |
| 68 Handle<JSObject> obj); | 70 Handle<JSObject> obj); |
| 69 | 71 |
| 70 // Release memory we allocated for the DateFormat once the JS object that | 72 // Release memory we allocated for the DateFormat once the JS object that |
| 71 // holds the pointer gets garbage collected. | 73 // holds the pointer gets garbage collected. |
| 72 static void DeleteDateFormat(v8::Isolate* isolate, | 74 static void DeleteDateFormat(v8::Isolate* isolate, |
| 73 Persistent<v8::Object>* object, | 75 Persistent<v8::Value>* object, |
| 74 void* param); | 76 void* param); |
| 75 private: | 77 private: |
| 76 DateFormat(); | 78 DateFormat(); |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 | 81 |
| 80 class NumberFormat { | 82 class NumberFormat { |
| 81 public: | 83 public: |
| 82 // Create a formatter for the specificied locale and options. Returns the | 84 // Create a formatter for the specificied locale and options. Returns the |
| 83 // resolved settings for the locale / options. | 85 // resolved settings for the locale / options. |
| 84 static icu::DecimalFormat* InitializeNumberFormat( | 86 static icu::DecimalFormat* InitializeNumberFormat( |
| 85 Isolate* isolate, | 87 Isolate* isolate, |
| 86 Handle<String> locale, | 88 Handle<String> locale, |
| 87 Handle<JSObject> options, | 89 Handle<JSObject> options, |
| 88 Handle<JSObject> resolved); | 90 Handle<JSObject> resolved); |
| 89 | 91 |
| 90 // Unpacks number format object from corresponding JavaScript object. | 92 // Unpacks number format object from corresponding JavaScript object. |
| 91 static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate, | 93 static icu::DecimalFormat* UnpackNumberFormat(Isolate* isolate, |
| 92 Handle<JSObject> obj); | 94 Handle<JSObject> obj); |
| 93 | 95 |
| 94 // Release memory we allocated for the NumberFormat once the JS object that | 96 // Release memory we allocated for the NumberFormat once the JS object that |
| 95 // holds the pointer gets garbage collected. | 97 // holds the pointer gets garbage collected. |
| 96 static void DeleteNumberFormat(v8::Isolate* isolate, | 98 static void DeleteNumberFormat(v8::Isolate* isolate, |
| 97 Persistent<v8::Object>* object, | 99 Persistent<v8::Value>* object, |
| 98 void* param); | 100 void* param); |
| 99 private: | 101 private: |
| 100 NumberFormat(); | 102 NumberFormat(); |
| 101 }; | 103 }; |
| 102 | 104 |
| 105 |
| 106 class Collator { |
| 107 public: |
| 108 // Create a collator for the specificied locale and options. Returns the |
| 109 // resolved settings for the locale / options. |
| 110 static icu::Collator* InitializeCollator( |
| 111 Isolate* isolate, |
| 112 Handle<String> locale, |
| 113 Handle<JSObject> options, |
| 114 Handle<JSObject> resolved); |
| 115 |
| 116 // Unpacks collator object from corresponding JavaScript object. |
| 117 static icu::Collator* UnpackCollator(Isolate* isolate, Handle<JSObject> obj); |
| 118 |
| 119 // Release memory we allocated for the Collator once the JS object that holds |
| 120 // the pointer gets garbage collected. |
| 121 static void DeleteCollator(v8::Isolate* isolate, |
| 122 Persistent<v8::Value>* object, |
| 123 void* param); |
| 124 private: |
| 125 Collator(); |
| 126 }; |
| 127 |
| 128 class BreakIterator { |
| 129 public: |
| 130 // Create a BreakIterator for the specificied locale and options. Returns the |
| 131 // resolved settings for the locale / options. |
| 132 static icu::BreakIterator* InitializeBreakIterator( |
| 133 Isolate* isolate, |
| 134 Handle<String> locale, |
| 135 Handle<JSObject> options, |
| 136 Handle<JSObject> resolved); |
| 137 |
| 138 // Unpacks break iterator object from corresponding JavaScript object. |
| 139 static icu::BreakIterator* UnpackBreakIterator(Isolate* isolate, |
| 140 Handle<JSObject> obj); |
| 141 |
| 142 // Release memory we allocated for the BreakIterator once the JS object that |
| 143 // holds the pointer gets garbage collected. |
| 144 static void DeleteBreakIterator(v8::Isolate* isolate, |
| 145 Persistent<v8::Value>* object, |
| 146 void* param); |
| 147 |
| 148 private: |
| 149 BreakIterator(); |
| 150 }; |
| 151 |
| 103 } } // namespace v8::internal | 152 } } // namespace v8::internal |
| 104 | 153 |
| 105 #endif // V8_I18N_H_ | 154 #endif // V8_I18N_H_ |
| OLD | NEW |