MCPcopy Create free account
hub / github.com/danielaparker/jsoncons / encode_value

Function encode_value

include/jsoncons_ext/toon/encode_toon.hpp:1203–1221  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1201
1202template <typename Json, typename Sink>
1203void encode_value(const Json& val, const toon_encode_options& options, Sink& sink, int depth)
1204{
1205 char delimiter = static_cast<char>(options.delimiter());
1206
1207 int line{0};
1208 if (is_json_array(val))
1209 {
1210 encode_array(val, options, sink, depth, line, jsoncons::optional<jsoncons::string_view>{});
1211 }
1212 else if (is_json_object(val))
1213 {
1214 encode_object(val, options, sink, depth, line, jsoncons::optional<jsoncons::string_view>{});
1215 }
1216 else
1217 {
1218 sink.append(depth*options.indent(), ' ');
1219 encode_primitive(val, delimiter, sink);
1220 }
1221}
1222
1223template <typename T, typename Alloc, typename TempAlloc, typename Sink>
1224typename std::enable_if<ext_traits::is_basic_json<T>::value, write_result>::type

Callers 1

try_encode_toonFunction · 0.85

Calls 8

is_json_arrayFunction · 0.85
encode_arrayFunction · 0.85
is_json_objectFunction · 0.85
encode_objectFunction · 0.85
encode_primitiveFunction · 0.85
delimiterMethod · 0.80
appendMethod · 0.45
indentMethod · 0.45

Tested by

no test coverage detected