aboutsummaryrefslogtreecommitdiff
path: root/src/serialization/serialization.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/serialization/serialization.h')
-rw-r--r--src/serialization/serialization.h36
1 files changed, 17 insertions, 19 deletions
diff --git a/src/serialization/serialization.h b/src/serialization/serialization.h
index 3ebeed171..4acadeab3 100644
--- a/src/serialization/serialization.h
+++ b/src/serialization/serialization.h
@@ -213,7 +213,7 @@ inline bool do_serialize(Archive &ar, bool &v)
* \brief self-explanatory
*/
#define END_SERIALIZE() \
- return ar.stream().good(); \
+ return ar.good(); \
}
/*! \macro VALUE(f)
@@ -223,7 +223,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag(#f); \
bool r = ::do_serialize(ar, f); \
- if (!r || !ar.stream().good()) return false; \
+ if (!r || !ar.good()) return false; \
} while(0);
/*! \macro FIELD_N(t,f)
@@ -234,7 +234,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag(t); \
bool r = ::do_serialize(ar, f); \
- if (!r || !ar.stream().good()) return false; \
+ if (!r || !ar.good()) return false; \
} while(0);
/*! \macro FIELD(f)
@@ -245,7 +245,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag(#f); \
bool r = ::do_serialize(ar, f); \
- if (!r || !ar.stream().good()) return false; \
+ if (!r || !ar.good()) return false; \
} while(0);
/*! \macro FIELDS(f)
@@ -255,7 +255,7 @@ inline bool do_serialize(Archive &ar, bool &v)
#define FIELDS(f) \
do { \
bool r = ::do_serialize(ar, f); \
- if (!r || !ar.stream().good()) return false; \
+ if (!r || !ar.good()) return false; \
} while(0);
/*! \macro VARINT_FIELD(f)
@@ -265,7 +265,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag(#f); \
ar.serialize_varint(f); \
- if (!ar.stream().good()) return false; \
+ if (!ar.good()) return false; \
} while(0);
/*! \macro VARINT_FIELD_N(t, f)
@@ -276,7 +276,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag(t); \
ar.serialize_varint(f); \
- if (!ar.stream().good()) return false; \
+ if (!ar.good()) return false; \
} while(0);
/*! \macro MAGIC_FIELD(m)
@@ -286,7 +286,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag("magic"); \
ar.serialize_blob((void*)magic.data(), magic.size()); \
- if (!ar.stream().good()) return false; \
+ if (!ar.good()) return false; \
if (magic != m) return false; \
} while(0);
@@ -297,7 +297,7 @@ inline bool do_serialize(Archive &ar, bool &v)
do { \
ar.tag("version"); \
ar.serialize_varint(version); \
- if (!ar.stream().good()) return false; \
+ if (!ar.good()) return false; \
} while(0);
@@ -339,10 +339,10 @@ namespace serialization {
*
* \brief self explanatory
*/
- template<class Stream>
- bool do_check_stream_state(Stream& s, boost::mpl::bool_<true>, bool noeof)
+ template<class Archive>
+ bool do_check_stream_state(Archive& ar, boost::mpl::bool_<true>, bool noeof)
{
- return s.good();
+ return ar.good();
}
/*! \fn do_check_stream_state
*
@@ -350,15 +350,13 @@ namespace serialization {
*
* \detailed Also checks to make sure that the stream is not at EOF
*/
- template<class Stream>
- bool do_check_stream_state(Stream& s, boost::mpl::bool_<false>, bool noeof)
+ template<class Archive>
+ bool do_check_stream_state(Archive& ar, boost::mpl::bool_<false>, bool noeof)
{
bool result = false;
- if (s.good())
+ if (ar.good())
{
- std::ios_base::iostate state = s.rdstate();
- result = noeof || EOF == s.peek();
- s.clear(state);
+ result = noeof || ar.eof();
}
return result;
}
@@ -371,7 +369,7 @@ namespace serialization {
template<class Archive>
bool check_stream_state(Archive& ar, bool noeof = false)
{
- return detail::do_check_stream_state(ar.stream(), typename Archive::is_saving(), noeof);
+ return detail::do_check_stream_state(ar, typename Archive::is_saving(), noeof);
}
/*! \fn serialize