Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_I18N_UNICODESTRING_H_ | |
| 6 #define BASE_I18N_UNICODESTRING_H_ | |
| 7 | |
| 8 #include "base/strings/string16.h" | |
| 9 #include "third_party/icu/source/common/unicode/unistr.h" | |
| 10 | |
| 11 namespace base { | |
| 12 namespace i18n { | |
| 13 | |
| 14 inline string16 UnicodeStringToString16(const icu::UnicodeString& unistr) { | |
| 15 return base::string16(reinterpret_cast<const char16*>(unistr.getBuffer()), | |
| 16 static_cast<size_t>(unistr.length())); | |
|
jungshik at Google
2017/03/08 21:02:39
Strictly speaking, the above reinterpret_cast has
| |
| 17 } | |
| 18 | |
| 19 } // namespace i18n | |
| 20 } // namespace base | |
| 21 | |
| 22 #endif // BASE_UNICODESTRING_H_ | |
| OLD | NEW |