1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

vcmi: modernize headers

This commit is contained in:
Konstantin
2023-04-18 00:11:16 +03:00
parent 51a261b449
commit 86f5d6de69
75 changed files with 234 additions and 273 deletions

View File

@@ -76,7 +76,7 @@ class DLL_LINKAGE CSerializer
vectors[&typeid(T)] = VectorizedObjectInfo<T, U>(Vector, idRetriever);
}
typedef std::map<const std::type_info *, std::any, TypeComparer> TTypeVecMap;
using TTypeVecMap = std::map<const std::type_info *, std::any, TypeComparer>;
TTypeVecMap vectors; //entry must be a pointer to vector containing pointers to the objects of key type
public:
@@ -94,7 +94,7 @@ public:
myType = &typeid(T);
TTypeVecMap::iterator i = vectors.find(myType);
auto i = vectors.find(myType);
if(i == vectors.end())
return nullptr;
else
@@ -134,8 +134,8 @@ public:
template<class S, class T>
struct is_serializeable
{
typedef char (&Yes)[1];
typedef char (&No)[2];
using Yes = char (&)[1];
using No = char (&)[2];
template<class U>
static Yes test(U * data, S* arg1 = 0,
@@ -149,42 +149,42 @@ struct is_serializeable
template <typename T> //metafunction returning CGObjectInstance if T is its derivate or T elsewise
struct VectorizedTypeFor
{
typedef typename
using type = typename
//if
boost::mpl::eval_if<std::is_same<CGHeroInstance,T>,
boost::mpl::eval_if<std::is_same<CGHeroInstance, T>,
boost::mpl::identity<CGHeroInstance>,
//else if
boost::mpl::eval_if<std::is_base_of<CGObjectInstance,T>,
boost::mpl::eval_if<std::is_base_of<CGObjectInstance, T>,
boost::mpl::identity<CGObjectInstance>,
//else
boost::mpl::identity<T>
> >::type type;
>>::type;
};
template <typename U>
struct VectorizedIDType
{
typedef typename
using type = typename
//if
boost::mpl::eval_if<std::is_same<CArtifact,U>,
boost::mpl::eval_if<std::is_same<CArtifact, U>,
boost::mpl::identity<ArtifactID>,
//else if
boost::mpl::eval_if<std::is_same<CCreature,U>,
boost::mpl::eval_if<std::is_same<CCreature, U>,
boost::mpl::identity<CreatureID>,
//else if
boost::mpl::eval_if<std::is_same<CHero,U>,
boost::mpl::eval_if<std::is_same<CHero, U>,
boost::mpl::identity<HeroTypeID>,
//else if
boost::mpl::eval_if<std::is_same<CArtifactInstance,U>,
boost::mpl::eval_if<std::is_same<CArtifactInstance, U>,
boost::mpl::identity<ArtifactInstanceID>,
//else if
boost::mpl::eval_if<std::is_same<CGHeroInstance,U>,
boost::mpl::eval_if<std::is_same<CGHeroInstance, U>,
boost::mpl::identity<HeroTypeID>,
//else if
boost::mpl::eval_if<std::is_base_of<CGObjectInstance,U>,
boost::mpl::eval_if<std::is_base_of<CGObjectInstance, U>,
boost::mpl::identity<ObjectInstanceID>,
//else
boost::mpl::identity<si32>
> > > > > >::type type;
>>>>>>::type;
};
/// Base class for deserializers