System::Collections::Generic::LinkedList< T > Class Template Reference

LinkedList forward declaration. More...

Inherits System::Object, and System::Collections::Generic::ICollection< T >.

Public Member Functions

 LinkedList ()
 Creates empty LinkedList. More...
 
 LinkedList (const SharedPtr< IEnumerable< T >> &collection)
 
SharedPtr< IEnumerator< T > > GetEnumerator () override
 
virtual int get_Count () const override
 
SharedPtr< LinkedListNode< T > > get_First ()
 
SharedPtr< LinkedListNode< T > > get_Last ()
 
virtual void Add (const T &item) override
 
virtual void Clear () override
 Deletes all elements in list. More...
 
virtual bool Contains (const T &item) const override
 
virtual bool Remove (const T &item) override
 
void Remove (const SharedPtr< LinkedListNode< T >> &item)
 
void RemoveFirst ()
 Removes first node from list. More...
 
void RemoveLast ()
 Removes last node from list. More...
 
void AddAfter (const SharedPtr< LinkedListNode< T >> &node, const SharedPtr< LinkedListNode< T >> &newNode)
 
SharedPtr< LinkedListNode< T > > AddAfter (const SharedPtr< LinkedListNode< T >> &node, const T &item)
 
void AddBefore (const SharedPtr< LinkedListNode< T >> &node, const SharedPtr< LinkedListNode< T >> &newNode)
 
SharedPtr< LinkedListNode< T > > AddBefore (const SharedPtr< LinkedListNode< T >> &node, const T &item)
 
void AddFirst (const SharedPtr< LinkedListNode< T >> &item)
 
SharedPtr< LinkedListNode< T > > AddFirst (const T &item)
 
void AddLast (const SharedPtr< LinkedListNode< T >> &item)
 
SharedPtr< LinkedListNode< T > > AddLast (const T &item)
 
virtual void CopyTo (ArrayPtr< T > arr, int index) override
 
void SetTemplateWeakPtr (unsigned int argument) override
 Makes list treat stored pointers as weak (not implemented). More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared refernce counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API bool Equals (ptr obj)
 Compares objects using C# Object.Equals semantics. More...
 
virtual ASPOSECPP_SHARED_API int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 
- Public Member Functions inherited from System::Collections::Generic::ICollection< T >
virtual bool get_IsReadOnly () const
 
ICollectionoperator= (ICollection &&)
 
ICollectionoperator= (const ICollection &)
 
 ICollection ()
 Default constructor. More...
 
 ICollection (const ICollection &)
 Copy constructor. More...
 
 ICollection (ICollection &&)
 Move constructor. More...
 
virtual ~ICollection ()
 Destructor. More...
 
- Public Member Functions inherited from System::Collections::Generic::IEnumerable< T >
LINQ_ElementAt (int index)
 
LINQ_First ()
 
LINQ_FirstOrDefault ()
 
LINQ_FirstOrDefault (std::function< bool(T)> predicate)
 
LINQ_Last ()
 
LINQ_LastOrDefault ()
 
SharedPtr< List< T > > LINQ_ToList ()
 
int LINQ_Count ()
 
System::ArrayPtr< T > LINQ_ToArray ()
 
bool LINQ_All (std::function< bool(T)> predicate)
 
bool LINQ_Any ()
 
bool LINQ_Any (std::function< bool(T)> predicate)
 
SharedPtr< IEnumerable< T > > LINQ_Where (std::function< bool(T)> predicate)
 
bool LINQ_Contains (T value)
 
template<typename ResultType >
SharedPtr< IEnumerable< ResultType > > LINQ_Cast ()
 
template<typename ResultType >
SharedPtr< IEnumerable< ResultType > > LINQ_OfType ()
 
template<typename ResultType >
SharedPtr< IEnumerable< ResultType > > LINQ_Select (const Func< T, ResultType > &selector)
 
template<typename Result >
SharedPtr< IEnumerable< Result > > LINQ_Cast ()
 
template<typename Result >
SharedPtr< IEnumerable< Result > > LINQ_OfType ()
 
template<typename Result >
SharedPtr< IEnumerable< Result > > LINQ_Select (const Func< Source, Result > &selector)
 

Protected Member Functions

 ~LinkedList () override
 Destructor. More...
 
- Protected Member Functions inherited from System::Collections::Generic::IEnumerable< T >
 ~IEnumerable () override
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. More...
 
- Public Types inherited from System::Collections::Generic::ICollection< T >
typedef T ValueType
 Value type name. More...
 
typedef ICollection< T > ThisType
 Collection type name. More...
 
- Public Types inherited from System::Collections::Generic::IEnumerable< T >
typedef IEnumerator< T > IEnumeratorType
 Enumerator type. More...
 
using ValueType = T
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Impleemnts C# typeof(System.Object) construct. More...
 

Detailed Description

template<typename T>
class System::Collections::Generic::LinkedList< T >

LinkedList forward declaration.

Linked list container. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

Template Parameters
TContained value type.

Constructor & Destructor Documentation

◆ LinkedList() [1/2]

template<typename T >
System::Collections::Generic::LinkedList< T >::LinkedList ( )
inline

Creates empty LinkedList.

◆ LinkedList() [2/2]

template<typename T >
System::Collections::Generic::LinkedList< T >::LinkedList ( const SharedPtr< IEnumerable< T >> &  collection)
inline

Copy constructor.

Parameters
collectionCollection to copy data from.

◆ ~LinkedList()

template<typename T >
System::Collections::Generic::LinkedList< T >::~LinkedList ( )
inlineoverrideprotected

Destructor.

Member Function Documentation

◆ Add()

template<typename T >
virtual void System::Collections::Generic::LinkedList< T >::Add ( const T &  item)
inlineoverridevirtual

Adds item into LinkedList end.

Parameters
itemItem to add into list.

Implements System::Collections::Generic::ICollection< T >.

◆ AddAfter() [1/2]

template<typename T >
void System::Collections::Generic::LinkedList< T >::AddAfter ( const SharedPtr< LinkedListNode< T >> &  node,
const SharedPtr< LinkedListNode< T >> &  newNode 
)
inline

Adds node after another one (not implemented).

Parameters
nodenode after which to insert
newNodenew node to add

◆ AddAfter() [2/2]

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::AddAfter ( const SharedPtr< LinkedListNode< T >> &  node,
const T &  item 
)
inline

Adds item after one (not implemented).

Parameters
nodenode after which to insert
itemItem to add

◆ AddBefore() [1/2]

template<typename T >
void System::Collections::Generic::LinkedList< T >::AddBefore ( const SharedPtr< LinkedListNode< T >> &  node,
const SharedPtr< LinkedListNode< T >> &  newNode 
)
inline

Adds node before another one (not implemented).

Parameters
nodenode before which to insert
newNodenew node to add

◆ AddBefore() [2/2]

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::AddBefore ( const SharedPtr< LinkedListNode< T >> &  node,
const T &  item 
)
inline

Adds item before one (not implemented).

Parameters
nodenode before which to insert
itemItem to add

◆ AddFirst() [1/2]

template<typename T >
void System::Collections::Generic::LinkedList< T >::AddFirst ( const SharedPtr< LinkedListNode< T >> &  item)
inline

Adds node to the beginning of list.

Parameters
itemItem to add.

◆ AddFirst() [2/2]

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::AddFirst ( const T &  item)
inline

Adds item to the beginning of list.

Parameters
itemItem to add.

◆ AddLast() [1/2]

template<typename T >
void System::Collections::Generic::LinkedList< T >::AddLast ( const SharedPtr< LinkedListNode< T >> &  item)
inline

Adds node to the beginning of list.

Parameters
itemItem to add.

◆ AddLast() [2/2]

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::AddLast ( const T &  item)
inline

Adds item to the beginning of list.

Parameters
itemItem to add.

◆ Clear()

template<typename T >
virtual void System::Collections::Generic::LinkedList< T >::Clear ( )
inlineoverridevirtual

Deletes all elements in list.

Implements System::Collections::Generic::ICollection< T >.

◆ Contains()

template<typename T >
virtual bool System::Collections::Generic::LinkedList< T >::Contains ( const T &  item) const
inlineoverridevirtual

Checks if element is present in list.

Parameters
itemItem to look for.
Returns
True if item is found, false otherwise.

Implements System::Collections::Generic::ICollection< T >.

◆ CopyTo()

template<typename T >
virtual void System::Collections::Generic::LinkedList< T >::CopyTo ( ArrayPtr< T >  arr,
int  index 
)
inlineoverridevirtual

Copies container data into existing array elements (not implemented).

Parameters
arrthe destination
indexzero-based index in array at which copying begins.

Implements System::Collections::Generic::ICollection< T >.

◆ get_Count()

template<typename T >
virtual int System::Collections::Generic::LinkedList< T >::get_Count ( ) const
inlineoverridevirtual

Gets number of elements in list.

Returns
Actual number of elements in list.

Implements System::Collections::Generic::ICollection< T >.

◆ get_First()

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::get_First ( )
inline

Gets pointer to the first element in the list.

Returns
First element in the list.

◆ get_Last()

template<typename T >
SharedPtr<LinkedListNode<T> > System::Collections::Generic::LinkedList< T >::get_Last ( )
inline

Gets pointer to the last element in the list.

Returns
Last element in the list.

◆ GetEnumerator()

template<typename T >
SharedPtr<IEnumerator<T> > System::Collections::Generic::LinkedList< T >::GetEnumerator ( )
inlineoverridevirtual

Gets enumerator to iterate through current LinkedList.

Returns
Newly created enumerator object.

Implements System::Collections::Generic::IEnumerable< T >.

◆ Remove() [1/2]

template<typename T >
virtual bool System::Collections::Generic::LinkedList< T >::Remove ( const T &  item)
inlineoverridevirtual

Removes first occurance of the specified item from list.

Parameters
itemItem to remove.
Returns
True if item was found and removed, false otherwise.

Implements System::Collections::Generic::ICollection< T >.

◆ Remove() [2/2]

template<typename T >
void System::Collections::Generic::LinkedList< T >::Remove ( const SharedPtr< LinkedListNode< T >> &  item)
inline

Removes node from list

Parameters
itemItem to remove.

◆ RemoveFirst()

template<typename T >
void System::Collections::Generic::LinkedList< T >::RemoveFirst ( )
inline

Removes first node from list.

◆ RemoveLast()

template<typename T >
void System::Collections::Generic::LinkedList< T >::RemoveLast ( )
inline

Removes last node from list.

◆ SetTemplateWeakPtr()

template<typename T >
void System::Collections::Generic::LinkedList< T >::SetTemplateWeakPtr ( unsigned int  argument)
inlineoverridevirtual

Makes list treat stored pointers as weak (not implemented).

Reimplemented from System::Object.