| 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 BASE_STRING16_H_ | 5 #ifndef BASE_STRING16_H_ |
| 6 #define BASE_STRING16_H_ | 6 #define BASE_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 19 matching lines...) Expand all Loading... |
| 30 #include <string> | 30 #include <string> |
| 31 | 31 |
| 32 #include "base/base_export.h" | 32 #include "base/base_export.h" |
| 33 #include "base/basictypes.h" | 33 #include "base/basictypes.h" |
| 34 | 34 |
| 35 #if defined(WCHAR_T_IS_UTF16) | 35 #if defined(WCHAR_T_IS_UTF16) |
| 36 | 36 |
| 37 typedef wchar_t char16; | 37 typedef wchar_t char16; |
| 38 typedef std::wstring string16; | 38 typedef std::wstring string16; |
| 39 | 39 |
| 40 namespace base { |
| 41 typedef std::char_traits<wchar_t> string16_char_traits; |
| 42 } |
| 43 |
| 40 #elif defined(WCHAR_T_IS_UTF32) | 44 #elif defined(WCHAR_T_IS_UTF32) |
| 41 | 45 |
| 42 typedef uint16 char16; | 46 typedef uint16 char16; |
| 43 | 47 |
| 44 namespace base { | 48 namespace base { |
| 45 | 49 |
| 46 // char16 versions of the functions required by string16_char_traits; these | 50 // char16 versions of the functions required by string16_char_traits; these |
| 47 // are based on the wide character functions of similar names ("w" or "wcs" | 51 // are based on the wide character functions of similar names ("w" or "wcs" |
| 48 // instead of "c16"). | 52 // instead of "c16"). |
| 49 BASE_EXPORT int c16memcmp(const char16* s1, const char16* s2, size_t n); | 53 BASE_EXPORT int c16memcmp(const char16* s1, const char16* s2, size_t n); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 BASE_EXPORT extern std::ostream& operator<<(std::ostream& out, | 176 BASE_EXPORT extern std::ostream& operator<<(std::ostream& out, |
| 173 const string16& str); | 177 const string16& str); |
| 174 | 178 |
| 175 // This is required by googletest to print a readable output on test failures. | 179 // This is required by googletest to print a readable output on test failures. |
| 176 BASE_EXPORT extern void PrintTo(const string16& str, std::ostream* out); | 180 BASE_EXPORT extern void PrintTo(const string16& str, std::ostream* out); |
| 177 } | 181 } |
| 178 | 182 |
| 179 #endif // WCHAR_T_IS_UTF32 | 183 #endif // WCHAR_T_IS_UTF32 |
| 180 | 184 |
| 181 #endif // BASE_STRING16_H_ | 185 #endif // BASE_STRING16_H_ |
| OLD | NEW |