OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_STRING16_H_ | 5 #ifndef BASE_STRINGS_STRING16_H_ |
6 #define BASE_STRINGS_STRING16_H_ | 6 #define BASE_STRINGS_STRING16_H_ |
7 | 7 |
8 // WHAT: | 8 // WHAT: |
9 // A version of std::basic_string that provides 2-byte characters even when | 9 // A version of std::basic_string that provides 2-byte characters even when |
10 // wchar_t is not implemented as a 2-byte type. You can access this class as | 10 // wchar_t is not implemented as a 2-byte type. You can access this class as |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 BASE_EXPORT char16* c16memmove(char16* s1, const char16* s2, size_t n); | 57 BASE_EXPORT char16* c16memmove(char16* s1, const char16* s2, size_t n); |
58 BASE_EXPORT char16* c16memcpy(char16* s1, const char16* s2, size_t n); | 58 BASE_EXPORT char16* c16memcpy(char16* s1, const char16* s2, size_t n); |
59 BASE_EXPORT char16* c16memset(char16* s, char16 c, size_t n); | 59 BASE_EXPORT char16* c16memset(char16* s, char16 c, size_t n); |
60 | 60 |
61 struct string16_char_traits { | 61 struct string16_char_traits { |
62 typedef char16 char_type; | 62 typedef char16 char_type; |
63 typedef int int_type; | 63 typedef int int_type; |
64 | 64 |
65 // int_type needs to be able to hold each possible value of char_type, and in | 65 // int_type needs to be able to hold each possible value of char_type, and in |
66 // addition, the distinct value of eof(). | 66 // addition, the distinct value of eof(). |
67 COMPILE_ASSERT(sizeof(int_type) > sizeof(char_type), unexpected_type_width); | 67 static_assert(sizeof(int_type) > sizeof(char_type), |
| 68 "int must be larger than 16 bits wide"); |
68 | 69 |
69 typedef std::streamoff off_type; | 70 typedef std::streamoff off_type; |
70 typedef mbstate_t state_type; | 71 typedef mbstate_t state_type; |
71 typedef std::fpos<state_type> pos_type; | 72 typedef std::fpos<state_type> pos_type; |
72 | 73 |
73 static void assign(char_type& c1, const char_type& c2) { | 74 static void assign(char_type& c1, const char_type& c2) { |
74 c1 = c2; | 75 c1 = c2; |
75 } | 76 } |
76 | 77 |
77 static bool eq(const char_type& c1, const char_type& c2) { | 78 static bool eq(const char_type& c1, const char_type& c2) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 // boundaries, such as in statically-linked executables. | 176 // boundaries, such as in statically-linked executables. |
176 // | 177 // |
177 // TODO(mark): File this bug with Apple and update this note with a bug number. | 178 // TODO(mark): File this bug with Apple and update this note with a bug number. |
178 | 179 |
179 extern template | 180 extern template |
180 class BASE_EXPORT std::basic_string<base::char16, base::string16_char_traits>; | 181 class BASE_EXPORT std::basic_string<base::char16, base::string16_char_traits>; |
181 | 182 |
182 #endif // WCHAR_T_IS_UTF32 | 183 #endif // WCHAR_T_IS_UTF32 |
183 | 184 |
184 #endif // BASE_STRINGS_STRING16_H_ | 185 #endif // BASE_STRINGS_STRING16_H_ |
OLD | NEW |