Represents a collection of objects.
operator[]
to return value_type
, which triggers updates and events on element changes. type_t&
would bypass these updates, while returning value_type&
would break the xtd::collections::generic::ilist interface. Classes | |
class | value_type |
Represents the value type of the collection. More... | |
Public Aliases | |
using | base_type |
Represents the list base type. | |
using | const_base_type |
Represents the list base type. | |
using | size_type |
Represents the list size type (usually xtd::size). | |
using | reference |
Represents the reference of list value type. | |
using | const_reference |
Represents the const reference of list value type. | |
using | pointer |
Represents the pointer of list value type. | |
using | const_pointer |
Represents the const pointer of list value type. | |
using | read_only_collection |
Represents the read only collection of of list. | |
Public Fields | |
static constexpr xtd::size | npos |
Represents a value that is not a valid position in a collection. | |
static constexpr xtd::size | bpos |
Represents the index of the first valid element in a collection. | |
static constexpr xtd::size | epos |
Represents the index of the last valid element in a collection. | |
Public Events | |
event< arranged_element_collection, delegate< void(size_t, type_t &item)> > | item_added |
Occurs when an item is added to the collection. | |
event< arranged_element_collection, delegate< void(size_t, type_t &item)> > | item_updated |
Occurs when an item is updated in the collection. | |
event< arranged_element_collection, delegate< void(size_t, type_t &item)> > | item_removed |
Occurs when an item is removed from the collection. | |
Public Constructors | |
arranged_element_collection ()=default | |
Initializes a new instance of the xtd::forms::layout::arranged_element_collection class that is empty. | |
arranged_element_collection (size_type capacity) | |
Constructs the container with specified count default-inserted instances of type_t. No copies are made. | |
arranged_element_collection (const xtd::collections::generic::ienumerable< type_t > &collection) | |
Initializes a new instance of the xtd::forms::layout::arranged_element_collection <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied. | |
arranged_element_collection (const arranged_element_collection &collection) | |
Default copy constructor with specified list. | |
arranged_element_collection (arranged_element_collection &&collection) | |
Move constructor with specified list. | |
arranged_element_collection (const base_type &collection) | |
Copy constructor with specified base type list. | |
arranged_element_collection (base_type &&collection) | |
Move constructor with specified base type list. | |
arranged_element_collection (std::initializer_list< type_t > items) | |
Constructs the container with the contents of the specified initializer list, and allocator. | |
template<std::input_iterator input_iterator_t> | |
arranged_element_collection (input_iterator_t first, input_iterator_t last) | |
Constructs the container with the contents of the range [first, last). | |
Public Properties | |
size_type | capacity () const noexcept |
Gets the total number of elements the internal data structure can hold without resizing. | |
void | capacity (size_type value) |
Sets the total number of elements the internal data structure can hold without resizing. | |
size_type | count () const noexcept override |
Gets the number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>. | |
pointer | data () |
Direct access to the underlying array. | |
const_pointer | data () const |
Direct access to the underlying array. | |
const auto & | items () const |
Returns the underlying base type items. | |
auto & | items () |
Returns the underlying base type items. | |
virtual bool | sorted () const noexcept |
Checks whether the container is sorted. | |
virtual arranged_element_collection & | sorted (bool value) |
Sets the container is sorted. | |
Public Methods | |
void | add (const type_t &item) override |
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>. | |
virtual void | add (type_t &&item) |
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>. | |
virtual void | add_range (const arranged_element_collection &collection) |
Adds elements to the end. | |
virtual void | add_range (const std::vector< type_t > &collection) |
Adds elements to the end. | |
virtual void | add_range (const std::initializer_list< type_t > &collection) |
Adds elements to the end. | |
template<class collection_t> | |
void | add_range (collection_t &&collection) |
Adds elements to the end. | |
template<class collection_t> | |
void | add_range (const collection_t &collection) |
Adds elements to the end. | |
void | clear () override |
Removes all items from the xtd::forms::layout::arranged_element_collection <type_t>. | |
bool | contains (const type_t &item) const noexcept override |
Determines whether the xtd::forms::layout::arranged_element_collection <type_t> contains a specific value. | |
void | copy_to (xtd::array< type_t > &array, xtd::size array_index) const override |
Copies the elements of the xtd::forms::layout::arranged_element_collection <type_t> to an xtd::array, starting at a particular xtd::array index. | |
xtd::collections::generic::enumerator< type_t > | get_enumerator () const noexcept override |
Returns an enumerator that iterates through the xtd::forms::layout::arranged_element_collection <type_t>. | |
virtual void | insert (xtd::size index, const type_t &value) |
Inserts specified element at specified index. | |
virtual arranged_element_collection & | sort () |
Sorts the content. | |
bool | remove (const type_t &item) override |
Removes the first occurrence of a specific object from the xtd::forms::layout::arranged_element_collection <type_t>. | |
virtual void | remove_at (size_t index) |
Erases element at specified index. | |
xtd::array< type_t > | to_array () const noexcept |
Gets an array with the elements of the container. | |
Public Operators | |
arranged_element_collection & | operator= (const arranged_element_collection &other) |
Copy assignment operator. Replaces the contents with a copy of the contents of other. | |
arranged_element_collection & | operator= (arranged_element_collection &&other) noexcept |
Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards. | |
arranged_element_collection & | operator= (const std::initializer_list< type_t > &items) |
Replaces the contents with those identified by initializer list ilist. | |
value_type & | operator[] (size_type index) |
Access specified element. | |
const value_type & | operator[] (size_type index) const |
Access specified element. | |
operator const_base_type & () const noexcept | |
Returns a reference to the underlying base type. | |
operator base_type & () noexcept | |
Returns a reference to the underlying base type. | |
bool | operator== (const arranged_element_collection &value) const |
bool | operator!= (const arranged_element_collection &value) const |
Public Deprecatd Properties | |
size_type | max_size () const noexcept |
Returns the maximum possible number of elements. | |
Public Deprecated Methods | |
reference | at (size_type pos) |
Access specified element with bounds checking. | |
const_reference | at (size_type pos) const |
Access specified element with bounds checking. | |
reference | back () |
Access the last element. | |
const_reference | back () const |
Access the last element. | |
const_reverse_iterator | crbegin () const noexcept |
Returns a reverse iterator to the end. | |
const_reverse_iterator | crend () const noexcept |
Returns a reverse iterator to the end. | |
reference | front () |
Access the first element. | |
const_reference | front () const |
Access the first element. | |
auto | get_allocator () const noexcept |
Returns the associated allocator. | |
template<class ... args_t> | |
void | emplace (xtd::collections::generic::list< value_type >::const_iterator pos, args_t &&... args) |
Inserts specified element at specified position. | |
template<class ... args_t> | |
void | emplace_back (args_t &&... args) |
Adds an element to the end. | |
auto | erase (xtd::collections::generic::list< value_type >::iterator pos) |
Erases element at specified position. | |
auto | erase (xtd::collections::generic::list< value_type >::const_iterator pos) |
Erases element at specified position. | |
auto | erase (xtd::collections::generic::list< value_type >::iterator first, xtd::collections::generic::list< value_type >::iterator last) |
Erases elements at specified range. | |
auto | erase (xtd::collections::generic::list< value_type >::const_iterator first, xtd::collections::generic::list< value_type >::const_iterator last) |
Erases elements at specified range. | |
void | erase_at (size_t index) |
Erases element at specified index. | |
auto | insert (xtd::collections::generic::list< value_type >::const_iterator pos, const type_t &value) |
Inserts specified element at specified position. | |
auto | insert (xtd::collections::generic::list< value_type >::const_iterator pos, type_t &&value) |
Inserts specified element at specified position. | |
void | insert_at (size_t index, const type_t &value) |
Inserts specified element at specified index. | |
void | pop_back () |
Removes the last element of the container. | |
void | push_back (const type_t &item) |
Adds an element to the end. | |
void | push_back (type_t &&item) |
Adds an element to the end. | |
void | push_back_range (const arranged_element_collection &collection) |
Adds elements to the end. | |
void | push_back_range (const std::vector< type_t > &collection) |
Adds elements to the end. | |
void | push_back_range (const std::initializer_list< type_t > &collection) |
Adds elements to the end. | |
template<class collection_t> | |
void | push_back_range (collection_t &&collection) |
Adds elements to the end. | |
template<class iterator_t> | |
void | push_back_range (iterator_t begin, iterator_t end) |
Adds elements to the end. | |
std::vector< type_t > | to_vector () const noexcept |
Gets an array with the elements of the container. | |
auto | rbegin () noexcept |
Returns a reverse iterator to the end. | |
auto | rbegin () const noexcept |
Returns a reverse iterator to the end. | |
auto | rend () noexcept |
Returns a reverse iterator to the end. | |
auto | rend () const noexcept |
Returns a reverse iterator to the end. | |
void | reserve (size_type size) |
Reserves storage. | |
void | shrink_to_fit () |
Reduces memory usage by freeing unused memory. | |
Protected Methods | |
virtual void | on_item_added (size_t index, type_t &item) |
Raises the xtd::forms::layout::arranged_element_collection::item_added event. | |
virtual void | on_item_updated (size_t index, type_t &item) |
Raises the xtd::forms::layout::arranged_element_collection::item_updated event. | |
virtual void | on_item_removed (size_t index, type_t &item) |
Raises the xtd::forms::layout::arranged_element_collection::item_removed event. | |
Additional Inherited Members | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual bool | equals (const object &obj) const noexcept |
Determines whether the specified object is equal to the current object. | |
virtual xtd::size | get_hash_code () const noexcept |
Serves as a hash function for a particular type. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t> | |
xtd::unique_ptr_object< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
template<class object_a_t, class object_b_t> | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t, class object_b_t> | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::base_type |
Represents the list base type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_base_type |
Represents the list base type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::size_type |
Represents the list size type (usually xtd::size).
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::reference |
Represents the reference of list value type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_reference |
Represents the const reference of list value type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::pointer |
Represents the pointer of list value type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::const_pointer |
Represents the const pointer of list value type.
using xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::read_only_collection |
Represents the read only collection of of list.
|
default |
Initializes a new instance of the xtd::forms::layout::arranged_element_collection class that is empty.
|
inlineexplicit |
Constructs the container with specified count default-inserted instances of type_t. No copies are made.
capacity | The number of elements that the new list can initially store. |
xtd::out_of_memory | There is not enough memory available on the system. |
|
inline |
Initializes a new instance of the xtd::forms::layout::arranged_element_collection <type_t> class that contains elements copied from the specified collection and has sufficient capacity to accommodate the number of elements copied.
collection | The collection whose elements are copied to the new list. |
|
inline |
Default copy constructor with specified list.
collection | The xtd::forms::layout::arranged_element_collection which elements will be inserted from. |
|
inline |
Move constructor with specified list.
list | The xtd::forms::layout::arranged_element_collection which elements will be moved from. |
|
inline |
Copy constructor with specified base type list.
list | The xtd::forms::layout::arranged_element_collection::base_type which elements will be inserted from. |
|
inline |
Move constructor with specified base type list.
list | The xtd::forms::layout::arranged_element_collection::base_type which elements will be moved from. |
|
inline |
Constructs the container with the contents of the specified initializer list, and allocator.
items | The initializer list to initialize the elements of the container with. |
|
inline |
Constructs the container with the contents of the range [first, last).
first | The first iterator the range to copy the elements from. |
last | The last iterator the range to copy the elements from. |
alloc | The allocator to use for all memory allocations of this container. |
|
inlinenoexcept |
Gets the total number of elements the internal data structure can hold without resizing.
xtd::argument_out_of_range_exception | xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. |
|
inline |
Sets the total number of elements the internal data structure can hold without resizing.
xtd::out_of_memory | There is not enough memory available on the system. |
xtd::argument_out_of_range_exception | xtd::collections::generic::list::capacity is set to a value that is less than xtd::collections::generic::list::count. |
|
inlineoverridenoexcept |
Gets the number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>.
|
inline |
Direct access to the underlying array.
|
inline |
Direct access to the underlying array.
|
inline |
Returns the underlying base type items.
|
inline |
Returns the underlying base type items.
|
inlinevirtualnoexcept |
Checks whether the container is sorted.
true
if container is sorted; otherwise false
.
|
inlinevirtual |
Sets the container is sorted.
value | true if container is sorted; otherwise false . |
|
inlineoverride |
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
item | The object to add to the xtd::forms::layout::arranged_element_collection <type_t>. |
|
inlinevirtual |
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
item | The object to add to the xtd::forms::layout::arranged_element_collection <type_t>. |
|
inlinevirtual |
Adds elements to the end.
collection | The elements to add. |
|
inlinevirtual |
Adds elements to the end.
collection | The elements to add. |
|
inlinevirtual |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inlineoverride |
Removes all items from the xtd::forms::layout::arranged_element_collection <type_t>.
|
inlineoverridenoexcept |
Determines whether the xtd::forms::layout::arranged_element_collection <type_t> contains a specific value.
item | The object to locate in the xtd::forms::layout::arranged_element_collection <type_t>. |
true
if item is found in the xtd::forms::layout::arranged_element_collection <type_t>; otherwise, false
.
|
inlineoverride |
Copies the elements of the xtd::forms::layout::arranged_element_collection <type_t> to an xtd::array, starting at a particular xtd::array index.
array | The one-dimensional xtd::array that is the destination of the elements copied from xtd::forms::layout::arranged_element_collection <type_t>. The xtd::array must have zero-based indexing. |
array_index | The zero-based index in array at which copying begins. |
xtd::argument_exception | The number of elements in the source xtd::forms::layout::arranged_element_collection <type_t> is greater than the available space from `array_index` to the end of the destination `array`. |
|
inlineoverridenoexcept |
Returns an enumerator that iterates through the xtd::forms::layout::arranged_element_collection <type_t>.
|
inlinevirtual |
Inserts specified element at specified index.
index | The index before which the content will be inserted. |
value | The element to insert. |
Reimplemented in xtd::forms::control::control_collection.
|
inlinevirtual |
Sorts the content.
|
inlineoverride |
Removes the first occurrence of a specific object from the xtd::forms::layout::arranged_element_collection <type_t>.
item | The object to remove from the xtd::forms::layout::arranged_element_collection <type_t>. |
true
if item was successfully removed from the xtd::forms::layout::arranged_element_collection <type_t>; otherwise, false
. This method also returns false
if item is not found in the original xtd::forms::layout::arranged_element_collection <type_t>. typ_t
implements the xtd::iequatable <type_t> generic interface, the equality comparer is the xtd::iequatable::equals method of that interface; otherwise, the default equality comparer is xtd::object::equals.
|
inlinevirtual |
Erases element at specified index.
pos | The index which the content will be erased. |
|
inlinenoexcept |
Gets an array with the elements of the container.
|
inline |
Copy assignment operator. Replaces the contents with a copy of the contents of other.
other | Another container to use as data source. |
|
inlinenoexcept |
Move assignment operator. Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container). other is in a valid but unspecified state afterwards.
other | Another base type container to use as data source. |
|
inline |
Replaces the contents with those identified by initializer list ilist.
items | Initializer list to use as data source |
|
inline |
Access specified element.
index | The position of the element to return. |
|
inline |
Access specified element.
index | The position of the element to return. |
|
inlinenoexcept |
Returns a reference to the underlying base type.
|
inlinenoexcept |
Returns a reference to the underlying base type.
|
inlinenoexcept |
Returns the maximum possible number of elements.
|
inline |
Access specified element with bounds checking.
pos | The position of the element to return. |
std::out_of_range | pos is greater than arranged_element_collection::size. |
|
inline |
Access specified element with bounds checking.
pos | The position of the element to return. |
std::out_of_range | pos is greater than arranged_element_collection::size. |
|
inline |
Access the last element.
|
inline |
Access the last element.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inline |
Access the first element.
|
inline |
Access the first element.
|
inlinenoexcept |
Returns the associated allocator.
|
inline |
Inserts specified element at specified position.
pos | The iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator. |
args | The arguments to forward to the constructor of the element |
|
inline |
Adds an element to the end.
args | The arguments to forward to the constructor of the element |
|
inline |
Erases element at specified position.
pos | The iterator which the content will be erased. |
|
inline |
Erases element at specified position.
pos | The iterator which the content will be erased. |
|
inline |
Erases elements at specified range.
first | The first iterator range which the content will be erased. |
first | The last iterator range which the content will be erased. |
|
inline |
Erases elements at specified range.
first | The first iterator range which the content will be erased. |
first | The last iterator range which the content will be erased. |
|
inline |
Erases element at specified index.
pos | The index which the content will be erased. |
|
inline |
Inserts specified element at specified position.
pos | The iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator. |
value | The element to insert. |
|
inline |
Inserts specified element at specified position.
pos | The iterator before which the content will be inserted. pos may be the arranged_element_collection::end iterator. |
value | The element to insert. |
|
inline |
Inserts specified element at specified index.
index | The index before which the content will be inserted. |
value | The element to insert. |
|
inline |
Removes the last element of the container.
|
inline |
Adds an element to the end.
item | The element to add. |
|
inline |
Adds an element to the end.
item | The element to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inline |
Adds elements to the end.
collection | The elements to add. |
|
inlinenoexcept |
Gets an array with the elements of the container.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inlinenoexcept |
Returns a reverse iterator to the end.
|
inline |
Reserves storage.
|
inline |
Reduces memory usage by freeing unused memory.
|
inlineprotectedvirtual |
Raises the xtd::forms::layout::arranged_element_collection::item_added event.
index | The index of the item. |
item | The item added. |
|
inlineprotectedvirtual |
Raises the xtd::forms::layout::arranged_element_collection::item_updated event.
index | The index of the item. |
item | The item updated. |
|
inlineprotectedvirtual |
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
index | The index of the item. |
item | The item removed. |
Reimplemented in xtd::forms::control::control_collection.
|
inlinestaticconstexpr |
Represents a value that is not a valid position in a collection.
|
inlinestaticconstexpr |
Represents the index of the first valid element in a collection.
0
.
|
inlinestaticconstexpr |
Represents the index of the last valid element in a collection.
items.count() - 1
. items[xtd::epos]
directly accesses the last element without manually subtracting one from the collection count. ~1_z
. With bitwise operator the code is more concise. 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.
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.
event<arranged_element_collection, delegate<void(size_t, type_t& item)> > xtd::forms::layout::arranged_element_collection< type_t, sorter_t >::item_removed |
Occurs when an item is removed from the collection.