source: NonGTP/Boost/boost/serialization/string.hpp @ 857

Revision 857, 2.9 KB checked in by igarcia, 18 years ago (diff)
Line 
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
25BOOST_CLASS_IMPLEMENTATION(std::string, boost::serialization::primitive_type)
26#ifndef BOOST_NO_STD_WSTRING
27BOOST_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// function specializations must be defined in the appropriate
38// namespace - boost::serialization
39#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
40#define STD _STLP_STD
41#else
42#define STD std
43#endif
44
45namespace boost {
46namespace serialization {
47
48// basic_string - general case
49template<class Archive, class U, class Allocator>
50inline void save(
51    Archive & ar,
52    const STD::basic_string<U, Allocator> &t,
53    const unsigned int file_version
54){
55    boost::serialization::stl::save_collection<
56        Archive, STD::basic_string<U, Allocator>
57    >(ar, t);
58}
59
60template<class Archive, class U, class Allocator>
61inline void load(
62    Archive & ar,
63    STD::basic_string<U, Allocator> &t,
64    const unsigned int file_version
65){
66    boost::serialization::stl::load_collection<
67        Archive,
68        STD::basic_string<U, Allocator>,
69        boost::serialization::stl::archive_input_seq<
70            Archive,
71            STD::basic_string<U, Allocator>
72        >,
73        boost::serialization::stl::reserve_imp<
74            STD::basic_string<U, Allocator>
75        >
76    >(ar, t);
77}
78
79// split non-intrusive serialization function member into separate
80// non intrusive save/load member functions
81template<class Archive, class U, class Allocator>
82inline void serialize(
83    Archive & ar,
84    STD::basic_string<U, Allocator> & t,
85    const unsigned int file_version
86){
87    boost::serialization::split_free(ar, t, file_version);
88}
89
90} // serialization
91} // namespace boost
92
93#include <boost/serialization/collection_traits.hpp>
94
95BOOST_SERIALIZATION_COLLECTION_TRAITS(STD::vector)
96#undef STD
97
98#endif
99
100#endif // BOOST_SERIALIZATION_STRING_HPP
Note: See TracBrowser for help on using the repository browser.