| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ | 5 #ifndef SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ |
| 6 #define SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ | 6 #define SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ |
| 7 | 7 |
| 8 #include <ostream> | 8 #include <ostream> |
| 9 | 9 |
| 10 #include "services/media/framework/models/demand.h" | 10 #include "services/media/framework/models/demand.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 inline std::ostream& outdent(std::ostream& os) { | 43 inline std::ostream& outdent(std::ostream& os) { |
| 44 --os.iword(ostream_indent_index()); | 44 --os.iword(ostream_indent_index()); |
| 45 return os; | 45 return os; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // The following overloads don't add newlines. | 48 // The following overloads don't add newlines. |
| 49 | 49 |
| 50 std::ostream& operator<<(std::ostream& os, Result value); | 50 std::ostream& operator<<(std::ostream& os, Result value); |
| 51 std::ostream& operator<<(std::ostream& os, Demand value); | 51 std::ostream& operator<<(std::ostream& os, Demand value); |
| 52 std::ostream& operator<<(std::ostream& os, const PacketPtr& value); | 52 std::ostream& operator<<(std::ostream& os, const PacketPtr& value); |
| 53 std::ostream& operator<<(std::ostream& os, StreamType::Scheme value); | 53 std::ostream& operator<<(std::ostream& os, StreamType::Medium value); |
| 54 std::ostream& operator<<(std::ostream& os, LpcmStreamType::SampleFormat value); | 54 std::ostream& operator<<(std::ostream& os, AudioStreamType::SampleFormat value); |
| 55 std::ostream& operator<<(std::ostream& os, | |
| 56 CompressedAudioStreamType::AudioEncoding value); | |
| 57 std::ostream& operator<<(std::ostream& os, | |
| 58 VideoStreamType::VideoEncoding value); | |
| 59 std::ostream& operator<<(std::ostream& os, VideoStreamType::VideoProfile value); | 55 std::ostream& operator<<(std::ostream& os, VideoStreamType::VideoProfile value); |
| 60 std::ostream& operator<<(std::ostream& os, VideoStreamType::PixelFormat value); | 56 std::ostream& operator<<(std::ostream& os, VideoStreamType::PixelFormat value); |
| 61 std::ostream& operator<<(std::ostream& os, VideoStreamType::ColorSpace value); | 57 std::ostream& operator<<(std::ostream& os, VideoStreamType::ColorSpace value); |
| 62 std::ostream& operator<<(std::ostream& os, const std::unique_ptr<Bytes>& value); | 58 std::ostream& operator<<(std::ostream& os, const std::unique_ptr<Bytes>& value); |
| 63 | 59 |
| 64 template <typename T> | 60 template <typename T> |
| 65 std::ostream& operator<<(std::ostream& os, Range<T> value) { | 61 std::ostream& operator<<(std::ostream& os, Range<T> value) { |
| 66 return os << value.min << ".." << value.max; | 62 return os << value.min << ".." << value.max; |
| 67 } | 63 } |
| 68 | 64 |
| 69 std::ostream& operator<<(std::ostream& os, Range<bool> value); | 65 std::ostream& operator<<(std::ostream& os, Range<bool> value); |
| 70 | 66 |
| 71 // The following overloads add newlines. | 67 // The following overloads add newlines. |
| 72 | 68 |
| 73 std::ostream& operator<<(std::ostream& os, | 69 std::ostream& operator<<(std::ostream& os, |
| 74 const std::unique_ptr<StreamType>& value); | 70 const std::unique_ptr<StreamType>& value); |
| 75 std::ostream& operator<<(std::ostream& os, | 71 std::ostream& operator<<(std::ostream& os, |
| 76 const std::unique_ptr<StreamTypeSet>& value); | 72 const std::unique_ptr<StreamTypeSet>& value); |
| 77 std::ostream& operator<<( | 73 std::ostream& operator<<( |
| 78 std::ostream& os, | 74 std::ostream& os, |
| 79 const std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>& value); | 75 const std::unique_ptr<std::vector<std::unique_ptr<StreamType>>>& value); |
| 80 std::ostream& operator<<( | 76 std::ostream& operator<<( |
| 81 std::ostream& os, | 77 std::ostream& os, |
| 82 const std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>>& value); | 78 const std::unique_ptr<std::vector<std::unique_ptr<StreamTypeSet>>>& value); |
| 83 | 79 |
| 80 template <typename T> |
| 81 std::ostream& operator<<(std::ostream& os, const std::vector<T>& value) { |
| 82 if (value.size() == 0) { |
| 83 return os << "<empty>" << std::endl; |
| 84 } else { |
| 85 os << std::endl; |
| 86 } |
| 87 |
| 88 int index = 0; |
| 89 for (const T& element : value) { |
| 90 os << begl << "[" << index++ << "] " << element; |
| 91 } |
| 92 |
| 93 return os; |
| 94 } |
| 95 |
| 84 } // namespace media | 96 } // namespace media |
| 85 } // namespace mojo | 97 } // namespace mojo |
| 86 | 98 |
| 87 #endif // SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ | 99 #endif // SERVICES_MEDIA_FRAMEWORK_FORMATTING_H_ |
| OLD | NEW |