OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_BASE_TEXT_UTF16_INDEXING_H_ | 5 #ifndef UI_BASE_TEXT_UTF16_INDEXING_H_ |
6 #define UI_BASE_TEXT_UTF16_INDEXING_H_ | 6 #define UI_BASE_TEXT_UTF16_INDEXING_H_ |
7 | 7 |
8 #include "base/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "ui/base/ui_export.h" | 9 #include "ui/base/ui_export.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 // Returns false if s[index-1] is a high surrogate and s[index] is a low | 13 // Returns false if s[index-1] is a high surrogate and s[index] is a low |
14 // surrogate, true otherwise. | 14 // surrogate, true otherwise. |
15 UI_EXPORT bool IsValidCodePointIndex(const string16& s, size_t index); | 15 UI_EXPORT bool IsValidCodePointIndex(const string16& s, size_t index); |
16 | 16 |
17 // |UTF16IndexToOffset| returns the number of code points between |base| and | 17 // |UTF16IndexToOffset| returns the number of code points between |base| and |
18 // |pos| in the given string. |UTF16OffsetToIndex| returns the index that is | 18 // |pos| in the given string. |UTF16OffsetToIndex| returns the index that is |
(...skipping 21 matching lines...) Expand all Loading... |
40 UI_EXPORT ptrdiff_t UTF16IndexToOffset(const string16& s, | 40 UI_EXPORT ptrdiff_t UTF16IndexToOffset(const string16& s, |
41 size_t base, | 41 size_t base, |
42 size_t pos); | 42 size_t pos); |
43 UI_EXPORT size_t UTF16OffsetToIndex(const string16& s, | 43 UI_EXPORT size_t UTF16OffsetToIndex(const string16& s, |
44 size_t base, | 44 size_t base, |
45 ptrdiff_t offset); | 45 ptrdiff_t offset); |
46 | 46 |
47 } // namespace ui | 47 } // namespace ui |
48 | 48 |
49 #endif // UI_BASE_TEXT_UTF16_INDEXING_H_ | 49 #endif // UI_BASE_TEXT_UTF16_INDEXING_H_ |
OLD | NEW |