MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/PositionBasedDynamics / dump

Method dump

extern/json/json.hpp:2200–2223  ·  view source on GitHub ↗

! @brief serialization Serialization function for JSON values. The function tries to mimic Python's `json.dumps()` function, and currently supports its @a indent parameter. @param[in] indent If indent is nonnegative, then array elements and object members will be pretty-printed with that indent level. An indent level of `0` will only insert newlines. `-1` (the default

Source from the content-addressed store, hash-verified

2198 @since version 1.0.0
2199 */
2200 string_t dump(const int indent = -1) const
2201 {
2202 std::stringstream ss;
2203 // fix locale problems
2204 const static std::locale loc(std::locale(), new DecimalSeparator);
2205 ss.imbue(loc);
2206
2207 // 6, 15 or 16 digits of precision allows round-trip IEEE 754
2208 // string->float->string, string->double->string or string->long
2209 // double->string; to be safe, we read this value from
2210 // std::numeric_limits<number_float_t>::digits10
2211 ss.precision(std::numeric_limits<double>::digits10);
2212
2213 if (indent >= 0)
2214 {
2215 dump(ss, true, static_cast<unsigned int>(indent));
2216 }
2217 else
2218 {
2219 dump(ss, false, 0);
2220 }
2221
2222 return ss.str();
2223 }
2224
2225 /*!
2226 @brief return the type of the JSON value (explicit)

Callers 3

basic_jsonClass · 0.80
patchMethod · 0.80
operator()Method · 0.80

Calls 4

strMethod · 0.45
emptyMethod · 0.45
cbeginMethod · 0.45
cendMethod · 0.45

Tested by

no test coverage detected