/****************************************************************************** libx42.net - skinned vertex animation library (.NET API) Copyright (C) 2007 HermitWorks Entertainment Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301, USA. ******************************************************************************/ #pragma once #include "BasicCollection.h" namespace Libx42 { ref class Model; generic< typename T > public ref class ModelItemCollection : public BasicCollection< T > { public: property T default[int] { virtual T get( int index ) override sealed { return items[index]; } } virtual int IndexOf( T item ) override sealed { return Array::IndexOf( items, item ); } property int Count { virtual int get( void ) override sealed { return items->Length; } } virtual bool Contains( T item ) override sealed { return Array::IndexOf( items, item ) != -1; } virtual Collections::Generic::IEnumerator< T >^ GetEnumerator( void ) override sealed { return ((Collections::Generic::IEnumerable< T >^)items)->GetEnumerator(); } virtual void CopyTo( array< T >^ array, int arrayIndex ) override sealed { items->CopyTo( array, arrayIndex ); } virtual array< T >^ ToArray( void ) override sealed { return (array< T >^)items->Clone(); } private: internal: Model ^owner; array< T >^ items; ModelItemCollection( Model^ owner ) : owner( owner ) { } }; };