| 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_GFX_UTF16_INDEXING_H_ | 5 #ifndef UI_GFX_UTF16_INDEXING_H_ |
| 6 #define UI_GFX_UTF16_INDEXING_H_ | 6 #define UI_GFX_UTF16_INDEXING_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 9 |
| 8 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 9 #include "ui/gfx/gfx_export.h" | 11 #include "ui/gfx/gfx_export.h" |
| 10 | 12 |
| 11 namespace gfx { | 13 namespace gfx { |
| 12 | 14 |
| 13 // Returns false if s[index-1] is a high surrogate and s[index] is a low | 15 // Returns false if s[index-1] is a high surrogate and s[index] is a low |
| 14 // surrogate, true otherwise. | 16 // surrogate, true otherwise. |
| 15 GFX_EXPORT bool IsValidCodePointIndex(const base::string16& s, size_t index); | 17 GFX_EXPORT bool IsValidCodePointIndex(const base::string16& s, size_t index); |
| 16 | 18 |
| 17 // |UTF16IndexToOffset| returns the number of code points between |base| and | 19 // |UTF16IndexToOffset| returns the number of code points between |base| and |
| (...skipping 22 matching lines...) Expand all Loading... |
| 40 GFX_EXPORT ptrdiff_t UTF16IndexToOffset(const base::string16& s, | 42 GFX_EXPORT ptrdiff_t UTF16IndexToOffset(const base::string16& s, |
| 41 size_t base, | 43 size_t base, |
| 42 size_t pos); | 44 size_t pos); |
| 43 GFX_EXPORT size_t UTF16OffsetToIndex(const base::string16& s, | 45 GFX_EXPORT size_t UTF16OffsetToIndex(const base::string16& s, |
| 44 size_t base, | 46 size_t base, |
| 45 ptrdiff_t offset); | 47 ptrdiff_t offset); |
| 46 | 48 |
| 47 } // namespace gfx | 49 } // namespace gfx |
| 48 | 50 |
| 49 #endif // UI_GFX_UTF16_INDEXING_H_ | 51 #endif // UI_GFX_UTF16_INDEXING_H_ |
| OLD | NEW |