| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // Provides system-dependent string type conversions for cases where it's | 9 // Provides system-dependent string type conversions for cases where it's |
| 10 // necessary to not use ICU. Generally, you should not need this in Chrome, | 10 // necessary to not use ICU. Generally, you should not need this in Chrome, |
| 11 // but it is used in some shared code. Dependencies should be minimal. | 11 // but it is used in some shared code. Dependencies should be minimal. |
| 12 | 12 |
| 13 #include <string> | 13 #include <string> |
| 14 | 14 |
| 15 #include "base/base_export.h" | 15 #include "base/base_export.h" |
| 16 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/string_piece.h" |
| 18 | 19 |
| 19 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
| 20 #include <CoreFoundation/CoreFoundation.h> | 21 #include <CoreFoundation/CoreFoundation.h> |
| 21 #ifdef __OBJC__ | 22 #ifdef __OBJC__ |
| 22 @class NSString; | 23 @class NSString; |
| 23 #else | 24 #else |
| 24 class NSString; | 25 class NSString; |
| 25 #endif | 26 #endif |
| 26 #endif // OS_MACOSX | 27 #endif // OS_MACOSX |
| 27 | 28 |
| 28 namespace base { | 29 namespace base { |
| 29 | 30 |
| 30 class StringPiece; | |
| 31 | |
| 32 // Converts between wide and UTF-8 representations of a string. On error, the | 31 // Converts between wide and UTF-8 representations of a string. On error, the |
| 33 // result is system-dependent. | 32 // result is system-dependent. |
| 34 BASE_EXPORT std::string SysWideToUTF8(const std::wstring& wide); | 33 BASE_EXPORT std::string SysWideToUTF8(const std::wstring& wide); |
| 35 BASE_EXPORT std::wstring SysUTF8ToWide(const StringPiece& utf8); | 34 BASE_EXPORT std::wstring SysUTF8ToWide(const StringPiece& utf8); |
| 36 | 35 |
| 37 // Converts between wide and the system multi-byte representations of a string. | 36 // Converts between wide and the system multi-byte representations of a string. |
| 38 // DANGER: This will lose information and can change (on Windows, this can | 37 // DANGER: This will lose information and can change (on Windows, this can |
| 39 // change between reboots). | 38 // change between reboots). |
| 40 BASE_EXPORT std::string SysWideToNativeMB(const std::wstring& wide); | 39 BASE_EXPORT std::string SysWideToNativeMB(const std::wstring& wide); |
| 41 BASE_EXPORT std::wstring SysNativeMBToWide(const StringPiece& native_mb); | 40 BASE_EXPORT std::wstring SysNativeMBToWide(const StringPiece& native_mb); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 // string type of length 0. | 79 // string type of length 0. |
| 81 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); | 80 BASE_EXPORT std::string SysNSStringToUTF8(NSString* ref); |
| 82 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); | 81 BASE_EXPORT string16 SysNSStringToUTF16(NSString* ref); |
| 83 BASE_EXPORT std::wstring SysNSStringToWide(NSString* ref); | 82 BASE_EXPORT std::wstring SysNSStringToWide(NSString* ref); |
| 84 | 83 |
| 85 #endif // defined(OS_MACOSX) | 84 #endif // defined(OS_MACOSX) |
| 86 | 85 |
| 87 } // namespace base | 86 } // namespace base |
| 88 | 87 |
| 89 #endif // BASE_SYS_STRING_CONVERSIONS_H_ | 88 #endif // BASE_SYS_STRING_CONVERSIONS_H_ |
| OLD | NEW |