| Index: mojo/public/cpp/bindings/map.h
|
| diff --git a/mojo/public/cpp/bindings/map.h b/mojo/public/cpp/bindings/map.h
|
| index 0a0f8051a80dcbab88c9655f28b9aa0687c22e4c..80655b5ece5ddfe651e4d758eafd69337c318aec 100644
|
| --- a/mojo/public/cpp/bindings/map.h
|
| +++ b/mojo/public/cpp/bindings/map.h
|
| @@ -5,6 +5,7 @@
|
| #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
|
| #define MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
|
|
|
| +#include <iosfwd>
|
| #include <map>
|
| #include <type_traits>
|
|
|
| @@ -293,6 +294,26 @@ struct TypeConverter<std::map<STLKey, STLValue>, Map<MojoKey, MojoValue>> {
|
| }
|
| };
|
|
|
| +// Prints the contents of a map to an output stream for debugging purposes.
|
| +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;
|
| +}
|
| +
|
| } // namespace mojo
|
|
|
| #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_H_
|
|
|