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_OFFSET_STRING_CONVERSIONS_H_ | 5 #ifndef BASE_STRINGS_UTF_OFFSET_STRING_CONVERSIONS_H_ |
6 #define BASE_STRINGS_UTF_OFFSET_STRING_CONVERSIONS_H_ | 6 #define BASE_STRINGS_UTF_OFFSET_STRING_CONVERSIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
12 #include "base/string16.h" | 12 #include "base/string16.h" |
13 #include "base/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | 16 |
17 // Like the conversions in utf_string_conversions.h, but also takes one or more | 17 // Like the conversions in utf_string_conversions.h, but also takes one or more |
18 // offsets (|offset[s]_for_adjustment|) into the source strings, each offset | 18 // offsets (|offset[s]_for_adjustment|) into the source strings, each offset |
19 // will be adjusted to point at the same logical place in the result strings. | 19 // will be adjusted to point at the same logical place in the result strings. |
20 // If this isn't possible because an offset points past the end of the source | 20 // If this isn't possible because an offset points past the end of the source |
21 // strings or into the middle of a multibyte sequence, the offending offset will | 21 // strings or into the middle of a multibyte sequence, the offending offset will |
22 // be set to string16::npos. |offset[s]_for_adjustment| may be NULL. | 22 // be set to string16::npos. |offset[s]_for_adjustment| may be NULL. |
23 BASE_EXPORT bool UTF8ToUTF16AndAdjustOffset(const char* src, | 23 BASE_EXPORT bool UTF8ToUTF16AndAdjustOffset(const char* src, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 private: | 84 private: |
85 void AdjustOffset(std::vector<size_t>::iterator offset); | 85 void AdjustOffset(std::vector<size_t>::iterator offset); |
86 | 86 |
87 std::vector<size_t>* offsets_for_adjustment_; | 87 std::vector<size_t>* offsets_for_adjustment_; |
88 std::vector<Adjustment> adjustments_; | 88 std::vector<Adjustment> adjustments_; |
89 }; | 89 }; |
90 | 90 |
91 } // namespace base | 91 } // namespace base |
92 | 92 |
93 #endif // BASE_STRINGS_UTF_OFFSET_STRING_CONVERSIONS_H_ | 93 #endif // BASE_STRINGS_UTF_OFFSET_STRING_CONVERSIONS_H_ |
OLD | NEW |