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

Unified Diff: mojo/common/common_type_converters.cc

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « mojo/common/common_type_converters.h ('k') | mojo/common/common_type_converters_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/common_type_converters.cc
diff --git a/mojo/common/common_type_converters.cc b/mojo/common/common_type_converters.cc
deleted file mode 100644
index b656acfc445aac9fb7cef4e1bee8ac88e3d1c097..0000000000000000000000000000000000000000
--- a/mojo/common/common_type_converters.cc
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2013 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.
-
-#include "mojo/common/common_type_converters.h"
-
-#include <string>
-
-#include "base/strings/utf_string_conversions.h"
-
-namespace mojo {
-
-// static
-String TypeConverter<String, base::StringPiece>::Convert(
- const base::StringPiece& input) {
- if (input.empty()) {
- char c = 0;
- return String(&c, 0);
- }
- return String(input.data(), input.size());
-}
-// static
-base::StringPiece TypeConverter<base::StringPiece, String>::Convert(
- const String& input) {
- return input.get();
-}
-
-// static
-String TypeConverter<String, base::string16>::Convert(
- const base::string16& input) {
- return TypeConverter<String, base::StringPiece>::Convert(
- base::UTF16ToUTF8(input));
-}
-// static
-base::string16 TypeConverter<base::string16, String>::Convert(
- const String& input) {
- return base::UTF8ToUTF16(input.To<base::StringPiece>());
-}
-
-std::string TypeConverter<std::string, Array<uint8_t> >::Convert(
- const Array<uint8_t>& input) {
- if (input.is_null())
- return std::string();
-
- return std::string(reinterpret_cast<const char*>(&input.front()),
- input.size());
-}
-
-Array<uint8_t> TypeConverter<Array<uint8_t>, std::string>::Convert(
- const std::string& input) {
- Array<uint8_t> result(input.size());
- memcpy(&result.front(), input.c_str(), input.size());
- return result.Pass();
-}
-
-} // namespace mojo
« no previous file with comments | « mojo/common/common_type_converters.h ('k') | mojo/common/common_type_converters_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698