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_I18N_CHAR_ITERATOR_H_ | 5 #ifndef BASE_I18N_CHAR_ITERATOR_H_ |
6 #define BASE_I18N_CHAR_ITERATOR_H_ | 6 #define BASE_I18N_CHAR_ITERATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 typedef unsigned char uint8_t; | 24 typedef unsigned char uint8_t; |
25 #endif | 25 #endif |
26 | 26 |
27 namespace base { | 27 namespace base { |
28 namespace i18n { | 28 namespace i18n { |
29 | 29 |
30 class BASE_I18N_EXPORT UTF8CharIterator { | 30 class BASE_I18N_EXPORT UTF8CharIterator { |
31 public: | 31 public: |
32 // Requires |str| to live as long as the UTF8CharIterator does. | 32 // Requires |str| to live as long as the UTF8CharIterator does. |
33 UTF8CharIterator(const std::string* str); | 33 explicit UTF8CharIterator(const std::string* str); |
34 ~UTF8CharIterator(); | 34 ~UTF8CharIterator(); |
35 | 35 |
36 // Return the starting array index of the current character within the | 36 // Return the starting array index of the current character within the |
37 // string. | 37 // string. |
38 int32 array_pos() const { return array_pos_; } | 38 int32 array_pos() const { return array_pos_; } |
39 | 39 |
40 // Return the logical index of the current character, independent of the | 40 // Return the logical index of the current character, independent of the |
41 // number of bytes each character takes. | 41 // number of bytes each character takes. |
42 int32 char_pos() const { return char_pos_; } | 42 int32 char_pos() const { return char_pos_; } |
43 | 43 |
(...skipping 25 matching lines...) Expand all Loading... |
69 | 69 |
70 // The current character. | 70 // The current character. |
71 int32 char_; | 71 int32 char_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(UTF8CharIterator); | 73 DISALLOW_COPY_AND_ASSIGN(UTF8CharIterator); |
74 }; | 74 }; |
75 | 75 |
76 class BASE_I18N_EXPORT UTF16CharIterator { | 76 class BASE_I18N_EXPORT UTF16CharIterator { |
77 public: | 77 public: |
78 // Requires |str| to live as long as the UTF16CharIterator does. | 78 // Requires |str| to live as long as the UTF16CharIterator does. |
79 UTF16CharIterator(const string16* str); | 79 explicit UTF16CharIterator(const string16* str); |
80 UTF16CharIterator(const char16* str, size_t str_len); | 80 UTF16CharIterator(const char16* str, size_t str_len); |
81 ~UTF16CharIterator(); | 81 ~UTF16CharIterator(); |
82 | 82 |
83 // Return the starting array index of the current character within the | 83 // Return the starting array index of the current character within the |
84 // string. | 84 // string. |
85 int32 array_pos() const { return array_pos_; } | 85 int32 array_pos() const { return array_pos_; } |
86 | 86 |
87 // Return the logical index of the current character, independent of the | 87 // Return the logical index of the current character, independent of the |
88 // number of codewords each character takes. | 88 // number of codewords each character takes. |
89 int32 char_pos() const { return char_pos_; } | 89 int32 char_pos() const { return char_pos_; } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // The current character. | 121 // The current character. |
122 int32 char_; | 122 int32 char_; |
123 | 123 |
124 DISALLOW_COPY_AND_ASSIGN(UTF16CharIterator); | 124 DISALLOW_COPY_AND_ASSIGN(UTF16CharIterator); |
125 }; | 125 }; |
126 | 126 |
127 } // namespace i18n | 127 } // namespace i18n |
128 } // namespace base | 128 } // namespace base |
129 | 129 |
130 #endif // BASE_I18N_CHAR_ITERATOR_H_ | 130 #endif // BASE_I18N_CHAR_ITERATOR_H_ |
OLD | NEW |