citra/src/common/construct.h

34 lines
1.8 KiB
C++
Raw Normal View History

2020-03-28 16:21:10 +01:00
// Copyright 2020 Citra Emulator Project
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
2020-01-02 01:45:58 +01:00
#pragma once
2020-03-28 16:21:10 +01:00
2019-12-24 18:49:56 +01:00
#include <boost/serialization/serialization.hpp>
class construct_access {
public:
2019-12-27 22:07:29 +01:00
template <class Archive, class T>
static inline void save_construct(Archive& ar, const T* t, const unsigned int file_version) {
2019-12-24 18:49:56 +01:00
t->save_construct(ar, file_version);
}
2019-12-27 22:07:29 +01:00
template <class Archive, class T>
static inline void load_construct(Archive& ar, T* t, const unsigned int file_version) {
2019-12-24 18:49:56 +01:00
T::load_construct(ar, t, file_version);
}
};
2019-12-27 22:07:29 +01:00
#define BOOST_SERIALIZATION_CONSTRUCT(T) \
namespace boost { \
namespace serialization { \
template <class Archive> \
inline void save_construct_data(Archive& ar, const T* t, const unsigned int file_version) { \
construct_access::save_construct(ar, t, file_version); \
} \
template <class Archive> \
inline void load_construct_data(Archive& ar, T* t, const unsigned int file_version) { \
construct_access::load_construct(ar, t, file_version); \
} \
} \
}