2013-06-12 19:21:00 +02:00
|
|
|
/*****************************************************************************
|
|
|
|
* PresentationFrameworkCollection.h *
|
|
|
|
* *
|
|
|
|
* System::Windows::PresentationFrameworkCollection definition file *
|
|
|
|
* Copyright (c) XFX Team. All rights reserved *
|
|
|
|
*****************************************************************************/
|
|
|
|
#ifndef _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_
|
|
|
|
#define _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_
|
2013-05-05 18:18:41 +02:00
|
|
|
|
|
|
|
#include <System/Collections/Generic/List.h>
|
|
|
|
#include <sassert.h>
|
|
|
|
|
|
|
|
using namespace System::Collections::Generic;
|
|
|
|
|
|
|
|
namespace System
|
|
|
|
{
|
|
|
|
namespace Windows
|
|
|
|
{
|
|
|
|
template <typename T>
|
2013-06-12 19:21:00 +02:00
|
|
|
class PresentationFrameworkCollection : public IList<T>, public Object
|
2013-05-05 18:18:41 +02:00
|
|
|
{
|
|
|
|
private:
|
|
|
|
List<T> _items;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
PresentationFrameworkCollection();
|
|
|
|
|
|
|
|
public:
|
|
|
|
int Count() const;
|
|
|
|
bool IsReadOnly() const;
|
|
|
|
|
|
|
|
void Add(const T& item);
|
|
|
|
void Clear();
|
|
|
|
bool Contains(const T& item) const;
|
|
|
|
void CopyTo(T array[], const int index) const;
|
2013-07-12 21:30:13 +02:00
|
|
|
static const Type& GetType();
|
2013-05-05 18:18:41 +02:00
|
|
|
int IndexOf(const T& item) const;
|
|
|
|
void Insert(const int index, const T& item);
|
|
|
|
bool Remove(const T& item);
|
|
|
|
void RemoveAt(const int index);
|
|
|
|
|
|
|
|
T& operator[](const int index);
|
|
|
|
};
|
|
|
|
|
|
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
int PresentationFrameworkCollection<T>::Count() const
|
|
|
|
{
|
|
|
|
return _items.Count();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
bool PresentationFrameworkCollection<T>::IsReadOnly() const
|
|
|
|
{
|
|
|
|
return _items.IsReadOnly();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void PresentationFrameworkCollection<T>::Add(const T& item)
|
|
|
|
{
|
|
|
|
_items.Add(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void PresentationFrameworkCollection<T>::Clear()
|
|
|
|
{
|
|
|
|
_items.Clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
bool PresentationFrameworkCollection<T>::Contains(const T& item) const
|
|
|
|
{
|
|
|
|
return (IndexOf(item) != -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void PresentationFrameworkCollection<T>::CopyTo(T array[], const int index) const
|
|
|
|
{
|
|
|
|
_items.CopyTo(array, index);
|
|
|
|
}
|
|
|
|
|
2013-07-12 21:30:13 +02:00
|
|
|
template <typename T>
|
|
|
|
const Type PresentationFrameworkCollection<T>::GetType()
|
|
|
|
{
|
|
|
|
static const Type PresentationFrameworkCollectionTypeInfo("PresentationFrameworkCollection", "System::Windows::PresentationFrameworkCollection", TypeCode::Object, true);
|
|
|
|
|
|
|
|
return PresentationFrameworkCollectionTypeInfo;
|
|
|
|
}
|
|
|
|
|
2013-05-05 18:18:41 +02:00
|
|
|
template <typename T>
|
|
|
|
int PresentationFrameworkCollection<T>::IndexOf(const T& item) const
|
|
|
|
{
|
|
|
|
return _items.IndexOf(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void PresentationFrameworkCollection<T>::Insert(const int index, const T& item)
|
|
|
|
{
|
|
|
|
_items.Insert(index, item);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
bool PresentationFrameworkCollection<T>::Remove(const T& item)
|
|
|
|
{
|
|
|
|
int itemIndex = IndexOf(item);
|
|
|
|
|
|
|
|
if (itemIndex == -1)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
RemoveAt(itemIndex);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
void PresentationFrameworkCollection<T>::RemoveAt(const int index)
|
|
|
|
{
|
|
|
|
_items.RemoveAt(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
T& PresentationFrameworkCollection<T>::operator[](const int index)
|
|
|
|
{
|
|
|
|
return _items[index];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-06-12 19:21:00 +02:00
|
|
|
|
|
|
|
#endif //_SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_
|