OLD | NEW |
1 // Copyright (c) 2009 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_UTF_OFFSET_STRING_CONVERSIONS_H_ | 5 #ifndef BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ |
6 #define BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ | 6 #define BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
| 11 #include "base/base_api.h" |
11 #include "base/string16.h" | 12 #include "base/string16.h" |
12 | 13 |
13 namespace base { | 14 namespace base { |
14 class StringPiece; | 15 class StringPiece; |
15 } | 16 } |
16 | 17 |
17 // Like the conversions in utf_string_conversions.h, but also take offsets into | 18 // Like the conversions in utf_string_conversions.h, but also take offsets into |
18 // the source strings, which will be adjusted to point at the same logical place | 19 // the source strings, which will be adjusted to point at the same logical place |
19 // in the result strings. If this isn't possible because the offsets point past | 20 // in the result strings. If this isn't possible because the offsets point past |
20 // the end of the source strings or into the middle of multibyte sequences, they | 21 // the end of the source strings or into the middle of multibyte sequences, they |
21 // will be set to std::wstring::npos. |offset_for_adjustment| may be NULL. | 22 // will be set to std::wstring::npos. |offset_for_adjustment| may be NULL. |
22 bool UTF8ToWideAndAdjustOffset(const char* src, | 23 BASE_API bool UTF8ToWideAndAdjustOffset(const char* src, |
23 size_t src_len, | 24 size_t src_len, |
24 std::wstring* output, | 25 std::wstring* output, |
25 size_t* offset_for_adjustment); | 26 size_t* offset_for_adjustment); |
26 std::wstring UTF8ToWideAndAdjustOffset(const base::StringPiece& utf8, | 27 BASE_API std::wstring UTF8ToWideAndAdjustOffset(const base::StringPiece& utf8, |
27 size_t* offset_for_adjustment); | 28 size_t* offset_for_adjustment); |
28 | 29 |
29 bool UTF16ToWideAndAdjustOffset(const char16* src, | 30 BASE_API bool UTF16ToWideAndAdjustOffset(const char16* src, |
30 size_t src_len, | 31 size_t src_len, |
31 std::wstring* output, | 32 std::wstring* output, |
32 size_t* offset_for_adjustment); | 33 size_t* offset_for_adjustment); |
33 std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16, | 34 BASE_API std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16, |
34 size_t* offset_for_adjustment); | 35 size_t* offset_for_adjustment); |
35 | 36 |
36 #endif // BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ | 37 #endif // BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ |
OLD | NEW |