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

Unified Diff: base/string_util.h

Issue 3076013: Move ASCIIToWide and ASCIIToUTF16 to utf_string_conversions.h. I've found it... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months 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
Index: base/string_util.h
===================================================================
--- base/string_util.h (revision 54020)
+++ base/string_util.h (working copy)
@@ -227,12 +227,21 @@
bool ContainsOnlyChars(const string16& input, const string16& characters);
bool ContainsOnlyChars(const std::string& input, const std::string& characters);
-// These convert between ASCII (7-bit) and Wide/UTF16 strings.
+// Converts to 7-bit ASCII by truncating. The result must be known to be ASCII
+// beforehand.
std::string WideToASCII(const std::wstring& wide);
-std::wstring ASCIIToWide(const base::StringPiece& ascii);
std::string UTF16ToASCII(const string16& utf16);
-string16 ASCIIToUTF16(const base::StringPiece& ascii);
+// Forward-declares for functions in utf_string_conversions.h. They used to
+// be here and they were moved. We keep these here so the entire project
+// doesn't need to be switched at once.
+// TODO(brettw) delete these when everybody includes utf_string_conversions.h
+// instead.
+std::wstring ASCIIToWide(const char* ascii);
+std::wstring ASCIIToWide(const std::string& ascii);
+string16 ASCIIToUTF16(const char* ascii);
+string16 ASCIIToUTF16(const std::string& ascii);
+
// Converts the given wide string to the corresponding Latin1. This will fail
// (return false) if any characters are more than 255.
bool WideToLatin1(const std::wstring& wide, std::string* latin1);
« no previous file with comments | « base/native_library_linux.cc ('k') | base/string_util.cc » ('j') | base/utf_string_conversions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698