diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 19:27:24 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-26 19:27:24 +0000 |
commit | f0fcfd3fe4f8b9f06608f9a6456f585cf82d9730 (patch) | |
tree | 8bd521ba25b97de5f71736937ad756ce704e1d5d /webkit/glue/glue_util.cc | |
parent | 2539eda33909f9efc27ac403e964e140eaf3dd84 (diff) | |
download | chromium_src-f0fcfd3fe4f8b9f06608f9a6456f585cf82d9730.zip chromium_src-f0fcfd3fe4f8b9f06608f9a6456f585cf82d9730.tar.gz chromium_src-f0fcfd3fe4f8b9f06608f9a6456f585cf82d9730.tar.bz2 |
Add UTF8 <-> UTF-16 conversion functions, and a WebCore::String -> std::string function. We already have a std::string -> WebCore::String function.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1393 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/glue_util.cc')
-rw-r--r-- | webkit/glue/glue_util.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/webkit/glue/glue_util.cc b/webkit/glue/glue_util.cc index 5d2f147..da61bd2 100644 --- a/webkit/glue/glue_util.cc +++ b/webkit/glue/glue_util.cc @@ -45,6 +45,14 @@ std::string16 StringToStdString16(const WebCore::String& str) { return std::string16(chars ? chars : (UChar *)L"", str.length()); } +std::string StringToStdString(const WebCore::String& str) { + if (str.length() == 0) + return std::string(); + std::string ret; + UTF16ToUTF8(str.characters(), str.length(), &ret); + return ret; +} + WebCore::String StdWStringToString(const std::wstring& str) { #if defined(WCHAR_T_IS_UTF16) return WebCore::String(str.data(), static_cast<unsigned>(str.length())); |