#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/iserializer.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/collections_save_imp.hpp>
Go to the source code of this file.
Defines | |
#define | PP_LABUST_CLEAN_ARRAY_ISERIALIZATOR_IMPL(CLASS_NAME) |
#define | PP_LABUST_CLEAN_ARRAY_OSERIALIZATOR_IMPL(CLASS_NAME) |
Functions | |
template<class Archive > | |
void | clean_string_serialize (Archive &ar, const std::string &s) |
#define PP_LABUST_CLEAN_ARRAY_ISERIALIZATOR_IMPL | ( | CLASS_NAME | ) |
namespace boost{namespace archive{namespace detail{ \ template<> \ struct load_array_type<CLASS_NAME> { \ template<class T> \ static void invoke(CLASS_NAME &ar, T &t){ \ typedef BOOST_DEDUCED_TYPENAME remove_extent< T >::type value_type; \ std::size_t current_count = sizeof(t) / ( \ static_cast<char *>(static_cast<void *>(&t[1])) \ - static_cast<char *>(static_cast<void *>(&t[0])) \ ); \ boost::serialization::collection_size_type count(current_count); \ ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count); \ } \ };\ }}};\
This is a specialization of the array loader to prevent writing the array length by default. It takes the generic save_array_type from the boost archive classes and comments the NVP notation.
Definition at line 76 of file clean_serializator.hpp.
#define PP_LABUST_CLEAN_ARRAY_OSERIALIZATOR_IMPL | ( | CLASS_NAME | ) |
namespace boost{namespace archive{namespace detail{ \ template<> \ struct save_array_type<CLASS_NAME> \ { \ template<class T> \ static void invoke(CLASS_NAME &ar, const T &t){ \ typedef BOOST_DEDUCED_TYPENAME boost::remove_extent< T >::type value_type; \ boost::archive::save_access::end_preamble(ar); \ std::size_t c = sizeof(t) / ( \ static_cast<const char *>(static_cast<const void *>(&t[1])) \ - static_cast<const char *>(static_cast<const void *>(&t[0])) \ ); \ boost::serialization::collection_size_type count(c); \ ar << boost::serialization::make_array(static_cast<value_type const*>(&t[0]),count); \ } \ };}}};
This is a specialization of the array saver to prevent writing the array length by default. It takes the generic save_array_type from the boost archive classes and comments the NVP notation.
Definition at line 52 of file clean_serializator.hpp.
void clean_string_serialize | ( | Archive & | ar, |
const std::string & | s | ||
) |
This is brute-force method for clean serialization of std::string.
Definition at line 97 of file clean_serializator.hpp.