7#include <system/collections/ienumerator.h>
8#include <system/collections/virtualized_iterator.h>
9#include <system/func.h>
10#include <system/linq/igrouping.h>
16namespace System {
namespace Collections {
namespace Generic {
18template<
typename T>
class ASPOSECPP_SHARED_CLASS
List;
51 T LINQ_ElementAt(
int index);
56 T LINQ_ElementAtOrDefault(
int index);
71 T LINQ_FirstOrDefault();
78 T LINQ_FirstOrDefault(std::function<
bool(T)> predicate);
87 T LINQ_LastOrDefault();
110 bool LINQ_All(std::function<
bool(T)> predicate);
119 bool LINQ_Any(std::function<
bool(T)> predicate);
129 bool LINQ_Contains(T value);
135 template <
typename ResultType>
141 template <
typename Key>
147 template <
typename Key>
153 template <
typename ResultType>
160 template <
typename ResultType>
167 template <
typename ResultType>
183 template <
typename Key>
191 template <
typename ResultType>
203 template <
typename ResultType>
210 template <
typename ResultType>
214 using iterator = System::Details::VirtualizedIterator<T>;
224 return iterator(virtualizeBeginIterator());
232 return iterator(virtualizeEndIterator());
271 return GetEnumeratorAsVirtualizedIterator();
277 return new System::Details::EnumeratorBasedEndIterator<T>();
283 return GetEnumeratorAsVirtualizedIterator();
289 return new System::Details::EnumeratorBasedEndIterator<T>();
302 auto enumerator = GetEnumerator();
303 if (enumerator->SharedCount() != 1)
305 enumerator->InitializeIterator();
308 iterator = enumerator->AsVirtualizedIterator();
310 iterator->MarkOwnedByVirtualizedIterator();
317 return const_cast<IEnumerable<T>*
>(
this)->GetEnumeratorAsVirtualizedIterator();
Definition: ienumerable.h:19
Iterator that wraps the pre-created enumerator and redirects all calls into it.
Definition: ienumerator.h:164
Interface of object providing enumerator on contained elements.
Definition: ienumerable.h:25
iterator end()
Gets iterator pointing right after the last element (if any) of the collection. This iterator can't b...
Definition: ienumerable.h:230
SharedPtr< IEnumerable< ResultType > > LINQ_Select(const Func< T, ResultType > &selector)
Transforms elements of a sequence.
virtualized_iterator * GetEnumeratorAsVirtualizedIterator() const
Gets enumerator instance and prepares it to be used as iterator kernel.
Definition: ienumerable.h:315
T virtualized_iterator_element
Inner iterator element type.
Definition: ienumerable.h:265
virtual virtualized_iterator * virtualizeBeginConstIterator() const
Gets the implementation of begin const iterator for the current container.
Definition: ienumerable.h:281
ResultType LINQ_Min(const Func< T, ResultType > &selector)
Invokes a transform function on each element of a generic sequence and returns the minimum resulting ...
System::Details::VirtualizedConstIterator< T > const_iterator
Const iterator type.
Definition: ienumerable.h:216
SharedPtr< IEnumerable< ResultType > > LINQ_Select(const Func< T, int32_t, ResultType > &selector)
Transforms each element of a sequence into a new form by incorporating the element's index.
IEnumerator< T > IEnumeratorType
Enumerator type.
Definition: ienumerable.h:31
System::Details::VirtualizedIteratorBase< T > virtualized_iterator
Inner iterator base type.
Definition: ienumerable.h:263
const_iterator cend() const
Gets iterator pointing right after the last const-qualified element (if any) of the collection.
Definition: ienumerable.h:257
const_iterator begin() const
Gets iterator pointing to the first element (if any) of the const-qualified instance of the collectio...
Definition: ienumerable.h:237
virtual virtualized_iterator * virtualizeBeginIterator()
Gets the implementation of begin iterator for the current container.
Definition: ienumerable.h:269
const_iterator end() const
Gets iterator pointing right after the last element (if any) of the const-qualified instance of the c...
Definition: ienumerable.h:244
SharedPtr< IEnumerable< ResultType > > LINQ_OfType()
Filters the elements of the sequence based on the specified type.
~IEnumerable() override
Destructor.
Definition: ienumerable.h:294
System::Details::VirtualizedIterator< T > iterator
Iterator type.
Definition: ienumerable.h:214
SharedPtr< Linq::IOrderedEnumerable< T > > LINQ_OrderBy(const Func< T, Key > &keySelector)
Sorts the elements of a sequence in ascending order according to the key values selected by keySelect...
SharedPtr< IEnumerable< ResultType > > LINQ_Cast()
Casts the elements to the specified type.
virtual virtualized_iterator * virtualizeEndIterator()
Gets the implementation of end iterator for the current container.
Definition: ienumerable.h:275
iterator begin()
Gets iterator pointing to the first element (if any) of the collection. This iterator can't be used t...
Definition: ienumerable.h:222
SharedPtr< IEnumerable< ResultType > > LINQ_SelectMany(const Func< T, SharedPtr< IEnumerable< ResultType > > > &selector)
Projects each element of a sequence and combines the resulting sequences into one sequence.
ResultType LINQ_Max(const Func< T, ResultType > &selector)
Invokes a transform function on each element of a generic sequence and returns the maximum resulting ...
virtual virtualized_iterator * virtualizeEndConstIterator() const
Gets the implementation of end const iterator for the current container.
Definition: ienumerable.h:287
const_iterator cbegin() const
Gets iterator pointing to the first const-qualified element (if any) of the collection.
Definition: ienumerable.h:251
virtual SharedPtr< IEnumerator< T > > GetEnumerator()=0
Gets enumerator.
SharedPtr< Linq::IOrderedEnumerable< T > > LINQ_OrderByDescending(const Func< T, Key > &keySelector)
Sorts the elements of a sequence in descending order according to the key values selected by keySelec...
virtualized_iterator * GetEnumeratorAsVirtualizedIterator()
Gets enumerator instance and prepares it to be used as iterator kernel.
Definition: ienumerable.h:298
System::SharedPtr< IEnumerable< System::SharedPtr< System::Linq::IGrouping< Key, T > > > > LINQ_GroupBy(System::Func< T, Key > keyPredicate)
Groups the elements of a sequence.
T ValueType
Definition: ienumerable.h:33
Interface of enumerator which can be used to iterate through some elements. Objects of this class sho...
Definition: ienumerator.h:63
List forward declaration.
Definition: list.h:127
Function delegate. This type should be allocated on stack and passed to functions by value or by refe...
Definition: func.h:82
Represents a sorted sequence.
Definition: iordered_enumerable.h:15
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
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