 |
LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
Go to the documentation of this file.
46 class ModelItemBase :
public std::enable_shared_from_this<T>
49 using T_wptr = std::weak_ptr<T>;
50 using T_ptr = std::shared_ptr<T>;
51 using T_cptr = std::shared_ptr<const T>;
72 using iterator =
typename TList_t::iterator;
251 template<
typename... Args>
254 Children_.append (std::make_shared<T> (std::forward<Args> (args)...));
272 template<
typename... Args>
275 Children_.insert (pos, std::make_shared<T> (std::forward<Args> (args)...));
327 return parent->GetRow (this->shared_from_this ());
typename TList_t::iterator iterator
A non-const iterator for the list of children.
iterator end()
Returns a non-const iterator pointing past the last child item.
void AppendExisting(const T_ptr &t)
Appends a child item t to the list of child items.
std::shared_ptr< const T > T_cptr
ModelItemBase()=default
Constructs a default ModelItemBase with no parent.
bool IsEmpty() const
Returns whether there are any children at all.
const TList_t & GetChildren() const
Returns a constant reference to the list of children.
std::weak_ptr< T > T_wptr
T_ptr & InsertChild(int pos, Args &&... args)
Creates a new child item, inserts it at the given position and returns it.
typename TList_t::const_iterator const_iterator
A const iterator for the list of children.
T_ptr GetChild(int row) const
Returns a child at the given row.
int GetRowCount() const
Returns the children count.
T_ptr GetParent() const
Returns the pointer to the parent item.
int GetRow() const
Returns the index of this item in the parent's children list.
iterator EraseChild(iterator it)
Erases a child item at the position defined by it.
std::shared_ptr< T > T_ptr
iterator begin()
Returns a non-const iterator pointing to the beginning of the child items list.
T_ptr & AppendChild(Args &&... args)
Creates a new child item, appends it and returns it.
iterator EraseChildren(iterator begin, iterator end)
Erases all child items in the given range.