-
Notifications
You must be signed in to change notification settings - Fork 0
/
dbstring_boost_serialization.h
50 lines (39 loc) · 1.57 KB
/
dbstring_boost_serialization.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
Copyright (C) 2017,2018 Blaise Dias
This is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BENEDIAS_DB_STRING_BOOST_SERIALIZATION_H_INCLUDED
#define BENEDIAS_DB_STRING_BOOST_SERIALIZATION_H_INCLUDED
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
BOOST_SERIALIZATION_SPLIT_FREE(benedias::sharedobj_ptr<benedias::memdb::dbstring>)
namespace boost {
namespace serialization {
void save(boost::archive::text_oarchive& ar,
const benedias::sharedobj_ptr<benedias::memdb::dbstring>& spdbs,
const boost::serialization::version_type& version)
{
std::string str = spdbs->std_str();
ar & str;
}
void load(boost::archive::text_iarchive& ar,
benedias::sharedobj_ptr<benedias::memdb::dbstring>& spdbs,
const boost::serialization::version_type& version)
{
std::string tmp;
ar & tmp;
benedias::sharedobj_ptr<benedias::memdb::dbstring> sp = benedias::memdb::dbstring::make_sharedobj(tmp);
spdbs = sp;
}
} // namespace serialization
} // namespace boost
#endif