| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 | 6 |
| 7 #include "base/strings/string_piece.h" | 7 #include "base/strings/string_piece.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversion_utils.h" | 9 #include "base/strings/utf_string_conversion_utils.h" |
| 10 | 10 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 bool UTF16ToUTF8(const char16* src, size_t src_len, std::string* output) { | 202 bool UTF16ToUTF8(const char16* src, size_t src_len, std::string* output) { |
| 203 return WideToUTF8(src, src_len, output); | 203 return WideToUTF8(src, src_len, output); |
| 204 } | 204 } |
| 205 | 205 |
| 206 std::string UTF16ToUTF8(const string16& utf16) { | 206 std::string UTF16ToUTF8(const string16& utf16) { |
| 207 return WideToUTF8(utf16); | 207 return WideToUTF8(utf16); |
| 208 } | 208 } |
| 209 | 209 |
| 210 #endif | 210 #endif |
| 211 | 211 |
| 212 std::wstring ASCIIToWide(const StringPiece& ascii) { | |
| 213 DCHECK(IsStringASCII(ascii)) << ascii; | |
| 214 return std::wstring(ascii.begin(), ascii.end()); | |
| 215 } | |
| 216 | |
| 217 string16 ASCIIToUTF16(const StringPiece& ascii) { | 212 string16 ASCIIToUTF16(const StringPiece& ascii) { |
| 218 DCHECK(IsStringASCII(ascii)) << ascii; | 213 DCHECK(IsStringASCII(ascii)) << ascii; |
| 219 return string16(ascii.begin(), ascii.end()); | 214 return string16(ascii.begin(), ascii.end()); |
| 220 } | 215 } |
| 221 | 216 |
| 222 std::string UTF16ToASCII(const string16& utf16) { | 217 std::string UTF16ToASCII(const string16& utf16) { |
| 223 DCHECK(IsStringASCII(utf16)) << UTF16ToUTF8(utf16); | 218 DCHECK(IsStringASCII(utf16)) << UTF16ToUTF8(utf16); |
| 224 return std::string(utf16.begin(), utf16.end()); | 219 return std::string(utf16.begin(), utf16.end()); |
| 225 } | 220 } |
| 226 | 221 |
| 227 } // namespace base | 222 } // namespace base |
| OLD | NEW |