Commit 20bdf9a0 authored by ager@chromium.org's avatar ager@chromium.org

Explicitly use icu namespace.

Chromium builds with U_USING_ICU_NAMESPACE=0, so we need this.

Landing for thakis@chromium.org.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7487 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ea8312ba
...@@ -46,16 +46,16 @@ icu::BreakIterator* BreakIterator::UnpackBreakIterator( ...@@ -46,16 +46,16 @@ icu::BreakIterator* BreakIterator::UnpackBreakIterator(
return NULL; return NULL;
} }
UnicodeString* BreakIterator::ResetAdoptedText( icu::UnicodeString* BreakIterator::ResetAdoptedText(
v8::Handle<v8::Object> obj, v8::Handle<v8::Value> value) { v8::Handle<v8::Object> obj, v8::Handle<v8::Value> value) {
// Get the previous value from the internal field. // Get the previous value from the internal field.
UnicodeString* text = static_cast<UnicodeString*>( icu::UnicodeString* text = static_cast<icu::UnicodeString*>(
obj->GetPointerFromInternalField(1)); obj->GetPointerFromInternalField(1));
delete text; delete text;
// Assign new value to the internal pointer. // Assign new value to the internal pointer.
v8::String::Value text_value(value); v8::String::Value text_value(value);
text = new UnicodeString( text = new icu::UnicodeString(
reinterpret_cast<const UChar*>(*text_value), text_value.length()); reinterpret_cast<const UChar*>(*text_value), text_value.length());
obj->SetPointerInInternalField(1, text); obj->SetPointerInInternalField(1, text);
...@@ -74,7 +74,7 @@ void BreakIterator::DeleteBreakIterator(v8::Persistent<v8::Value> object, ...@@ -74,7 +74,7 @@ void BreakIterator::DeleteBreakIterator(v8::Persistent<v8::Value> object,
// pointing to a break iterator. // pointing to a break iterator.
delete UnpackBreakIterator(persistent_object); delete UnpackBreakIterator(persistent_object);
delete static_cast<UnicodeString*>( delete static_cast<icu::UnicodeString*>(
persistent_object->GetPointerFromInternalField(1)); persistent_object->GetPointerFromInternalField(1));
// Then dispose of the persistent handle to JS object. // Then dispose of the persistent handle to JS object.
...@@ -144,8 +144,9 @@ v8::Handle<v8::Value> BreakIterator::BreakIteratorBreakType( ...@@ -144,8 +144,9 @@ v8::Handle<v8::Value> BreakIterator::BreakIteratorBreakType(
} }
// TODO(cira): Remove cast once ICU fixes base BreakIterator class. // TODO(cira): Remove cast once ICU fixes base BreakIterator class.
int32_t status = icu::RuleBasedBreakIterator* rule_based_iterator =
static_cast<RuleBasedBreakIterator*>(break_iterator)->getRuleStatus(); static_cast<icu::RuleBasedBreakIterator*>(break_iterator);
int32_t status = rule_based_iterator->getRuleStatus();
// Keep return values in sync with JavaScript BreakType enum. // Keep return values in sync with JavaScript BreakType enum.
if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) { if (status >= UBRK_WORD_NONE && status < UBRK_WORD_NONE_LIMIT) {
return v8::Int32::New(UBRK_WORD_NONE); return v8::Int32::New(UBRK_WORD_NONE);
......
...@@ -51,8 +51,8 @@ class BreakIterator { ...@@ -51,8 +51,8 @@ class BreakIterator {
// Deletes the old value and sets the adopted text in // Deletes the old value and sets the adopted text in
// corresponding JavaScript object. // corresponding JavaScript object.
static UnicodeString* ResetAdoptedText(v8::Handle<v8::Object> obj, static icu::UnicodeString* ResetAdoptedText(v8::Handle<v8::Object> obj,
v8::Handle<v8::Value> text_value); v8::Handle<v8::Value> text_value);
// Release memory we allocated for the BreakIterator once the JS object that // Release memory we allocated for the BreakIterator once the JS object that
// holds the pointer gets garbage collected. // holds the pointer gets garbage collected.
......
...@@ -167,7 +167,7 @@ v8::Handle<v8::Value> I18NExtension::JSAvailableLocales( ...@@ -167,7 +167,7 @@ v8::Handle<v8::Value> I18NExtension::JSAvailableLocales(
v8::Local<v8::Array> all_locales = v8::Array::New(); v8::Local<v8::Array> all_locales = v8::Array::New();
int count = 0; int count = 0;
const Locale* icu_locales = icu::Locale::getAvailableLocales(count); const icu::Locale* icu_locales = icu::Locale::getAvailableLocales(count);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
all_locales->Set(i, v8::String::New(icu_locales[i].getName())); all_locales->Set(i, v8::String::New(icu_locales[i].getName()));
} }
...@@ -230,7 +230,7 @@ static v8::Handle<v8::Value> GetDisplayItem(const v8::Arguments& args, ...@@ -230,7 +230,7 @@ static v8::Handle<v8::Value> GetDisplayItem(const v8::Arguments& args,
icu::Locale icu_locale(base_locale.c_str()); icu::Locale icu_locale(base_locale.c_str());
icu::Locale display_locale = icu::Locale display_locale =
icu::Locale(*v8::String::Utf8Value(args[1]->ToString())); icu::Locale(*v8::String::Utf8Value(args[1]->ToString()));
UnicodeString result; icu::UnicodeString result;
if (item == "language") { if (item == "language") {
icu_locale.getDisplayLanguage(display_locale, result); icu_locale.getDisplayLanguage(display_locale, result);
} else if (item == "script") { } else if (item == "script") {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment