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

Unified Diff: third_party/WebKit/Source/wtf/text/WTFString.cpp

Issue 1382583002: Add toStdString methods to CString and WTF::String (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to String::toUTF8StdString Created 5 years, 2 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: third_party/WebKit/Source/wtf/text/WTFString.cpp
diff --git a/third_party/WebKit/Source/wtf/text/WTFString.cpp b/third_party/WebKit/Source/wtf/text/WTFString.cpp
index 6fee9d06de8ce8269a1a0d9ad21a820acf6fc3d9..8532275cbf659e993e553749582202c59b85a98f 100644
--- a/third_party/WebKit/Source/wtf/text/WTFString.cpp
+++ b/third_party/WebKit/Source/wtf/text/WTFString.cpp
@@ -32,6 +32,7 @@
#include "wtf/dtoa.h"
#include "wtf/text/CString.h"
#include "wtf/text/CharacterNames.h"
+#include "wtf/text/StringUTF8Adaptor.h"
#include "wtf/text/UTF8.h"
#include "wtf/text/Unicode.h"
#include <stdarg.h>
@@ -836,6 +837,12 @@ CString String::utf8(UTF8ConversionMode mode) const
return CString(bufferVector.data(), buffer - bufferVector.data());
}
+std::string String::toUTF8StdString() const
+{
+ StringUTF8Adaptor utf8String = StringUTF8Adaptor(*this);
+ return std::string(utf8String.data(), utf8String.length());
+}
+
String String::make8BitFrom16BitSource(const UChar* source, size_t length)
{
if (!length)
« no previous file with comments | « third_party/WebKit/Source/wtf/text/WTFString.h ('k') | third_party/WebKit/Source/wtf/text/WTFStringTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698