mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vinodk...@apache.org
Subject [3/3] mesos git commit: Added output stream operator for ContentType enum.
Date Thu, 13 Aug 2015 21:13:38 GMT
Added output stream operator for ContentType enum.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/49c11430
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/49c11430
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/49c11430

Branch: refs/heads/master
Commit: 49c114305cc81ed78b326c23427fb6e985a8c3d7
Parents: 2926208
Author: Vinod Kone <vinodkone@gmail.com>
Authored: Thu Aug 13 14:13:05 2015 -0700
Committer: Vinod Kone <vinodkone@gmail.com>
Committed: Thu Aug 13 14:13:05 2015 -0700

----------------------------------------------------------------------
 src/common/http.hpp | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/49c11430/src/common/http.hpp
----------------------------------------------------------------------
diff --git a/src/common/http.hpp b/src/common/http.hpp
index 98a1270..6f4f686 100644
--- a/src/common/http.hpp
+++ b/src/common/http.hpp
@@ -47,6 +47,21 @@ enum class ContentType
 };
 
 
+inline std::ostream& operator<<(std::ostream& stream, ContentType contentType)
+{
+  switch (contentType) {
+    case ContentType::PROTOBUF: {
+      return stream << APPLICATION_PROTOBUF;
+    }
+    case ContentType::JSON: {
+      return stream << APPLICATION_JSON;
+    }
+  }
+
+  UNREACHABLE();
+}
+
+
 // Serializes a protobuf message for transmission
 // based on the HTTP content type.
 std::string serialize(


Mime
View raw message