MCPcopy Create free account
hub / github.com/apache/thrift / ThriftDebugString

Function ThriftDebugString

lib/cpp/src/thrift/protocol/TDebugProtocol.h:161–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159
160template <typename ThriftStruct>
161std::string ThriftDebugString(const ThriftStruct& ts) {
162 using namespace apache::thrift::transport;
163 using namespace apache::thrift::protocol;
164 auto* buffer = new TMemoryBuffer;
165 std::shared_ptr<TTransport> trans(buffer);
166 TDebugProtocol protocol(trans);
167
168 ts.write(&protocol);
169
170 uint8_t* buf;
171 uint32_t size;
172 buffer->getBuffer(&buf, &size);
173 return std::string((char*)buf, (unsigned int)size);
174}
175
176// TODO(dreiss): This is badly broken. Don't use it unless you are me.
177#if 0

Callers 6

operator<Method · 0.85
operator<Method · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
operator<Method · 0.85
operator<Method · 0.85

Calls 3

stringFunction · 0.85
writeMethod · 0.65
getBufferMethod · 0.45

Tested by 6

operator<Method · 0.68
operator<Method · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
operator<Method · 0.68
operator<Method · 0.68