1 #include <zypp/zyppng/base/private/base_p.h>
5 BasePrivate::~BasePrivate()
8 Base::Base() : d_ptr( new BasePrivate )
16 Base::Base ( BasePrivate &dd )
22 Base::WeakPtr Base::parent() const
24 return d_func()->parent;
27 void Base::addChild( Base::Ptr child )
33 //we are already the parent
34 auto childParent = child->d_func()->parent.lock();
35 if ( childParent.get() == this )
39 childParent->removeChild( child );
42 d->children.insert( child );
44 auto tracker = this->weak_this<Base>();
45 child->d_func()->parent = tracker;
48 void Base::removeChild( Base::Ptr child )
53 //we are not the child of this object
54 if ( child->d_func()->parent.lock().get() != this )
58 d->children.erase( child );
59 child->d_func()->parent.reset();
62 const std::unordered_set<Base::Ptr> &Base::children() const
64 return d_func()->children;