3DRadSpace 0.1.0Alpha
3DRadSpace is a free, simple to use, rapid application development game engine.
Loading...
Searching...
No Matches
Engine3DRadSpace.Objects::ChildObjectCollection Class Reference

Represents a collection of child objects owned by a parent object. Unlike ObjectList, this doesn't (re)initialize the container objects nor has ownership. More...

#include <ChildObjectCollection.hpp>

Public Member Functions

 ChildObjectCollection (IObject *owner)
void Add (IObject *ptr)
 Adds an IObject pointer reference to this list.
void Remove (IObject *ptr)
 Removes the specified object.
void Remove (size_t index)
 Removes the ith object in this list.
IObject * operator[] (size_t index) const
 Returns the ith object in this list.
IObject *& operator[] (size_t index)
 Returns an reference to the ith's object pointer in this list.
size_t Count () const noexcept
 Returns how many objects are in this list.
void Clear ()
 Empties this list.
std::vector< IObject * > Find (std::function< bool(IObject *)> predicate) const noexcept
 Finds objects that match the specified predicate.
std::vector< IObject * >::iterator begin () noexcept
 Begin iterator for range-based for loops.
std::vector< IObject * >::const_iterator begin () const noexcept
 Begin const iterator for range-based for loops.
std::vector< IObject * >::iterator end () noexcept
 End iterator for range-based for loops.
std::vector< IObject * >::const_iterator end () const noexcept
 End const iterator for range-based for loops.

Friends

class IObject

Detailed Description

Represents a collection of child objects owned by a parent object. Unlike ObjectList, this doesn't (re)initialize the container objects nor has ownership.

Constructor & Destructor Documentation

◆ ChildObjectCollection()

ChildObjectCollection::ChildObjectCollection ( IObject * owner)
explicit

Member Function Documentation

◆ Add()

void ChildObjectCollection::Add ( IObject * ptr)

Adds an IObject pointer reference to this list.

Parameters
ptrIObject

◆ begin() [1/2]

std::vector< IObject * >::const_iterator ChildObjectCollection::begin ( ) const
noexcept

Begin const iterator for range-based for loops.

Returns
Const iterator to the beginning of the collection.

◆ begin() [2/2]

std::vector< IObject * >::iterator ChildObjectCollection::begin ( )
noexcept

Begin iterator for range-based for loops.

Returns
Iterator to the beginning of the collection.

◆ Clear()

void ChildObjectCollection::Clear ( )

Empties this list.

◆ Count()

size_t ChildObjectCollection::Count ( ) const
noexcept

Returns how many objects are in this list.

Returns
Number of objects in the list.

◆ end() [1/2]

std::vector< IObject * >::const_iterator ChildObjectCollection::end ( ) const
noexcept

End const iterator for range-based for loops.

Returns
Const iterator to the end of the collection.

◆ end() [2/2]

std::vector< IObject * >::iterator ChildObjectCollection::end ( )
noexcept

End iterator for range-based for loops.

Returns
Iterator to the end of the collection.

◆ Find()

std::vector< IObject * > ChildObjectCollection::Find ( std::function< bool(IObject *)> predicate) const
noexcept

Finds objects that match the specified predicate.

Parameters
predicatePredicate : (IObject*) -> bool
Returns
A vector of IObject pointers that match the predicate.

◆ operator[]() [1/2]

IObject *& ChildObjectCollection::operator[] ( size_t index)

Returns an reference to the ith's object pointer in this list.

Parameters
indexIndex. Must be smaller than Count
Returns
Reference to the i-th object pointer.

◆ operator[]() [2/2]

IObject * ChildObjectCollection::operator[] ( size_t index) const

Returns the ith object in this list.

Parameters
indexIndex
Returns
Object reference.

◆ Remove() [1/2]

void ChildObjectCollection::Remove ( IObject * ptr)

Removes the specified object.

Parameters
ptrObject to be removed

◆ Remove() [2/2]

void ChildObjectCollection::Remove ( size_t index)

Removes the ith object in this list.

Parameters
indexi

◆ IObject

friend class IObject
friend

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