|
|
@ -503,14 +503,14 @@ template<typename Stream, typename T, typename A> inline void Unserialize(Stream |
|
|
|
/**
|
|
|
|
* optional |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T> void Serialize(Stream& os, const boost::optional<T>& item, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T> void Unserialize(Stream& is, boost::optional<T>& item, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T> void Serialize(Stream& os, const boost::optional<T>& item); |
|
|
|
template<typename Stream, typename T> void Unserialize(Stream& is, boost::optional<T>& item); |
|
|
|
|
|
|
|
/**
|
|
|
|
* array |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T, std::size_t N> void Serialize(Stream& os, const boost::array<T, N>& item, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T, std::size_t N> void Unserialize(Stream& is, boost::array<T, N>& item, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T, std::size_t N> void Serialize(Stream& os, const boost::array<T, N>& item); |
|
|
|
template<typename Stream, typename T, std::size_t N> void Unserialize(Stream& is, boost::array<T, N>& item); |
|
|
|
|
|
|
|
/**
|
|
|
|
* pair |
|
|
@ -533,8 +533,8 @@ template<typename Stream, typename K, typename Pred, typename A> void Unserializ |
|
|
|
/**
|
|
|
|
* list |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T, typename A> void Serialize(Stream& os, const std::list<T, A>& m, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T, typename A> void Unserialize(Stream& is, std::list<T, A>& m, int nType, int nVersion); |
|
|
|
template<typename Stream, typename T, typename A> void Serialize(Stream& os, const std::list<T, A>& m); |
|
|
|
template<typename Stream, typename T, typename A> void Unserialize(Stream& is, std::list<T, A>& m); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -721,31 +721,31 @@ inline void Unserialize(Stream& is, std::vector<T, A>& v) |
|
|
|
* optional |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T> |
|
|
|
void Serialize(Stream& os, const boost::optional<T>& item, int nType, int nVersion) |
|
|
|
void Serialize(Stream& os, const boost::optional<T>& item) |
|
|
|
{ |
|
|
|
// If the value is there, put 0x01 and then serialize the value.
|
|
|
|
// If it's not, put 0x00.
|
|
|
|
if (item) { |
|
|
|
unsigned char discriminant = 0x01; |
|
|
|
Serialize(os, discriminant, nType, nVersion); |
|
|
|
Serialize(os, *item, nType, nVersion); |
|
|
|
Serialize(os, discriminant); |
|
|
|
Serialize(os, *item); |
|
|
|
} else { |
|
|
|
unsigned char discriminant = 0x00; |
|
|
|
Serialize(os, discriminant, nType, nVersion); |
|
|
|
Serialize(os, discriminant); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
template<typename Stream, typename T> |
|
|
|
void Unserialize(Stream& is, boost::optional<T>& item, int nType, int nVersion) |
|
|
|
void Unserialize(Stream& is, boost::optional<T>& item) |
|
|
|
{ |
|
|
|
unsigned char discriminant = 0x00; |
|
|
|
Unserialize(is, discriminant, nType, nVersion); |
|
|
|
Unserialize(is, discriminant); |
|
|
|
|
|
|
|
if (discriminant == 0x00) { |
|
|
|
item = boost::none; |
|
|
|
} else if (discriminant == 0x01) { |
|
|
|
T object; |
|
|
|
Unserialize(is, object, nType, nVersion); |
|
|
|
Unserialize(is, object); |
|
|
|
item = object; |
|
|
|
} else { |
|
|
|
throw std::ios_base::failure("non-canonical optional discriminant"); |
|
|
@ -758,18 +758,18 @@ void Unserialize(Stream& is, boost::optional<T>& item, int nType, int nVersion) |
|
|
|
* array |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T, std::size_t N> |
|
|
|
void Serialize(Stream& os, const boost::array<T, N>& item, int nType, int nVersion) |
|
|
|
void Serialize(Stream& os, const boost::array<T, N>& item) |
|
|
|
{ |
|
|
|
for (size_t i = 0; i < N; i++) { |
|
|
|
Serialize(os, item[i], nType, nVersion); |
|
|
|
Serialize(os, item[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
template<typename Stream, typename T, std::size_t N> |
|
|
|
void Unserialize(Stream& is, boost::array<T, N>& item, int nType, int nVersion) |
|
|
|
void Unserialize(Stream& is, boost::array<T, N>& item) |
|
|
|
{ |
|
|
|
for (size_t i = 0; i < N; i++) { |
|
|
|
Unserialize(is, item[i], nType, nVersion); |
|
|
|
Unserialize(is, item[i]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -851,15 +851,15 @@ void Unserialize(Stream& is, std::set<K, Pred, A>& m) |
|
|
|
* list |
|
|
|
*/ |
|
|
|
template<typename Stream, typename T, typename A> |
|
|
|
void Serialize(Stream& os, const std::list<T, A>& l, int nType, int nVersion) |
|
|
|
void Serialize(Stream& os, const std::list<T, A>& l) |
|
|
|
{ |
|
|
|
WriteCompactSize(os, l.size()); |
|
|
|
for (typename std::list<T, A>::const_iterator it = l.begin(); it != l.end(); ++it) |
|
|
|
Serialize(os, (*it), nType, nVersion); |
|
|
|
Serialize(os, (*it)); |
|
|
|
} |
|
|
|
|
|
|
|
template<typename Stream, typename T, typename A> |
|
|
|
void Unserialize(Stream& is, std::list<T, A>& l, int nType, int nVersion) |
|
|
|
void Unserialize(Stream& is, std::list<T, A>& l) |
|
|
|
{ |
|
|
|
l.clear(); |
|
|
|
unsigned int nSize = ReadCompactSize(is); |
|
|
@ -867,7 +867,7 @@ void Unserialize(Stream& is, std::list<T, A>& l, int nType, int nVersion) |
|
|
|
for (unsigned int i = 0; i < nSize; i++) |
|
|
|
{ |
|
|
|
T item; |
|
|
|
Unserialize(is, item, nType, nVersion); |
|
|
|
Unserialize(is, item); |
|
|
|
l.push_back(item); |
|
|
|
} |
|
|
|
} |
|
|
|