Public Types | Public Member Functions
efl::eina::_nonpod_inarray< T > Class Template Reference

Public Types

typedef T value_type
 The type of each element. More...
 
typedef T & reference
 Type for a reference to an element. More...
 
typedef T const & const_reference
 Type for a constant reference to an element. More...
 
typedef T * pointer
 Type for a pointer to an element. More...
 
typedef T const * const_pointer
 Type for a constant pointer for an element. More...
 
typedef pointer iterator
 Type for a iterator to this kind of inline array. More...
 
typedef const_pointer const_iterator
 Type for a constant iterator for this kind of inline array. More...
 
typedef std::size_t size_type
 Type for size information used in the array. More...
 
typedef std::ptrdiff_t difference_type
 Type to represent the distance between two iterators. More...
 
typedef std::reverse_iterator< iteratorreverse_iterator
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Type for the native Eina_Inarray handle. More...
 

Public Member Functions

 _nonpod_inarray (Eina_Inarray *array)
 Create a new object from a handle to a native Eina_Inarray. More...
 
 _nonpod_inarray ()
 Default constructor. More...
 
 _nonpod_inarray (size_type n, value_type const &t)
 Construct an array object with n copies of t. More...
 
template<typename InputIterator >
 _nonpod_inarray (InputIterator i, InputIterator const &j, typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *=0)
 Create a inline array coping the elements from the given range. More...
 
 _nonpod_inarray (_nonpod_inarray< T >const &other)
 Copy constructor. More...
 
 ~_nonpod_inarray ()
 Destructor of array for non-POD elements. More...
 
_nonpod_inarray< T > & operator= (_nonpod_inarray< T >const &other)
 Replace current content with the cotent of another array. More...
 
void clear ()
 Remove all the elements of the array.
 
void push_back (T const &value)
 Add a copy of the given element at the end of the array. More...
 
void pop_back ()
 Remove the last element of the array.
 
iterator insert (iterator i, value_type const &t)
 Insert a new element at the given position. More...
 
iterator insert (iterator i, size_t n, value_type const &t)
 Insert n copies of t at the given position. More...
 
template<typename InputIterator >
iterator insert (iterator p, InputIterator i, InputIterator j, typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *=0)
 Insert the elements between the given range at the given position. More...
 
iterator erase (iterator q)
 Remove the element at the given position. More...
 
iterator erase (iterator i, iterator j)
 Remove the elements between the given range. More...
 
template<typename InputIterator >
void assign (InputIterator i, InputIterator j, typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *=0)
 Replace the content of the array by the elements in the given range. More...
 
void assign (size_type n, value_type const &t)
 Replace the content of the array by n copies t. More...
 
value_typeoperator[] (size_type i)
 Get a reference to the element at the given position. More...
 
value_type const & operator[] (size_type i) const
 Get a constant reference to the element at the given position. More...
 
value_typeback ()
 Get a reference to the last element. More...
 
value_type const & back () const
 Get a constant reference to the last element. More...
 
value_typefront ()
 Get a reference to the first element. More...
 
value_type const & front () const
 Get a constant reference to the first element. More...
 
iterator begin ()
 Get an iterator pointing to the first element of the array. More...
 
iterator end ()
 Get an iterator to the position following the last element of the array. More...
 
const_iterator begin () const
 Get a constant iterator pointing to the first element of the array. More...
 
const_iterator end () const
 Get a constant iterator to the position following the last element of the array. More...
 
const_reverse_iterator rbegin () const
 Get a constant reverse iterator pointing to the reverse begin of the array. More...
 
const_reverse_iterator rend () const
 Get a constant reverse iterator pointing to the reverse end of the array. More...
 
reverse_iterator rbegin ()
 Get a reverse iterator pointing to the reverse begin of the array. More...
 
reverse_iterator rend ()
 Get a reverse iterator pointing to the reverse end of the array. More...
 
const_iterator cbegin () const
 Get a constant iterator pointing to the first element of the array. More...
 
const_iterator cend () const
 Get a constant iterator to the position following the last element of the array. More...
 
const_reverse_iterator crbegin () const
 Get a constant reverse iterator pointing to the reverse begin of the array. More...
 
const_reverse_iterator crend () const
 Get a constant reverse iterator pointing to the reverse end of the array. More...
 
void swap (_nonpod_inarray< T > &other)
 Swap content between two inline arrays. More...
 
size_type max_size () const
 Get the maximum number of elements a inline array can hold. More...
 
Eina_Inarraynative_handle ()
 Get the handle for the wrapped Eina_Inarray. More...
 
Eina_Inarray const * native_handle () const
 Get the handle for the wrapped Eina_Inarray. More...
 

Member Typedef Documentation

◆ value_type

template<typename T>
typedef T efl::eina::_nonpod_inarray< T >::value_type

The type of each element.

◆ reference

template<typename T>
typedef T& efl::eina::_nonpod_inarray< T >::reference

Type for a reference to an element.

◆ const_reference

template<typename T>
typedef T const& efl::eina::_nonpod_inarray< T >::const_reference

Type for a constant reference to an element.

◆ pointer

template<typename T>
typedef T* efl::eina::_nonpod_inarray< T >::pointer

Type for a pointer to an element.

◆ const_pointer

template<typename T>
typedef T const* efl::eina::_nonpod_inarray< T >::const_pointer

Type for a constant pointer for an element.

◆ iterator

template<typename T>
typedef pointer efl::eina::_nonpod_inarray< T >::iterator

Type for a iterator to this kind of inline array.

Defined as a pointer for performance reasons.

◆ const_iterator

template<typename T>
typedef const_pointer efl::eina::_nonpod_inarray< T >::const_iterator

Type for a constant iterator for this kind of inline array.

Defined as a const_pointer for performance reasons.

◆ size_type

template<typename T>
typedef std::size_t efl::eina::_nonpod_inarray< T >::size_type

Type for size information used in the array.

◆ difference_type

template<typename T>
typedef std::ptrdiff_t efl::eina::_nonpod_inarray< T >::difference_type

Type to represent the distance between two iterators.

◆ const_reverse_iterator

template<typename T>
typedef std::reverse_iterator<const_iterator> efl::eina::_nonpod_inarray< T >::const_reverse_iterator

Type for the native Eina_Inarray handle.

Constructor & Destructor Documentation

◆ _nonpod_inarray() [1/5]

template<typename T>
efl::eina::_nonpod_inarray< T >::_nonpod_inarray ( Eina_Inarray array)
inline

Create a new object from a handle to a native Eina_Inarray.

Parameters
arrayHandle to a native Eina_Inarray.

This constructor wraps a pre-allocated Eina_Inarray providing an OOP interface to it.

Warning
It is important to note that the created object gains ownership of the handle, deallocating it at destruction time.

◆ _nonpod_inarray() [2/5]

template<typename T>
efl::eina::_nonpod_inarray< T >::_nonpod_inarray ( )
inline

Default constructor.

Create an empty array.

This constructor creates an array object with no elements. Elements are declarated as having the same size of the given template typename argument.

◆ _nonpod_inarray() [3/5]

template<typename T>
efl::eina::_nonpod_inarray< T >::_nonpod_inarray ( size_type  n,
value_type const &  t 
)
inline

Construct an array object with n copies of t.

Parameters
nNumber of elements.
tValue to be copied to each element.

This constructor creates an inline array with n elements, each one as a copy of t.

◆ _nonpod_inarray() [4/5]

template<typename T>
template<typename InputIterator >
efl::eina::_nonpod_inarray< T >::_nonpod_inarray ( InputIterator  i,
InputIterator const &  j,
typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *  = 0 
)
inline

Create a inline array coping the elements from the given range.

Parameters
iIterator to the initial position. The element pointed by this iterator will be copied.
jIterator to the final position. The element pointed by this iterator will NOT be copied.

This constructor creates a inline array with copies of the elements between i and j in the same order. Note that the ending element (pointed by j) is excluded.

◆ _nonpod_inarray() [5/5]

template<typename T>
efl::eina::_nonpod_inarray< T >::_nonpod_inarray ( _nonpod_inarray< T >const &  other)
inline

Copy constructor.

Creates a copy of the given inline array.

Parameters
otherAnother inline array of the same type.

This constructor creates an inline array containing a copy of each element inside other in the same order.

References efl::eina::_nonpod_inarray< T >::begin(), efl::eina::_inarray_access_traits::end(), and efl::eina::_nonpod_inarray< T >::end().

◆ ~_nonpod_inarray()

template<typename T>
efl::eina::_nonpod_inarray< T >::~_nonpod_inarray ( )
inline

Destructor of array for non-POD elements.

Calls the destructor of each allocated element, before the base class destructor releases their memory.

Member Function Documentation

◆ operator=()

template<typename T>
_nonpod_inarray<T>& efl::eina::_nonpod_inarray< T >::operator= ( _nonpod_inarray< T >const &  other)
inline

Replace current content with the cotent of another array.

Parameters
otherAnother inline array of the same type.

This assignment operator replaces the content of the array by a copy of the content of the given array other. The array size is adjusted accordingly and the newly copied elements keep their original order.

References efl::eina::_nonpod_inarray< T >::begin(), efl::eina::_inarray_access_traits::end(), and efl::eina::_nonpod_inarray< T >::end().

◆ push_back()

template<typename T>
void efl::eina::_nonpod_inarray< T >::push_back ( T const &  value)
inline

Add a copy of the given element at the end of the array.

Parameters
valueElement to be added at the end of the array.

This member function allocates a new element at the end of the inline array, the content of value is copied to the new element.

References efl::eina::_inarray_access_traits::end().

◆ insert() [1/3]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::insert ( iterator  i,
value_type const &  t 
)
inline

Insert a new element at the given position.

Parameters
iIterator pointing to the position where the new element will be inserted.
tValue to be copied to the new element.
Returns
Iterator pointing to the new element inserted.

This member function inserts a copy of the element t at the position i. The new element comes right before the element originally pointed by i.

At the end, a valid iterator pointing to the element just inserted is returned.

◆ insert() [2/3]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::insert ( iterator  i,
size_t  n,
value_type const &  t 
)
inline

Insert n copies of t at the given position.

Parameters
iIterator pointing to the position where the new elements will be inserted.
nNumber of elements to be inserted.
tValue to be copied to each new inserted element.
Returns
Iterator pointing to the first inserted element.

This member function inserts n new elements at position i in the array, each one as a copy of t. The new elements come right before the element originally pointed by i.

At the end, a valid iterator pointing to the first element inserted is returned.

References efl::eina::_inarray_access_traits::begin(), eina_inarray_new(), eina_inarray_resize(), and efl::eina::_inarray_access_traits::index().

◆ insert() [3/3]

template<typename T>
template<typename InputIterator >
iterator efl::eina::_nonpod_inarray< T >::insert ( iterator  p,
InputIterator  i,
InputIterator  j,
typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *  = 0 
)
inline

Insert the elements between the given range at the given position.

Parameters
pIterator pointing to the position where the new elements will be inserted.
iIterator to the initial position. The element pointed by this iterator will be copied.
jIterator to the final position. The element pointed by this iterator will NOT be copied.
Returns
Iterator pointing to the first inserted element.

This member function inserts a copy of the elements between i and j at the position p. The new elements come right before the element originally pointed by p. Note that the element pointed by j is not copied.

◆ erase() [1/2]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::erase ( iterator  q)
inline

Remove the element at the given position.

Parameters
qIterator pointing to the element to be removed.
Returns
Iterator pointing to the element after the removed one.

This member function removes the element pointed by the iterator q, reducing the array size by one. At the end, a valid iterator pointing to the element right after the removed one is returned.

◆ erase() [2/2]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::erase ( iterator  i,
iterator  j 
)
inline

Remove the elements between the given range.

Parameters
iIterator pointing to the starting position to be removed.
jIterator pointing to the ending position to be removed. The element pointed by this iterator is not removed.
Returns
Iterator pointing to the new position of the first non-removed element after the removed ones (i.e. the one originally pointed by j).

This member function removes the elements between the iterators i and j, including the element pointed by i but not the element pointed by .

References efl::eina::_inarray_access_traits::end().

◆ assign() [1/2]

template<typename T>
template<typename InputIterator >
void efl::eina::_nonpod_inarray< T >::assign ( InputIterator  i,
InputIterator  j,
typename eina::enable_if<!eina::is_integral< InputIterator >::value >::type *  = 0 
)

Replace the content of the array by the elements in the given range.

Parameters
iIterator pointing to the beginning of the elements to be copied.
jIterator pointing to the end of the elements to be copied. Note that the element pointed by j will NOT be copied.

This member function replaces the current elements by copies of the elements between the iterators i and j, including the element pointed by i but not the one pointed by j. The size of the array is adjusted accordingly and the newly copied elements remain in their original order.

◆ assign() [2/2]

template<typename T>
void efl::eina::_nonpod_inarray< T >::assign ( size_type  n,
value_type const &  t 
)

Replace the content of the array by n copies t.

Parameters
nNumber of elements.
tValue to be copied to each element.

◆ operator[]() [1/2]

template<typename T>
value_type& efl::eina::_nonpod_inarray< T >::operator[] ( size_type  i)
inline

Get a reference to the element at the given position.

Parameters
iPosition of the element.
Returns
Reference to the element at the ith position.

References efl::eina::_inarray_access_traits::begin().

◆ operator[]() [2/2]

template<typename T>
value_type const& efl::eina::_nonpod_inarray< T >::operator[] ( size_type  i) const
inline

Get a constant reference to the element at the given position.

Parameters
iPosition of the element.
Returns
Constant reference to the element at the ith position.

Version of operator[](size_type i) for const-qualified inline array objects. Return a constant reference instead.

◆ back() [1/2]

template<typename T>
value_type& efl::eina::_nonpod_inarray< T >::back ( )
inline

Get a reference to the last element.

Returns
Reference to the last element in the array.

◆ back() [2/2]

template<typename T>
value_type const& efl::eina::_nonpod_inarray< T >::back ( ) const
inline

Get a constant reference to the last element.

Returns
Constant reference to the last element in the array.

Version of back() for const-qualified inline array objects. Return a constant reference instead.

◆ front() [1/2]

template<typename T>
value_type& efl::eina::_nonpod_inarray< T >::front ( )
inline

Get a reference to the first element.

Returns
Reference to the first element of the array.

◆ front() [2/2]

template<typename T>
value_type const& efl::eina::_nonpod_inarray< T >::front ( ) const
inline

Get a constant reference to the first element.

Returns
Constant reference to the first element of the array.

Version of front() for const-qualified inline array objects. Return a constant reference instead.

◆ begin() [1/2]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::begin ( )
inline

Get an iterator pointing to the first element of the array.

Returns
Iterator to the initial position of the array.

This member function returns an iterator pointing to the first element of the array. If the array is empty the returned iterator is the same as the one returned by end().

Referenced by efl::eina::_nonpod_inarray< T >::_nonpod_inarray(), and efl::eina::_nonpod_inarray< T >::operator=().

◆ end() [1/2]

template<typename T>
iterator efl::eina::_nonpod_inarray< T >::end ( )
inline

Get an iterator to the position following the last element of the array.

Returns
Iterator to the final position of the array.

This member function returns an iterator to the position following the last element in the array. If the array is empty the returned iterator is the same as the one returned by begin(). Note that attempting to access this position causes undefined behavior.

Referenced by efl::eina::_nonpod_inarray< T >::_nonpod_inarray(), and efl::eina::_nonpod_inarray< T >::operator=().

◆ begin() [2/2]

template<typename T>
const_iterator efl::eina::_nonpod_inarray< T >::begin ( ) const
inline

Get a constant iterator pointing to the first element of the array.

Returns
Constant iterator to the initial position of the array.

Version of begin() for const-qualified inline array objects. Returns a constant iterator instead.

◆ end() [2/2]

template<typename T>
const_iterator efl::eina::_nonpod_inarray< T >::end ( ) const
inline

Get a constant iterator to the position following the last element of the array.

Returns
Constant iterator to the final position of the array.

Version of end() for const-qualified inline array objects. Returns a constant iterator instead.

◆ rbegin() [1/2]

template<typename T>
const_reverse_iterator efl::eina::_nonpod_inarray< T >::rbegin ( ) const
inline

Get a constant reverse iterator pointing to the reverse begin of the array.

Returns
Constant reverse iterator pointing to the reverse begin of the array.

Version of rbegin() for const-qualified inline array objects. Returns a constant reverse iterator instead.

◆ rend() [1/2]

template<typename T>
const_reverse_iterator efl::eina::_nonpod_inarray< T >::rend ( ) const
inline

Get a constant reverse iterator pointing to the reverse end of the array.

Returns
Constant reverse iterator pointing to the reverse end of the array.

Version of rend() for const-qualified inline array objects. Returns a constant reverse iterator instead.

◆ rbegin() [2/2]

template<typename T>
reverse_iterator efl::eina::_nonpod_inarray< T >::rbegin ( )
inline

Get a reverse iterator pointing to the reverse begin of the array.

Returns
Reverse iterator pointing to the reverse begin of the array.

This member function returns a reverse iterator pointing to the last element of the array. If the array is empty the returned reverse iterator is the same as the one returned by rend().

◆ rend() [2/2]

template<typename T>
reverse_iterator efl::eina::_nonpod_inarray< T >::rend ( )
inline

Get a reverse iterator pointing to the reverse end of the array.

Returns
Reverse iterator pointing to the reverse end of the array.

This member function returns a reverse iterator pointing to the position before the first element of the array. If the array is empty the returned iterator is the same as the one returned by rbegin().

Note
Note that attempting to access this position causes undefined behavior.

◆ cbegin()

template<typename T>
const_iterator efl::eina::_nonpod_inarray< T >::cbegin ( ) const
inline

Get a constant iterator pointing to the first element of the array.

Returns
Constant iterator to the initial position of the array.

This member function works like the constant overload of begin() but is granted to return a constant iterator even for arrays that are not const-qualified.

◆ cend()

template<typename T>
const_iterator efl::eina::_nonpod_inarray< T >::cend ( ) const
inline

Get a constant iterator to the position following the last element of the array.

Returns
Constant iterator to the final position of the array.

This member function works like the constant overload of end() but is granted to return a constant iterator even for arrays that are not const-qualified.

◆ crbegin()

template<typename T>
const_reverse_iterator efl::eina::_nonpod_inarray< T >::crbegin ( ) const
inline

Get a constant reverse iterator pointing to the reverse begin of the array.

Returns
Constant reverse iterator pointing to the reverse begin of the array.

This member function works like the constant overload of rbegin() but is granted to return a constant reverse iterator even for arrays that are not const-qualified.

◆ crend()

template<typename T>
const_reverse_iterator efl::eina::_nonpod_inarray< T >::crend ( ) const
inline

Get a constant reverse iterator pointing to the reverse end of the array.

Returns
Constant reverse iterator pointing to the reverse end of the array.

This member function works like the constant overload of rend() but is granted to return a constant reverse iterator even for arrays that are not const-qualified.

◆ swap()

template<typename T>
void efl::eina::_nonpod_inarray< T >::swap ( _nonpod_inarray< T > &  other)
inline

Swap content between two inline arrays.

Parameters
otherOther inline array of the same type.

References efl::eina::swap().

◆ max_size()

template<typename T>
size_type efl::eina::_nonpod_inarray< T >::max_size ( ) const
inline

Get the maximum number of elements a inline array can hold.

Returns
Maximum number of elements a inline array can hold.

◆ native_handle() [1/2]

template<typename T>
Eina_Inarray* efl::eina::_nonpod_inarray< T >::native_handle ( )
inline

Get the handle for the wrapped Eina_Inarray.

Returns
Internal handle for the native Eina inline array.

This member function returns the native Eina_Inarray handle that is wrapped inside this object. It is important to take care when using it, since the handle will be automatically release upon object destruction.

◆ native_handle() [2/2]

template<typename T>
Eina_Inarray const* efl::eina::_nonpod_inarray< T >::native_handle ( ) const
inline

Get the handle for the wrapped Eina_Inarray.

Returns
Internal handle for the native Eina inline array.

This member function returns the native Eina_Inarray handle that is wrapped inside this object. It is important to take care when using it, since the handle will be automatically release upon object destruction.