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

Unified Diff: mojo/public/cpp/bindings/formatting.h

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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/public/cpp/bindings/callback.h ('k') | mojo/public/cpp/bindings/interface_handle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/formatting.h
diff --git a/mojo/public/cpp/bindings/formatting.h b/mojo/public/cpp/bindings/formatting.h
deleted file mode 100644
index 2dc7d090fa5f94ba739bad3afd931fbd4e7289da..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/formatting.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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 MOJO_PUBLIC_CPP_BINDINGS_FORMATTING_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_FORMATTING_H_
-
-#include <iosfwd>
-
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/map.h"
-#include "mojo/public/cpp/bindings/struct_ptr.h"
-
-namespace mojo {
-
-// Prints the contents of an array to an output stream in a human-readable
-// format.
-template <typename T>
-std::ostream& operator<<(std::ostream& os, const mojo::Array<T>& array) {
- if (array) {
- os << "[";
- bool first = true;
- for (auto it = array.storage().cbegin(); it != array.storage().cend();
- ++it) {
- if (first)
- first = false;
- else
- os << ", ";
- os << *it;
- }
- os << "]";
- } else {
- os << "null";
- }
- return os;
-}
-
-// Prints the contents of a map to an output stream in a human-readable
-// format.
-template <typename Key, typename Value>
-std::ostream& operator<<(std::ostream& os, const mojo::Map<Key, Value>& map) {
- if (map) {
- os << "{";
- bool first = true;
- for (auto it = map.cbegin(); it != map.cend(); ++it) {
- if (first)
- first = false;
- else
- os << ", ";
- os << it.GetKey() << ": " << it.GetValue();
- }
- os << "}";
- } else {
- os << "null";
- }
- return os;
-}
-
-// Prints the pointee of a Mojo structure pointer to an output stream
-// assuming there exists an operator<< overload that accepts a const
-// reference to the object.
-template <typename T, typename = typename T::Data_>
-std::ostream& operator<<(std::ostream& os, const T* value) {
- return value ? os << *value : os << "null";
-}
-template <typename T>
-std::ostream& operator<<(std::ostream& os, const StructPtr<T>& value) {
- return os << value.get();
-}
-template <typename T>
-std::ostream& operator<<(std::ostream& os, const InlinedStructPtr<T>& value) {
- return os << value.get();
-}
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_FORMATTING_H_
« no previous file with comments | « mojo/public/cpp/bindings/callback.h ('k') | mojo/public/cpp/bindings/interface_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698