mirror of https://github.com/OpenMW/openmw.git
Split type traits for ESM4, ESM3 and unite common
parent
e1f580e7a0
commit
90ed24f4c9
@ -0,0 +1,35 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM_TYPETRAITS
|
||||
#define OPENMW_COMPONENTS_ESM_TYPETRAITS
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
template <class T, class = std::void_t<>>
|
||||
struct HasId : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct HasId<T, std::void_t<decltype(T::mId)>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline constexpr bool hasId = HasId<T>::value;
|
||||
|
||||
template <class T, class = std::void_t<>>
|
||||
struct HasModel : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct HasModel<T, std::void_t<decltype(T::mModel)>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline constexpr bool hasModel = HasModel<T>::value;
|
||||
}
|
||||
|
||||
#endif // OPENMW_COMPONENTS_ESM_TYPETRAITS
|
@ -0,0 +1,22 @@
|
||||
#ifndef OPENMW_COMPONENTS_ESM3_TYPETRAITS
|
||||
#define OPENMW_COMPONENTS_ESM3_TYPETRAITS
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
template <class T, class = std::void_t<>>
|
||||
struct HasIndex : std::false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct HasIndex<T, std::void_t<decltype(T::mIndex)>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline constexpr bool hasIndex = HasIndex<T>::value;
|
||||
}
|
||||
|
||||
#endif // OPENMW_COMPONENTS_ESM3_TYPETRAITS
|
Loading…
Reference in New Issue