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_STRINGS_SYS_STRING_CONVERSIONS_H_ | 5 #ifndef BASE_STRINGS_SYS_STRING_CONVERSIONS_H_ |
6 #define BASE_STRINGS_SYS_STRING_CONVERSIONS_H_ | 6 #define BASE_STRINGS_SYS_STRING_CONVERSIONS_H_ |
7 | 7 |
8 // Provides system-dependent string type conversions for cases where it's | 8 // Provides system-dependent string type conversions for cases where it's |
9 // necessary to not use ICU. Generally, you should not need this in Chrome, | 9 // necessary to not use ICU. Generally, you should not need this in Chrome, |
10 // but it is used in some shared code. Dependencies should be minimal. | 10 // but it is used in some shared code. Dependencies should be minimal. |
11 | 11 |
| 12 #include <stdint.h> |
| 13 |
12 #include <string> | 14 #include <string> |
13 | 15 |
14 #include "base/base_export.h" | 16 #include "base/base_export.h" |
15 #include "base/basictypes.h" | |
16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
17 #include "base/strings/string_piece.h" | 18 #include "base/strings/string_piece.h" |
| 19 #include "build/build_config.h" |
18 | 20 |
19 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
20 #include <CoreFoundation/CoreFoundation.h> | 22 #include <CoreFoundation/CoreFoundation.h> |
21 #ifdef __OBJC__ | 23 #ifdef __OBJC__ |
22 @class NSString; | 24 @class NSString; |
23 #else | 25 #else |
24 class NSString; | 26 class NSString; |
25 #endif | 27 #endif |
26 #endif // OS_MACOSX | 28 #endif // OS_MACOSX |
27 | 29 |
(...skipping 11 matching lines...) Expand all Loading... |
39 BASE_EXPORT std::wstring SysNativeMBToWide(const StringPiece& native_mb); | 41 BASE_EXPORT std::wstring SysNativeMBToWide(const StringPiece& native_mb); |
40 | 42 |
41 // Windows-specific ------------------------------------------------------------ | 43 // Windows-specific ------------------------------------------------------------ |
42 | 44 |
43 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
44 | 46 |
45 // Converts between 8-bit and wide strings, using the given code page. The | 47 // Converts between 8-bit and wide strings, using the given code page. The |
46 // code page identifier is one accepted by the Windows function | 48 // code page identifier is one accepted by the Windows function |
47 // MultiByteToWideChar(). | 49 // MultiByteToWideChar(). |
48 BASE_EXPORT std::wstring SysMultiByteToWide(const StringPiece& mb, | 50 BASE_EXPORT std::wstring SysMultiByteToWide(const StringPiece& mb, |
49 uint32 code_page); | 51 uint32_t code_page); |
50 BASE_EXPORT std::string SysWideToMultiByte(const std::wstring& wide, | 52 BASE_EXPORT std::string SysWideToMultiByte(const std::wstring& wide, |
51 uint32 code_page); | 53 uint32_t code_page); |
52 | 54 |
53 #endif // defined(OS_WIN) | 55 #endif // defined(OS_WIN) |
54 | 56 |
55 // Mac-specific ---------------------------------------------------------------- | 57 // Mac-specific ---------------------------------------------------------------- |
56 | 58 |
57 #if defined(OS_MACOSX) | 59 #if defined(OS_MACOSX) |
58 | 60 |
59 // Converts between STL strings and CFStringRefs/NSStrings. | 61 // Converts between STL strings and CFStringRefs/NSStrings. |
60 | 62 |
61 // Creates a string, and returns it with a refcount of 1. You are responsible | 63 // Creates a string, and returns it with a refcount of 1. You are responsible |
(...skipping 12 matching lines...) Expand all Loading... |
74 // Same, but accepts NSString input. Converts nil NSString* to the appropriate | 76 // Same, but accepts NSString input. Converts nil NSString* to the appropriate |
75 // string type of length 0. | 77 // string type of length 0. |
76 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); | 78 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); |
77 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); | 79 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); |
78 | 80 |
79 #endif // defined(OS_MACOSX) | 81 #endif // defined(OS_MACOSX) |
80 | 82 |
81 } // namespace base | 83 } // namespace base |
82 | 84 |
83 #endif // BASE_STRINGS_SYS_STRING_CONVERSIONS_H_ | 85 #endif // BASE_STRINGS_SYS_STRING_CONVERSIONS_H_ |
OLD | NEW |