xtd - Reference Guide  0.2.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Classes | Public Types | Public Attributes | Static Public Attributes | Public Member Functions | List of all members
xtd::forms::layout::arranged_element_collection< type_t, sorter_t > Class Template Reference

#include <arranged_element_collection.h>

Definition

template<typename type_t, typename sorter_t = sorter_none>
class xtd::forms::layout::arranged_element_collection< type_t, sorter_t >

Represents a collection of objects.

Namespace
xtd::forms::layout
Library
xtd.forms
Remarks
The xtd::forms::layout::arranged_element_collection class represents a collection of objects arranged on a design surface or inside a parent xtd.forms::container_control.

Classes

class  value_type
 Represents the value type of the collection. More...
 

Public Types

using allocator_type = std::allocator< value_type >
 Represents the allocator type of the collection. More...
 
using const_iterator = typename std::vector< value_type >::const_iterator
 Represents the const iterator type of the collection. More...
 
using const_pointer = typename std::allocator_traits< allocator_type >::const_pointer
 Represents the value type const pointer of the collection. More...
 
using const_reference = const value_type &
 Represents the value type const reference the collection. More...
 
using const_reverse_iterator = typename std::vector< value_type >::const_reverse_iterator
 Represents the const reverse iterator type of the collection. More...
 
using difference_type = std::ptrdiff_t
 Represents the pointer difference type of the collection. More...
 
using iterator = typename std::vector< value_type >::iterator
 Represents the iterator type of the collection. More...
 
using pointer = typename std::allocator_traits< allocator_type >::pointer
 Represents the value type pointer of the collection. More...
 
using reference = value_type &
 Represents the value type reference of the collection. More...
 
using reverse_iterator = typename std::vector< value_type >::reverse_iterator
 Represents the reverse iterator type of the collection. More...
 
using size_type = std::size_t
 Represents the size type of the collection. More...
 

Public Attributes

event< arranged_element_collection, delegate< void(size_t, type_t &item)> > item_added
 Occurs when an item is added to the collection. More...
 
event< arranged_element_collection, delegate< void(size_t, type_t &item)> > item_erased
 Occurs when an item is erased from the collection. More...
 
event< arranged_element_collection, delegate< void(size_t, type_t &item)> > item_updated
 Occurs when an item is updated in the collection. More...
 

Static Public Attributes

static const size_type npos = std::numeric_limits<size_type>::max()
 This is a special value equal to the maximum value representable by the type size_t. More...
 

Public Member Functions

 arranged_element_collection (const allocator_type &allocator=allocator_type())
 Creates a new object xtd::forms::layout::arranged_element_collection with specified allocator (optional). More...
 
 arranged_element_collection (const std::initializer_list< type_t > &il)
 Creates a new object xtd::diagnostics::trace_listener_collection with specified initializer list. More...
 
reference at (size_type pos)
 Access specified element with bounds checking. More...
 
const_reference at (size_type pos) const
 Access specified element with bounds checking. More...
 
reference back ()
 Access the last element. More...
 
const_reference back () const
 Access the last element. More...
 
iterator begin ()
 Returns an iterator to the beginning. More...
 
const_iterator begin () const
 Returns an iterator to the beginning. More...
 
size_type capacity () const
 Returns the number of elements that can be held in currently allocated storage. More...
 
const_iterator cbegin () const
 Returns an iterator to the beginning. More...
 
const_iterator cend () const
 Returns an iterator to the end. More...
 
void clear ()
 clears the contents. More...
 
const_reverse_iterator crbegin () const
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator crend () const
 Returns a reverse iterator to the end. More...
 
pointer data ()
 Direct access to the underlying array. More...
 
const_pointer data () const
 Direct access to the underlying array. More...
 
bool empty () const
 Checks whether the container is empty. More...
 
iterator end ()
 Returns an iterator to the end. More...
 
const_iterator end () const
 Returns an iterator to the end. More...
 
iterator erase (iterator pos)
 Erases element at specified position. More...
 
iterator erase (const_iterator pos)
 Erases element at specified position. More...
 
iterator erase (iterator first, iterator last)
 Erases elements at specified range. More...
 
iterator erase (const_iterator first, const_iterator last)
 Erases elements at specified range. More...
 
void erase_at (size_t index)
 Erases element at specified index. More...
 
reference front ()
 Access the first element. More...
 
const_reference front () const
 Access the first element. More...
 
allocator_type get_allocator () const
 Returns the associated allocator. More...
 
iterator insert (iterator pos, const value_type &value)
 Inserts specified element at specified position. More...
 
iterator insert (const_iterator pos, const value_type &value)
 Inserts specified element at specified position. More...
 
iterator insert (const_iterator pos, const value_type &&value)
 Inserts specified element at specified position. More...
 
void insert_at (size_t index, const value_type &value)
 Inserts specified element at specified index. More...
 
size_type max_size () const
 Returns the maximum possible number of elements. More...
 
reference operator[] (size_type pos)
 Access specified element. More...
 
const_reference operator[] (size_type pos) const
 Access specified element. More...
 
void push_back (const value_type &item)
 Adds an element to the end. More...
 
void push_back (value_type &&item)
 Adds an element to the end. More...
 
void push_back_range (const arranged_element_collection &collection)
 Adds elements to the end. More...
 
void push_back_range (const std::vector< value_type > &collection)
 Adds elements to the end. More...
 
void push_back_range (const std::initializer_list< value_type > &collection)
 Adds elements to the end. More...
 
template<typename collection_t >
void push_back_range (collection_t collection)
 Adds elements to the end. More...
 
reverse_iterator rbegin ()
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator rbegin () const
 Returns a reverse iterator to the end. More...
 
reverse_iterator rend ()
 Returns a reverse iterator to the end. More...
 
const_reverse_iterator rend () const
 Returns a reverse iterator to the end. More...
 
void reserve (size_type size)
 Reserves storage. More...
 
void shrink_to_fit ()
 Reduces memory usage by freeing unused memory. More...
 
size_type size () const
 Returns the number of elements. More...
 
void sort ()
 Sorts the content. More...
 
bool sorted () const
 Checks whether the container is sorted. More...
 
void sorted (bool value)
 Sets the container is sorted. More...
 
std::vector< type_t > to_array () const
 Gets an array with the elements of the container. More...
 
std::vector< type_t > to_vector () const
 Gets an array with the elements of the container. More...
 

Member Typedef Documentation

◆ allocator_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::allocator_type = std::allocator<value_type>

Represents the allocator type of the collection.

◆ const_iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_iterator = typename std::vector<value_type>::const_iterator

Represents the const iterator type of the collection.

◆ const_pointer

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_pointer = typename std::allocator_traits<allocator_type>::const_pointer

Represents the value type const pointer of the collection.

◆ const_reference

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_reference = const value_type&

Represents the value type const reference the collection.

◆ const_reverse_iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_reverse_iterator = typename std::vector<value_type>::const_reverse_iterator

Represents the const reverse iterator type of the collection.

◆ difference_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::difference_type = std::ptrdiff_t

Represents the pointer difference type of the collection.

◆ iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::iterator = typename std::vector<value_type>::iterator

Represents the iterator type of the collection.

◆ pointer

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::pointer = typename std::allocator_traits<allocator_type>::pointer

Represents the value type pointer of the collection.

◆ reference

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reference = value_type&

Represents the value type reference of the collection.

◆ reverse_iterator

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reverse_iterator = typename std::vector<value_type>::reverse_iterator

Represents the reverse iterator type of the collection.

◆ size_type

template<typename type_t, typename sorter_t = sorter_none>
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::size_type = std::size_t

Represents the size type of the collection.

Constructor & Destructor Documentation

◆ arranged_element_collection() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( const allocator_type allocator = allocator_type())
inlineexplicit

Creates a new object xtd::forms::layout::arranged_element_collection with specified allocator (optional).

Parameters
allocatorThe allocator associate to the collection (optional).
Remarks
If allocator not specified, the std::allocator<value_type> is used.

◆ arranged_element_collection() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::arranged_element_collection ( const std::initializer_list< type_t > &  il)
inline

Creates a new object xtd::diagnostics::trace_listener_collection with specified initializer list.

Parameters
ilThe initializer list that contains items to fill the collection.

Member Function Documentation

◆ at() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::at ( size_type  pos)
inline

Access specified element with bounds checking.

Parameters
posThe position of the element to return.
Exceptions
std::out_of_rangepos is greater than arranged_element_collection::size.

◆ at() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::at ( size_type  pos) const
inline

Access specified element with bounds checking.

Parameters
posThe position of the element to return.
Exceptions
std::out_of_rangepos is greater than arranged_element_collection::size.

◆ back() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::back ( )
inline

Access the last element.

Returns
The last element.

◆ back() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::back ( ) const
inline

Access the last element.

Returns
The last element.

◆ begin() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::begin ( )
inline

Returns an iterator to the beginning.

Returns
The iterator to the beginning.

◆ begin() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::begin ( ) const
inline

Returns an iterator to the beginning.

Returns
The iterator to the beginning.

◆ capacity()

template<typename type_t, typename sorter_t = sorter_none>
size_type xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::capacity ( ) const
inline

Returns the number of elements that can be held in currently allocated storage.

Returns
The number of elements that can be held in currently allocated storage.

◆ cbegin()

template<typename type_t, typename sorter_t = sorter_none>
const_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::cbegin ( ) const
inline

Returns an iterator to the beginning.

Returns
The iterator to the beginning.

◆ cend()

template<typename type_t, typename sorter_t = sorter_none>
const_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::cend ( ) const
inline

Returns an iterator to the end.

Returns
The iterator to the end.

◆ clear()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::clear ( )
inline

clears the contents.

◆ crbegin()

template<typename type_t, typename sorter_t = sorter_none>
const_reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::crbegin ( ) const
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ crend()

template<typename type_t, typename sorter_t = sorter_none>
const_reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::crend ( ) const
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ data() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
pointer xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::data ( )
inline

Direct access to the underlying array.

Returns
The underlying array.

◆ data() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_pointer xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::data ( ) const
inline

Direct access to the underlying array.

Returns
The underlying array.

◆ empty()

template<typename type_t, typename sorter_t = sorter_none>
bool xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::empty ( ) const
inline

Checks whether the container is empty.

Returns
true if container is empty; otherwise false.

◆ end() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::end ( )
inline

Returns an iterator to the end.

Returns
The iterator to the end.

◆ end() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::end ( ) const
inline

Returns an iterator to the end.

Returns
The iterator to the end.

◆ erase() [1/4]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( iterator  pos)
inline

Erases element at specified position.

Parameters
posThe iterator which the content will be erased.

◆ erase() [2/4]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( const_iterator  pos)
inline

Erases element at specified position.

Parameters
posThe iterator which the content will be erased.

◆ erase() [3/4]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( iterator  first,
iterator  last 
)
inline

Erases elements at specified range.

Parameters
firstThe first iterator range which the content will be erased.
firstThe last iterator range which the content will be erased.

◆ erase() [4/4]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase ( const_iterator  first,
const_iterator  last 
)
inline

Erases elements at specified range.

Parameters
firstThe first iterator range which the content will be erased.
firstThe last iterator range which the content will be erased.

◆ erase_at()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::erase_at ( size_t  index)
inline

Erases element at specified index.

Parameters
posThe index which the content will be erased.

◆ front() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::front ( )
inline

Access the first element.

Returns
The first element.

◆ front() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::front ( ) const
inline

Access the first element.

Returns
The first element.

◆ get_allocator()

template<typename type_t, typename sorter_t = sorter_none>
allocator_type xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::get_allocator ( ) const
inline

Returns the associated allocator.

Returns
The associate allocator.

◆ insert() [1/3]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( iterator  pos,
const value_type value 
)
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
valueThe element to insert.

◆ insert() [2/3]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( const_iterator  pos,
const value_type value 
)
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
valueThe element to insert.

◆ insert() [3/3]

template<typename type_t, typename sorter_t = sorter_none>
iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert ( const_iterator  pos,
const value_type &&  value 
)
inline

Inserts specified element at specified position.

Parameters
posThe iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator.
valueThe element to insert.

◆ insert_at()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::insert_at ( size_t  index,
const value_type value 
)
inline

Inserts specified element at specified index.

Parameters
posThe index before which the content will be inserted.
valueThe element to insert.

◆ max_size()

template<typename type_t, typename sorter_t = sorter_none>
size_type xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::max_size ( ) const
inline

Returns the maximum possible number of elements.

Returns
The maximum possible number of elements.

◆ operator[]() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator[] ( size_type  pos)
inline

Access specified element.

Returns
The requested element.

◆ operator[]() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reference xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::operator[] ( size_type  pos) const
inline

Access specified element.

Returns
The requested element.

◆ push_back() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back ( const value_type item)
inline

Adds an element to the end.

Parameters
itemThe element to add.

◆ push_back() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back ( value_type &&  item)
inline

Adds an element to the end.

Parameters
itemThe element to add.

◆ push_back_range() [1/4]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const arranged_element_collection< type_t, sorter_t > &  collection)
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ push_back_range() [2/4]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const std::vector< value_type > &  collection)
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ push_back_range() [3/4]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( const std::initializer_list< value_type > &  collection)
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ push_back_range() [4/4]

template<typename type_t, typename sorter_t = sorter_none>
template<typename collection_t >
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::push_back_range ( collection_t  collection)
inline

Adds elements to the end.

Parameters
collectionThe elements to add.

◆ rbegin() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rbegin ( )
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ rbegin() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rbegin ( ) const
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ rend() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rend ( )
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ rend() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
const_reverse_iterator xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::rend ( ) const
inline

Returns a reverse iterator to the end.

Returns
The reverse iterator to the end.

◆ reserve()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reserve ( size_type  size)
inline

Reserves storage.

◆ shrink_to_fit()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::shrink_to_fit ( )
inline

Reduces memory usage by freeing unused memory.

◆ size()

template<typename type_t, typename sorter_t = sorter_none>
size_type xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::size ( ) const
inline

Returns the number of elements.

Returns
The number of elements.

◆ sort()

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sort ( )
inline

Sorts the content.

◆ sorted() [1/2]

template<typename type_t, typename sorter_t = sorter_none>
bool xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sorted ( ) const
inline

Checks whether the container is sorted.

Returns
true if container is sorted; otherwise false.

◆ sorted() [2/2]

template<typename type_t, typename sorter_t = sorter_none>
void xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::sorted ( bool  value)
inline

Sets the container is sorted.

Parameters
valuetrue if container is sorted; otherwise false.

◆ to_array()

template<typename type_t, typename sorter_t = sorter_none>
std::vector<type_t> xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::to_array ( ) const
inline

Gets an array with the elements of the container.

Returns
The array that contains elements of the container.

◆ to_vector()

template<typename type_t, typename sorter_t = sorter_none>
std::vector<type_t> xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::to_vector ( ) const
inline

Gets an array with the elements of the container.

Returns
The array that contains elements of the container.

Member Data Documentation

◆ item_added

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(size_t, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_added

Occurs when an item is added to the collection.

◆ item_erased

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(size_t, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_erased

Occurs when an item is erased from the collection.

◆ item_updated

template<typename type_t, typename sorter_t = sorter_none>
event<arranged_element_collection, delegate<void(size_t, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_updated

Occurs when an item is updated in the collection.

◆ npos

template<typename type_t, typename sorter_t = sorter_none>
const size_type xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::npos = std::numeric_limits<size_type>::max()
static

This is a special value equal to the maximum value representable by the type size_t.


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