| 69 | } |
| 70 | |
| 71 | std::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 | |
| 85 | JSONPtr LoadFromString(std::string const & str) |
| 86 | { |
no test coverage detected