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