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

Side by Side Diff: third_party/WebKit/public/platform/StringVectorCopier.h

Issue 2537953003: WebString: makes string16 conversions explicit (part 1: blink, content) (Closed)
Patch Set: fix Created 4 years 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef StringVectorCopier_h
6 #define StringVectorCopier_h
7
8 #include "public/platform/WebString.h"
9 #include "public/platform/WebVector.h"
10 #include <utility>
11
12 namespace blink {
13
14 template <typename ARRAY>
15 WebVector<WebString> CopyStringVectorFromUTF16(const ARRAY& input) {
16 WebVector<WebString> output(input.size());
17 std::transform(input.begin(), input.end(), output.begin(),
18 [](const typename ARRAY::value_type& s) {
19 return WebString::fromUTF16(s);
20 });
21 return output;
22 }
23
24 template <typename ARRAY>
25 WebVector<WebString> CopyStringVectorFromUTF8(const ARRAY& input) {
26 WebVector<WebString> output(input.size());
27 std::transform(input.begin(), input.end(), output.begin(),
28 [](const std::string& s) { return WebString::fromUTF8(s); });
29 return output;
30 }
31
32 template <typename ARRAY>
33 WebVector<WebString> CopyStringVectorFromLatin1(const ARRAY& input) {
34 WebVector<WebString> output(input.size());
35 std::transform(input.begin(), input.end(), output.begin(),
36 [](const std::string& s) { return WebString::fromLatin1(s); });
37 return output;
38 }
39
40 } // namespace blink
41
42 #endif // StringVectorCopier_h
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/FilePathConversion.h ('k') | third_party/WebKit/public/platform/WebString.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698