MCPcopy Create free account
hub / github.com/comaps/comaps / DumpToString

Function DumpToString

libs/cppjansson/cppjansson.cpp:71–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71std::string DumpToString(JSONPtr const & json, size_t flags)
72{
73 std::string result;
74 size_t size = json_dumpb(json.get(), nullptr, 0, flags);
75 if (size == 0)
76 MYTHROW(base::Json::Exception, ("Zero size JSON while serializing"));
77
78 result.resize(size);
79 if (size != json_dumpb(json.get(), &result.front(), size, flags))
80 MYTHROW(base::Json::Exception, ("Wrong size JSON written while serializing"));
81
82 return result;
83}
84
85JSONPtr LoadFromString(std::string const & str)
86{

Callers 1

DebugPrintFunction · 0.85

Calls 3

frontMethod · 0.80
getMethod · 0.65
resizeMethod · 0.45

Tested by

no test coverage detected