summaryrefslogtreecommitdiffstats
path: root/base/string_util.h
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 20:27:57 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-07 20:27:57 +0000
commite6da5e1fb081aeb82ea9a95e400e320df19e0255 (patch)
tree424914e838ec1cf59bd1c7814dc93937a71374cf /base/string_util.h
parent09ad1e629a88f99d2e93797304f4a6060915e228 (diff)
downloadchromium_src-e6da5e1fb081aeb82ea9a95e400e320df19e0255.zip
chromium_src-e6da5e1fb081aeb82ea9a95e400e320df19e0255.tar.gz
chromium_src-e6da5e1fb081aeb82ea9a95e400e320df19e0255.tar.bz2
Add UTF-16 <-> Wide conversions for Mac.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@534 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/string_util.h')
-rw-r--r--base/string_util.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/base/string_util.h b/base/string_util.h
index 1a4080a..46269ff 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -37,6 +37,7 @@
#include <stdarg.h> // va_list
#include "base/basictypes.h"
+#include "base/string16.h"
// Safe standard library wrappers for all platforms.
@@ -152,17 +153,22 @@ std::wstring CollapseWhitespace(const std::wstring& text,
std::string WideToASCII(const std::wstring& wide);
std::wstring ASCIIToWide(const std::string& ascii);
-// These convert between UTF8 and UTF16 strings. They are potentially slow, so
-// avoid unnecessary conversions. Most things should be in wide. The low-level
-// versions return a boolean indicating whether the conversion was 100% valid.
-// In this case, it will still do the best it can and put the result in the
-// output buffer. The versions that return strings ignore this error and just
-// return the best conversion possible.
+// These convert between UTF-8, -16, and -32 strings. They are potentially slow,
+// so avoid unnecessary conversions. The low-level versions return a boolean
+// indicating whether the conversion was 100% valid. In this case, it will still
+// do the best it can and put the result in the output buffer. The versions that
+// return strings ignore this error and just return the best conversion
+// possible.
bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output);
std::string WideToUTF8(const std::wstring& wide);
bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output);
std::wstring UTF8ToWide(const std::string& utf8);
+bool WideToUTF16(const wchar_t* src, size_t src_len, std::string16* output);
+std::string16 WideToUTF16(const std::wstring& wide);
+bool UTF16ToWide(const char16* src, size_t src_len, std::wstring* output);
+std::wstring UTF16ToWide(const std::string16& utf8);
+
// Defines the error handling modes of WideToCodepage and CodepageToWide.
class OnStringUtilConversionError {
public: