From: David Reiss Date: Tue, 8 Apr 2008 05:06:32 +0000 (+0000) Subject: TDebugProtocol: Add support for messages. X-Git-Tag: 0.2.0~830 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=642f2d3fbec475de8dac8a70cfd972982ed3267f;p=common%2Fthrift.git TDebugProtocol: Add support for messages. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665642 13f79535-47bb-0310-9956-ffa450edef68 --- 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) {