From 642f2d3fbec475de8dac8a70cfd972982ed3267f Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 8 Apr 2008 05:06:32 +0000 Subject: [PATCH] TDebugProtocol: Add support for messages. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665642 13f79535-47bb-0310-9956-ffa450edef68 --- lib/cpp/src/protocol/TDebugProtocol.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/cpp/src/protocol/TDebugProtocol.cpp b/lib/cpp/src/protocol/TDebugProtocol.cpp index e10c6cbc..f79e97fc 100644 --- a/lib/cpp/src/protocol/TDebugProtocol.cpp +++ b/lib/cpp/src/protocol/TDebugProtocol.cpp @@ -135,13 +135,21 @@ uint32_t TDebugProtocol::writeItem(const std::string& str) { uint32_t TDebugProtocol::writeMessageBegin(const std::string& name, const TMessageType messageType, const int32_t seqid) { - throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, - "TDebugProtocol does not support messages (yet)."); + string mtype; + switch (messageType) { + case T_CALL : mtype = "call" ; break; + case T_REPLY : mtype = "reply" ; break; + case T_EXCEPTION : mtype = "exn" ; break; + } + + uint32_t size = writeIndented("(" + mtype + ") " + name + "("); + indentUp(); + return size; } uint32_t TDebugProtocol::writeMessageEnd() { - throw TProtocolException(TProtocolException::NOT_IMPLEMENTED, - "TDebugProtocol does not support messages (yet)."); + indentDown(); + return writeIndented(")\n"); } uint32_t TDebugProtocol::writeStructBegin(const string& name) { -- 2.17.1