TDebugProtocol: Support a limit on string length.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665641 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TDebugProtocol.h b/lib/cpp/src/protocol/TDebugProtocol.h
index 196cff2..310c2b2 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.h
+++ b/lib/cpp/src/protocol/TDebugProtocol.h
@@ -50,10 +50,23 @@
  public:
   TDebugProtocol(boost::shared_ptr<TTransport> trans)
     : TWriteOnlyProtocol(trans, "TDebugProtocol")
+    , string_limit_(DEFAULT_STRING_LIMIT)
+    , string_prefix_size_(DEFAULT_STRING_PREFIX_SIZE)
   {
     write_state_.push_back(UNINIT);
   }
 
+  static const int32_t DEFAULT_STRING_LIMIT = 256;
+  static const int32_t DEFAULT_STRING_PREFIX_SIZE = 16;
+
+  void setStringSizeLimit(int32_t string_limit) {
+    string_limit_ = string_limit;
+  }
+
+  void setStringPrefixSize(int32_t string_prefix_size) {
+    string_prefix_size_ = string_prefix_size;
+  }
+
 
   virtual uint32_t writeMessageBegin(const std::string& name,
                                      const TMessageType messageType,
@@ -118,6 +131,9 @@
 
   static std::string fieldTypeName(TType type);
 
+  int32_t string_limit_;
+  int32_t string_prefix_size_;
+
   std::string indent_str_;
   static const int indent_inc = 2;