From cbf35e1779dccff9941ad90c8e572d4c41fa7799 Mon Sep 17 00:00:00 2001 From: "kinaba@chromium.org" Date: Thu, 8 Sep 2011 02:18:10 +0000 Subject: Add UTF16ToUTF8AndAdjustOffset() to base/. Currently, only UTF8ToUTF16 version is implemented. The converse version will be required for an upcoming patch for supporting input methods in PPAPI (crbug.com/59425), where WebKit strings (UTF16) with segmentation information must be converted to PPAPI strings (UTF8). BUG= TEST=base_unittests Review URL: http://codereview.chromium.org/7828092 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100079 0039d316-1c4b-4281-b951-d872f2087c98 --- base/utf_offset_string_conversions.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'base/utf_offset_string_conversions.h') diff --git a/base/utf_offset_string_conversions.h b/base/utf_offset_string_conversions.h index 01177b6..c2faf3a 100644 --- a/base/utf_offset_string_conversions.h +++ b/base/utf_offset_string_conversions.h @@ -14,6 +14,7 @@ namespace base { class StringPiece; +class StringPiece16; } // Like the conversions in utf_string_conversions.h, but also takes one or more @@ -38,6 +39,13 @@ BASE_EXPORT string16 UTF8ToUTF16AndAdjustOffsets( const base::StringPiece& utf8, std::vector* offsets_for_adjustment); +BASE_EXPORT std::string UTF16ToUTF8AndAdjustOffset( + const base::StringPiece16& utf16, + size_t* offset_for_adjustment); +BASE_EXPORT std::string UTF16ToUTF8AndAdjustOffsets( + const base::StringPiece16& utf16, + std::vector* offsets_for_adjustment); + // Limiting function callable by std::for_each which will replace any value // which is equal to or greater than |limit| with npos. template -- cgit v1.1