xtd 1.0.0
Loading...
Searching...
No Matches
arranged_element_collection.hpp
Go to the documentation of this file.
1
4#pragma once
5
6//#include "items_added_event_handler.hpp"
7#include "sorter_none.hpp"
8#include <xtd/collections/generic/helpers/equator>
9#include <xtd/collections/generic/list>
11#include <xtd/array>
12#include <xtd/argument_out_of_range_exception>
13#include <xtd/event_args>
14#include <xtd/event_handler>
15#include <xtd/event>
16#include <xtd/object>
17#include <xtd/new_ptr>
18#include <xtd/usize_object>
19
21namespace xtd {
23 namespace forms {
25 namespace layout {
40 template<typename type_t, typename sorter_t = sorter_none>
41 class arranged_element_collection : public object, public xtd::collections::generic::icollection<type_t> {
42 public:
44 class value_type : public type_t {
45 public:
47 value_type() = default;
48 value_type(const value_type&) = default;
49 value_type(value_type&&) = default;
50 template<typename ...args_t>
51 value_type(args_t&& ...args) : type_t(args...) {}
52 value_type& operator =(const value_type& value) {
53 if (value.owner) owner = value.owner;
54 if (owner != nullptr && !owner->data_->inserting && !owner->data_->erasing) owner->on_item_updated(pos, static_cast<type_t&>(const_cast<value_type&>(value)));
55 type_t::operator =(value);
56 return self_;
57 }
59 if (value.owner) owner = value.owner;
60 if (owner != nullptr && !owner->data_->inserting && !owner->data_->erasing) owner->on_item_updated(pos, static_cast<type_t&>(value));
61 type_t::operator =(value);
62 return self_;
63 }
64 operator type_t() {return self_;}
65 friend std::ostream& operator <<(std::ostream& os, const arranged_element_collection::value_type& value) {return os << static_cast<const type_t&>(value);}
67
68 private:
69 friend class arranged_element_collection;
71 arranged_element_collection* owner = nullptr;
72 };
73
75
84 using reference = type_t&;
86 using const_reference = const type_t&;
88 using pointer = value_type*;
90 using const_pointer = const value_type*;
94
96
106 inline static constexpr xtd::usize npos = xtd::npos;
107
116 static inline constexpr xtd::usize bpos = 0;
117
134 static inline constexpr xtd::usize epos = npos - 1;
136
138
160
163 arranged_element_collection(const arranged_element_collection& collection) {*data_ = *collection.data_;}
167 data_ = std::move(collection.data_);
168 collection.data_ = new_ptr<data_collection>();
169 }
170
172 arranged_element_collection(const base_type& collection) {data_->items = collection;}
175 arranged_element_collection(base_type&& collection) {data_->items = std::move(collection);}
178 arranged_element_collection(std::initializer_list<type_t> items) {add_range(items);}
183 template <std::input_iterator input_iterator_t>
184 arranged_element_collection(input_iterator_t first, input_iterator_t last) {
185 for (auto iterator = first; iterator != last; ++iterator)
186 add(*iterator);
187 }
188
189
191
196 [[nodiscard]] auto capacity() const noexcept -> size_type {return data_->items.capacity();}
201 auto capacity(size_type value) -> void {data_->items.capacity(value);}
202
205 [[nodiscard]] auto count() const noexcept -> size_type override {return data_->items.count();}
206
209 [[nodiscard]] auto data() -> pointer {return data_->items.data();}
212 [[nodiscard]] auto data() const -> const_pointer {return data_->items.data();}
213
216 [[nodiscard]] const auto& items() const {return data_->items.items();}
219 [[nodiscard]] auto& items() {return data_->items.items();}
220
223 [[nodiscard]] virtual auto sorted() const noexcept -> bool {return data_->sorted;}
226 virtual auto sorted(bool value) -> arranged_element_collection& {
227 if (data_->sorted == value) return self_;
228 data_->sorted = value;
229 if (data_->sorted) sort();
230 return self_;
231 }
232
233
235
239 auto add(const type_t& item) -> void override {
240 data_->items.add(item);
241 xtd::usize index = data_->items.count() - 1;
242 static_cast<value_type&>(self_[index]).owner = this;
243 static_cast<value_type&>(self_[index]).pos = index;
244 on_item_added(index, data_->items[index]);
245 if (data_->sorted) sort();
246 }
247
249 virtual auto add(type_t&& item) -> void {
250 data_->items.add(item);
251 xtd::usize index = data_->items.count() - 1;
252 static_cast<value_type&>(self_[index]).owner = this;
253 static_cast<value_type&>(self_[index]).pos = index;
254 on_item_added(index, data_->items[index]);
255 if (data_->sorted) sort();
256 }
257
260 virtual auto add_range(const arranged_element_collection& collection) -> void {
261 for (const auto& item : collection)
262 add(item);
263 }
264
266 virtual auto add_range(const std::vector<type_t>& collection) -> void {
267 for (const auto& item : collection)
268 add(item);
269 }
270
272 virtual auto add_range(const std::initializer_list<type_t>& collection) -> void {
273 for (const auto& item : collection)
274 add(item);
275 }
276
278 template<typename collection_t>
279 auto add_range(collection_t&& collection) -> void {
280 for (auto& item : collection)
281 add(value_type(item));
282 }
283
285 template<typename collection_t>
286 auto add_range(const collection_t& collection) -> void {
287 for (const auto& item : collection)
288 add(item);
289 }
290
293 auto clear() -> void override {
294 while (count())
295 remove_at(0);
296 }
297
301 [[nodiscard]] auto contains(const type_t& item) const noexcept -> bool override {
302 return data_->items.contains(item);
303 }
304
309 auto copy_to(xtd::array<type_t>& array, xtd::usize array_index) const -> void override {
311 auto i = size_type {0};
312 for (const type_t& item : self_) {
313 if (i >= count()) return;
314 array[array_index + i++] = item;
315 }
316 }
317
320 [[nodiscard]] auto get_enumerator() const noexcept -> xtd::collections::generic::enumerator<type_t> override {
321 struct arranged_element_collection_enumerator : public xtd::collections::generic::ienumerator<type_t> {
322 explicit arranged_element_collection_enumerator(const arranged_element_collection& items, xtd::usize version) : items_(items), version_(version) {}
323
324 const type_t& current() const override {
326 if (version_ != items_.items().version()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "Collection was modified; enumeration operation may not execute.");
327 return items_[index_];
328 }
329
330 bool move_next() override {
331 if (version_ != items_.items().version()) xtd::helpers::throw_helper::throws(xtd::helpers::exception_case::invalid_operation, "Collection was modified; enumeration operation may not execute.");
332 return ++index_ < items_.count();
333 }
334
335 void reset() override {
336 version_ = items_.items().version();
338 }
339
340 private:
342 const arranged_element_collection& items_;
343 size_type version_ = 0;
344 };
345
347 }
348
352 virtual auto insert(xtd::usize index, const type_t& value) -> void {
354 data_->inserting = true;
355 items().insert(items().begin() + index, value);
356 data_->inserting = false;
357 static_cast<value_type&>(self_[index]).owner = this;
358 static_cast<value_type&>(self_[index]).pos = index;
359 on_item_added(index, data_->items[index]);
360 if (data_->sorted) sort();
361 }
362
365 sorter_t sorter;
366 sorter(items().begin(), items().end());
367 return self_;
368 }
369
375 auto remove(const type_t& item) -> bool override {
376 if (count() == 0) return false;
377 for (auto index = size_type {0}; index < count(); ++index) {
378 if (!xtd::collections::generic::helpers::equator<type_t> {}(self_[index], item)) continue;
379 remove_at(index);
380 return true;
381 }
382 return false;
383 }
384
387 virtual auto remove_at(xtd::usize index) -> void {
389 on_item_removed(index, const_cast<value_type&>(data_->items[index]));
390 data_->erasing = true;
391 items().erase(items().begin() + index);
392 data_->erasing = false;
393 }
394
412 data_->items.reverse(index, count);
413 return self_;
414 }
415
416
419 [[nodiscard]] auto to_array() const noexcept -> xtd::array<type_t> {
420 return data_->items.count() ? xtd::array<type_t>(data_->items.begin(), data_->items.end()) : xtd::array<type_t> {};
421 }
422
423
425
435
439 clear();
440 add_range(std::move(other.data_->items));
441 return self_;
442 }
443
446 auto operator =(const std::initializer_list<type_t>& items) -> arranged_element_collection& {
447 clear();
449 return self_;
450 }
451
455 [[nodiscard]] auto operator [](size_type index) -> value_type& {
457 data_->items[index].pos = index > npos / 2 ? count() - (npos - index) : index;
458 data_->items[index].owner = this;
459 return data_->items[index];
460 }
461
464 [[nodiscard]] auto operator [](size_type index) const -> const value_type& {
466 data_->items[index].pos = index > npos / 2 ? count() - (npos - index) : index;
467 data_->items[index].owner = const_cast<arranged_element_collection*>(this);
468 return data_->items[index];
469 }
470
473 [[nodiscard]] operator const_base_type& () const noexcept {return items();}
476 [[nodiscard]] operator base_type& () noexcept {return items();}
477
478 [[nodiscard]] auto operator ==(const arranged_element_collection& value) const -> bool {return data_->items == value.data_->items;}
479 [[nodiscard]] auto operator !=(const arranged_element_collection& value) const -> bool {return !operator ==(value);}
481
483
487 event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)>> item_added;
488
491 event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)>> item_updated;
492
495 event<arranged_element_collection, delegate<void(xtd::usize, type_t& item)>> item_removed;
497
499
503 using reverse_iterator [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items::reverse_iterator - Will be removed in version 1.2.0.")]] = typename xtd::collections::generic::list<value_type>::base_type::reverse_iterator;
506 using const_reverse_iterator [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items::const_reverse_iterator - Will be removed in version 1.2.0.")]] = typename xtd::collections::generic::list<value_type>::base_type::const_reverse_iterator;
508
510
515 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().max_size - Will be removed in version 1.2.0.")]]
516 [[nodiscard]] auto max_size() const noexcept -> size_type {return data_->items.max_size();}
518
520
526 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [] - Will be removed in version 1.2.0.")]]
527 [[nodiscard]] auto at(size_type pos) -> reference {
528 data_->items[pos].pos = pos;
529 data_->items[pos].owner = this;
530 return data_->items.at(pos);
531 }
532
536 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [] - Will be removed in version 1.2.0.")]]
537 [[nodiscard]] auto at(size_type pos) const -> const_reference {return data_->items.at(pos);}
538
542 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [~1_z] - Will be removed in version 1.2.0.")]]
543 [[nodiscard]] auto back() -> reference {return data_->items.back();}
547 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [~1_z] - Will be removed in version 1.2.0.")]]
548 [[nodiscard]] auto back() const -> const_reference {return data_->items.back();}
549
553 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().crbegin - Will be removed in version 1.2.0.")]]
554 [[nodiscard]] auto crbegin() const noexcept -> const_reverse_iterator {return data_->items.crbegin();}
558 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().crend - Will be removed in version 1.2.0.")]]
559 [[nodiscard]] auto crend() const noexcept -> const_reverse_iterator {return data_->items.crend();}
560
564 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [0] - Will be removed in version 1.2.0.")]]
565 [[nodiscard]] auto front() -> reference {return data_->items.front();}
569 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::operator [0] - Will be removed in version 1.2.0.")]]
570 [[nodiscard]] auto front() const -> const_reference {return data_->items.front();}
571
575 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().get_allocator - Will be removed in version 1.2.0.")]]
576 [[nodiscard]] auto get_allocator() const noexcept {return data_->items.get_allocator();}
577
582 template<typename ...args_t>
583 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.")]]
585 auto index = pos - items().begin();
586 data_->inserting = true;
587 auto result = data_->items.insert(pos, args...);
588 data_->inserting = false;
589 self_[index].owner = this;
590 self_[index].pos = index;
591 on_item_added(index, data_->items[index]);
592 if (data_->sorted) sort();
593 return result;
594 }
595
599 template<typename ...args_t>
600 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.")]]
601 auto emplace_back(args_t&& ... args) -> void {
602 data_->items.emplace_back(args...);
603 xtd::usize index = data_->items.count() - 1;
604 self_[index].owner = this;
605 self_[index].pos = index;
606 on_item_added(index, data_->items[index]);
607 if (data_->sorted) sort();
608 }
609
613 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.")]]
615 on_item_removed(pos - items().begin(), *pos);
616 data_->erasing = true;
617 auto result = items().erase(pos);
618 data_->erasing = false;
619 return result;
620 }
621
624 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.")]]
626 on_item_removed(pos - items().begin(), const_cast<value_type&>(*pos));
627 data_->erasing = true;
628 auto result = items().erase(pos);
629 data_->erasing = false;
630 return result;
631 }
632
637 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.")]]
639 auto result = items().end();
640 auto index = first - items().begin();
641 for (auto it = first; it <= last; ++it)
642 remove_at(index++);
643 return result;
644 }
645
649 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.")]]
651 auto result = items().end();
652 auto index = first - items().begin();
653 for (auto it = first; it <= last; ++it)
654 remove_at(index++);
655 return result;
656 }
657
661 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove_at - Will be removed in version 1.2.0.")]]
662 auto erase_at(xtd::usize index) -> void {
663 remove_at(index);
664 }
665
670 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.")]]
672 auto index = pos - items().begin();
673 data_->inserting = true;
674 auto result = items().insert(pos, value);
675 data_->inserting = false;
676 self_[index].owner = this;
677 self_[index].pos = index;
678 on_item_added(index, data_->items[index]);
679 if (data_->sorted) sort();
680 return result;
681 }
682
686 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.")]]
688 auto index = pos - items().begin();
689 data_->inserting = true;
690 auto result = items().insert(pos, value);
691 data_->inserting = false;
692 self_[index].owner = this;
693 self_[index].pos = index;
694 on_item_added(index, data_->items[index]);
695 if (data_->sorted) sort();
696 return result;
697 }
698
703 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::insert - Will be removed in version 1.2.0.")]]
704 auto insert_at(xtd::usize index, const type_t& value) -> void {
705 insert(index, value);
706 }
707
710 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::remove(count() - 1) - Will be removed in version 1.2.0.")]]
711 auto pop_back() -> void {
712 if (count() != 0) remove_at(count() - 1);
713 }
714
718 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.")]]
719 auto push_back(const type_t& item) -> void {
720 add(item);
721 }
722
725 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add - Will be removed in version 1.2.0.")]]
726 auto push_back(type_t&& item) -> void {
727 add(std::move(item));
728 }
729
733 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.")]]
734 auto push_back_range(const arranged_element_collection& collection) -> void {
735 add_range(collection);
736 }
737
740 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.")]]
741 auto push_back_range(const std::vector<type_t>& collection) -> void {
742 add_range(collection);
743 }
744
747 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.")]]
748 auto push_back_range(const std::initializer_list<type_t>& collection) -> void {
749 add_range(collection);
750 }
751
754 template<typename collection_t>
755 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.")]]
756 auto push_back_range(collection_t&& collection) -> void {
757 add_range(collection);
758 }
759
762 template<typename iterator_t>
763 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::add_range - Will be removed in version 1.2.0.")]]
764 auto push_back_range(iterator_t begin, iterator_t end) -> void {
766 }
767
771 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::to_array - Will be removed in version 1.2.0.")]]
772 [[nodiscard]] auto to_vector() const noexcept -> std::vector<type_t> {return to_array();}
773
777 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().rbegin - Will be removed in version 1.2.0.")]]
778 [[nodiscard]] auto rbegin() noexcept {return data_->items.rbegin();}
782 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().rbegin - Will be removed in version 1.2.0.")]]
783 [[nodiscard]] auto rbegin() const noexcept {return data_->items.rbegin();}
784
788 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().rend - Will be removed in version 1.2.0.")]]
789 [[nodiscard]] auto rend() noexcept {return data_->items.rend();}
793 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().rend - Will be removed in version 1.2.0.")]]
794 [[nodiscard]] auto rend() const noexcept {return data_->items.rend();}
795
798 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().reserve - Will be removed in version 1.2.0.")]]
799 auto reserve(size_type size) -> void {data_->items.reserve(size);}
800
803 [[deprecated("Replaced by xtd::forms::layout::arranged_element_collection::items().shrink_to_fit - Will be removed in version 1.2.0.")]]
804 auto shrink_to_fit() -> void {data_->items.shrink_to_fit();}
806
807 protected:
809
814 virtual auto on_item_added(xtd::usize index, type_t& item) -> void {item_added(index, item);}
815
819 virtual auto on_item_updated(xtd::usize index, type_t& item) -> void {item_updated(index, item);}
820
824 virtual auto on_item_removed(xtd::usize index, type_t& item) -> void {item_removed(index, item);}
826
827 private:
828 [[nodiscard]] auto is_read_only() const noexcept -> bool override {return false;}
829 [[nodiscard]] auto is_synchronized() const noexcept -> bool override {return false;}
830 [[nodiscard]] auto sync_root() const noexcept -> const xtd::object& override {return data_->sync_root;}
831
832 struct data_collection {
833 mutable xtd::collections::generic::list < value_type > items;
834 bool inserting = false;
835 bool erasing = false;
836 bool sorted = false;
837 xtd::object sync_root;
838 };
840 };
841 }
842 }
843}
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Definition array.hpp:64
virtual auto items() const noexcept -> const base_type &
Returns the underlying base type items.
Definition basic_array.hpp:111
virtual auto length() const noexcept -> size_type
Gets a size that represents the total number of elements in all the dimensions of the array.
Definition basic_array.hpp:122
static constexpr xtd::usize max_value
Definition box_integer.hpp:71
Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
Definition ienumerable.hpp:40
Supports a simple iteration over a generic collection.
Definition ienumerator.hpp:58
Represents a strongly typed list of objects that can be accessed by index. Provides methods to search...
Definition list.hpp:80
auto insert(size_type index, const type_t &value) -> void override
Determines the index of a specific item in the xtd::collections::generic::list <type_t>.
Definition list.hpp:697
typename xtd::collections::generic::helpers::raw_array< value_type >::base_type base_type
Represents the list base type.
Definition list.hpp:88
Provides the base class for a generic read-only collection.
Definition read_only_collection.hpp:39
Represents the value type of the collection.
Definition arranged_element_collection.hpp:44
Represents a collection of objects.
Definition arranged_element_collection.hpp:41
auto clear() -> void override
Removes all items from the xtd::forms::layout::arranged_element_collection <type_t>.
Definition arranged_element_collection.hpp:293
auto remove(const type_t &item) -> bool override
Removes the first occurrence of a specific object from the xtd::forms::layout::arranged_element_colle...
Definition arranged_element_collection.hpp:375
auto & items()
Returns the underlying base type items.
Definition arranged_element_collection.hpp:219
const auto & items() const
Definition arranged_element_collection.hpp:216
virtual auto remove_at(xtd::usize index) -> void
Erases element at specified index.
Definition arranged_element_collection.hpp:387
auto crbegin() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:554
arranged_element_collection(std::initializer_list< type_t > items)
Constructs the container with the contents of the specified initializer list, and allocator.
Definition arranged_element_collection.hpp:178
virtual auto sort() -> arranged_element_collection &
Sorts the content.
Definition arranged_element_collection.hpp:364
typename xtd::collections::generic::list< value_type >::base_type::reverse_iterator reverse_iterator
arranged_element_collection(const base_type &collection)
Copy constructor with specified base type list.
Definition arranged_element_collection.hpp:172
xtd::string & reference
Definition arranged_element_collection.hpp:84
auto shrink_to_fit() -> void
Reduces memory usage by freeing unused memory.
Definition arranged_element_collection.hpp:804
auto back() const -> const_reference
Access the last element.
Definition arranged_element_collection.hpp:548
auto rend() noexcept
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:789
auto push_back_range(const std::initializer_list< type_t > &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:748
arranged_element_collection(const arranged_element_collection &collection)
Default copy constructor with specified list.
Definition arranged_element_collection.hpp:163
auto push_back_range(iterator_t begin, iterator_t end) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:764
arranged_element_collection(base_type &&collection)
Move constructor with specified base type list.
Definition arranged_element_collection.hpp:175
auto get_allocator() const noexcept
Returns the associated allocator.
Definition arranged_element_collection.hpp:576
virtual auto on_item_removed(xtd::usize index, type_t &item) -> void
Raises the xtd::forms::layout::arranged_element_collection::item_removed event.
Definition arranged_element_collection.hpp:824
auto get_enumerator() const noexcept -> xtd::collections::generic::enumerator< type_t > override
Returns an enumerator that iterates through the xtd::forms::layout::arranged_element_collection <type...
Definition arranged_element_collection.hpp:320
auto data() -> pointer
Direct access to the underlying array.
Definition arranged_element_collection.hpp:209
auto crend() const noexcept -> const_reverse_iterator
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:559
auto pop_back() -> void
Removes the last element of the container.
Definition arranged_element_collection.hpp:711
arranged_element_collection(input_iterator_t first, input_iterator_t last)
Constructs the container with the contents of the range [first, last).
Definition arranged_element_collection.hpp:184
auto operator=(const arranged_element_collection &other) -> arranged_element_collection &
Copy assignment operator. Replaces the contents with a copy of the contents of other.
Definition arranged_element_collection.hpp:430
auto add(const type_t &item) -> void override
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
Definition arranged_element_collection.hpp:239
auto push_back(const type_t &item) -> void
Adds an element to the end.
Definition arranged_element_collection.hpp:719
auto insert(xtd::collections::generic::list< value_type >::const_iterator pos, type_t &&value)
Inserts specified element at specified position.
Definition arranged_element_collection.hpp:687
auto to_array() const noexcept -> xtd::array< type_t >
Gets an array with the elements of the container.
Definition arranged_element_collection.hpp:419
auto at(size_type pos) -> reference
Access specified element with bounds checking.
Definition arranged_element_collection.hpp:527
auto emplace(xtd::collections::generic::list< value_type >::const_iterator pos, args_t &&... args) -> void
Inserts specified element at specified position.
Definition arranged_element_collection.hpp:584
const xtd::string & const_reference
Definition arranged_element_collection.hpp:86
auto erase(xtd::collections::generic::list< value_type >::const_iterator pos)
Erases element at specified position.
Definition arranged_element_collection.hpp:625
auto capacity(size_type value) -> void
Sets the total number of elements the internal data structure can hold without resizing.
Definition arranged_element_collection.hpp:201
auto rbegin() noexcept
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:778
static constexpr xtd::usize bpos
Definition arranged_element_collection.hpp:116
auto front() -> reference
Access the first element.
Definition arranged_element_collection.hpp:565
auto copy_to(xtd::array< type_t > &array, xtd::usize array_index) const -> void override
Copies the elements of the xtd::forms::layout::arranged_element_collection <type_t> to an xtd::array,...
Definition arranged_element_collection.hpp:309
xtd::usize size_type
Definition arranged_element_collection.hpp:82
auto push_back_range(const std::vector< type_t > &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:741
auto push_back_range(collection_t &&collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:756
arranged_element_collection()=default
Initializes a new instance of the xtd::forms::layout::arranged_element_collection class that is empty...
virtual auto add_range(const std::initializer_list< type_t > &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:272
auto front() const -> const_reference
Access the first element.
Definition arranged_element_collection.hpp:570
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.
Definition arranged_element_collection.hpp:650
auto reverse() -> arranged_element_collection &
Reverses the order of the elements in the entire xtd::collections::generic::list <type_t>.
Definition arranged_element_collection.hpp:401
virtual auto add(type_t &&item) -> void
Adds an item to the xtd::forms::layout::arranged_element_collection <type_t>.
Definition arranged_element_collection.hpp:249
static constexpr xtd::usize npos
Definition arranged_element_collection.hpp:106
virtual auto sorted(bool value) -> arranged_element_collection &
Sets the container is sorted.
Definition arranged_element_collection.hpp:226
auto add_range(const collection_t &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:286
auto rbegin() const noexcept
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:783
auto at(size_type pos) const -> const_reference
Access specified element with bounds checking.
Definition arranged_element_collection.hpp:537
auto push_back_range(const arranged_element_collection &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:734
auto rend() const noexcept
Returns a reverse iterator to the end.
Definition arranged_element_collection.hpp:794
auto contains(const type_t &item) const noexcept -> bool override
Determines whether the xtd::forms::layout::arranged_element_collection <type_t> contains a specific v...
Definition arranged_element_collection.hpp:301
auto push_back(type_t &&item) -> void
Adds an element to the end.
Definition arranged_element_collection.hpp:726
auto reverse(size_type index, size_type count) -> arranged_element_collection &
Reverses the order of the elements in the specified range.
Definition arranged_element_collection.hpp:411
auto operator[](size_type index) -> value_type &
Access specified element.
Definition arranged_element_collection.hpp:455
event< arranged_element_collection, delegate< void(xtd::usize, xtd::string &item)> > item_updated
Definition arranged_element_collection.hpp:491
virtual auto add_range(const std::vector< type_t > &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:266
auto insert(xtd::collections::generic::list< value_type >::const_iterator pos, const type_t &value)
Inserts specified element at specified position.
Definition arranged_element_collection.hpp:671
auto insert_at(xtd::usize index, const type_t &value) -> void
Inserts specified element at specified index.
Definition arranged_element_collection.hpp:704
const base_type const_base_type
Definition arranged_element_collection.hpp:80
static constexpr xtd::usize epos
Definition arranged_element_collection.hpp:134
arranged_element_collection(size_type capacity)
Constructs the container with specified count default-inserted instances of type_t....
Definition arranged_element_collection.hpp:151
auto erase(xtd::collections::generic::list< value_type >::iterator first, xtd::collections::generic::list< value_type >::iterator last)
Erases elements at specified range.
Definition arranged_element_collection.hpp:638
arranged_element_collection(arranged_element_collection &&collection)
Move constructor with specified list.
Definition arranged_element_collection.hpp:166
value_type * pointer
Definition arranged_element_collection.hpp:88
auto emplace_back(args_t &&... args) -> void
Adds an element to the end.
Definition arranged_element_collection.hpp:601
const value_type * const_pointer
Definition arranged_element_collection.hpp:90
auto erase_at(xtd::usize index) -> void
Erases element at specified index.
Definition arranged_element_collection.hpp:662
xtd::collections::object_model::read_only_collection< value_type > read_only_collection
Definition arranged_element_collection.hpp:92
virtual auto on_item_added(xtd::usize index, type_t &item) -> void
Raises the xtd::forms::layout::arranged_element_collection::item_added event.
Definition arranged_element_collection.hpp:814
typename xtd::collections::generic::list< value_type >::base_type::const_reverse_iterator const_reverse_iterator
auto count() const noexcept -> size_type override
Gets the number of elements contained in the xtd::forms::layout::arranged_element_collection <type_t>...
Definition arranged_element_collection.hpp:205
virtual auto insert(xtd::usize index, const type_t &value) -> void
Inserts specified element at specified index.
Definition arranged_element_collection.hpp:352
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...
Definition arranged_element_collection.hpp:159
virtual auto add_range(const arranged_element_collection &collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:260
event< arranged_element_collection, delegate< void(xtd::usize, xtd::string &item)> > item_removed
Definition arranged_element_collection.hpp:495
event< arranged_element_collection, delegate< void(xtd::usize, xtd::string &item)> > item_added
Definition arranged_element_collection.hpp:487
auto capacity() const noexcept -> size_type
Definition arranged_element_collection.hpp:196
auto reserve(size_type size) -> void
Reserves storage.
Definition arranged_element_collection.hpp:799
virtual auto on_item_updated(xtd::usize index, type_t &item) -> void
Raises the xtd::forms::layout::arranged_element_collection::item_updated event.
Definition arranged_element_collection.hpp:819
auto back() -> reference
Access the last element.
Definition arranged_element_collection.hpp:543
typename xtd::collections::generic::list< value_type >::base_type base_type
Definition arranged_element_collection.hpp:78
auto to_vector() const noexcept -> std::vector< type_t >
Gets an array with the elements of the container.
Definition arranged_element_collection.hpp:772
auto data() const -> const_pointer
Direct access to the underlying array.
Definition arranged_element_collection.hpp:212
auto max_size() const noexcept -> size_type
Returns the maximum possible number of elements.
Definition arranged_element_collection.hpp:516
virtual auto sorted() const noexcept -> bool
Checks whether the container is sorted.
Definition arranged_element_collection.hpp:223
auto add_range(collection_t &&collection) -> void
Adds elements to the end.
Definition arranged_element_collection.hpp:279
auto erase(xtd::collections::generic::list< value_type >::iterator pos)
Erases element at specified position.
Definition arranged_element_collection.hpp:614
static auto throws(xtd::helpers::exception_case exception_case, const source_location &location=source_location::current()) -> void
Throws an exption with specified exception case.
Supports all classes in the xtd class hierarchy and provides low-level services to derived classes....
Definition object.hpp:45
object()=default
Create a new instance of the ultimate base class object.
Represents the version number of an assembly, operating system, or the xtd. This class cannot be inhe...
Definition version.hpp:115
@ index_out_of_range
The index is out of range.
Definition exception_case.hpp:61
@ argument_out_of_range
The argument is out of range.
Definition exception_case.hpp:35
@ invalid_operation
The operation is not valid.
Definition exception_case.hpp:65
#define self_
The self_ expression is a reference value expression whose value is the reference of the implicit obj...
Definition self.hpp:20
constexpr auto npos
Represents a value that is not a valid position in a collection.
Definition npos.hpp:26
xtd::sptr< type_t > ptr
The xtd::ptr object is a shared pointer.
Definition ptr.hpp:27
std::size_t usize
Represents an unsigned size of any object in bytes.
Definition usize.hpp:22
auto new_ptr(args_t &&... args) -> xtd::ptr< type_t >
The xtd::new_ptr operator creates a xtd::ptr object.
Definition new_ptr.hpp:24
@ other
The operating system is other.
Definition platform_id.hpp:60
@ end
The END key.
Definition keys.hpp:151
@ i
The I key.
Definition keys.hpp:215
The xtd::collections namespace contains interfaces and classes that define various collections of obj...
Definition any_pair.hpp:10
The xtd::forms::layout namespace contains classes for implementing layout behaviors in your form or c...
Definition arranged_element_collection.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:219
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8
const xtd::collections::generic::helpers::wrap_pointer_iterator< pointer > iterator
Represents the iterator of read_only_span value type.
Definition read_only_span.hpp:71
auto first() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the first count elements of the sequence.
Definition read_only_span.hpp:249
auto begin() const -> const_iterator
Returns an iterator to the beginning.
Definition read_only_span.hpp:186
auto last() const -> read_only_span< type_t, count >
Obtains a subspan consisting of the last N elements of the sequence.
Definition read_only_span.hpp:274
auto end() const -> const_iterator
Returns an iterator to the end.
Definition read_only_span.hpp:205
constexpr auto size() const noexcept -> size_type
Returns the number of elements.
Definition read_only_span.hpp:217
std::add_cv_t< type_t > value_type
Represents the read_only_span value type.
Definition read_only_span.hpp:57
Contains xtd::forms::layout::sorter_none class.
Implements a function object for performing comparisons. Unless specialised, invokes operator== on ty...
Definition equator.hpp:39
Contains xtd::helpers::throw_helper class.