♻️ split set_parent function

This commit is contained in:
Niels Lohmann
2021-01-14 21:55:49 +01:00
parent 10751d1189
commit b9d3aa4067
4 changed files with 110 additions and 114 deletions
@@ -132,7 +132,7 @@ struct external_constructor<value_t::array>
{
j.m_type = value_t::array;
j.m_value = arr;
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
@@ -141,7 +141,7 @@ struct external_constructor<value_t::array>
{
j.m_type = value_t::array;
j.m_value = std::move(arr);
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
@@ -154,7 +154,7 @@ struct external_constructor<value_t::array>
using std::end;
j.m_type = value_t::array;
j.m_value.array = j.template create<typename BasicJsonType::array_t>(begin(arr), end(arr));
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
@@ -185,7 +185,7 @@ struct external_constructor<value_t::array>
{
std::copy(std::begin(arr), std::end(arr), j.m_value.array->begin());
}
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
};
@@ -198,7 +198,7 @@ struct external_constructor<value_t::object>
{
j.m_type = value_t::object;
j.m_value = obj;
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
@@ -207,7 +207,7 @@ struct external_constructor<value_t::object>
{
j.m_type = value_t::object;
j.m_value = std::move(obj);
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
@@ -220,7 +220,7 @@ struct external_constructor<value_t::object>
j.m_type = value_t::object;
j.m_value.object = j.template create<typename BasicJsonType::object_t>(begin(obj), end(obj));
j.set_parent(j, true);
j.set_parents();
j.assert_invariant();
}
};
+4 -4
View File
@@ -236,7 +236,7 @@ class json_sax_dom_parser
bool end_object()
{
ref_stack.back()->set_parent(*ref_stack.back(), true);
ref_stack.back()->set_parents();
ref_stack.pop_back();
return true;
}
@@ -255,7 +255,7 @@ class json_sax_dom_parser
bool end_array()
{
ref_stack.back()->set_parent(*ref_stack.back(), true);
ref_stack.back()->set_parents();
ref_stack.pop_back();
return true;
}
@@ -437,7 +437,7 @@ class json_sax_dom_callback_parser
}
else
{
ref_stack.back()->set_parent(*ref_stack.back(), true);
ref_stack.back()->set_parents();
}
}
@@ -488,7 +488,7 @@ class json_sax_dom_callback_parser
keep = callback(static_cast<int>(ref_stack.size()) - 1, parse_event_t::array_end, *ref_stack.back());
if (keep)
{
ref_stack.back()->set_parent(*ref_stack.back(), true);
ref_stack.back()->set_parents();
}
else
{