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 <[email protected]> Authored: Thu Aug 13 14:13:05 2015 -0700 Committer: Vinod Kone <[email protected]> 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(
