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_SYS_STRING_CONVERSIONS_H_ | 5 #ifndef BASE_SYS_STRING_CONVERSIONS_H_ |
6 #define BASE_SYS_STRING_CONVERSIONS_H_ | 6 #define BASE_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. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
55 // Mac-specific ---------------------------------------------------------------- | 55 // Mac-specific ---------------------------------------------------------------- |
56 | 56 |
57 #if defined(OS_MACOSX) | 57 #if defined(OS_MACOSX) |
58 | 58 |
59 // Converts between STL strings and CFStringRefs/NSStrings. | 59 // Converts between STL strings and CFStringRefs/NSStrings. |
60 | 60 |
61 // Creates a string, and returns it with a refcount of 1. You are responsible | 61 // Creates a string, and returns it with a refcount of 1. You are responsible |
62 // for releasing it. Returns NULL on failure. | 62 // for releasing it. Returns NULL on failure. |
63 BASE_EXPORT CFStringRef SysUTF8ToCFStringRef(const std::string& utf8); | 63 BASE_EXPORT CFStringRef SysUTF8ToCFStringRef(const std::string& utf8); |
64 BASE_EXPORT CFStringRef SysUTF16ToCFStringRef(const string16& utf16); | 64 BASE_EXPORT CFStringRef SysUTF16ToCFStringRef(const string16& utf16); |
65 BASE_EXPORT CFStringRef SysWideToCFStringRef(const std::wstring& wide); | 65 BASE_EXPORT CFStringRef SysWideToCFStringRef(const std::wstring& wide); |
Mark Mentovai
2012/07/24 16:35:28
Is this one used?
groby-ooo-7-16
2012/07/31 02:00:14
No, and neither are the other widestring funcs.
On
| |
66 | 66 |
67 // Same, but returns an autoreleased NSString. | 67 // Same, but returns an autoreleased NSString. |
68 BASE_EXPORT NSString* SysUTF8ToNSString(const std::string& utf8); | 68 BASE_EXPORT NSString* SysUTF8ToNSString(const std::string& utf8); |
69 BASE_EXPORT NSString* SysUTF16ToNSString(const string16& utf16); | 69 BASE_EXPORT NSString* SysUTF16ToNSString(const string16& utf16); |
70 BASE_EXPORT NSString* SysWideToNSString(const std::wstring& wide); | |
71 | 70 |
72 // Converts a CFStringRef to an STL string. Returns an empty string on failure. | 71 // Converts a CFStringRef to an STL string. Returns an empty string on failure. |
73 BASE_EXPORT std::string SysCFStringRefToUTF8(CFStringRef ref); | 72 BASE_EXPORT std::string SysCFStringRefToUTF8(CFStringRef ref); |
74 BASE_EXPORT string16 SysCFStringRefToUTF16(CFStringRef ref); | 73 BASE_EXPORT string16 SysCFStringRefToUTF16(CFStringRef ref); |
75 BASE_EXPORT std::wstring SysCFStringRefToWide(CFStringRef ref); | 74 BASE_EXPORT std::wstring SysCFStringRefToWide(CFStringRef ref); |
76 | 75 |
77 // Same, but accepts NSString input. Converts nil NSString* to the appropriate | 76 // Same, but accepts NSString input. Converts nil NSString* to the appropriate |
78 // string type of length 0. | 77 // string type of length 0. |
79 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); | 78 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); |
80 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); | 79 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); |
81 BASE_EXPORT std::wstring SysNSStringToWide(NSString* ref); | 80 BASE_EXPORT std::wstring SysNSStringToWide(NSString* ref); |
82 | 81 |
83 #endif // defined(OS_MACOSX) | 82 #endif // defined(OS_MACOSX) |
84 | 83 |
85 } // namespace base | 84 } // namespace base |
86 | 85 |
87 #endif // BASE_SYS_STRING_CONVERSIONS_H_ | 86 #endif // BASE_SYS_STRING_CONVERSIONS_H_ |
OLD | NEW |