| 1 | #ifndef  BOOST_SERIALIZATION_STRING_HPP | 
|---|
| 2 | #define BOOST_SERIALIZATION_STRING_HPP | 
|---|
| 3 |  | 
|---|
| 4 | // MS compatible compilers support #pragma once | 
|---|
| 5 | #if defined(_MSC_VER) && (_MSC_VER >= 1020) | 
|---|
| 6 | # pragma once | 
|---|
| 7 | #endif | 
|---|
| 8 |  | 
|---|
| 9 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | 
|---|
| 10 | // serialization/string.hpp: | 
|---|
| 11 | // serialization for stl string templates | 
|---|
| 12 |  | 
|---|
| 13 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .  | 
|---|
| 14 | // Use, modification and distribution is subject to the Boost Software | 
|---|
| 15 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | 
|---|
| 16 | // http://www.boost.org/LICENSE_1_0.txt) | 
|---|
| 17 |  | 
|---|
| 18 | //  See http://www.boost.org for updates, documentation, and revision history. | 
|---|
| 19 |  | 
|---|
| 20 | #include <string> | 
|---|
| 21 |  | 
|---|
| 22 | #include <boost/config.hpp> | 
|---|
| 23 | #include <boost/serialization/level.hpp> | 
|---|
| 24 |  | 
|---|
| 25 | BOOST_CLASS_IMPLEMENTATION(std::string, boost::serialization::primitive_type) | 
|---|
| 26 | #ifndef BOOST_NO_STD_WSTRING | 
|---|
| 27 | BOOST_CLASS_IMPLEMENTATION(std::wstring, boost::serialization::primitive_type) | 
|---|
| 28 | #endif | 
|---|
| 29 |  | 
|---|
| 30 | // left over from a previous incarnation - strings are now always primitive types | 
|---|
| 31 | #if 0  | 
|---|
| 32 | #include <string> | 
|---|
| 33 | #include <boost/serialization/collections_save_imp.hpp> | 
|---|
| 34 | #include <boost/serialization/collections_load_imp.hpp> | 
|---|
| 35 | #include <boost/serialization/split_free.hpp> | 
|---|
| 36 |  | 
|---|
| 37 | namespace boost {  | 
|---|
| 38 | namespace serialization { | 
|---|
| 39 |  | 
|---|
| 40 | // basic_string - general case | 
|---|
| 41 | template<class Archive, class U, class Allocator> | 
|---|
| 42 | inline void save( | 
|---|
| 43 |     Archive & ar, | 
|---|
| 44 |     const std::basic_string<U, Allocator> &t, | 
|---|
| 45 |     const unsigned int file_version | 
|---|
| 46 | ){ | 
|---|
| 47 |     boost::serialization::stl::save_collection< | 
|---|
| 48 |         Archive, std::basic_string<U, Allocator>  | 
|---|
| 49 |     >(ar, t); | 
|---|
| 50 | } | 
|---|
| 51 |  | 
|---|
| 52 | template<class Archive, class U, class Allocator> | 
|---|
| 53 | inline void load( | 
|---|
| 54 |     Archive & ar, | 
|---|
| 55 |     std::basic_string<U, Allocator> &t, | 
|---|
| 56 |     const unsigned int file_version | 
|---|
| 57 | ){ | 
|---|
| 58 |     boost::serialization::stl::load_collection< | 
|---|
| 59 |         Archive, | 
|---|
| 60 |         std::basic_string<U, Allocator>, | 
|---|
| 61 |         boost::serialization::stl::archive_input_seq< | 
|---|
| 62 |             Archive,  | 
|---|
| 63 |             std::basic_string<U, Allocator>  | 
|---|
| 64 |         >, | 
|---|
| 65 |         boost::serialization::stl::reserve_imp< | 
|---|
| 66 |             std::basic_string<U, Allocator>  | 
|---|
| 67 |         > | 
|---|
| 68 |     >(ar, t); | 
|---|
| 69 | } | 
|---|
| 70 |  | 
|---|
| 71 | // split non-intrusive serialization function member into separate | 
|---|
| 72 | // non intrusive save/load member functions | 
|---|
| 73 | template<class Archive, class U, class Allocator> | 
|---|
| 74 | inline void serialize( | 
|---|
| 75 |     Archive & ar, | 
|---|
| 76 |     std::basic_string<U, Allocator> & t, | 
|---|
| 77 |     const unsigned int file_version | 
|---|
| 78 | ){ | 
|---|
| 79 |     boost::serialization::split_free(ar, t, file_version); | 
|---|
| 80 | } | 
|---|
| 81 |  | 
|---|
| 82 | } // serialization | 
|---|
| 83 | } // namespace boost | 
|---|
| 84 |  | 
|---|
| 85 | #include <boost/serialization/collection_traits.hpp> | 
|---|
| 86 |  | 
|---|
| 87 | BOOST_SERIALIZATION_COLLECTION_TRAITS(std::vector) | 
|---|
| 88 |  | 
|---|
| 89 | #endif | 
|---|
| 90 |  | 
|---|
| 91 | #endif // BOOST_SERIALIZATION_STRING_HPP | 
|---|