Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62785 - in trunk/boost: archive archive/impl archive/iterators serialization
From: ramey_at_[hidden]
Date: 2010-06-11 00:11:24


Author: ramey
Date: 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
New Revision: 62785
URL: http://svn.boost.org/trac/boost/changeset/62785

Log:
fix #3 for version_type
Text files modified:
   trunk/boost/archive/basic_archive.hpp | 16 ++++++++++------
   trunk/boost/archive/basic_text_iarchive.hpp | 16 ----------------
   trunk/boost/archive/basic_text_oarchive.hpp | 9 ---------
   trunk/boost/archive/impl/basic_binary_oprimitive.ipp | 2 +-
   trunk/boost/archive/impl/text_iarchive_impl.ipp | 2 +-
   trunk/boost/archive/impl/text_oarchive_impl.ipp | 2 +-
   trunk/boost/archive/impl/xml_iarchive_impl.ipp | 2 +-
   trunk/boost/archive/impl/xml_oarchive_impl.ipp | 20 ++++++++++----------
   trunk/boost/archive/iterators/head_iterator.hpp | 1 -
   trunk/boost/archive/text_wiarchive.hpp | 12 ++++++++----
   trunk/boost/archive/text_woarchive.hpp | 7 +++++++
   trunk/boost/archive/xml_iarchive.hpp | 6 ------
   trunk/boost/archive/xml_oarchive.hpp | 5 -----
   trunk/boost/archive/xml_wiarchive.hpp | 18 +++++++++++++-----
   trunk/boost/archive/xml_woarchive.hpp | 18 +++++++-----------
   trunk/boost/serialization/collection_size_type.hpp | 4 ++++
   trunk/boost/serialization/item_version_type.hpp | 14 +++++++++-----
   17 files changed, 72 insertions(+), 82 deletions(-)

Modified: trunk/boost/archive/basic_archive.hpp
==============================================================================
--- trunk/boost/archive/basic_archive.hpp (original)
+++ trunk/boost/archive/basic_archive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -55,11 +55,11 @@
         return *this;
     }
     // used for text output
- operator const unsigned int () const {
+ operator const base_type () const {
         return t;
     }
- // used for text output
- operator uint_least16_t & (){
+ // used for text input
+ operator base_type & (){
         return t;
     }
     bool operator==(const library_version_type & rhs) const {
@@ -90,7 +90,11 @@
         return *this;
     }
     // used for text output
- operator const unsigned int () const {
+ operator const base_type () const {
+ return t;
+ }
+ // used for text intput
+ operator base_type & (){
         return t;
     }
     bool operator==(const version_type & rhs) const {
@@ -111,7 +115,7 @@
         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);
+ // assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
     class_id_type(const class_id_type & t_) :
         t(t_.t)
@@ -156,7 +160,7 @@
         return *this;
     }
     // used for text output
- operator const unsigned int () const {
+ operator const uint_least32_t () const {
         return t;
     }
     // used for text input

Modified: trunk/boost/archive/basic_text_iarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_iarchive.hpp (original)
+++ trunk/boost/archive/basic_text_iarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -30,8 +30,6 @@
 
 #include <boost/archive/detail/common_iarchive.hpp>
 
-#include <boost/serialization/item_version_type.hpp>
-
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
 #ifdef BOOST_MSVC
@@ -69,20 +67,6 @@
     // text file don't include the optional information
     void load_override(class_id_optional_type & /*t*/, int){}
 
- void load_override(version_type & t, int){
- unsigned int v;
- load_override(v, 0);
- t = version_type(v);
- }
- void load_override(
- boost::serialization::item_version_type & t,
- int
- ){
- unsigned int v;
- load_override(v, 0);
- t = boost::serialization::item_version_type(v);
- }
-
     BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
     load_override(class_name_type & t, int);
 

Modified: trunk/boost/archive/basic_text_oarchive.hpp
==============================================================================
--- trunk/boost/archive/basic_text_oarchive.hpp (original)
+++ trunk/boost/archive/basic_text_oarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -31,7 +31,6 @@
 
 #include <boost/archive/detail/common_oarchive.hpp>
 #include <boost/serialization/string.hpp>
-#include <boost/serialization/item_version_type.hpp>
 
 #include <boost/archive/detail/abi_prefix.hpp> // must be the last header
 
@@ -87,14 +86,6 @@
         this->detail_common_oarchive::save_override(t, 0);
     }
 
- void save_override(const version_type & t, int){
- const unsigned int x = t;
- * this->This() << x;
- }
- void save_override(const boost::serialization::item_version_type & t, int){
- const unsigned int x = t;
- * this->This() << x;
- }
     // text file don't include the optional information
     void save_override(const class_id_optional_type & /* t */, int){}
 

Modified: trunk/boost/archive/impl/basic_binary_oprimitive.ipp
==============================================================================
--- trunk/boost/archive/impl/basic_binary_oprimitive.ipp (original)
+++ trunk/boost/archive/impl/basic_binary_oprimitive.ipp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 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: trunk/boost/archive/impl/text_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_iarchive_impl.ipp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -71,6 +71,7 @@
     ws[size] = L'\0';
 }
 #endif // BOOST_NO_INTRINSIC_WCHAR_T
+#endif // BOOST_NO_CWCHAR
 
 #ifndef BOOST_NO_STD_WSTRING
 template<class Archive>
@@ -90,7 +91,6 @@
 }
 
 #endif // BOOST_NO_STD_WSTRING
-#endif // BOOST_NO_CWCHAR
 
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)

Modified: trunk/boost/archive/impl/text_oarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/text_oarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/text_oarchive_impl.ipp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -69,6 +69,7 @@
     os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char));
 }
 #endif
+#endif // BOOST_NO_CWCHAR
 
 #ifndef BOOST_NO_STD_WSTRING
 template<class Archive>
@@ -81,7 +82,6 @@
     os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char));
 }
 #endif
-#endif // BOOST_NO_CWCHAR
 
 template<class Archive>
 BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY())

Modified: trunk/boost/archive/impl/xml_iarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_iarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_iarchive_impl.ipp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -48,7 +48,6 @@
 
 // wide char stuff used by char archives
 
-#ifndef BOOST_NO_CWCHAR
 #ifndef BOOST_NO_STD_WSTRING
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)
@@ -83,6 +82,7 @@
 }
 #endif // BOOST_NO_STD_WSTRING
 
+#ifndef BOOST_NO_CWCHAR
 #ifndef BOOST_NO_INTRINSIC_WCHAR_T
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)

Modified: trunk/boost/archive/impl/xml_oarchive_impl.ipp
==============================================================================
--- trunk/boost/archive/impl/xml_oarchive_impl.ipp (original)
+++ trunk/boost/archive/impl/xml_oarchive_impl.ipp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -48,6 +48,16 @@
     );
 }
 
+#ifndef BOOST_NO_INTRINSIC_WCHAR_T
+template<class Archive>
+BOOST_ARCHIVE_DECL(void)
+xml_oarchive_impl<Archive>::save(const wchar_t * ws){
+ save_iterator(os, ws, ws + std::wcslen(ws));
+}
+#endif
+
+#endif // BOOST_NO_CWCHAR
+
 #ifndef BOOST_NO_STD_WSTRING
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)
@@ -59,16 +69,6 @@
 }
 #endif
 
-#ifndef BOOST_NO_INTRINSIC_WCHAR_T
-template<class Archive>
-BOOST_ARCHIVE_DECL(void)
-xml_oarchive_impl<Archive>::save(const wchar_t * ws){
- save_iterator(os, ws, ws + std::wcslen(ws));
-}
-#endif
-
-#endif // BOOST_NO_CWCHAR
-
 template<class Archive>
 BOOST_ARCHIVE_DECL(void)
 xml_oarchive_impl<Archive>::save(const std::string & s){

Modified: trunk/boost/archive/iterators/head_iterator.hpp
==============================================================================
--- trunk/boost/archive/iterators/head_iterator.hpp (original)
+++ trunk/boost/archive/iterators/head_iterator.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 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: trunk/boost/archive/text_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/text_wiarchive.hpp (original)
+++ trunk/boost/archive/text_wiarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -27,7 +27,6 @@
 #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
@@ -57,10 +56,15 @@
     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 x;
- basic_text_iprimitive<std::wistream>::load(x);
- t = boost::serialization::item_version_type(x);
+ unsigned int v;
+ load(v);
+ t = boost::serialization::item_version_type(v);
     }
     BOOST_WARCHIVE_DECL(void)
     load(char * t);

Modified: trunk/boost/archive/text_woarchive.hpp
==============================================================================
--- trunk/boost/archive/text_woarchive.hpp (original)
+++ trunk/boost/archive/text_woarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 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: trunk/boost/archive/xml_iarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_iarchive.hpp (original)
+++ trunk/boost/archive/xml_iarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -23,7 +23,6 @@
 #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,11 +63,6 @@
     void load(T & t){
         basic_text_iprimitive<std::istream>::load(t);
     }
- void load(boost::serialization::item_version_type & t){
- unsigned int v;
- basic_text_iprimitive<std::istream>::load(v);
- t = boost::serialization::item_version_type(v);
- }
     BOOST_ARCHIVE_DECL(void)
     load(char * t);
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T

Modified: trunk/boost/archive/xml_oarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_oarchive.hpp (original)
+++ trunk/boost/archive/xml_oarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -30,7 +30,6 @@
 #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
 
@@ -63,10 +62,6 @@
         basic_text_oprimitive<std::ostream>::save(t);
     }
 
- void save(const boost::serialization::item_version_type & t){
- const unsigned int x = t;
- basic_text_oprimitive<std::ostream>::save(x);
- }
     BOOST_ARCHIVE_DECL(void)
     save(const char * t);
     #ifndef BOOST_NO_INTRINSIC_WCHAR_T

Modified: trunk/boost/archive/xml_wiarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_wiarchive.hpp (original)
+++ trunk/boost/archive/xml_wiarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -65,13 +65,21 @@
         return is;
     }
     template<class T>
- void load(T & t){
+ void
+ load(T & t){
         basic_text_iprimitive<std::wistream>::load(t);
     }
- void load(boost::serialization::item_version_type & t){
- unsigned int x;
- basic_text_iprimitive<std::wistream>::load(x);
- t = boost::serialization::item_version_type(x);
+ 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);

Modified: trunk/boost/archive/xml_woarchive.hpp
==============================================================================
--- trunk/boost/archive/xml_woarchive.hpp (original)
+++ trunk/boost/archive/xml_woarchive.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -46,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>,
@@ -75,9 +67,13 @@
     save(const T & t){
         basic_text_oprimitive<std::wostream>::save(t);
     }
- void save(const boost::serialization::item_version_type & t){
- const unsigned int x = t;
- basic_text_oprimitive<std::wostream>::save(x);
+ void
+ save(const version_type & t){
+ save(static_cast<const unsigned int>(t));
+ }
+ void
+ save(const boost::serialization::version_type & t){
+ save(static_cast<const unsigned int>(t));
     }
     BOOST_WARCHIVE_DECL(void)
     save(const char * t);

Modified: trunk/boost/serialization/collection_size_type.hpp
==============================================================================
--- trunk/boost/serialization/collection_size_type.hpp (original)
+++ trunk/boost/serialization/collection_size_type.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -32,6 +32,10 @@
         t = rhs.t;
         return *this;
     }
+ collection_size_type & operator=(const unsigned int & rhs){
+ t = rhs;
+ return *this;
+ }
     // used for text output
     operator const base_type () const {
         return t;

Modified: trunk/boost/serialization/item_version_type.hpp
==============================================================================
--- trunk/boost/serialization/item_version_type.hpp (original)
+++ trunk/boost/serialization/item_version_type.hpp 2010-06-11 00:11:22 EDT (Fri, 11 Jun 2010)
@@ -7,7 +7,7 @@
 // http://www.boost.org/LICENSE_1_0.txt)
 
 #include <boost/cstdint.hpp> // uint_least8_t
-#include <boost/operators.hpp>
+#include <boost/integer_traits.hpp>
 #include <boost/serialization/level.hpp>
 #include <boost/serialization/is_bitwise_serializable.hpp>
 
@@ -25,26 +25,30 @@
     base_type t;
     item_version_type(): t(0) {};
 public:
- explicit item_version_type(const unsigned int & t_) : t(t_){
+ explicit item_version_type(const unsigned int t_) : t(t_){
         assert(t_ <= boost::integer_traits<base_type>::const_max);
     }
     item_version_type(const item_version_type & t_) :
         t(t_.t)
     {}
- item_version_type & operator=(const item_version_type & rhs){
+ item_version_type & operator=(item_version_type rhs){
         t = rhs.t;
         return *this;
     }
     // used for text output
- operator const unsigned int () const {
+ operator const base_type () const {
         return t;
     }
+ // used for text output
+ operator base_type & () {
+ return t;
+ }
     bool operator==(const item_version_type & rhs) const {
         return t == rhs.t;
     }
     bool operator<(const item_version_type & rhs) const {
         return t < rhs.t;
- }
+ }
 };
 
 #if defined(_MSC_VER)


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