32#ifdef _QX_ENABLE_BOOST_SERIALIZATION
33#ifndef _QX_SERIALIZE_QWEAKPOINTER_H_
34#define _QX_SERIALIZE_QWEAKPOINTER_H_
40#include <boost/serialization/serialization.hpp>
41#include <boost/serialization/split_free.hpp>
42#include <boost/serialization/nvp.hpp>
44#include <QtCore/QWeakPointer>
49namespace serialization {
51template <
class Archive,
typename T>
52inline void save(Archive & ar,
const QWeakPointer<T> & t,
const unsigned int file_version)
54 Q_UNUSED(file_version);
55 QSharedPointer<T> ptr = t.toStrongRef();
56 ar << boost::serialization::make_nvp(
"qt_weak_ptr", ptr);
59template <
class Archive,
typename T>
60inline void load(Archive & ar, QWeakPointer<T> & t,
const unsigned int file_version)
62 Q_UNUSED(file_version);
63 QSharedPointer<T> ptr;
64 ar >> boost::serialization::make_nvp(
"qt_weak_ptr", ptr);
65 t = QWeakPointer<T>(ptr);
68template <
class Archive,
typename T>
69inline void serialize(Archive & ar, QWeakPointer<T> & t,
const unsigned int file_version)
71 boost::serialization::split_free(ar, t, file_version);
void serialize(Archive &ar, boost::tuple< T0, T1 > &t, const unsigned int file_version)
void load(Archive &ar, boost::unordered_map< Key, Value > &t, const unsigned int)
void save(Archive &ar, const boost::unordered_map< Key, Value > &t, const unsigned int)