| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ | 5 #ifndef BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ |
| 6 #define BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ | 6 #define BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ |
| 7 | 7 |
| 8 // This should only be used by the various UTF string conversion files. | 8 // This should only be used by the various UTF string conversion files. |
| 9 | 9 |
| 10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 BASE_EXPORT bool ReadUnicodeCharacter(const wchar_t* src, | 53 BASE_EXPORT bool ReadUnicodeCharacter(const wchar_t* src, |
| 54 int32 src_len, | 54 int32 src_len, |
| 55 int32* char_index, | 55 int32* char_index, |
| 56 uint32* code_point); | 56 uint32* code_point); |
| 57 #endif // defined(WCHAR_T_IS_UTF32) | 57 #endif // defined(WCHAR_T_IS_UTF32) |
| 58 | 58 |
| 59 // WriteUnicodeCharacter ------------------------------------------------------- | 59 // WriteUnicodeCharacter ------------------------------------------------------- |
| 60 | 60 |
| 61 // Appends a UTF-8 character to the given 8-bit string. Returns the number of | 61 // Appends a UTF-8 character to the given 8-bit string. Returns the number of |
| 62 // bytes written. | 62 // bytes written. |
| 63 // TODO(brettw) Bug 79631: This function should not be exposed. | |
| 64 BASE_EXPORT size_t WriteUnicodeCharacter(uint32 code_point, | 63 BASE_EXPORT size_t WriteUnicodeCharacter(uint32 code_point, |
| 65 std::string* output); | 64 std::string* output); |
| 66 | 65 |
| 67 // Appends the given code point as a UTF-16 character to the given 16-bit | 66 // Appends the given code point as a UTF-16 character to the given 16-bit |
| 68 // string. Returns the number of 16-bit values written. | 67 // string. Returns the number of 16-bit values written. |
| 69 BASE_EXPORT size_t WriteUnicodeCharacter(uint32 code_point, string16* output); | 68 BASE_EXPORT size_t WriteUnicodeCharacter(uint32 code_point, string16* output); |
| 70 | 69 |
| 71 #if defined(WCHAR_T_IS_UTF32) | 70 #if defined(WCHAR_T_IS_UTF32) |
| 72 // Appends the given UTF-32 character to the given 32-bit string. Returns the | 71 // Appends the given UTF-32 character to the given 32-bit string. Returns the |
| 73 // number of 32-bit values written. | 72 // number of 32-bit values written. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 void PrepareForUTF8Output(const CHAR* src, size_t src_len, std::string* output); | 87 void PrepareForUTF8Output(const CHAR* src, size_t src_len, std::string* output); |
| 89 | 88 |
| 90 // Prepares an output buffer (containing either UTF-16 or -32 data) given some | 89 // Prepares an output buffer (containing either UTF-16 or -32 data) given some |
| 91 // UTF-8 input that will be converted to it. See PrepareForUTF8Output(). | 90 // UTF-8 input that will be converted to it. See PrepareForUTF8Output(). |
| 92 template<typename STRING> | 91 template<typename STRING> |
| 93 void PrepareForUTF16Or32Output(const char* src, size_t src_len, STRING* output); | 92 void PrepareForUTF16Or32Output(const char* src, size_t src_len, STRING* output); |
| 94 | 93 |
| 95 } // namespace base | 94 } // namespace base |
| 96 | 95 |
| 97 #endif // BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ | 96 #endif // BASE_STRINGS_UTF_STRING_CONVERSION_UTILS_H_ |
| OLD | NEW |