GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
gd::SPtrList< T > Class Template Reference

Public Member Functions

 SPtrList (const SPtrList< T > &)
 
SPtrList< T > & operator= (const SPtrList< T > &rhs)
 
T & Insert (const T &element, size_t position=(size_t)-1)
 Insert the specified element to the list. More...
 
void Insert (std::shared_ptr< T > element, size_t position=(size_t)-1)
 Insert the specified element to the list. More...
 
void Insert (const SPtrList< T > &otherEvents, size_t begin, size_t end, size_t position=(size_t)-1)
 Copy elements from another list.
 
size_t GetCount () const
 Return the number of elements.
 
std::shared_ptr< T > GetSmartPtr (size_t index)
 Return the smart pointer to the element at position index in the elements list.
 
T & Get (size_t index)
 Return a reference to the element at position index in the elements list.
 
const T & Get (size_t index) const
 Return a reference to the element at position index in the elements list.
 
void Remove (const T &element)
 Remove the specified element.
 
void Remove (size_t index)
 Remove the element at the specified index in the list.
 
bool IsEmpty () const
 Return true if there isn't any element in the list.
 
void Clear ()
 Clear the list of elements.
 
Utilities

Utility methods

bool Contains (const T &elementToSearch) const
 
std::vector-like API

These functions ensure that the class can be used just like a std::vector for iterations.

size_t size () const
 Alias for GetCount() More...
 
bool empty () const
 Alias for IsEmpty() More...
 
T & operator[] (size_t index)
 Alias for Get() More...
 
const T & operator[] (size_t index) const
 Alias for Get() More...
 
T & at (size_t index)
 Alias for Get() More...
 
const T & at (size_t index) const
 Alias for Get() More...
 

Protected Member Functions

void Init (const SPtrList< T > &other)
 

Protected Attributes

std::vector< std::shared_ptr< T > > elements
 

Member Function Documentation

template<typename T>
T& gd::SPtrList< T >::at ( size_t  index)
inline

Alias for Get()

See also
SPtrList::Get.
template<typename T>
const T& gd::SPtrList< T >::at ( size_t  index) const
inline

Alias for Get()

See also
SPtrList::Get.
template<typename T>
bool gd::SPtrList< T >::Contains ( const T &  elementToSearch) const

Return true if the specified element exists in the list.

Parameters
elementThe element to searched for
template<typename T>
bool gd::SPtrList< T >::empty ( ) const
inline

Alias for IsEmpty()

See also
SPtrList::IsEmpty.
template<typename T>
void gd::SPtrList< T >::Init ( const SPtrList< T > &  other)
protected

Initialize from another list of elements, copying elements. Used by copy-ctor and assign-op. Don't forget to update me if members were changed!

template<typename T>
T & gd::SPtrList< T >::Insert ( const T &  element,
size_t  position = (size_t)-1 
)

Insert the specified element to the list.

Note
The element passed by parameter is copied.
Parameters
elementThe element that must be copied and inserted into the list
positionInsertion position. If the position is invalid, the object is inserted at the end of the objects list.
Returns
A reference to the element in the list
template<typename T>
void gd::SPtrList< T >::Insert ( std::shared_ptr< T >  element,
size_t  position = (size_t)-1 
)

Insert the specified element to the list.

Note
The element passed by parameter is not copied.
Parameters
elementThe smart pointer to the element that must be inserted into the list
positionInsertion position. If the position is invalid, the object is inserted at the end of the objects list.
template<typename T>
T& gd::SPtrList< T >::operator[] ( size_t  index)
inline

Alias for Get()

See also
SPtrList::Get.
template<typename T>
const T& gd::SPtrList< T >::operator[] ( size_t  index) const
inline

Alias for Get()

See also
SPtrList::Get.
template<typename T>
size_t gd::SPtrList< T >::size ( ) const
inline

Alias for GetCount()

See also
SPtrList::GetCount.

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