32#ifdef _QX_ENABLE_BOOST_SERIALIZATION
33#ifndef _QX_SERIALIZE_QX_COLLECTION_H_
34#define _QX_SERIALIZE_QX_COLLECTION_H_
40#include <boost/serialization/serialization.hpp>
41#include <boost/serialization/split_free.hpp>
42#include <boost/serialization/nvp.hpp>
43#include <boost/serialization/utility.hpp>
48namespace serialization {
50template <
class Archive,
typename Key,
typename Value>
53 Q_UNUSED(file_version);
54 long lCount = t.
count();
55 ar << boost::serialization::make_nvp(
"count", lCount);
57 for (
long l = 0; l < lCount; l++)
60 ar << boost::serialization::make_nvp(
"item", pair_key_value);
64template <
class Archive,
typename Key,
typename Value>
67 Q_UNUSED(file_version);
69 ar >> boost::serialization::make_nvp(
"count", lCount);
73 std::pair<Key, Value> pair_key_value;
75 for (
long l = 0; l < lCount; l++)
77 ar >> boost::serialization::make_nvp(
"item", pair_key_value);
78 t.
insert(pair_key_value.first, pair_key_value.second);
82template <
class Archive,
typename Key,
typename Value>
85 boost::serialization::split_free(ar, t, file_version);
QxOrm thread-safe container (keep insertion order + quick access by index + quick access by key)
qx::QxCollection<Key, Value> : QxOrm thread-safe container (keep insertion order + quick access by in...
bool insert(const Key &key, const Value &value)
Add element 'value' at the end of the list indexed by 'key'.
const_reference_key getKeyByIndex(long index) const
Return the key associated with the element at index position 'index'.
void reserve(long size)
Request that the capacity of the allocated storage space for the items of the container be at least e...
long count() const
Return the number of items in the list (same as 'size()')
void clear()
Remove all items from the list.
const_reference_value getByIndex(long index) const
Return the item at index position 'index'.
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)