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

Side by Side Diff: mojo/public/bindings/lib/array.cc

Issue 220243007: Mojo: Move mojo/public/bindings/lib to mojo/public/cpp/bindings/lib. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « mojo/public/bindings/lib/TODO ('k') | mojo/public/bindings/lib/array_internal.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 #include "mojo/public/cpp/bindings/array.h"
6
7 namespace mojo {
8
9 // static
10 String TypeConverter<String, std::string>::ConvertFrom(const std::string& input,
11 Buffer* buf) {
12 String::Builder result(input.size(), buf);
13 if (!input.empty())
14 memcpy(&result[0], input.data(), input.size());
15 return result.Finish();
16 }
17 // static
18 std::string TypeConverter<String, std::string>::ConvertTo(const String& input) {
19 if (input.is_null() || input.size() == 0)
20 return std::string();
21
22 return std::string(&input[0], &input[0] + input.size());
23 }
24
25 // static
26 String TypeConverter<String, const char*>::ConvertFrom(const char* input,
27 Buffer* buf) {
28 if (!input)
29 return String();
30
31 size_t size = strlen(input);
32 String::Builder result(size, buf);
33 if (size != 0)
34 memcpy(&result[0], input, size);
35 return result.Finish();
36 }
37
38 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/bindings/lib/TODO ('k') | mojo/public/bindings/lib/array_internal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698