| Index: third_party/WebKit/public/platform/StringVectorCopier.h
|
| diff --git a/third_party/WebKit/public/platform/StringVectorCopier.h b/third_party/WebKit/public/platform/StringVectorCopier.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fe8231a9c638749d29dc6739ba849ccb1de53769
|
| --- /dev/null
|
| +++ b/third_party/WebKit/public/platform/StringVectorCopier.h
|
| @@ -0,0 +1,42 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef StringVectorCopier_h
|
| +#define StringVectorCopier_h
|
| +
|
| +#include "public/platform/WebString.h"
|
| +#include "public/platform/WebVector.h"
|
| +#include <utility>
|
| +
|
| +namespace blink {
|
| +
|
| +template <typename ARRAY>
|
| +WebVector<WebString> CopyStringVectorFromUTF16(const ARRAY& input) {
|
| + WebVector<WebString> output(input.size());
|
| + std::transform(input.begin(), input.end(), output.begin(),
|
| + [](const typename ARRAY::value_type& s) {
|
| + return WebString::fromUTF16(s);
|
| + });
|
| + return output;
|
| +}
|
| +
|
| +template <typename ARRAY>
|
| +WebVector<WebString> CopyStringVectorFromUTF8(const ARRAY& input) {
|
| + WebVector<WebString> output(input.size());
|
| + std::transform(input.begin(), input.end(), output.begin(),
|
| + [](const std::string& s) { return WebString::fromUTF8(s); });
|
| + return output;
|
| +}
|
| +
|
| +template <typename ARRAY>
|
| +WebVector<WebString> CopyStringVectorFromLatin1(const ARRAY& input) {
|
| + WebVector<WebString> output(input.size());
|
| + std::transform(input.begin(), input.end(), output.begin(),
|
| + [](const std::string& s) { return WebString::fromLatin1(s); });
|
| + return output;
|
| +}
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // StringVectorCopier_h
|
|
|