OLD | NEW |
1 // Copyright (c) 2006-2008 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_STRING16_H_ | 5 #ifndef BASE_STRING16_H_ |
6 #define BASE_STRING16_H_ | 6 #define BASE_STRING16_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // WHAT: | 9 // WHAT: |
10 // A version of std::basic_string that provides 2-byte characters even when | 10 // A version of std::basic_string that provides 2-byte characters even when |
11 // wchar_t is not implemented as a 2-byte type. You can access this class as | 11 // wchar_t is not implemented as a 2-byte type. You can access this class as |
(...skipping 11 matching lines...) Expand all Loading... |
23 // entirely improper on those systems where the encoding of wchar_t is defined | 23 // entirely improper on those systems where the encoding of wchar_t is defined |
24 // as UTF-32. | 24 // as UTF-32. |
25 // | 25 // |
26 // Here, we define string16, which is similar to std::wstring but replaces all | 26 // Here, we define string16, which is similar to std::wstring but replaces all |
27 // libc functions with custom, 2-byte-char compatible routines. It is capable | 27 // libc functions with custom, 2-byte-char compatible routines. It is capable |
28 // of carrying UTF-16-encoded data. | 28 // of carrying UTF-16-encoded data. |
29 | 29 |
30 #include <stdio.h> | 30 #include <stdio.h> |
31 #include <string> | 31 #include <string> |
32 | 32 |
| 33 #include "base/base_api.h" |
33 #include "base/basictypes.h" | 34 #include "base/basictypes.h" |
34 | 35 |
35 #if defined(WCHAR_T_IS_UTF16) | 36 #if defined(WCHAR_T_IS_UTF16) |
36 | 37 |
37 typedef wchar_t char16; | 38 typedef wchar_t char16; |
38 typedef std::wstring string16; | 39 typedef std::wstring string16; |
39 | 40 |
40 #elif defined(WCHAR_T_IS_UTF32) | 41 #elif defined(WCHAR_T_IS_UTF32) |
41 | 42 |
42 typedef uint16 char16; | 43 typedef uint16 char16; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // to occur even when a std::basic_string<> does not cross shared library | 162 // to occur even when a std::basic_string<> does not cross shared library |
162 // boundaries, such as in statically-linked executables. | 163 // boundaries, such as in statically-linked executables. |
163 // | 164 // |
164 // TODO(mark): File this bug with Apple and update this note with a bug number. | 165 // TODO(mark): File this bug with Apple and update this note with a bug number. |
165 | 166 |
166 extern template class std::basic_string<char16, base::string16_char_traits>; | 167 extern template class std::basic_string<char16, base::string16_char_traits>; |
167 | 168 |
168 typedef std::basic_string<char16, base::string16_char_traits> string16; | 169 typedef std::basic_string<char16, base::string16_char_traits> string16; |
169 | 170 |
170 namespace base { | 171 namespace base { |
171 extern std::ostream& operator<<(std::ostream& out, const string16& str); | 172 BASE_API extern std::ostream& operator<<(std::ostream& out, |
| 173 const string16& str); |
172 } | 174 } |
173 | 175 |
174 #endif // WCHAR_T_IS_UTF32 | 176 #endif // WCHAR_T_IS_UTF32 |
175 | 177 |
176 #endif // BASE_STRING16_H_ | 178 #endif // BASE_STRING16_H_ |
OLD | NEW |