mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 21:28:53 +02:00
ircd::json::stack: Complete the move semantics for entities.
This commit is contained in:
parent
3e1157f043
commit
dd42e04bb5
1 changed files with 87 additions and 0 deletions
87
ircd/json.cc
87
ircd/json.cc
|
@ -430,6 +430,24 @@ noexcept
|
||||||
other.cp = nullptr;
|
other.cp = nullptr;
|
||||||
other.co = nullptr;
|
other.co = nullptr;
|
||||||
other.ca = nullptr;
|
other.ca = nullptr;
|
||||||
|
|
||||||
|
if(cp)
|
||||||
|
{
|
||||||
|
assert(cp->s == &other);
|
||||||
|
cp->s = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(co)
|
||||||
|
{
|
||||||
|
assert(co->s == &other);
|
||||||
|
co->s = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ca)
|
||||||
|
{
|
||||||
|
assert(ca->s == &other);
|
||||||
|
ca->s = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::json::stack::~stack()
|
ircd::json::stack::~stack()
|
||||||
|
@ -658,6 +676,29 @@ noexcept
|
||||||
,mc{std::move(other.mc)}
|
,mc{std::move(other.mc)}
|
||||||
{
|
{
|
||||||
other.s = nullptr;
|
other.s = nullptr;
|
||||||
|
|
||||||
|
if(s)
|
||||||
|
{
|
||||||
|
assert(s->co == &other);
|
||||||
|
s->co = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pm)
|
||||||
|
{
|
||||||
|
assert(pm->co == &other);
|
||||||
|
pm->co = this;
|
||||||
|
}
|
||||||
|
else if(pa)
|
||||||
|
{
|
||||||
|
assert(pa->co == &other);
|
||||||
|
pa->co = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cm)
|
||||||
|
{
|
||||||
|
assert(cm->po == &other);
|
||||||
|
cm->po = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::json::stack::object::object(stack &s)
|
ircd::json::stack::object::object(stack &s)
|
||||||
|
@ -839,6 +880,34 @@ noexcept
|
||||||
,vc{std::move(other.vc)}
|
,vc{std::move(other.vc)}
|
||||||
{
|
{
|
||||||
other.s = nullptr;
|
other.s = nullptr;
|
||||||
|
|
||||||
|
if(s)
|
||||||
|
{
|
||||||
|
assert(s->ca == &other);
|
||||||
|
s->ca = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pm)
|
||||||
|
{
|
||||||
|
assert(pm->ca == &other);
|
||||||
|
pm->ca = this;
|
||||||
|
}
|
||||||
|
else if(pa)
|
||||||
|
{
|
||||||
|
assert(pa->ca == &other);
|
||||||
|
pa->ca = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(co)
|
||||||
|
{
|
||||||
|
assert(co->pa == &other);
|
||||||
|
co->pa = this;
|
||||||
|
}
|
||||||
|
else if(ca)
|
||||||
|
{
|
||||||
|
assert(ca->pa == &other);
|
||||||
|
ca->pa = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::json::stack::array::array(stack &s)
|
ircd::json::stack::array::array(stack &s)
|
||||||
|
@ -1040,8 +1109,26 @@ noexcept
|
||||||
,name{std::move(other.name)}
|
,name{std::move(other.name)}
|
||||||
,co{std::move(other.co)}
|
,co{std::move(other.co)}
|
||||||
,ca{std::move(other.ca)}
|
,ca{std::move(other.ca)}
|
||||||
|
,vc{std::move(other.vc)}
|
||||||
{
|
{
|
||||||
other.s = nullptr;
|
other.s = nullptr;
|
||||||
|
|
||||||
|
if(po)
|
||||||
|
{
|
||||||
|
assert(po->cm == &other);
|
||||||
|
po->cm = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(co)
|
||||||
|
{
|
||||||
|
assert(co->pm == &other);
|
||||||
|
co->pm = this;
|
||||||
|
}
|
||||||
|
else if(ca)
|
||||||
|
{
|
||||||
|
assert(ca->pm == &other);
|
||||||
|
ca->pm = this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ircd::json::stack::member::member(stack &s,
|
ircd::json::stack::member::member(stack &s,
|
||||||
|
|
Loading…
Reference in a new issue