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

Function ThriftJSONString

lib/cpp/src/thrift/protocol/TJSONProtocol.h:330–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328
329template <typename ThriftStruct>
330std::string ThriftJSONString(const ThriftStruct& ts) {
331 using namespace apache::thrift::transport;
332 using namespace apache::thrift::protocol;
333 auto* buffer = new TMemoryBuffer;
334 std::shared_ptr<TTransport> trans(buffer);
335 TJSONProtocol protocol(trans);
336
337 ts.write(&protocol);
338
339 uint8_t* buf;
340 uint32_t size;
341 buffer->getBuffer(&buf, &size);
342 return std::string((char*)buf, (unsigned int)size);
343}
344}
345} // apache::thrift
346

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.85

Calls 3

stringFunction · 0.85
writeMethod · 0.65
getBufferMethod · 0.45

Tested by 1

BOOST_AUTO_TEST_CASEFunction · 0.68