OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium 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 | 4 |
5 #include "base/i18n/number_formatting.h" | 5 #include "base/i18n/number_formatting.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
13 #include "unicode/numfmt.h" | 13 #include "unicode/numfmt.h" |
14 #include "unicode/ustring.h" | 14 #include "unicode/ustring.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 struct NumberFormatWrapper { | 20 struct NumberFormatWrapper { |
(...skipping 21 matching lines...) Expand all Loading... |
42 // As a fallback, just return the raw number in a string. | 42 // As a fallback, just return the raw number in a string. |
43 return UTF8ToUTF16(StringPrintf("%" PRId64, number)); | 43 return UTF8ToUTF16(StringPrintf("%" PRId64, number)); |
44 } | 44 } |
45 icu::UnicodeString ustr; | 45 icu::UnicodeString ustr; |
46 number_format->format(number, ustr); | 46 number_format->format(number, ustr); |
47 | 47 |
48 return string16(ustr.getBuffer(), static_cast<size_t>(ustr.length())); | 48 return string16(ustr.getBuffer(), static_cast<size_t>(ustr.length())); |
49 } | 49 } |
50 | 50 |
51 } // namespace base | 51 } // namespace base |
OLD | NEW |