| 261 | } |
| 262 | |
| 263 | std::string node::dump(bool root) const |
| 264 | { |
| 265 | if (is_null()) |
| 266 | return ""; |
| 267 | if (is<number>()) |
| 268 | return utils::string::truncate_float(std::to_string(as<number>())); |
| 269 | if (is<integer>()) |
| 270 | return std::to_string(as<integer>()); |
| 271 | if (is<string>()) |
| 272 | return utils::string::quote(as<string>()); |
| 273 | if (is<boolean>()) |
| 274 | return (as<boolean>() ? "true" : "false"); |
| 275 | if (is<array>()) |
| 276 | return dump_array(); |
| 277 | if (is<object>()) |
| 278 | return dump_object(root); |
| 279 | } |
| 280 | |
| 281 | bool node::is_primitive() const |
| 282 | { |
no test coverage detected