68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.1 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
// NoesisGUI - http://www.noesisengine.com
 | 
						|
// Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved.
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
 | 
						|
 | 
						|
namespace Noesis
 | 
						|
{
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
T* Collection<T>::Get(uint32_t index) const
 | 
						|
{
 | 
						|
    return (T*)BaseCollection::mItems[index].GetPtr();
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
void Collection<T>::Set(uint32_t index, T* item)
 | 
						|
{
 | 
						|
    BaseCollection::Set(index, item);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
int Collection<T>::Add(T* item)
 | 
						|
{
 | 
						|
    return BaseCollection::Add(item);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
void Collection<T>::Insert(uint32_t index, T* item)
 | 
						|
{
 | 
						|
    BaseCollection::Insert(index, item);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
bool Collection<T>::Contains(const T* item) const
 | 
						|
{
 | 
						|
    return BaseCollection::IndexOfComponent(item) >= 0;
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
int Collection<T>::IndexOf(const T* item) const
 | 
						|
{
 | 
						|
    return BaseCollection::IndexOfComponent(item);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
bool Collection<T>::Remove(const T* item)
 | 
						|
{
 | 
						|
    return BaseCollection::Remove(item);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////////////////////////////////////////////////
 | 
						|
template<class T>
 | 
						|
const TypeClass* Collection<T>::GetItemType() const
 | 
						|
{
 | 
						|
    static_assert(IsDerived<T, BaseComponent>::Result, "T must inherit from BaseComponent");
 | 
						|
    return TypeOf<T>();
 | 
						|
}
 | 
						|
 | 
						|
}
 |