[ create a new paste ] login | about

Link: http://codepad.org/mIuXMQBQ    [ raw code | fork ]

C, pasted on Aug 30:
template<typename>
struct HasOrigin {enum {value = true}; };

template <> struct HasOrigin <AniLineSegment> { enum { value = false }; };

template<class T, class K, class Enable = void>
struct ChangePosTemplate
{
public:
	static inline void Execute(K* dataSource, QGraphicsItem * item){};
};

template<class T, class K>
struct ChangePosTemplate<T,K,typename boost::enable_if<HasOrigin<K>>::type>
{
public:
	static inline void Execute(K* dataSource, QGraphicsItem * item);
};
template<class T, class K>
inline void ChangePosTemplate<T, K,typename boost::enable_if<HasOrigin<K>>::type>::Execute(K* dataSource, QGraphicsItem * item)
{
	    if(dataSource->HasItemPosition())
	    {
	        long x = (dataSource->K::template GetOrigin<AniObject::EDataSheetType::dst_point>()).x();
	        long y = (dataSource->K::template GetOrigin<AniObject::EDataSheetType::dst_point>()).y();
	        item->setPos(x,y);
	    }
}
template<class T, class K>
struct ChangePosTemplate<T,K,typename boost::disable_if<HasOrigin<K>>::type>
{
public:
	static inline void Execute(K* dataSource, QGraphicsItem * item);
};
template<class T, class K>
inline void ChangePosTemplate<T, K, typename boost::disable_if<HasOrigin<K>>::type>::Execute(K* dataSource, QGraphicsItem * item)
{

}


Create a new paste based on this one


Comments: