File indexing completed on 2025-01-18 09:50:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROPERTY_TREE_PTREE_SERIALIZATION_HPP_INCLUDED
0011 #define BOOST_PROPERTY_TREE_PTREE_SERIALIZATION_HPP_INCLUDED
0012
0013 #include <boost/property_tree/ptree.hpp>
0014
0015 #include <boost/serialization/nvp.hpp>
0016 #include <boost/serialization/collections_save_imp.hpp>
0017 #include <boost/serialization/detail/stack_constructor.hpp>
0018 #include <boost/serialization/split_free.hpp>
0019 #include <boost/serialization/utility.hpp>
0020 #include <boost/serialization/library_version_type.hpp>
0021
0022 namespace boost { namespace property_tree
0023 {
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 template<class Archive, class K, class D, class C>
0043 inline void save(Archive &ar,
0044 const basic_ptree<K, D, C> &t,
0045 const unsigned int file_version)
0046 {
0047 using namespace boost::serialization;
0048 stl::save_collection<Archive, basic_ptree<K, D, C> >(ar, t);
0049 ar << make_nvp("data", t.data());
0050 }
0051
0052 namespace detail
0053 {
0054 template <class Archive, class K, class D, class C>
0055 inline void load_children(Archive &ar,
0056 basic_ptree<K, D, C> &t)
0057 {
0058 namespace bsl = boost::serialization;
0059
0060 typedef basic_ptree<K, D, C> tree;
0061 typedef typename tree::value_type value_type;
0062
0063 bsl::collection_size_type count;
0064 ar >> BOOST_SERIALIZATION_NVP(count);
0065 bsl::item_version_type item_version(0);
0066 const bsl::library_version_type library_version(
0067 ar.get_library_version()
0068 );
0069 if(bsl::library_version_type(3) < library_version){
0070 ar >> BOOST_SERIALIZATION_NVP(item_version);
0071 }
0072
0073
0074
0075 t.clear();
0076 while(count-- > 0){
0077 bsl::detail::stack_construct<Archive, value_type>
0078 u(ar, item_version);
0079 ar >> bsl::make_nvp("item", u.reference());
0080 t.push_back(u.reference());
0081 ar.reset_object_address(& t.back() , & u.reference());
0082 }
0083 }
0084 }
0085
0086
0087
0088
0089
0090
0091
0092
0093
0094
0095
0096
0097
0098
0099 template<class Archive, class K, class D, class C>
0100 inline void load(Archive &ar,
0101 basic_ptree<K, D, C> &t,
0102 const unsigned int file_version)
0103 {
0104 namespace bsl = boost::serialization;
0105
0106 detail::load_children(ar, t);
0107 ar >> bsl::make_nvp("data", t.data());
0108 }
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118 template<class Archive, class K, class D, class C>
0119 inline void serialize(Archive &ar,
0120 basic_ptree<K, D, C> &t,
0121 const unsigned int file_version)
0122 {
0123 using namespace boost::serialization;
0124 split_free(ar, t, file_version);
0125 }
0126
0127 } }
0128
0129 #endif