libzypp  17.22.0
zyppng::Base Class Reference

#include <base.h>

Inheritance diagram for zyppng::Base:

Public Types

using Ptr = std::shared_ptr< Base >
 
using WeakPtr = std::weak_ptr< Base >
 

Public Member Functions

 Base ()
 
virtual ~Base ()
 
WeakPtr parent () const
 
void addChild (Base::Ptr child)
 
void removeChild (Ptr child)
 
const std::unordered_set< Ptr > & children () const
 
template<typename T >
std::vector< std::weak_ptr< T > > findChildren () const
 
template<typename T >
std::shared_ptr< T > shared_this () const
 
template<typename T >
std::shared_ptr< T > shared_this ()
 
template<typename T >
std::weak_ptr< T > weak_this () const
 
template<typename T >
std::weak_ptr< T > weak_this ()
 

Protected Member Functions

 Base (BasePrivate &dd)
 

Protected Attributes

std::unique_ptr< BasePrivated_ptr
 

Private Member Functions

 NON_COPYABLE (Base)
 

Detailed Description

The Base class is used as a common base class for objects that emit signals, it also supports a parent/child relationship where the parent object tracks keeps a reference for all its children.

Definition at line 32 of file base.h.

Member Typedef Documentation

◆ Ptr

using zyppng::Base::Ptr = std::shared_ptr<Base>

Definition at line 38 of file base.h.

◆ WeakPtr

using zyppng::Base::WeakPtr = std::weak_ptr<Base>

Definition at line 39 of file base.h.

Constructor & Destructor Documentation

◆ Base() [1/2]

zyppng::Base::Base ( )

Definition at line 8 of file base.cc.

◆ ~Base()

zyppng::Base::~Base ( )
virtual

Definition at line 13 of file base.cc.

◆ Base() [2/2]

zyppng::Base::Base ( BasePrivate dd)
protected

Definition at line 16 of file base.cc.

Member Function Documentation

◆ NON_COPYABLE()

zyppng::Base::NON_COPYABLE ( Base  )
private

◆ parent()

Base::WeakPtr zyppng::Base::parent ( ) const

Returns the parent object if there is one, otherwise returns a zero WeakPtr

Definition at line 22 of file base.cc.

◆ addChild()

void zyppng::Base::addChild ( Base::Ptr  child)

Adds a new object to the child list, the object will keep a reference for its entire lifetime or until the object is removed

Definition at line 27 of file base.cc.

◆ removeChild()

void zyppng::Base::removeChild ( Base::Ptr  child)

Removes a child object from the internal child list

Definition at line 48 of file base.cc.

◆ children()

const std::unordered_set< Base::Ptr > & zyppng::Base::children ( ) const

Returns all child objects of this object

Definition at line 62 of file base.cc.

◆ findChildren()

template<typename T >
std::vector< std::weak_ptr<T> > zyppng::Base::findChildren ( ) const
inline

Returns all children that can be casted to type T

Definition at line 70 of file base.h.

◆ shared_this() [1/2]

template<typename T >
std::shared_ptr<T> zyppng::Base::shared_this ( ) const
inline

Definition at line 81 of file base.h.

◆ shared_this() [2/2]

template<typename T >
std::shared_ptr<T> zyppng::Base::shared_this ( )
inline

Definition at line 86 of file base.h.

◆ weak_this() [1/2]

template<typename T >
std::weak_ptr<T> zyppng::Base::weak_this ( ) const
inline

Definition at line 91 of file base.h.

◆ weak_this() [2/2]

template<typename T >
std::weak_ptr<T> zyppng::Base::weak_this ( )
inline

Definition at line 96 of file base.h.

Member Data Documentation

◆ d_ptr

std::unique_ptr<BasePrivate> zyppng::Base::d_ptr
protected

Definition at line 102 of file base.h.


The documentation for this class was generated from the following files: