namespace {
template<typename T, typename = void>
- struct __serializer;
+ struct _serializer;
/// Serialize the specified object.
template<typename T>
void
- __proc(compat::ostream &os, const T &x) {
- __serializer<T>::proc(os, x);
+ _proc(compat::ostream &os, const T &x) {
+ _serializer<T>::proc(os, x);
}
/// Deserialize the specified object.
template<typename T>
void
- __proc(compat::istream &is, T &x) {
- __serializer<T>::proc(is, x);
+ _proc(compat::istream &is, T &x) {
+ _serializer<T>::proc(is, x);
}
template<typename T>
T
- __proc(compat::istream &is) {
+ _proc(compat::istream &is) {
T x;
- __serializer<T>::proc(is, x);
+ _serializer<T>::proc(is, x);
return x;
}
/// (De)serialize a scalar value.
template<typename T>
- struct __serializer<T, typename std::enable_if<
- std::is_scalar<T>::value>::type> {
+ struct _serializer<T, typename std::enable_if<
+ std::is_scalar<T>::value>::type> {
static void
proc(compat::ostream &os, const T &x) {
os.write(reinterpret_cast<const char *>(&x), sizeof(x));
/// (De)serialize a vector.
template<typename T>
- struct __serializer<compat::vector<T>> {
+ struct _serializer<compat::vector<T>> {
static void
proc(compat::ostream &os, const compat::vector<T> &v) {
- __proc<uint32_t>(os, v.size());
+ _proc<uint32_t>(os, v.size());
for (size_t i = 0; i < v.size(); i++)
- __proc<T>(os, v[i]);
+ _proc<T>(os, v[i]);
}
static void
proc(compat::istream &is, compat::vector<T> &v) {
- v.reserve(__proc<uint32_t>(is));
+ v.reserve(_proc<uint32_t>(is));
for (size_t i = 0; i < v.size(); i++)
- new(&v[i]) T(__proc<T>(is));
+ new(&v[i]) T(_proc<T>(is));
}
};
/// (De)serialize a module::section.
template<>
- struct __serializer<module::section> {
+ struct _serializer<module::section> {
template<typename S, typename QT>
static void
proc(S &s, QT &x) {
- __proc(s, x.id);
- __proc(s, x.type);
- __proc(s, x.size);
- __proc(s, x.data);
+ _proc(s, x.id);
+ _proc(s, x.type);
+ _proc(s, x.size);
+ _proc(s, x.data);
}
};
/// (De)serialize a module::argument.
template<>
- struct __serializer<module::argument> {
+ struct _serializer<module::argument> {
template<typename S, typename QT>
static void
proc(S &s, QT &x) {
- __proc(s, x.type);
- __proc(s, x.size);
+ _proc(s, x.type);
+ _proc(s, x.size);
}
};
/// (De)serialize a module::symbol.
template<>
- struct __serializer<module::symbol> {
+ struct _serializer<module::symbol> {
template<typename S, typename QT>
static void
proc(S &s, QT &x) {
- __proc(s, x.name);
- __proc(s, x.section);
- __proc(s, x.offset);
- __proc(s, x.args);
+ _proc(s, x.name);
+ _proc(s, x.section);
+ _proc(s, x.offset);
+ _proc(s, x.args);
}
};
/// (De)serialize a module.
template<>
- struct __serializer<module> {
+ struct _serializer<module> {
template<typename S, typename QT>
static void
proc(S &s, QT &x) {
- __proc(s, x.syms);
- __proc(s, x.secs);
+ _proc(s, x.syms);
+ _proc(s, x.secs);
}
};
};
namespace clover {
void
module::serialize(compat::ostream &os) const {
- __proc(os, *this);
+ _proc(os, *this);
}
module
module::deserialize(compat::istream &is) {
- return __proc<module>(is);
+ return _proc<module>(is);
}
const module::symbol &