|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r63778 - in branches/release/boost/archive: . detail impl iterators
From: ramey_at_[hidden]
Date: 2010-07-09 12:48:58
Author: ramey
Date: 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
New Revision: 63778
URL: http://svn.boost.org/trac/boost/changeset/63778
Log:
Merge to release
Properties modified:
branches/release/boost/archive/ (props changed)
Text files modified:
branches/release/boost/archive/archive_exception.hpp | 5
branches/release/boost/archive/basic_archive.hpp | 199 ++++++++++++++++++++++++++++++++++-----
branches/release/boost/archive/basic_binary_iarchive.hpp | 92 ++++++++---------
branches/release/boost/archive/basic_binary_iprimitive.hpp | 6
branches/release/boost/archive/basic_binary_oarchive.hpp | 76 ++++++--------
branches/release/boost/archive/basic_binary_oprimitive.hpp | 6
branches/release/boost/archive/basic_text_iarchive.hpp | 4
branches/release/boost/archive/basic_text_iprimitive.hpp | 70 ++++++-------
branches/release/boost/archive/basic_text_oarchive.hpp | 29 -----
branches/release/boost/archive/basic_text_oprimitive.hpp | 42 ++------
branches/release/boost/archive/basic_xml_archive.hpp | 2
branches/release/boost/archive/basic_xml_oarchive.hpp | 2
branches/release/boost/archive/detail/auto_link_archive.hpp | 2
branches/release/boost/archive/detail/basic_iarchive.hpp | 4
branches/release/boost/archive/detail/basic_oarchive.hpp | 2
branches/release/boost/archive/detail/common_iarchive.hpp | 2
branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp | 4
branches/release/boost/archive/detail/polymorphic_oarchive_route.hpp | 2
branches/release/boost/archive/impl/basic_binary_iarchive.ipp | 26 ++++
branches/release/boost/archive/impl/basic_binary_oarchive.ipp | 2
branches/release/boost/archive/impl/basic_binary_oprimitive.ipp | 2
branches/release/boost/archive/impl/basic_text_iarchive.ipp | 5
branches/release/boost/archive/impl/basic_text_iprimitive.ipp | 2
branches/release/boost/archive/impl/basic_text_oarchive.ipp | 2
branches/release/boost/archive/impl/basic_text_oprimitive.ipp | 2
branches/release/boost/archive/impl/basic_xml_grammar.hpp | 9 +
branches/release/boost/archive/impl/basic_xml_iarchive.ipp | 10 +-
branches/release/boost/archive/impl/basic_xml_oarchive.ipp | 2
branches/release/boost/archive/impl/xml_iarchive_impl.ipp | 4
branches/release/boost/archive/impl/xml_wiarchive_impl.ipp | 2
branches/release/boost/archive/iterators/head_iterator.hpp | 1
branches/release/boost/archive/polymorphic_iarchive.hpp | 16 +-
branches/release/boost/archive/polymorphic_oarchive.hpp | 2
branches/release/boost/archive/text_wiarchive.hpp | 11 ++
branches/release/boost/archive/text_woarchive.hpp | 7 +
branches/release/boost/archive/xml_oarchive.hpp | 1
branches/release/boost/archive/xml_wiarchive.hpp | 16 +++
branches/release/boost/archive/xml_woarchive.hpp | 17 +-
38 files changed, 413 insertions(+), 275 deletions(-)
Modified: branches/release/boost/archive/archive_exception.hpp
==============================================================================
--- branches/release/boost/archive/archive_exception.hpp (original)
+++ branches/release/boost/archive/archive_exception.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -61,7 +61,7 @@
incompatible_native_format, // attempt to read native binary format
// on incompatible platform
array_size_too_short,// array being loaded doesn't fit in array allocated
- stream_error, // i/o error on stream
+ input_stream_error, // error on input stream
invalid_class_name, // class name greater than the maximum permitted.
// most likely a corrupted archive or an attempt
// to insert virus via buffer overrun method.
@@ -70,8 +70,9 @@
unsupported_class_version, // type saved with a version # greater than the
// one used by the program. This indicates that the proggram
// needs to be rebuilt.
- multiple_code_instantiation // code for implementing serialization for some
+ multiple_code_instantiation, // code for implementing serialization for some
// type has been instantiated in more than one module.
+ output_stream_error // error on input stream
} exception_code;
protected:
std::string m_msg;
Modified: branches/release/boost/archive/basic_archive.hpp
==============================================================================
--- branches/release/boost/archive/basic_archive.hpp (original)
+++ branches/release/boost/archive/basic_archive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -16,39 +16,169 @@
// See http://www.boost.org for updates, documentation, and revision history.
+#include <cassert>
#include <boost/config.hpp>
-#include <boost/cstdint.hpp>
+#include <boost/cstdint.hpp> // size_t
#include <boost/noncopyable.hpp>
#include <boost/integer_traits.hpp>
-#include <boost/serialization/strong_typedef.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
-#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
-namespace boost { \
-namespace archive { \
-BOOST_STRONG_TYPEDEF(T, D) \
-} /* archive */ \
-template<> \
-class integer_traits<boost::archive::D> : \
- public integer_traits<boost::T> \
-{}; \
-} /* boost */ \
-/**/
-
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least16_t, version_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_optional_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(int_least16_t, class_id_reference_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_id_type)
-BOOST_ARCHIVE_STRONG_TYPEDEF(uint_least32_t, object_reference_type)
-
namespace boost {
namespace archive {
+#if defined(_MSC_VER)
+#pragma warning( push )
+#pragma warning( disable : 4244 4267 )
+#endif
+
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * Don't ever changes this. If you do, they previously created
+ * binary archives won't be readable !!!
+ */
+class library_version_type {
+private:
+ typedef uint_least16_t base_type;
+ base_type t;
+public:
+ library_version_type(): t(0) {};
+ explicit library_version_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ library_version_type(const library_version_type & t_) :
+ t(t_.t)
+ {}
+ library_version_type & operator=(const library_version_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const base_type () const {
+ return t;
+ }
+ // used for text input
+ operator base_type & (){
+ return t;
+ }
+ bool operator==(const library_version_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const library_version_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+BOOST_ARCHIVE_DECL(library_version_type)
+BOOST_ARCHIVE_VERSION();
+
+class version_type {
+private:
+ typedef uint_least8_t base_type;
+ base_type t;
+ version_type(): t(0) {};
+public:
+ explicit version_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ version_type(const version_type & t_) :
+ t(t_.t)
+ {}
+ version_type & operator=(const version_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const base_type () const {
+ return t;
+ }
+ // used for text intput
+ operator base_type & (){
+ return t;
+ }
+ bool operator==(const version_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const version_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+class class_id_type {
+private:
+ typedef int_least16_t base_type;
+ base_type t;
+public:
+ class_id_type() : t(0) {};
+ explicit class_id_type(const int t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ explicit class_id_type(const std::size_t t_) : t(t_){
+ // assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ class_id_type(const class_id_type & t_) :
+ t(t_.t)
+ {}
+ class_id_type & operator=(const class_id_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+
+ // used for text output
+ operator const int () const {
+ return t;
+ }
+ // used for text input
+ operator int_least16_t &() {
+ return t;
+ }
+ bool operator==(const class_id_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const class_id_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+#define NULL_POINTER_TAG boost::archive::class_id_type(-1)
+
+class object_id_type {
+private:
+ typedef uint_least32_t base_type;
+ base_type t;
+public:
+ object_id_type(): t(0) {};
+ explicit object_id_type(const unsigned int & t_) : t(t_){
+ assert(t_ <= boost::integer_traits<base_type>::const_max);
+ }
+ object_id_type(const object_id_type & t_) :
+ t(t_.t)
+ {}
+ object_id_type & operator=(const object_id_type & rhs){
+ t = rhs.t;
+ return *this;
+ }
+ // used for text output
+ operator const uint_least32_t () const {
+ return t;
+ }
+ // used for text input
+ operator uint_least32_t & () {
+ return t;
+ }
+ bool operator==(const object_id_type & rhs) const {
+ return t == rhs.t;
+ }
+ bool operator<(const object_id_type & rhs) const {
+ return t < rhs.t;
+ }
+};
+
+#if defined(_MSC_VER)
+#pragma warning( pop )
+#endif
+
struct tracking_type {
-// typedef bool value_type;
bool t;
explicit tracking_type(const bool t_ = false)
: t(t_)
@@ -106,13 +236,29 @@
flags_last = 8
};
-#define NULL_POINTER_TAG class_id_type(-1)
-
BOOST_ARCHIVE_DECL(const char *)
BOOST_ARCHIVE_SIGNATURE();
-BOOST_ARCHIVE_DECL(version_type)
-BOOST_ARCHIVE_VERSION();
+/* NOTE : Warning : Warning : Warning : Warning : Warning
+ * If any of these are changed to different sized types,
+ * binary_iarchive won't be able to read older archives
+ * unless you rev the library version and include conditional
+ * code based on the library version. There is nothing
+ * inherently wrong in doing this - but you have to be super
+ * careful because it's easy to get wrong and start breaking
+ * old archives !!!
+ */
+
+#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
+ class D : public T { \
+ public: \
+ explicit D(const T t) : T(t){} \
+ }; \
+/**/
+
+BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type)
+BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type)
+BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type)
}// namespace archive
}// namespace boost
@@ -124,6 +270,7 @@
// set implementation level to primitive for all types
// used internally by the serialization library
+BOOST_CLASS_IMPLEMENTATION(boost::archive::library_version_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
Modified: branches/release/boost/archive/basic_binary_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_iarchive.hpp (original)
+++ branches/release/boost/archive/basic_binary_iarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -27,9 +27,11 @@
#include <boost/detail/workaround.hpp>
#include <boost/serialization/pfto.hpp>
+#include <boost/archive/basic_archive.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/string.hpp>
+#include <boost/serialization/item_version_type.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
@@ -66,57 +68,51 @@
void load_override(T & t, BOOST_PFTO int version){
this->detail_common_iarchive::load_override(t, static_cast<int>(version));
}
+
+ // include these to trap a change in binary format which
+ // isn't specifically handled
+ BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char));
+ // upto 32K classes
+ BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
+ BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
+ // upto 2G objects
+ BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
+ BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
+
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */, int){}
- // the following have been overridden to provide specific sizes
- // for these pseudo prmitive types.
- void load_override(version_type & t, int){
- // upto 255 versions
- unsigned char x=0;
- * this->This() >> x;
- t = version_type(x);
- }
- void load_override(class_id_type & t, int){
- // upto 32K classes
- int_least16_t x=0;
- * this->This() >> x;
- t = class_id_type(x);
- }
- void load_override(class_id_reference_type & t, int){
- // upto 32K classes
- int_least16_t x=0;
- * this->This() >> x;
- t = class_id_reference_type(x);
- }
- void load_override(object_id_type & t, int){
- // upto 2G objects
- uint_least32_t x=0;
- * this->This() >> x;
- t = object_id_type(x);
- }
- void load_override(object_reference_type & t, int){
- // upto 2G objects
- uint_least32_t x=0;
- * this->This() >> x;
- t = object_reference_type(x);
- }
- void load_override(tracking_type & t, int){
- char x=0;
- * this->This() >> x;
- t = (0 != x);
- }
- void load_override(serialization::collection_size_type & t, int){
- if (this->get_library_version() < 6) {
- unsigned int x=0;
- * this->This() >> x;
- t = serialization::collection_size_type(x);
- }
- else {
- std::size_t x=0;
- * this->This() >> x;
- t = serialization::collection_size_type(x);
- }
+ void load_override(boost::serialization::item_version_type & t, int version){
+ if(library_version_type(6) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = boost::serialization::item_version_type(x);
+ }
+ }
+
+ void load_override(version_type & t, int version){
+ if(boost::archive::library_version_type(6) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = boost::archive::version_type(x);
+ }
+ }
+
+ void load_override(serialization::collection_size_type & t, int version){
+ if(boost::archive::library_version_type(5) < this->get_library_version()){
+ this->detail_common_iarchive::load_override(t, version);
+ }
+ else{
+ unsigned int x=0;
+ * this->This() >> x;
+ t = serialization::collection_size_type(x);
+ }
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
Modified: branches/release/boost/archive/basic_binary_iprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_iprimitive.hpp (original)
+++ branches/release/boost/archive/basic_binary_iprimitive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -51,10 +51,10 @@
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
-#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array.hpp>
+#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@@ -162,7 +162,7 @@
);
if(scount != s)
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
);
// note: an optimizer should eliminate the following for char files
assert(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
@@ -176,7 +176,7 @@
scount = m_sb.sgetn(& t, 1);
if(scount != 1)
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
);
std::memcpy(static_cast<char*>(address) + (count - s), &t, s);
}
Modified: branches/release/boost/archive/basic_binary_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_oarchive.hpp (original)
+++ branches/release/boost/archive/basic_binary_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -24,13 +24,13 @@
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
#include <cassert>
-#include <boost/integer.hpp>
-#include <boost/integer_traits.hpp>
-
#include <boost/config.hpp>
+#include <boost/detail/workaround.hpp>
#include <boost/serialization/pfto.hpp>
-#include <boost/detail/workaround.hpp>
+#include <boost/integer.hpp>
+#include <boost/integer_traits.hpp>
+
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/collection_size_type.hpp>
@@ -74,44 +74,28 @@
this->detail_common_oarchive::save_override(t, static_cast<int>(version));
}
+ // include these to trap a change in binary format which
+ // isn't specifically handled
+ BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(char));
+ // upto 32K classes
+ BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
+ BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
+ // upto 2G objects
+ BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
+ BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
+
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
- void save_override(const version_type & t, int){
- // upto 255 versions
- // note:t.t resolves borland ambguity
- assert(t.t < boost::integer_traits<unsigned char>::const_max);
- const unsigned char x = static_cast<const unsigned char>(t.t);
- * this->This() << x;
- }
- void save_override(const class_id_type & t, int){
- // upto 32K classes
- assert(t.t < boost::integer_traits<boost::int_least16_t>::const_max);
- const boost::int_least16_t x = static_cast<const boost::int_least16_t>(t.t);
- * this->This() << x;
- }
- void save_override(const class_id_reference_type & t, int){
- // upto 32K classes
- assert(t.t < boost::integer_traits<boost::int_least16_t>::const_max);
- const boost::int_least16_t x = t.t;
- * this->This() << x;
- }
- void save_override(const object_id_type & t, int){
- // upto 2G objects
- assert(t.t < boost::integer_traits<boost::uint_least32_t>::const_max);
- const boost::uint_least32_t x = t.t;
- * this->This() << x;
- }
- void save_override(const object_reference_type & t, int){
- // upto 2G objects
- assert(t.t < boost::integer_traits<boost::uint_least32_t>::const_max);
- const boost::uint_least32_t x = t.t;
- * this->This() << x;
- }
- void save_override(const tracking_type & t, int){
- const char x = t.t;
- * this->This() << x;
+ #if 0 // enable this if we decide to support generation of previous versions
+ void save_override(const boost::archive::version_type & t, int version){
+ if(this->get_library_version() < boost::archive::library_version_type(7)){
+ * this->This() << static_cast<int_least16_t >(t);
+ }
+ else
+ this->detail_common_oarchive::save_override(t, version);
}
+ #endif
// explicitly convert to char * to avoid compile ambiguities
void save_override(const class_name_type & t, int){
@@ -119,12 +103,18 @@
* this->This() << s;
}
+ #if 0
void save_override(const serialization::collection_size_type & t, int){
- // for backward compatibility, 64 bit integer or variable length integer would be preferred
- std::size_t x = t.t;
- * this->This() << x;
- }
-
+ if (get_library_version() < boost::archive::library_version_type(6)){
+ unsigned int x=0;
+ * this->This() >> x;
+ t = serialization::collection_size_type(x);
+ }
+ else{
+ * this->This() >> t;
+ }
+ }
+ #endif
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
Modified: branches/release/boost/archive/basic_binary_oprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_binary_oprimitive.hpp (original)
+++ branches/release/boost/archive/basic_binary_oprimitive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -45,10 +45,10 @@
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
-#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/array.hpp>
+#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@@ -155,7 +155,7 @@
// be sure that the output stream is opened with ios::binary
//if(os.fail())
// boost::serialization::throw_exception(
- // archive_exception(archive_exception::stream_error)
+ // archive_exception(archive_exception::output_stream_error)
// );
// figure number of elements to output - round up
count = ( count + sizeof(Elem) - 1)
@@ -167,7 +167,7 @@
);
if(count != static_cast<std::size_t>(scount))
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
//os.write(
// static_cast<const BOOST_DEDUCED_TYPENAME OStream::char_type *>(address),
Modified: branches/release/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_iarchive.hpp (original)
+++ branches/release/boost/archive/basic_text_iarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -29,7 +29,6 @@
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
-#include <boost/serialization/string.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -62,8 +61,7 @@
// template ordering
typedef detail::common_iarchive<Archive> detail_common_iarchive;
template<class T>
- void load_override(T & t, BOOST_PFTO int)
- {
+ void load_override(T & t, BOOST_PFTO int){
this->detail_common_iarchive::load_override(t, 0);
}
// text file don't include the optional information
Modified: branches/release/boost/archive/basic_text_iprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_iprimitive.hpp (original)
+++ branches/release/boost/archive/basic_text_iprimitive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -46,8 +46,8 @@
#include <boost/limits.hpp>
#include <boost/io/ios_state.hpp>
#include <boost/scoped_ptr.hpp>
+#include <boost/static_assert.hpp>
-#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/throw_exception.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
@@ -58,6 +58,11 @@
/////////////////////////////////////////////////////////////////////////
// class basic_text_iarchive - load serialized objects from a input text stream
+#if defined(_MSC_VER)
+#pragma warning( push )
+#pragma warning( disable : 4244 4267 )
+#endif
+
template<class IStream>
class basic_text_iprimitive
{
@@ -81,52 +86,41 @@
template<class T>
void load(T & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- is >> t;
+ if(! is.fail()){
+ is >> t;
+ return;
+ }
+ boost::serialization::throw_exception(
+ archive_exception(archive_exception::input_stream_error)
+ );
}
- void load(unsigned char & t)
+
+ void load(char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- unsigned short int i;
- is >> i;
- t = static_cast<unsigned char>(i);
+ short int i;
+ load(i);
+ t = i;
}
void load(signed char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- signed short int i;
- is >> i;
- t = static_cast<signed char>(i);
+ short int i;
+ load(i);
+ t = i;
}
- void load(char & t)
+ void load(unsigned char & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- short int i;
- is >> i;
- t = static_cast<char>(i);
+ unsigned short int i;
+ load(i);
+ t = i;
}
+
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
void load(wchar_t & t)
{
- if(is.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- unsigned i;
- is >> i;
- t = static_cast<wchar_t>(i);
+ BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
+ int i;
+ load(i);
+ t = i;
}
#endif
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
@@ -138,6 +132,10 @@
load_binary(void *address, std::size_t count);
};
+#if defined(_MSC_VER)
+#pragma warning( pop )
+#endif
+
} // namespace archive
} // namespace boost
Modified: branches/release/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_oarchive.hpp (original)
+++ branches/release/boost/archive/basic_text_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -83,34 +83,7 @@
// start new objects on a new line
void save_override(const object_id_type & t, int){
this->This()->newline();
- // note extra .t to funciton with Borland 5.51 compiler
- // and invoke prmitive to underlying value
- this->This()->save(t.t);
- }
-
- void save_override(const object_reference_type & t, int){
- this->This()->newline();
- // note extra .t to funciton with Borland 5.51 compiler
- // and invoke prmitive to underlying value
- this->This()->save(t.t);
- }
-
- // note the following four overrides are necessary for some borland
- // compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
- void save_override(const version_type & t, int){
- // note:t.t resolves borland ambguity
- const unsigned int x = t.t;
- * this->This() << x;
- }
- void save_override(const class_id_type & t, int){
- // note:t.t resolves borland ambguity
- const int x = t.t;
- * this->This() << x;
- }
- void save_override(const class_id_reference_type & t, int){
- // note:t.t resolves borland ambguity
- const int x = t.t;
- * this->This() << x;
+ this->detail_common_oarchive::save_override(t, 0);
}
// text file don't include the optional information
Modified: branches/release/boost/archive/basic_text_oprimitive.hpp
==============================================================================
--- branches/release/boost/archive/basic_text_oprimitive.hpp (original)
+++ branches/release/boost/archive/basic_text_oprimitive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -29,9 +29,9 @@
#include <boost/config/no_tr1/cmath.hpp> // isnan
#include <cassert>
#include <cstddef> // size_t
-#include <boost/serialization/collection_size_type.hpp>
#include <boost/config.hpp>
+#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
@@ -47,6 +47,7 @@
#endif
#include <boost/limits.hpp>
+#include <boost/integer.hpp>
#include <boost/io/ios_state.hpp>
#include <boost/scoped_ptr.hpp>
#include <boost/serialization/throw_exception.hpp>
@@ -86,7 +87,7 @@
void save(const T &t){
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os << t;
}
@@ -99,42 +100,27 @@
assert(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os << t;
}
void save(const signed char t)
{
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short int>(t);
+ save(static_cast<short int>(t));
}
void save(const unsigned char t)
{
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short unsigned int>(t);
+ save(static_cast<short unsigned int>(t));
}
void save(const char t)
{
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<short int>(t);
+ save(static_cast<short int>(t));
}
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
void save(const wchar_t t)
{
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
- os << static_cast<int>(t);
+ BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
+ save(static_cast<int>(t));
}
#endif
void save(const float t)
@@ -142,7 +128,7 @@
// must be a user mistake - can't serialize un-initialized data
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os << std::setprecision(std::numeric_limits<float>::digits10 + 2);
os << t;
@@ -152,7 +138,7 @@
// must be a user mistake - can't serialize un-initialized data
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os << std::setprecision(std::numeric_limits<double>::digits10 + 2);
os << t;
@@ -166,16 +152,12 @@
void put(BOOST_DEDUCED_TYPENAME OStream::char_type c){
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os.put(c);
}
// unformatted append of null terminated string
void put(const char * s){
- if(os.fail())
- boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
- );
while('\0' != *s)
os.put(*s++);
}
Modified: branches/release/boost/archive/basic_xml_archive.hpp
==============================================================================
--- branches/release/boost/archive/basic_xml_archive.hpp (original)
+++ branches/release/boost/archive/basic_xml_archive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -16,9 +16,9 @@
// See http://www.boost.org for updates, documentation, and revision history.
-#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/archive_exception.hpp>
+#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
Modified: branches/release/boost/archive/basic_xml_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/basic_xml_oarchive.hpp (original)
+++ branches/release/boost/archive/basic_xml_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -93,7 +93,7 @@
this->detail_common_oarchive::save_override(t, 0);
}
- // special treatment for name-value pairs.
+ // special treatment for name-value pairs.
typedef detail::common_oarchive<Archive> detail_common_oarchive;
template<class T>
void save_override(
Modified: branches/release/boost/archive/detail/auto_link_archive.hpp
==============================================================================
--- branches/release/boost/archive/detail/auto_link_archive.hpp (original)
+++ branches/release/boost/archive/detail/auto_link_archive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -45,4 +45,4 @@
#include <boost/config/auto_link.hpp>
#endif // auto-linking disabled
-#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
+#endif // BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
Modified: branches/release/boost/archive/detail/basic_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/basic_iarchive.hpp (original)
+++ branches/release/boost/archive/detail/basic_iarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -84,8 +84,8 @@
);
// real public API starts here
void
- set_library_version(version_type archive_library_version);
- unsigned int
+ set_library_version(library_version_type archive_library_version);
+ library_version_type
get_library_version() const;
unsigned int
get_flags() const;
Modified: branches/release/boost/archive/detail/basic_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/basic_oarchive.hpp (original)
+++ branches/release/boost/archive/detail/basic_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -87,7 +87,7 @@
}
// real public interface starts here
void end_preamble(); // default implementation does nothing
- unsigned int get_library_version() const;
+ library_version_type get_library_version() const;
unsigned int get_flags() const;
};
Modified: branches/release/boost/archive/detail/common_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/detail/common_iarchive.hpp (original)
+++ branches/release/boost/archive/detail/common_iarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -21,8 +21,6 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/basic_pointer_iserializer.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
-#include <boost/archive/detail/archive_serializer_map.hpp>
-#include <boost/serialization/singleton.hpp>
#ifdef BOOST_MSVC
# pragma warning(push)
Modified: branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp
==============================================================================
--- branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp (original)
+++ branches/release/boost/archive/detail/polymorphic_iarchive_route.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -71,10 +71,10 @@
){
return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
}
- virtual void set_library_version(version_type archive_library_version){
+ virtual void set_library_version(library_version_type archive_library_version){
ArchiveImplementation::set_library_version(archive_library_version);
}
- virtual unsigned int get_library_version() const{
+ virtual library_version_type get_library_version() const{
return ArchiveImplementation::get_library_version();
}
virtual unsigned int get_flags() const {
Modified: branches/release/boost/archive/detail/polymorphic_oarchive_route.hpp
==============================================================================
--- branches/release/boost/archive/detail/polymorphic_oarchive_route.hpp (original)
+++ branches/release/boost/archive/detail/polymorphic_oarchive_route.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -138,7 +138,7 @@
ArchiveImplementation::save(t);
}
#endif
- virtual unsigned int get_library_version() const{
+ virtual library_version_type get_library_version() const{
return ArchiveImplementation::get_library_version();
}
virtual unsigned int get_flags() const {
Modified: branches/release/boost/archive/impl/basic_binary_iarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_binary_iarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_binary_iarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -16,6 +16,8 @@
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::memcpy;
+ using ::strlen;
+ using ::size_t;
}
#endif
@@ -48,7 +50,24 @@
basic_binary_iarchive<Archive>::init(){
// read signature in an archive version independent manner
std::string file_signature;
- * this->This() >> file_signature;
+ try {
+ std::size_t l;
+ this->This()->load(l);
+ if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
+ // borland de-allocator fixup
+ #if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
+ if(NULL != file_signature.data())
+ #endif
+ file_signature.resize(l);
+ // note breaking a rule here - could be a problem on some platform
+ if(0 < l)
+ this->This()->load_binary(&(*file_signature.begin()), l);
+ }
+ }
+ catch(archive_exception const &) { // catch stream_error archive exceptions
+ // will cause invalid_signature archive exception to be thrown below
+ file_signature = "";
+ }
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
boost::serialization::throw_exception(
archive_exception(archive_exception::invalid_signature)
@@ -56,7 +75,7 @@
// make sure the version of the reading archive library can
// support the format of the archive being read
- version_type input_library_version;
+ library_version_type input_library_version;
* this->This() >> input_library_version;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
@@ -68,8 +87,7 @@
basic_iarchive::set_library_version(input_library_version);
#endif
- // extra little .t is to get around borland quirk
- if(BOOST_ARCHIVE_VERSION() < input_library_version.t)
+ if(BOOST_ARCHIVE_VERSION() < input_library_version)
boost::serialization::throw_exception(
archive_exception(archive_exception::unsupported_version)
);
Modified: branches/release/boost/archive/impl/basic_binary_oarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_binary_oarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_binary_oarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -38,7 +38,7 @@
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
* this->This() << file_signature;
// write library version
- const version_type v(BOOST_ARCHIVE_VERSION());
+ const library_version_type v(BOOST_ARCHIVE_VERSION());
* this->This() << v;
}
Modified: branches/release/boost/archive/impl/basic_binary_oprimitive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_binary_oprimitive.ipp (original)
+++ branches/release/boost/archive/impl/basic_binary_oprimitive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -81,6 +81,7 @@
this->This()->save(l);
save_binary(ws, l * sizeof(wchar_t) / sizeof(char));
}
+#endif
#ifndef BOOST_NO_STD_WSTRING
template<class Archive, class Elem, class Tr>
@@ -92,7 +93,6 @@
save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char));
}
#endif
-#endif
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
Modified: branches/release/boost/archive/impl/basic_text_iarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_text_iarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_text_iarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -19,7 +19,7 @@
#endif
#include <boost/detail/workaround.hpp>
-
+#include <boost/serialization/string.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
namespace boost {
@@ -27,6 +27,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// implementation of text_text_archive
+
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_text_iarchive<Archive>::load_override(class_name_type & t, int){
@@ -55,7 +56,7 @@
// make sure the version of the reading archive library can
// support the format of the archive being read
- version_type input_library_version;
+ library_version_type input_library_version;
* this->This() >> input_library_version;
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
Modified: branches/release/boost/archive/impl/basic_text_iprimitive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_text_iprimitive.ipp (original)
+++ branches/release/boost/archive/impl/basic_text_iprimitive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -70,7 +70,7 @@
if(is.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
);
// convert from base64 to binary
typedef BOOST_DEDUCED_TYPENAME
Modified: branches/release/boost/archive/impl/basic_text_oarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_text_oarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_text_oarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -54,7 +54,7 @@
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
* this->This() << file_signature;
// write library version
- const version_type v(BOOST_ARCHIVE_VERSION());
+ const library_version_type v(BOOST_ARCHIVE_VERSION());
* this->This() << v;
}
Modified: branches/release/boost/archive/impl/basic_text_oprimitive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_text_oprimitive.ipp (original)
+++ branches/release/boost/archive/impl/basic_text_oprimitive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -37,7 +37,7 @@
if(os.fail())
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::output_stream_error)
);
os.put('\n');
Modified: branches/release/boost/archive/impl/basic_xml_grammar.hpp
==============================================================================
--- branches/release/boost/archive/impl/basic_xml_grammar.hpp (original)
+++ branches/release/boost/archive/impl/basic_xml_grammar.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -169,9 +169,12 @@
struct return_values {
StringType object_name;
StringType contents;
- class_id_type class_id;
- object_id_type object_id;
- version_type version;
+ //class_id_type class_id;
+ int_least16_t class_id;
+ //object_id_type object_id;
+ uint_least32_t object_id;
+ //version_type version;
+ unsigned int version;
tracking_type tracking_level;
StringType class_name;
return_values() :
Modified: branches/release/boost/archive/impl/basic_xml_iarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_xml_iarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_xml_iarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -32,7 +32,7 @@
bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is());
if(true != result){
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
);
}
// don't check start tag at highest level
@@ -49,7 +49,7 @@
bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is());
if(true != result){
boost::serialization::throw_exception(
- archive_exception(archive_exception::stream_error)
+ archive_exception(archive_exception::input_stream_error)
);
}
@@ -79,19 +79,19 @@
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_iarchive<Archive>::load_override(object_id_type & t, int){
- t = this->This()->gimpl->rv.object_id;
+ t = object_id_type(this->This()->gimpl->rv.object_id);
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_iarchive<Archive>::load_override(version_type & t, int){
- t = this->This()->gimpl->rv.version;
+ t = version_type(this->This()->gimpl->rv.version);
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_iarchive<Archive>::load_override(class_id_type & t, int){
- t = this->This()->gimpl->rv.class_id;
+ t = class_id_type(this->This()->gimpl->rv.class_id);
}
template<class Archive>
Modified: branches/release/boost/archive/impl/basic_xml_oarchive.ipp
==============================================================================
--- branches/release/boost/archive/impl/basic_xml_oarchive.ipp (original)
+++ branches/release/boost/archive/impl/basic_xml_oarchive.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -168,7 +168,7 @@
basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
{
int i = t.t; // extra .t is for borland
- write_attribute(VBOOST_ARCHIVE_XML_ERSION(), i);
+ write_attribute(BOOST_ARCHIVE_XML_VERSION(), i);
}
#endif
Modified: branches/release/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- branches/release/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ branches/release/boost/archive/impl/xml_iarchive_impl.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -112,7 +112,7 @@
}
*ws = L'\0';
}
-#endif
+#endif // BOOST_NO_INTRINSIC_WCHAR_T
#endif // BOOST_NO_CWCHAR
@@ -157,7 +157,7 @@
xml_iarchive_impl<Archive>::init(){
gimpl->init(is);
this->set_library_version(
- version_type(gimpl->rv.version)
+ library_version_type(gimpl->rv.version)
);
}
Modified: branches/release/boost/archive/impl/xml_wiarchive_impl.ipp
==============================================================================
--- branches/release/boost/archive/impl/xml_wiarchive_impl.ipp (original)
+++ branches/release/boost/archive/impl/xml_wiarchive_impl.ipp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -147,7 +147,7 @@
xml_wiarchive_impl<Archive>::init(){
gimpl->init(is);
this->set_library_version(
- version_type(gimpl->rv.version)
+ library_version_type(gimpl->rv.version)
);
}
Modified: branches/release/boost/archive/iterators/head_iterator.hpp
==============================================================================
--- branches/release/boost/archive/iterators/head_iterator.hpp (original)
+++ branches/release/boost/archive/iterators/head_iterator.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -16,7 +16,6 @@
// See http://www.boost.org for updates, documentation, and revision history.
-#include <boost/type_traits/is_same.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
#include <boost/iterator/iterator_traits.hpp>
Modified: branches/release/boost/archive/polymorphic_iarchive.hpp
==============================================================================
--- branches/release/boost/archive/polymorphic_iarchive.hpp (original)
+++ branches/release/boost/archive/polymorphic_iarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -111,12 +111,12 @@
// special treatment for name-value pairs.
template<class T>
void load_override(
- #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
- const
- #endif
- boost::serialization::nvp<T> & t,
- int
- ){
+ #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
+ const
+ #endif
+ boost::serialization::nvp<T> & t,
+ int
+ ){
load_start(t.name());
archive::load(* this->This(), t.value());
load_end(t.name());
@@ -125,8 +125,8 @@
virtual ~polymorphic_iarchive_impl(){};
public:
// utility function implemented by all legal archives
- virtual void set_library_version(version_type archive_library_version) = 0;
- virtual unsigned int get_library_version() const = 0;
+ virtual void set_library_version(library_version_type archive_library_version) = 0;
+ virtual library_version_type get_library_version() const = 0;
virtual unsigned int get_flags() const = 0;
virtual void delete_created_pointers() = 0;
virtual void reset_object_address(
Modified: branches/release/boost/archive/polymorphic_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/polymorphic_oarchive.hpp (original)
+++ branches/release/boost/archive/polymorphic_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -127,7 +127,7 @@
public:
// utility functions implemented by all legal archives
virtual unsigned int get_flags() const = 0;
- virtual unsigned int get_library_version() const = 0;
+ virtual library_version_type get_library_version() const = 0;
virtual void save_binary(const void * t, std::size_t size) = 0;
virtual void save_object(
Modified: branches/release/boost/archive/text_wiarchive.hpp
==============================================================================
--- branches/release/boost/archive/text_wiarchive.hpp (original)
+++ branches/release/boost/archive/text_wiarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -27,6 +27,7 @@
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -55,6 +56,16 @@
void load(T & t){
basic_text_iprimitive<std::wistream>::load(t);
}
+ void load(version_type & t){
+ unsigned int v;
+ load(v);
+ t = version_type(v);
+ }
+ void load(boost::serialization::item_version_type & t){
+ unsigned int v;
+ load(v);
+ t = boost::serialization::item_version_type(v);
+ }
BOOST_WARCHIVE_DECL(void)
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: branches/release/boost/archive/text_woarchive.hpp
==============================================================================
--- branches/release/boost/archive/text_woarchive.hpp (original)
+++ branches/release/boost/archive/text_woarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -35,6 +35,7 @@
#include <boost/archive/basic_text_oprimitive.hpp>
#include <boost/archive/basic_text_oarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -64,6 +65,12 @@
this->newtoken();
basic_text_oprimitive<std::wostream>::save(t);
}
+ void save(const version_type & t){
+ save(static_cast<const unsigned int>(t));
+ }
+ void save(const boost::serialization::item_version_type & t){
+ save(static_cast<const unsigned int>(t));
+ }
BOOST_WARCHIVE_DECL(void)
save(const char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: branches/release/boost/archive/xml_oarchive.hpp
==============================================================================
--- branches/release/boost/archive/xml_oarchive.hpp (original)
+++ branches/release/boost/archive/xml_oarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -61,6 +61,7 @@
void save(const T & t){
basic_text_oprimitive<std::ostream>::save(t);
}
+
BOOST_ARCHIVE_DECL(void)
save(const char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: branches/release/boost/archive/xml_wiarchive.hpp
==============================================================================
--- branches/release/boost/archive/xml_wiarchive.hpp (original)
+++ branches/release/boost/archive/xml_wiarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -28,6 +28,7 @@
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_xml_iarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -64,9 +65,22 @@
return is;
}
template<class T>
- void load(T & t){
+ void
+ load(T & t){
basic_text_iprimitive<std::wistream>::load(t);
}
+ void
+ load(version_type & t){
+ unsigned int v;
+ load(v);
+ t = version_type(v);
+ }
+ void
+ load(boost::serialization::item_version_type & t){
+ unsigned int v;
+ load(v);
+ t = boost::serialization::item_version_type(v);
+ }
BOOST_WARCHIVE_DECL(void)
load(char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Modified: branches/release/boost/archive/xml_woarchive.hpp
==============================================================================
--- branches/release/boost/archive/xml_woarchive.hpp (original)
+++ branches/release/boost/archive/xml_woarchive.hpp 2010-07-09 12:48:52 EDT (Fri, 09 Jul 2010)
@@ -34,6 +34,7 @@
#include <boost/archive/basic_text_oprimitive.hpp>
#include <boost/archive/basic_xml_oarchive.hpp>
#include <boost/archive/detail/register_archive.hpp>
+#include <boost/serialization/item_version_type.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -45,14 +46,6 @@
namespace boost {
namespace archive {
-#if 0
-BOOST_WARCHIVE_DECL(std::wostream &)
-operator<<(std::wostream &os, const char *t);
-
-BOOST_WARCHIVE_DECL(std::wostream &)
-operator<<(std::wostream &os, const char t);
-#endif
-
template<class Archive>
class xml_woarchive_impl :
public basic_text_oprimitive<std::wostream>,
@@ -74,6 +67,14 @@
save(const T & t){
basic_text_oprimitive<std::wostream>::save(t);
}
+ void
+ save(const version_type & t){
+ save(static_cast<const unsigned int>(t));
+ }
+ void
+ save(const boost::serialization::item_version_type & t){
+ save(static_cast<const unsigned int>(t));
+ }
BOOST_WARCHIVE_DECL(void)
save(const char * t);
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk