MCPcopy Create free account
hub / github.com/bcndev/bytecoin / begin_array

Method begin_array

src/seria/JsonInputStream.cpp:93–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93bool JsonInputStreamValue::begin_array(size_t &size, bool fixed_size) {
94 const JsonValue *val = get_value();
95 if (val && !val->is_array())
96 throw std::runtime_error("JsonInputStreamValue: Array expected.");
97 if (val && fixed_size && val->size() != size)
98 throw std::runtime_error("JsonInputStreamValue: Array with size=" + common::to_string(size) + " expected.");
99 if (!fixed_size)
100 size = val ? val->size() : 0;
101 chain.push_back(val);
102 idxs.push_back(0);
103 return val;
104}
105
106void JsonInputStreamValue::end_array() {
107 invariant(!chain.empty() && !idxs.empty(), "JsonInputStreamValue unexpected end_array.");

Callers

nothing calls this directly

Calls 3

is_arrayMethod · 0.80
to_stringFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected