MCPcopy Create free account
hub / github.com/PABannier/bark.cpp / end_array

Method end_array

examples/server/json.hpp:7069–7099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7067 }
7068
7069 bool end_array()
7070 {
7071 bool keep = true;
7072
7073 if (ref_stack.back())
7074 {
7075 keep = callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
7076 if (keep)
7077 {
7078 ref_stack.back()->set_parents();
7079 }
7080 else
7081 {
7082 // discard array
7083 *ref_stack.back() = discarded;
7084 }
7085 }
7086
7087 JSON_ASSERT(!ref_stack.empty());
7088 JSON_ASSERT(!keep_stack.empty());
7089 ref_stack.pop_back();
7090 keep_stack.pop_back();
7091
7092 // remove discarded value
7093 if (!keep && !ref_stack.empty() && ref_stack.back()->is_array())
7094 {
7095 ref_stack.back()->m_value.array->pop_back();
7096 }
7097
7098 return true;
7099 }
7100
7101 template<class Exception>
7102 bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected