/***************************************************************************** * PresentationFrameworkCollection.h * * * * System::Windows::PresentationFrameworkCollection definition file * * Copyright (c) XFX Team. All rights reserved * *****************************************************************************/ #ifndef _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_ #define _SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_ #include #include using namespace System::Collections::Generic; namespace System { namespace Windows { template class PresentationFrameworkCollection : public IList, public Object { private: List _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; static const Type& GetType(); 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 int PresentationFrameworkCollection::Count() const { return _items.Count(); } template bool PresentationFrameworkCollection::IsReadOnly() const { return _items.IsReadOnly(); } template void PresentationFrameworkCollection::Add(const T& item) { _items.Add(item); } template void PresentationFrameworkCollection::Clear() { _items.Clear(); } template bool PresentationFrameworkCollection::Contains(const T& item) const { return (IndexOf(item) != -1); } template void PresentationFrameworkCollection::CopyTo(T array[], const int index) const { _items.CopyTo(array, index); } template const Type PresentationFrameworkCollection::GetType() { static const Type PresentationFrameworkCollectionTypeInfo("PresentationFrameworkCollection", "System::Windows::PresentationFrameworkCollection", TypeCode::Object, true); return PresentationFrameworkCollectionTypeInfo; } template int PresentationFrameworkCollection::IndexOf(const T& item) const { return _items.IndexOf(item); } template void PresentationFrameworkCollection::Insert(const int index, const T& item) { _items.Insert(index, item); } template bool PresentationFrameworkCollection::Remove(const T& item) { int itemIndex = IndexOf(item); if (itemIndex == -1) return false; RemoveAt(itemIndex); return true; } template void PresentationFrameworkCollection::RemoveAt(const int index) { _items.RemoveAt(index); } template T& PresentationFrameworkCollection::operator[](const int index) { return _items[index]; } } } #endif //_SYSTEM_WINDOWS_PRESENTATIONFRAMEWORKCOLLECTION_