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

Side by Side 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: Add include 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * (C) 1999 Lars Knoll (knoll@kde.org) 2 * (C) 1999 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2012 Apple Inc. All rights reserved.
4 * Copyright (C) 2007-2009 Torch Mobile, Inc. 4 * Copyright (C) 2007-2009 Torch Mobile, Inc.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 // converted. 829 // converted.
830 ASSERT((buffer + 3) <= (buffer + bufferVector.size())); 830 ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
831 putUTF8Triple(buffer, *characters); 831 putUTF8Triple(buffer, *characters);
832 } 832 }
833 } 833 }
834 } 834 }
835 835
836 return CString(bufferVector.data(), buffer - bufferVector.data()); 836 return CString(bufferVector.data(), buffer - bufferVector.data());
837 } 837 }
838 838
839 std::string String::toUTF8() const
840 {
841 return utf8().toStdString();
esprehn 2015/09/30 18:15:39 callers should just do .utf8().toStdString()
842 }
843
839 String String::make8BitFrom16BitSource(const UChar* source, size_t length) 844 String String::make8BitFrom16BitSource(const UChar* source, size_t length)
840 { 845 {
841 if (!length) 846 if (!length)
842 return emptyString(); 847 return emptyString();
843 848
844 LChar* destination; 849 LChar* destination;
845 String result = String::createUninitialized(length, destination); 850 String result = String::createUninitialized(length, destination);
846 851
847 copyLCharsFromUCharSource(destination, source, length); 852 copyLCharsFromUCharSource(destination, source, length);
848 853
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 buffer.append('\0'); 1226 buffer.append('\0');
1222 return buffer; 1227 return buffer;
1223 } 1228 }
1224 1229
1225 Vector<char> asciiDebug(String& string) 1230 Vector<char> asciiDebug(String& string)
1226 { 1231 {
1227 return asciiDebug(string.impl()); 1232 return asciiDebug(string.impl());
1228 } 1233 }
1229 1234
1230 #endif 1235 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698