92 lines
3.1 KiB
C++
92 lines
3.1 KiB
C++
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
// NoesisGUI - http://www.noesisengine.com
|
|
// Copyright (c) 2013 Noesis Technologies S.L. All Rights Reserved.
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
#include <NsCore/DynamicCast.h>
|
|
|
|
|
|
namespace Noesis
|
|
{
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline T* FreezableCollection<T>::Get(uint32_t index) const
|
|
{
|
|
return (T*)BaseFreezableCollection::mItems[index].GetPtr();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline void FreezableCollection<T>::Set(uint32_t index, T* item)
|
|
{
|
|
BaseFreezableCollection::Set(index, item);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline int FreezableCollection<T>::Add(T* item)
|
|
{
|
|
return BaseFreezableCollection::Add(item);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline void FreezableCollection<T>::Insert(uint32_t index, T* item)
|
|
{
|
|
BaseFreezableCollection::Insert(index, item);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline bool FreezableCollection<T>::Contains(const T* item) const
|
|
{
|
|
return BaseFreezableCollection::IndexOfComponent(item) >= 0;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline int FreezableCollection<T>::IndexOf(const T* item) const
|
|
{
|
|
return BaseFreezableCollection::IndexOfComponent(item);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline bool FreezableCollection<T>::Remove(const T* item)
|
|
{
|
|
return BaseFreezableCollection::Remove(item);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline const TypeClass* FreezableCollection<T>::GetItemType() const
|
|
{
|
|
static_assert(IsDerived<T, DependencyObject>::Result, "T must inherit from DependencyObject");
|
|
return TypeOf<T>();
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline Ptr<FreezableCollection<T>> FreezableCollection<T>::Clone() const
|
|
{
|
|
return StaticPtrCast<FreezableCollection<T>>(Freezable::Clone());
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline Ptr<FreezableCollection<T>> FreezableCollection<T>::CloneCurrentValue() const
|
|
{
|
|
return StaticPtrCast<FreezableCollection<T>>(Freezable::CloneCurrentValue());
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
template<class T>
|
|
inline Ptr<Freezable> FreezableCollection<T>::CreateInstanceCore() const
|
|
{
|
|
return *new FreezableCollection<T>();
|
|
}
|
|
|
|
}
|