2#ifndef _aspose_system_collections_object_model_collection_h
3#define _aspose_system_collections_object_model_collection_h
7#include <system/string.h>
8#include <system/collections/list.h>
10namespace System {
namespace Collections {
namespace ObjectModel {
30 throw ArgumentNullException(u
"list");
51 return items->get_Count();
56 virtual T
idx_get(
int index)
const override
58 if (index < 0 || index >= get_Count())
60 throw ArgumentOutOfRangeException(u
"index");
63 return items->idx_get(index);
68 virtual void idx_set(
int index, T value)
override
70 if (index < 0 || index >= get_Count())
72 throw ArgumentOutOfRangeException(u
"index");
74 items->idx_set(index, value);
81 if (index < 0 || index >= get_Count())
83 throw ArgumentOutOfRangeException(u
"index");
86 return items->idx_get(index);
93 if (index < 0 || index >= get_Count())
95 throw ArgumentOutOfRangeException(u
"index");
97 return items->idx_get(index);
102 virtual void Add(
const T& item)
override
104 int index = get_Count();
105 InsertItem(index, item);
117 return items->Contains(item);
123 return items->GetEnumerator();
130 return items->IndexOf(item);
135 void Insert(
int index,
const T& item)
override
137 if (index < 0 || index > get_Count())
139 throw ArgumentOutOfRangeException(u
"index");
142 InsertItem(index, item);
149 int index = items->IndexOf(item);
162 if (index < 0 || index >= get_Count())
164 throw ArgumentOutOfRangeException(u
"index");
175 items->CopyTo(arr, index);
182 items->SetTemplateWeakPtr(argument);
186 template <
typename U>
201 , m_size(list->get_Count())
206 return m_list->idx_get(m_index);
219 if (m_index < m_size) {
226 return m_index != it.m_index;
230 return m_index == it.m_index;
261 return items->virtualizeBeginIterator();
266 return items->virtualizeEndIterator();
271 return items->virtualizeBeginConstIterator();
276 return items->virtualizeEndConstIterator();
293 items->Insert(index, item);
299 items->RemoveAt(index);
304 virtual void SetItem(
int index,
const T& item)
306 items->idx_set(index, item);
Interface of indexed container of elements. Objects of this class should only be allocated using Syst...
Definition: ilist.h:19
List pointer with access operators. This type is a pointer to manage other object's deletion....
Definition: list.h:38
Iterates elements of the sequence container in the reverse order.
Definition: collection.h:188
bool operator==(const reverse_iterator_prototype &it) const
Definition: collection.h:229
bool operator!=(const reverse_iterator_prototype &it) const
Definition: collection.h:225
reverse_iterator_prototype & operator++()
Definition: collection.h:209
reverse_iterator_prototype & operator--()
Definition: collection.h:217
const U operator*() const
Definition: collection.h:205
reverse_iterator_prototype(const SharedPtr< Generic::IList< U > > &list)
Definition: collection.h:199
reverse_iterator_prototype()
Definition: collection.h:195
Base type for generic collection. Objects of this class should only be allocated using System::MakeOb...
Definition: collection.h:19
bool Remove(const T &item) override
Removes specific item.
Definition: collection.h:147
virtual void RemoveItem(int index)
Removes item from specified position.
Definition: collection.h:297
int IndexOf(const T &item) const override
Looks for element in collection.
Definition: collection.h:128
const_reverse_iterator rbegin() const noexcept
Gets a reverse iterator to the last element of the const-qualified collection (first in reverse).
Definition: collection.h:246
void SetTemplateWeakPtr(uint32_t argument) override
Makes stored pointers weak (if applicable).
Definition: collection.h:180
const_reverse_iterator crend() const noexcept
Gets a reverse iterator for a non-existent const-qualified element before the start of the collection...
Definition: collection.h:256
virtual T idx_get(int index) const override
Gets value at specified index.
Definition: collection.h:56
virtual void InsertItem(int index, const T &item)
Inserts item into specified position.
Definition: collection.h:291
bool Contains(const T &item) const override
Checks if item is present in collection.
Definition: collection.h:115
const Generic::ListPtr< T > get_Items() const
Internal data structure accessor.
Definition: collection.h:42
const_reverse_iterator rend() const noexcept
Gets a reverse iterator for a non-existent element before the start of the const-qualified collection...
Definition: collection.h:249
virtual void idx_set(int index, T value) override
Sets value at specified index.
Definition: collection.h:68
T & operator[](int index)
Gets value at specified index.
Definition: collection.h:79
void RemoveAt(int index) override
Removes item at specific position.
Definition: collection.h:160
virtual void CopyTo(ArrayPtr< T > arr, int index) override
Copies collection elements into existing array elements.
Definition: collection.h:173
reverse_iterator rend() noexcept
Gets a reverse iterator for a non-existent element before the start of the collection.
Definition: collection.h:242
reverse_iterator_prototype< T > reverse_iterator
Definition: collection.h:234
reverse_iterator_prototype< T > const_reverse_iterator
Definition: collection.h:235
System::Details::VirtualizedIteratorBase< T > * virtualizeEndConstIterator() const override
Gets the implementation of end const iterator for the current container.
Definition: collection.h:274
virtual void SetItem(int index, const T &item)
Sets item at specified position.
Definition: collection.h:304
~Collection() override
Destructor.
Definition: collection.h:281
System::Details::VirtualizedIteratorBase< T > * virtualizeBeginConstIterator() const override
Gets the implementation of begin const iterator for the current container.
Definition: collection.h:269
SharedPtr< Generic::IList< T > > get_Items()
Internal data structure accessor.
Definition: collection.h:36
System::Details::VirtualizedIteratorBase< T > * virtualizeEndIterator() override
Gets the implementation of end iterator for the current container.
Definition: collection.h:264
virtual void ClearItems()
Deletes all items.
Definition: collection.h:284
System::Details::VirtualizedIteratorBase< T > * virtualizeBeginIterator() override
Gets the implementation of begin iterator for the current container.
Definition: collection.h:259
void Clear() override
Deletes all elements.
Definition: collection.h:108
Collection()
Creates empty collection.
Definition: collection.h:24
const T & operator[](int index) const
Gets value at specified index.
Definition: collection.h:91
reverse_iterator rbegin() noexcept
Gets a reverse iterator to the last element of collection (first in reverse).
Definition: collection.h:239
SharedPtr< Generic::IEnumerator< T > > GetEnumerator() override
Gets enumerator to iterate through collection.
Definition: collection.h:121
int get_Count() const override
Gets number of elements.
Definition: collection.h:49
virtual void Add(const T &item) override
Adds value to container.
Definition: collection.h:102
Collection(SharedPtr< Generic::IList< T > > list)
Definition: collection.h:27
void Insert(int index, const T &item) override
Inserts item into specified position.
Definition: collection.h:135
const_reverse_iterator crbegin() const noexcept
Gets a reverse iterator to the last const-qualified element of collection (first in reverse).
Definition: collection.h:253
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
Definition: db_command.h:9
std::enable_if<!IsSmartPtr< T >::value, SmartPtr< T > >::type MakeObject(Args &&... args)
Creates object on heap and returns shared pointer to it.
Definition: smart_ptr.h:1506