Index: webrtc/base/optional_ios.h |
diff --git a/webrtc/base/optional_ios.h b/webrtc/base/optional_ios.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3d1092a4ba4314272c8edebbaee51fd2012219db |
--- /dev/null |
+++ b/webrtc/base/optional_ios.h |
@@ -0,0 +1,34 @@ |
+/* |
+ * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
+ * |
+ * Use of this source code is governed by a BSD-style license |
+ * that can be found in the LICENSE file in the root of the source |
+ * tree. An additional intellectual property rights grant can be found |
+ * in the file PATENTS. All contributing project authors may |
+ * be found in the AUTHORS file in the root of the source tree. |
+ */ |
+ |
+#ifndef WEBRTC_BASE_OPTIONAL_IOS_H_ |
+#define WEBRTC_BASE_OPTIONAL_IOS_H_ |
+ |
+#include <ostream> |
+#include "webrtc/base/optional.h" |
+ |
+namespace rtc { |
+ |
+// Contains function definitions to allow writing rtc::Optional<T> to ostreams. |
+// Allows for simpler logging of rtc::Optional<T> values. |
+ |
+template <typename T> |
+std::ostream& operator<<(std::ostream& stream, rtc::Optional<T> value) { |
+ if (value) { |
+ stream << *value; |
+ } else { |
+ stream << "<not set>"; |
+ } |
+ return stream; |
+} |
pthatcher1
2016/03/17 21:51:28
Can we put this in optional.h? Is the dependency
skvlad
2016/03/18 00:49:17
Ok - moved it to optional.h. The ostream dependenc
|
+ |
+} // namespace rtc |
+ |
+#endif // WEBRTC_BASE_OPTIONAL_IOS_H_ |