diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 13:19:24 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-19 13:19:24 +0000 |
commit | 4bdaceb429c7cd6a3a2a8bc692f418969c24ff28 (patch) | |
tree | e399572c17bb4ed5de86bd702ea28a041e40b9b0 /base/sys_string_conversions.h | |
parent | 1e3f8396c6f205b2be2a102d4fbca870638e7f6b (diff) | |
download | chromium_src-4bdaceb429c7cd6a3a2a8bc692f418969c24ff28.zip chromium_src-4bdaceb429c7cd6a3a2a8bc692f418969c24ff28.tar.gz chromium_src-4bdaceb429c7cd6a3a2a8bc692f418969c24ff28.tar.bz2 |
Move the system string conversion functions from std::string to StringPiece. We often work with char* in the system layer, so this should save extra copying.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1027 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_string_conversions.h')
-rw-r--r-- | base/sys_string_conversions.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/base/sys_string_conversions.h b/base/sys_string_conversions.h index fc0a5eb..ed9b8fa 100644 --- a/base/sys_string_conversions.h +++ b/base/sys_string_conversions.h @@ -37,18 +37,20 @@ #include <string> #include "base/basictypes.h" +class StringPiece; + namespace base { // Converts between wide and UTF-8 representations of a string. On error, the // result is system-dependent. std::string SysWideToUTF8(const std::wstring& wide); -std::wstring SysUTF8ToWide(const std::string& utf8); +std::wstring SysUTF8ToWide(StringPiece utf8); // Converts between wide and the system multi-byte representations of a string. // DANGER: This will lose information and can change (on Windows, this can // change between reboots). std::string SysWideToNativeMB(const std::wstring& wide); -std::wstring SysNativeMBToWide(const std::string& native_mb); +std::wstring SysNativeMBToWide(StringPiece native_mb); // Windows-specific ------------------------------------------------------------ @@ -57,7 +59,7 @@ std::wstring SysNativeMBToWide(const std::string& native_mb); // Converts between 8-bit and wide strings, using the given code page. The // code page identifier is one accepted by the Windows function // MultiByteToWideChar(). -std::wstring SysMultiByteToWide(const std::string& mb, uint32 code_page); +std::wstring SysMultiByteToWide(StringPiece mb, uint32 code_page); std::string SysWideToMultiByte(const std::wstring& wide, uint32 code_page); #endif // defined(OS_WIN) |