| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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. |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 | 15 |
| 16 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
| 17 #include <CoreFoundation/CoreFoundation.h> | 17 #include <CoreFoundation/CoreFoundation.h> |
| 18 #ifdef __OBJC__ | 18 #ifdef __OBJC__ |
| 19 @class NSString; | 19 @class NSString; |
| 20 #else | 20 #else |
| 21 class NSString; | 21 class NSString; |
| 22 #endif | 22 #endif |
| 23 #endif // OS_MACOSX | 23 #endif // OS_MACOSX |
| 24 | 24 |
| 25 namespace base { |
| 26 |
| 25 class StringPiece; | 27 class StringPiece; |
| 26 | 28 |
| 27 namespace base { | |
| 28 | |
| 29 // Converts between wide and UTF-8 representations of a string. On error, the | 29 // Converts between wide and UTF-8 representations of a string. On error, the |
| 30 // result is system-dependent. | 30 // result is system-dependent. |
| 31 std::string SysWideToUTF8(const std::wstring& wide); | 31 std::string SysWideToUTF8(const std::wstring& wide); |
| 32 std::wstring SysUTF8ToWide(const StringPiece& utf8); | 32 std::wstring SysUTF8ToWide(const StringPiece& utf8); |
| 33 | 33 |
| 34 // Converts between wide and the system multi-byte representations of a string. | 34 // Converts between wide and the system multi-byte representations of a string. |
| 35 // DANGER: This will lose information and can change (on Windows, this can | 35 // DANGER: This will lose information and can change (on Windows, this can |
| 36 // change between reboots). | 36 // change between reboots). |
| 37 std::string SysWideToNativeMB(const std::wstring& wide); | 37 std::string SysWideToNativeMB(const std::wstring& wide); |
| 38 std::wstring SysNativeMBToWide(const StringPiece& native_mb); | 38 std::wstring SysNativeMBToWide(const StringPiece& native_mb); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // Same, but accepts NSString input. | 74 // Same, but accepts NSString input. |
| 75 std::string SysNSStringToUTF8(NSString* ref); | 75 std::string SysNSStringToUTF8(NSString* ref); |
| 76 string16 SysNSStringToUTF16(NSString* ref); | 76 string16 SysNSStringToUTF16(NSString* ref); |
| 77 std::wstring SysNSStringToWide(NSString* ref); | 77 std::wstring SysNSStringToWide(NSString* ref); |
| 78 | 78 |
| 79 #endif // defined(OS_MACOSX) | 79 #endif // defined(OS_MACOSX) |
| 80 | 80 |
| 81 } // namespace base | 81 } // namespace base |
| 82 | 82 |
| 83 #endif // BASE_SYS_STRING_CONVERSIONS_H_ | 83 #endif // BASE_SYS_STRING_CONVERSIONS_H_ |
| OLD | NEW |