Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1951)

Unified Diff: base/i18n/icu_string_conversions.h

Issue 372017: Fix various problems with inline autocomplete and URLs that change length dur... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/base.gyp ('k') | base/i18n/icu_string_conversions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/i18n/icu_string_conversions.h
===================================================================
--- base/i18n/icu_string_conversions.h (revision 31214)
+++ base/i18n/icu_string_conversions.h (working copy)
@@ -40,6 +40,17 @@
extern const char kCodepageUTF16BE[];
extern const char kCodepageUTF16LE[];
+// Like CodepageToUTF16() (see below), but also takes an offset into |encoded|,
+// which will be adjusted to point at the same logical place in |utf16|. If
+// this isn't possible because it points past the end of |encoded| or into the
+// middle of a multibyte sequence, it will be set to std::string16::npos.
+// |offset_for_adjustment| may be NULL.
+bool CodepageToUTF16AndAdjustOffset(const std::string& encoded,
+ const char* codepage_name,
+ OnStringConversionError::Type on_error,
+ string16* utf16,
+ size_t* offset_for_adjustment);
+
// Converts between UTF-16 strings and the encoding specified. If the
// encoding doesn't exist or the encoding fails (when on_error is FAIL),
// returns false.
@@ -47,11 +58,24 @@
const char* codepage_name,
OnStringConversionError::Type on_error,
std::string* encoded);
+inline bool CodepageToUTF16(const std::string& encoded,
+ const char* codepage_name,
+ OnStringConversionError::Type on_error,
+ string16* utf16) {
+ return CodepageToUTF16AndAdjustOffset(encoded, codepage_name, on_error, utf16,
+ NULL);
+}
-bool CodepageToUTF16(const std::string& encoded,
- const char* codepage_name,
- OnStringConversionError::Type on_error,
- string16* utf16);
+// Like CodepageToWide() (see below), but also takes an offset into |encoded|,
+// which will be adjusted to point at the same logical place in |wide|. If
+// this isn't possible because it points past the end of |encoded| or into the
+// middle of a multibyte sequence, it will be set to std::wstring::npos.
+// |offset_for_adjustment| may be NULL.
+bool CodepageToWideAndAdjustOffset(const std::string& encoded,
+ const char* codepage_name,
+ OnStringConversionError::Type on_error,
+ std::wstring* wide,
+ size_t* offset_for_adjustment);
// Converts between wide strings and the encoding specified. If the
// encoding doesn't exist or the encoding fails (when on_error is FAIL),
@@ -60,10 +84,13 @@
const char* codepage_name,
OnStringConversionError::Type on_error,
std::string* encoded);
-bool CodepageToWide(const std::string& encoded,
- const char* codepage_name,
- OnStringConversionError::Type on_error,
- std::wstring* wide);
+inline bool CodepageToWide(const std::string& encoded,
+ const char* codepage_name,
+ OnStringConversionError::Type on_error,
+ std::wstring* wide) {
+ return CodepageToWideAndAdjustOffset(encoded, codepage_name, on_error, wide,
+ NULL);
+}
} // namespace base
« no previous file with comments | « base/base.gyp ('k') | base/i18n/icu_string_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698