summaryrefslogtreecommitdiffstats
path: root/base/utf_string_conversions.h
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 19:27:48 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-13 19:27:48 +0000
commitb9f9383602610ef1f94e9bee2d91d7c044e16051 (patch)
tree8f16f6ff2f2b40bd69cae63fb6ae517ad9d0e35b /base/utf_string_conversions.h
parent7bc3ca67f1395c1744cb09ac50ff9ddf92f66ab7 (diff)
downloadchromium_src-b9f9383602610ef1f94e9bee2d91d7c044e16051.zip
chromium_src-b9f9383602610ef1f94e9bee2d91d7c044e16051.tar.gz
chromium_src-b9f9383602610ef1f94e9bee2d91d7c044e16051.tar.bz2
Split *AndAdjustOffset() functions into their own header, to restore utf_string_conversions.h to a simple, readable state.
BUG=4010 TEST=none Review URL: http://codereview.chromium.org/387012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/utf_string_conversions.h')
-rw-r--r--base/utf_string_conversions.h39
1 files changed, 7 insertions, 32 deletions
diff --git a/base/utf_string_conversions.h b/base/utf_string_conversions.h
index 7069f83..71e2cb2 100644
--- a/base/utf_string_conversions.h
+++ b/base/utf_string_conversions.h
@@ -8,26 +8,10 @@
#include <string>
#include "base/string16.h"
-#include "base/string_piece.h"
-// Like the conversions below, but also takes an offset into the source string,
-// which will be adjusted to point at the same logical place in the result
-// string. If this isn't possible because it points past the end of the source
-// string or into the middle of a multibyte sequence, it will be set to
-// std::wstring::npos. |offset_for_adjustment| may be NULL.
-bool UTF8ToWideAndAdjustOffset(const char* src,
- size_t src_len,
- std::wstring* output,
- size_t* offset_for_adjustment);
-std::wstring UTF8ToWideAndAdjustOffset(const base::StringPiece& utf8,
- size_t* offset_for_adjustment);
-
-bool UTF16ToWideAndAdjustOffset(const char16* src,
- size_t src_len,
- std::wstring* output,
- size_t* offset_for_adjustment);
-std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16,
- size_t* offset_for_adjustment);
+namespace base {
+class StringPiece;
+}
// These convert between UTF-8, -16, and -32 strings. They are potentially slow,
// so avoid unnecessary conversions. The low-level versions return a boolean
@@ -44,22 +28,13 @@ std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16,
// some situations.
bool WideToUTF8(const wchar_t* src, size_t src_len, std::string* output);
std::string WideToUTF8(const std::wstring& wide);
-inline bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output) {
- return UTF8ToWideAndAdjustOffset(src, src_len, output, NULL);
-}
-inline std::wstring UTF8ToWide(const base::StringPiece& utf8) {
- return UTF8ToWideAndAdjustOffset(utf8, NULL);
-}
+bool UTF8ToWide(const char* src, size_t src_len, std::wstring* output);
+std::wstring UTF8ToWide(const base::StringPiece& utf8);
bool WideToUTF16(const wchar_t* src, size_t src_len, string16* output);
string16 WideToUTF16(const std::wstring& wide);
-inline bool UTF16ToWide(const char16* src, size_t src_len,
- std::wstring* output) {
- return UTF16ToWideAndAdjustOffset(src, src_len, output, NULL);
-}
-inline std::wstring UTF16ToWide(const string16& utf16) {
- return UTF16ToWideAndAdjustOffset(utf16, NULL);
-}
+bool UTF16ToWide(const char16* src, size_t src_len, std::wstring* output);
+std::wstring UTF16ToWide(const string16& utf16);
bool UTF8ToUTF16(const char* src, size_t src_len, string16* output);
string16 UTF8ToUTF16(const std::string& utf8);