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 e10c6cb..f79e97f 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.cpp
+++ b/lib/cpp/src/protocol/TDebugProtocol.cpp
@@ -135,13 +135,21 @@
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) {