first commit
This commit is contained in:
237
include/QxSerialize/boost/QxExportDllBoostArchive.h
Normal file
237
include/QxSerialize/boost/QxExportDllBoostArchive.h
Normal file
@@ -0,0 +1,237 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_EXPORT_DLL_BOOST_ARCHIVE_H_
|
||||
#define _QX_EXPORT_DLL_BOOST_ARCHIVE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#if _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
#if (!_QX_BUILDING_QX_ORM)
|
||||
|
||||
#include <QxSerialize/boost/QxImportDllBoostArchive.h>
|
||||
|
||||
#if (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_SINGLETON_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::archive_serializer_map, Archive)
|
||||
#else // (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_SINGLETON_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION > 103800)
|
||||
|
||||
#if (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_serializer_map, ArchiveIn) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_serializer_map, ArchiveOut)
|
||||
#else // (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_pointer_iserializer, ArchiveIn) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_pointer_oserializer, ArchiveOut)
|
||||
#endif // (BOOST_VERSION > 103800)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_POINTER_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::save_pointer_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::save_pointer_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_POINTER_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_NON_POINTER_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::save_non_pointer_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::save_non_pointer_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_NON_POINTER_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_ENUM_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::save_enum_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::save_enum_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_ENUM_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_ARRAY_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::save_array_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::save_array_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_SAVE_ARRAY_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_POINTER_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::load_pointer_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::load_pointer_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_POINTER_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_NON_POINTER_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::load_non_pointer_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::load_non_pointer_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_NON_POINTER_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_ENUM_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::load_enum_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::load_enum_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_ENUM_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_ARRAY_TYPE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::archive::detail::load_array_type, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::load_array_type, Archive)
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_LOAD_ARRAY_TYPE_HPP(Archive) /* Nothing */
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_INTERFACE_IARCHIVE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::interface_iarchive, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::interface_iarchive, Archive)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_INTERFACE_OARCHIVE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::interface_oarchive, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::interface_oarchive, Archive)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_COMMON_IARCHIVE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::common_iarchive, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::common_iarchive, Archive)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_COMMON_OARCHIVE_HPP(Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::common_oarchive, Archive) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::archive::detail::common_oarchive, Archive)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_INTERFACE_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_INTERFACE_IARCHIVE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_INTERFACE_OARCHIVE_HPP(ArchiveOut)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_COMMON_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_COMMON_IARCHIVE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_COMMON_OARCHIVE_HPP(ArchiveOut)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_SINGLETON_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_SINGLETON_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_NON_POINTER_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_NON_POINTER_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_POINTER_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_POINTER_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_ENUM_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_ENUM_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_ARRAY_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_SAVE_ARRAY_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_NON_POINTER_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_NON_POINTER_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_POINTER_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_POINTER_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_ENUM_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_ENUM_TYPE_HPP(ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_ARRAY_TYPE_HPP(ArchiveIn) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_LOAD_ARRAY_TYPE_HPP(ArchiveOut)
|
||||
|
||||
#define QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_INTERFACE_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_BOOST_EXPORT_ARCHIVE_COMMON_HPP(ArchiveIn, ArchiveOut)
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
QX_BOOST_EXPORT_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
|
||||
QX_BOOST_EXPORT_ARCHIVE_HPP(boost::archive::polymorphic_binary_iarchive, boost::archive::polymorphic_binary_oarchive)
|
||||
QX_BOOST_EXPORT_ARCHIVE_HPP(boost::archive::polymorphic_text_iarchive, boost::archive::polymorphic_text_oarchive)
|
||||
QX_BOOST_EXPORT_ARCHIVE_HPP(boost::archive::polymorphic_xml_iarchive, boost::archive::polymorphic_xml_oarchive)
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive)
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
QX_BOOST_EXPORT_ARCHIVE_SERIALIZER_MAP_HPP(eos::portable_iarchive, eos::portable_oarchive)
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(eos::portable_iarchive, eos::portable_oarchive)
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_BINARY
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
QX_BOOST_EXPORT_ARCHIVE_ALL_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
|
||||
#if _QX_USE_SERIALIZE_POLYMORPHIC_PATCH
|
||||
namespace boost
|
||||
{
|
||||
namespace archive
|
||||
{
|
||||
template <>
|
||||
inline void xml_iarchive_impl<naked_xml_iarchive>::load(std::basic_string<unsigned short, std::char_traits<unsigned short>, std::allocator<unsigned short>> &s)
|
||||
{
|
||||
Q_UNUSED(s);
|
||||
qAssert(false);
|
||||
}
|
||||
template <>
|
||||
inline void xml_oarchive_impl<xml_oarchive>::save(std::basic_string<unsigned short, std::char_traits<unsigned short>, std::allocator<unsigned short>> const &s)
|
||||
{
|
||||
Q_UNUSED(s);
|
||||
qAssert(false);
|
||||
}
|
||||
}
|
||||
} // namespace boost::archive
|
||||
#endif // _QX_USE_SERIALIZE_POLYMORPHIC_PATCH
|
||||
|
||||
#endif // (! _QX_BUILDING_QX_ORM)
|
||||
#endif // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
#endif // _QX_EXPORT_DLL_BOOST_ARCHIVE_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
252
include/QxSerialize/boost/QxExportDllMacroCpp.h
Normal file
252
include/QxSerialize/boost/QxExportDllMacroCpp.h
Normal file
@@ -0,0 +1,252 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_EXPORT_DLL_MACRO_CPP_H_
|
||||
#define _QX_EXPORT_DLL_MACRO_CPP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#include <QxSerialize/boost/QxExportDllMacroHpp.h>
|
||||
|
||||
#if _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
|
||||
#if (BOOST_VERSION < 106600)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::pointer_iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::pointer_oserializer, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 106600)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, T)
|
||||
#endif // (BOOST_VERSION < 106600)
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, QX_BOOST_132_SHARED_PTR_HELPER(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::pointer_iserializer, ArchiveIn, QX_BOOST_132_SHARED_PTR_HELPER(T))
|
||||
#else // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, QX_BOOST_132_SHARED_PTR_HELPER(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::pointer_oserializer, ArchiveOut, QX_BOOST_132_SHARED_PTR_HELPER(T))
|
||||
#else // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_ISERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::iserializer, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_OSERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::archive::detail::oserializer, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::oserializer, ArchiveOut, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_EXTENDED_TYPE_ID_CPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_CPP(class, boost::serialization::extended_type_info_typeid, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_CPP(class, boost::serialization::singleton, boost::serialization::extended_type_info_typeid, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_VOID_CAST_PRIMITIVE_CPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(class, boost::serialization::void_cast_detail::void_caster_primitive, T, QX_GET_BASE_CLASS_2(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::serialization::void_cast_detail::void_caster_primitive, T, QX_GET_BASE_CLASS_2(T))
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_TYPE_INFO_IMPL_CPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_CPP(struct, boost::serialization::type_info_implementation, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_CPP(class, boost::serialization::singleton, boost::serialization::type_info_implementation, T)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::save_pointer_type, ArchiveOut, T *) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::save_pointer_type, ArchiveOut, T *)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_NON_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::save_non_pointer_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::save_non_pointer_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_NON_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ENUM_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::save_enum_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::save_enum_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ENUM_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ARRAY_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::save_array_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::save_array_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ARRAY_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::load_pointer_type, ArchiveIn, T *) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::load_pointer_type, ArchiveIn, T *)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_NON_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::load_non_pointer_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::load_non_pointer_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_NON_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ENUM_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::load_enum_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::load_enum_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ENUM_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ARRAY_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_CPP(struct, boost::archive::detail::load_array_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_CPP(class, boost::serialization::singleton, boost::archive::detail::load_array_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ARRAY_TYPE_CPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_ISERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_OSERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_CPP(ArchiveIn, ArchiveOut, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_EXTENDED_TYPE_ID_CPP(T) \
|
||||
/* \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_VOID_CAST_PRIMITIVE_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_TYPE_INFO_IMPL_CPP(T) \
|
||||
*/
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive, T)
|
||||
#else // _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive, T)
|
||||
#else // _QX_SERIALIZE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_BINARY_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_TEXT_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::text_iarchive, boost::archive::text_oarchive, T)
|
||||
#else // _QX_SERIALIZE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_TEXT_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_XML_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive, T)
|
||||
#else // _QX_SERIALIZE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_XML_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(eos::portable_iarchive, eos::portable_oarchive, T)
|
||||
#else // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::text_wiarchive, boost::archive::text_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_CPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_CPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_TEXT_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_XML_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_CPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_CPP(T)
|
||||
|
||||
#else // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_CPP(T) /* Nothing */
|
||||
|
||||
#endif // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
#endif // _QX_EXPORT_DLL_MACRO_CPP_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
264
include/QxSerialize/boost/QxExportDllMacroHpp.h
Normal file
264
include/QxSerialize/boost/QxExportDllMacroHpp.h
Normal file
@@ -0,0 +1,264 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_EXPORT_DLL_MACRO_HPP_H_
|
||||
#define _QX_EXPORT_DLL_MACRO_HPP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#include <QxSerialize/boost/QxSerialize_shared_ptr.h>
|
||||
|
||||
#include <QxTraits/get_base_class.h>
|
||||
|
||||
#if _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#if (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_132_SHARED_PTR_HELPER(T) \
|
||||
boost_132::detail::sp_counted_base_impl<T *, boost::serialization::null_deleter>
|
||||
#else // (BOOST_VERSION >= 104100)
|
||||
#define QX_BOOST_132_SHARED_PTR_HELPER(T) \
|
||||
boost_132::detail::sp_counted_base_impl<T *, boost_132::serialization::detail::null_deleter>
|
||||
#endif // (BOOST_VERSION >= 104100)
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#if (BOOST_VERSION < 106600)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::pointer_iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::pointer_oserializer, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 106600)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, T)
|
||||
#endif // (BOOST_VERSION < 106600)
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_iserializer, ArchiveIn, QX_BOOST_132_SHARED_PTR_HELPER(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::pointer_iserializer, ArchiveIn, QX_BOOST_132_SHARED_PTR_HELPER(T))
|
||||
#else // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::pointer_oserializer, ArchiveOut, QX_BOOST_132_SHARED_PTR_HELPER(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::pointer_oserializer, ArchiveOut, QX_BOOST_132_SHARED_PTR_HELPER(T))
|
||||
#else // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_ISERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::iserializer, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::iserializer, ArchiveIn, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_OSERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::archive::detail::oserializer, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::oserializer, ArchiveOut, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_EXTENDED_TYPE_ID_HPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::serialization::extended_type_info_typeid, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::serialization::extended_type_info_typeid, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_VOID_CAST_PRIMITIVE_HPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(class, boost::serialization::void_cast_detail::void_caster_primitive, T, QX_GET_BASE_CLASS_2(T)) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::serialization::void_cast_detail::void_caster_primitive, T, QX_GET_BASE_CLASS_2(T))
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_TYPE_INFO_IMPL_HPP(T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(struct, boost::serialization::type_info_implementation, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_HPP(class, boost::serialization::singleton, boost::serialization::type_info_implementation, T)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::save_pointer_type, ArchiveOut, T *) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::save_pointer_type, ArchiveOut, T *)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_NON_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::save_non_pointer_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::save_non_pointer_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_NON_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ENUM_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::save_enum_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::save_enum_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ENUM_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ARRAY_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::save_array_type, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::save_array_type, ArchiveOut, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_SAVE_ARRAY_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::load_pointer_type, ArchiveIn, T *) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::load_pointer_type, ArchiveIn, T *)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_NON_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::load_non_pointer_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::load_non_pointer_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_NON_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ENUM_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::load_enum_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::load_enum_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ENUM_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#if (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ARRAY_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_P2_HPP(struct, boost::archive::detail::load_array_type, ArchiveIn, T) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_U_P1_P2_HPP(class, boost::serialization::singleton, boost::archive::detail::load_array_type, ArchiveIn, T)
|
||||
#else // (BOOST_VERSION < 104100)
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_LOAD_ARRAY_TYPE_HPP(ArchiveIn, ArchiveOut, T) /* Nothing */
|
||||
#endif // (BOOST_VERSION < 104100)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_ISERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_OSERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_ISERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_POINTER_OSERIALIZER_BOOST_132_HELPER_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_SAVE_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_LOAD_POINTER_TYPE_HPP(ArchiveIn, ArchiveOut, T)
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_IMPL_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_EXTENDED_TYPE_ID_HPP(T) \
|
||||
/* \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_VOID_CAST_PRIMITIVE_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_TYPE_INFO_IMPL_HPP(T) \
|
||||
*/
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive, T)
|
||||
#else // _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive, T)
|
||||
#else // _QX_SERIALIZE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_BINARY_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_TEXT_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive, T)
|
||||
#else // _QX_SERIALIZE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_TEXT_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_XML_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive, T)
|
||||
#else // _QX_SERIALIZE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_XML_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(eos::portable_iarchive, eos::portable_oarchive, T)
|
||||
#else // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_TEXT
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_WITH_ARCHIVE_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive, T)
|
||||
#else // _QX_SERIALIZE_WIDE_XML
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_HPP(T) /* Nothing */
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_IMPL_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_POLYMORPHIC_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_TEXT_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_XML_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_PORTABLE_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_BINARY_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_TEXT_HPP(T) \
|
||||
QX_BOOST_EXPORT_SERIALIZATION_WIDE_XML_HPP(T)
|
||||
|
||||
#else // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
|
||||
#define QX_BOOST_EXPORT_SERIALIZATION_HPP(T) /* Nothing */
|
||||
|
||||
#endif // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
#endif // _QX_EXPORT_DLL_MACRO_HPP_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
84
include/QxSerialize/boost/QxImportDllBoostArchive.h
Normal file
84
include/QxSerialize/boost/QxImportDllBoostArchive.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_IMPORT_DLL_BOOST_ARCHIVE_H_
|
||||
#define _QX_IMPORT_DLL_BOOST_ARCHIVE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#if _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
|
||||
#if (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_serializer_map, ArchiveIn) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_serializer_map, ArchiveOut)
|
||||
#else // (BOOST_VERSION > 103800)
|
||||
#define QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(ArchiveIn, ArchiveOut) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_pointer_iserializer, ArchiveIn) \
|
||||
QX_DLL_EXPORT_TEMPLATE_T_P1_HPP(class, boost::archive::detail::archive_pointer_oserializer, ArchiveOut)
|
||||
#endif // (BOOST_VERSION > 103800)
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::polymorphic_iarchive, boost::archive::polymorphic_oarchive)
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::binary_iarchive, boost::archive::binary_oarchive)
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::text_iarchive, boost::archive::text_oarchive)
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::xml_iarchive, boost::archive::xml_oarchive)
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_BINARY
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::binary_wiarchive, boost::archive::binary_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::text_wiarchive, boost::archive::text_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
QX_BOOST_IMPORT_ARCHIVE_SERIALIZER_MAP_HPP(boost::archive::xml_wiarchive, boost::archive::xml_woarchive)
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
|
||||
#endif // _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON
|
||||
#endif // _QX_IMPORT_DLL_BOOST_ARCHIVE_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
195
include/QxSerialize/boost/QxSerializeInclude.h
Normal file
195
include/QxSerialize/boost/QxSerializeInclude.h
Normal file
@@ -0,0 +1,195 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_INCLUDE_H_
|
||||
#define _QX_SERIALIZE_INCLUDE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4189)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
#include <boost/archive/polymorphic_iarchive.hpp>
|
||||
#include <boost/archive/polymorphic_oarchive.hpp>
|
||||
#include <boost/archive/polymorphic_binary_iarchive.hpp>
|
||||
#include <boost/archive/polymorphic_binary_oarchive.hpp>
|
||||
#include <boost/archive/polymorphic_text_iarchive.hpp>
|
||||
#include <boost/archive/polymorphic_text_oarchive.hpp>
|
||||
#include <boost/archive/polymorphic_xml_iarchive.hpp>
|
||||
#include <boost/archive/polymorphic_xml_oarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_POLYMORPHIC
|
||||
|
||||
#if _QX_SERIALIZE_BINARY
|
||||
#include <boost/archive/binary_iarchive.hpp>
|
||||
#include <boost/archive/binary_oarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_XML
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_BINARY
|
||||
#include <boost/archive/binary_wiarchive.hpp>
|
||||
#include <boost/archive/binary_woarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
#include <boost/archive/text_wiarchive.hpp>
|
||||
#include <boost/archive/text_woarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
#include <boost/archive/xml_wiarchive.hpp>
|
||||
#include <boost/archive/xml_woarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#include <QxSerialize/boost/portable_binary/portable_iarchive.hpp>
|
||||
#include <QxSerialize/boost/portable_binary/portable_oarchive.hpp>
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
|
||||
#ifndef _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
#define _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
#if (BOOST_VERSION > 103800)
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#else // (BOOST_VERSION > 103800)
|
||||
#include <boost/archive/impl/archive_pointer_oserializer.ipp>
|
||||
#include <boost/archive/impl/archive_pointer_iserializer.ipp>
|
||||
#endif // (BOOST_VERSION > 103800)
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iarchive.ipp>
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#include <boost/archive/impl/basic_text_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iarchive.ipp>
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
#if (BOOST_VERSION > 103800)
|
||||
#else // (BOOST_VERSION > 103800)
|
||||
#if _QX_INCLUDE_BOOST_SERIALIZE_ARCHIVE_IMPL_IPP
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#include <boost/archive/impl/text_oarchive_impl.ipp>
|
||||
#include <boost/archive/impl/text_iarchive_impl.ipp>
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
#if _QX_SERIALIZE_XML
|
||||
#include <boost/archive/impl/xml_oarchive_impl.ipp>
|
||||
#include <boost/archive/impl/xml_iarchive_impl.ipp>
|
||||
#endif // _QX_SERIALIZE_XML
|
||||
#if _QX_SERIALIZE_WIDE_TEXT
|
||||
#include <boost/archive/impl/text_woarchive_impl.ipp>
|
||||
#include <boost/archive/impl/text_wiarchive_impl.ipp>
|
||||
#endif // _QX_SERIALIZE_WIDE_TEXT
|
||||
#if _QX_SERIALIZE_WIDE_XML
|
||||
#include <boost/archive/impl/xml_woarchive_impl.ipp>
|
||||
#include <boost/archive/impl/xml_wiarchive_impl.ipp>
|
||||
#endif // _QX_SERIALIZE_WIDE_XML
|
||||
#endif // _QX_INCLUDE_BOOST_SERIALIZE_ARCHIVE_IMPL_IPP
|
||||
#endif // (BOOST_VERSION > 103800)
|
||||
#endif // _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef QX_DEFAULT_ARCHIVE_INPUT // && QX_DEFAULT_ARCHIVE_OUTPUT
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::polymorphic_binary_iarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::polymorphic_binary_oarchive
|
||||
#elif _QX_SERIALIZE_BINARY
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::binary_iarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::binary_oarchive
|
||||
#elif _QX_SERIALIZE_TEXT
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::text_iarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::text_oarchive
|
||||
#elif _QX_SERIALIZE_XML
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::xml_iarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::xml_oarchive
|
||||
#elif _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT eos::portable_iarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT eos::portable_oarchive
|
||||
#elif _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::binary_wiarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::binary_woarchive
|
||||
#elif _QX_SERIALIZE_WIDE_TEXT
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::text_wiarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::text_woarchive
|
||||
#elif _QX_SERIALIZE_WIDE_XML
|
||||
#define QX_DEFAULT_ARCHIVE_INPUT boost::archive::xml_wiarchive
|
||||
#define QX_DEFAULT_ARCHIVE_OUTPUT boost::archive::xml_woarchive
|
||||
#endif // _QX_SERIALIZE_BINARY
|
||||
#endif // QX_DEFAULT_ARCHIVE_INPUT
|
||||
|
||||
#ifndef QX_CLONE_STRING_STREAM // && QX_CLONE_BINARY_OUTPUT_ARCHIVE && QX_CLONE_BINARY_INPUT_ARCHIVE
|
||||
#if _QX_SERIALIZE_POLYMORPHIC
|
||||
#define QX_CLONE_STRING_STREAM std::stringstream
|
||||
#define QX_CLONE_BINARY_OUTPUT_ARCHIVE boost::archive::polymorphic_binary_oarchive
|
||||
#define QX_CLONE_BINARY_INPUT_ARCHIVE boost::archive::polymorphic_binary_iarchive
|
||||
#elif _QX_SERIALIZE_WIDE_BINARY
|
||||
#define QX_CLONE_STRING_STREAM std::wstringstream
|
||||
#define QX_CLONE_BINARY_OUTPUT_ARCHIVE boost::archive::binary_woarchive
|
||||
#define QX_CLONE_BINARY_INPUT_ARCHIVE boost::archive::binary_wiarchive
|
||||
#elif _QX_SERIALIZE_BINARY
|
||||
#define QX_CLONE_STRING_STREAM std::stringstream
|
||||
#define QX_CLONE_BINARY_OUTPUT_ARCHIVE boost::archive::binary_oarchive
|
||||
#define QX_CLONE_BINARY_INPUT_ARCHIVE boost::archive::binary_iarchive
|
||||
#elif _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#define QX_CLONE_STRING_STREAM std::stringstream
|
||||
#define QX_CLONE_BINARY_OUTPUT_ARCHIVE eos::portable_oarchive
|
||||
#define QX_CLONE_BINARY_INPUT_ARCHIVE eos::portable_iarchive
|
||||
#endif // _QX_SERIALIZE_WIDE_BINARY
|
||||
#else
|
||||
#define QX_CLONE_NEED_BINARY_TO_INCREASE_PERFORMANCE "qx::clone() need binary archive for best performance"
|
||||
#if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
|
||||
#pragma message(QX_CLONE_NEED_BINARY_TO_INCREASE_PERFORMANCE)
|
||||
#elif defined(__GNUC__) || defined(__HP_aCC) || defined(__SUNPRO_CC) || defined(__IBMCPP__)
|
||||
#warning QX_CLONE_NEED_BINARY_TO_INCREASE_PERFORMANCE
|
||||
#endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__DMC__)
|
||||
#endif // QX_CLONE_STRING_STREAM
|
||||
|
||||
#endif // _QX_SERIALIZE_INCLUDE_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
63
include/QxSerialize/boost/QxSerialize_shared_ptr.h
Normal file
63
include/QxSerialize/boost/QxSerialize_shared_ptr.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_BOOST_SHARED_PTR_H_
|
||||
#define _QX_SERIALIZE_BOOST_SHARED_PTR_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4100)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#include <boost/serialization/shared_ptr_132.hpp>
|
||||
#else // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
#ifdef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
|
||||
#undef BOOST_SERIALIZATION_SHARED_PTR_132_HPP
|
||||
#endif // BOOST_SERIALIZATION_SHARED_PTR_132_HPP
|
||||
#endif // _QX_SUPPORT_BOOST_SERIALIZE_SHARED_PTR_132
|
||||
|
||||
#include <boost/serialization/shared_ptr.hpp>
|
||||
#include <boost/serialization/weak_ptr.hpp>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _QX_SERIALIZE_BOOST_SHARED_PTR_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
161
include/QxSerialize/boost/QxSerialize_tuple.h
Normal file
161
include/QxSerialize/boost/QxSerialize_tuple.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZE_BOOST_TUPLE_H_
|
||||
#define _QX_SERIALIZE_BOOST_TUPLE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template <class Archive, typename T0, typename T1>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4, T5> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_6", boost::get<5>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4, T5, T6> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_6", boost::get<5>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_7", boost::get<6>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_6", boost::get<5>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_7", boost::get<6>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_8", boost::get<7>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_6", boost::get<5>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_7", boost::get<6>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_8", boost::get<7>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_9", boost::get<8>(t));
|
||||
}
|
||||
|
||||
template <class Archive, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
inline void serialize(Archive &ar, boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> &t, const unsigned int file_version)
|
||||
{
|
||||
Q_UNUSED(file_version);
|
||||
ar &boost::serialization::make_nvp("tuple_1", boost::get<0>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_2", boost::get<1>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_3", boost::get<2>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_4", boost::get<3>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_5", boost::get<4>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_6", boost::get<5>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_7", boost::get<6>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_8", boost::get<7>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_9", boost::get<8>(t));
|
||||
ar &boost::serialization::make_nvp("tuple_10", boost::get<9>(t));
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
} // namespace serialization
|
||||
|
||||
#endif // _QX_SERIALIZE_BOOST_TUPLE_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
176
include/QxSerialize/boost/QxSerialize_unordered_map.h
Normal file
176
include/QxSerialize/boost/QxSerialize_unordered_map.h
Normal file
@@ -0,0 +1,176 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZATION_BOOST_UNORDERED_MAP_H_
|
||||
#define _QX_SERIALIZATION_BOOST_UNORDERED_MAP_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
#if (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void save(Archive &ar, const boost::unordered_map<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = static_cast<long>(t.size());
|
||||
ar << boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
typedef typename boost::unordered_map<Key, Value>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr->first, itr->second);
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void load(Archive &ar, boost::unordered_map<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = 0;
|
||||
ar >> boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lSize);
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lSize; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
#else // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void save(Archive &ar, const boost::unordered_map<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::save_collection<Archive, boost::unordered_map<Key, Value>>(ar, t);
|
||||
}
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void load(Archive &ar, boost::unordered_map<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_map<Key, Value>,
|
||||
boost::serialization::stl::archive_input_map<Archive, boost::unordered_map<Key, Value>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_map<Key, Value>>>(ar, t);
|
||||
}
|
||||
|
||||
#endif // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void serialize(Archive &ar, boost::unordered_map<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void save(Archive &ar, const boost::unordered_multimap<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = static_cast<long>(t.size());
|
||||
ar << boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
typedef typename boost::unordered_multimap<Key, Value>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
std::pair<Key, Value> pair_key_value = std::make_pair(itr->first, itr->second);
|
||||
ar << boost::serialization::make_nvp("item", pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void load(Archive &ar, boost::unordered_multimap<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = 0;
|
||||
ar >> boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lSize);
|
||||
std::pair<Key, Value> pair_key_value;
|
||||
|
||||
for (long l = 0; l < lSize; l++)
|
||||
{
|
||||
ar >> boost::serialization::make_nvp("item", pair_key_value);
|
||||
t.insert(pair_key_value);
|
||||
}
|
||||
}
|
||||
|
||||
#else // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void save(Archive &ar, const boost::unordered_multimap<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::save_collection<Archive, boost::unordered_multimap<Key, Value>>(ar, t);
|
||||
}
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void load(Archive &ar, boost::unordered_multimap<Key, Value> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
#if (BOOST_VERSION >= 104200)
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_multimap<Key, Value>,
|
||||
boost::serialization::stl::archive_input_map<Archive, boost::unordered_multimap<Key, Value>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_multimap<Key, Value>>>(ar, t);
|
||||
#else // (BOOST_VERSION >= 104200)
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_multimap<Key, Value>,
|
||||
boost::serialization::stl::archive_input_multimap<Archive, boost::unordered_multimap<Key, Value>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_multimap<Key, Value>>>(ar, t);
|
||||
#endif // (BOOST_VERSION >= 104200)
|
||||
}
|
||||
|
||||
#endif // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key, class Value>
|
||||
inline void serialize(Archive &ar, boost::unordered_multimap<Key, Value> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // _QX_SERIALIZATION_BOOST_UNORDERED_MAP_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
174
include/QxSerialize/boost/QxSerialize_unordered_set.h
Normal file
174
include/QxSerialize/boost/QxSerialize_unordered_set.h
Normal file
@@ -0,0 +1,174 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_SERIALIZATION_BOOST_UNORDERED_SET_H_
|
||||
#define _QX_SERIALIZATION_BOOST_UNORDERED_SET_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
#if (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void save(Archive &ar, const boost::unordered_set<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = static_cast<long>(t.size());
|
||||
ar << boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
typedef typename boost::unordered_set<Key>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
ar << boost::serialization::make_nvp("item", (*itr));
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void load(Archive &ar, boost::unordered_set<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = 0;
|
||||
ar >> boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lSize);
|
||||
|
||||
for (long l = 0; l < lSize; l++)
|
||||
{
|
||||
Key item;
|
||||
ar >> boost::serialization::make_nvp("item", item);
|
||||
t.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
#else // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void save(Archive &ar, const boost::unordered_set<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::save_collection<Archive, boost::unordered_set<Key>>(ar, t);
|
||||
}
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void load(Archive &ar, boost::unordered_set<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_set<Key>,
|
||||
boost::serialization::stl::archive_input_set<Archive, boost::unordered_set<Key>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_set<Key>>>(ar, t);
|
||||
}
|
||||
|
||||
#endif // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void serialize(Archive &ar, boost::unordered_set<Key> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
#if (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void save(Archive &ar, const boost::unordered_multiset<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = static_cast<long>(t.size());
|
||||
ar << boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
typedef typename boost::unordered_multiset<Key>::const_iterator type_itr;
|
||||
for (type_itr itr = t.begin(); itr != t.end(); ++itr)
|
||||
{
|
||||
ar << boost::serialization::make_nvp("item", (*itr));
|
||||
}
|
||||
}
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void load(Archive &ar, boost::unordered_multiset<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
long lSize = 0;
|
||||
ar >> boost::serialization::make_nvp("size", lSize);
|
||||
|
||||
t.clear();
|
||||
t.reserve(lSize);
|
||||
|
||||
for (long l = 0; l < lSize; l++)
|
||||
{
|
||||
Key item;
|
||||
ar >> boost::serialization::make_nvp("item", item);
|
||||
t.insert(item);
|
||||
}
|
||||
}
|
||||
|
||||
#else // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void save(Archive &ar, const boost::unordered_multiset<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
boost::serialization::stl::save_collection<Archive, boost::unordered_multiset<Key>>(ar, t);
|
||||
}
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void load(Archive &ar, boost::unordered_multiset<Key> &t, const unsigned int /* file_version */)
|
||||
{
|
||||
#if (BOOST_VERSION >= 104200)
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_multiset<Key>,
|
||||
boost::serialization::stl::archive_input_set<Archive, boost::unordered_multiset<Key>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_multiset<Key>>>(ar, t);
|
||||
#else // (BOOST_VERSION >= 104200)
|
||||
boost::serialization::stl::load_collection<Archive, boost::unordered_multiset<Key>,
|
||||
boost::serialization::stl::archive_input_multiset<Archive, boost::unordered_multiset<Key>>,
|
||||
boost::serialization::stl::no_reserve_imp<boost::unordered_multiset<Key>>>(ar, t);
|
||||
#endif // (BOOST_VERSION >= 104200)
|
||||
}
|
||||
|
||||
#endif // (BOOST_VERSION > 105700)
|
||||
|
||||
template <class Archive, class Key>
|
||||
inline void serialize(Archive &ar, boost::unordered_multiset<Key> &t, const unsigned int file_version)
|
||||
{
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // _QX_SERIALIZATION_BOOST_UNORDERED_SET_H_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
208
include/QxSerialize/boost/class_export/qx_boost_class_export.h
Normal file
208
include/QxSerialize/boost/class_export/qx_boost_class_export.h
Normal file
@@ -0,0 +1,208 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** https://www.qxorm.com/
|
||||
** Copyright (C) 2013 XDL Team (ic-east.com)
|
||||
**
|
||||
** This file is part of the QxOrm library
|
||||
**
|
||||
** This software is provided 'as-is', without any express or implied
|
||||
** warranty. In no event will the authors be held liable for any
|
||||
** damages arising from the use of this software
|
||||
**
|
||||
** Commercial Usage
|
||||
** Licensees holding valid commercial QxOrm licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and XDL Team
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU
|
||||
** General Public License version 3.0 as published by the Free Software
|
||||
** Foundation and appearing in the file 'license.gpl3.txt' included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU General Public License version 3.0 requirements will be
|
||||
** met : http://www.gnu.org/copyleft/gpl.html
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, or
|
||||
** if you have questions regarding the use of this file, please contact :
|
||||
** ic-east.com
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#ifndef _QX_BOOST_SERIALIZATION_EXPORT_HPP_
|
||||
#define _QX_BOOST_SERIALIZATION_EXPORT_HPP_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <QxCommon/QxConfig.h>
|
||||
|
||||
#if _QX_USE_MODIFY_BOOST_SERIALIZATION_EXPORT_HPP
|
||||
|
||||
#include <utility>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/preprocessor/stringize.hpp>
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
#include <boost/serialization/extended_type_info_typeid.hpp>
|
||||
#endif // BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
|
||||
#include <boost/serialization/static_warning.hpp>
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#include <boost/serialization/force_include.hpp>
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace archive
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class basic_pointer_iserializer;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
template <class Archive, class T>
|
||||
class pointer_iserializer;
|
||||
template <class Archive, class T>
|
||||
class pointer_oserializer;
|
||||
|
||||
template <class Archive, class Serializable>
|
||||
struct export_impl
|
||||
{
|
||||
static const basic_pointer_iserializer &
|
||||
enable_load(mpl::true_)
|
||||
{
|
||||
return boost::serialization::singleton<
|
||||
pointer_iserializer<Archive, Serializable>>::get_const_instance();
|
||||
}
|
||||
|
||||
static const basic_pointer_oserializer &
|
||||
enable_save(mpl::true_)
|
||||
{
|
||||
return boost::serialization::singleton<
|
||||
pointer_oserializer<Archive, Serializable>>::get_const_instance();
|
||||
}
|
||||
inline static void enable_load(mpl::false_) {}
|
||||
inline static void enable_save(mpl::false_) {}
|
||||
};
|
||||
|
||||
// On many platforms, naming a specialization of this template is
|
||||
// enough to cause its argument to be instantiated.
|
||||
template <void (*)()>
|
||||
struct instantiate_function
|
||||
{
|
||||
};
|
||||
|
||||
template <class Archive, class Serializable>
|
||||
struct ptr_serialization_support
|
||||
{
|
||||
#if defined(BOOST_MSVC)
|
||||
virtual BOOST_DLLEXPORT void instantiate() QX_USED;
|
||||
#elif defined(__BORLANDC__)
|
||||
static BOOST_DLLEXPORT void instantiate() QX_USED;
|
||||
enum
|
||||
{
|
||||
x = sizeof(instantiate(), 3)
|
||||
};
|
||||
#else
|
||||
static BOOST_DLLEXPORT void instantiate() QX_USED;
|
||||
typedef instantiate_function<
|
||||
&ptr_serialization_support::instantiate>
|
||||
x;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class Archive, class Serializable>
|
||||
BOOST_DLLEXPORT void
|
||||
ptr_serialization_support<Archive, Serializable>::instantiate()
|
||||
{
|
||||
export_impl<Archive, Serializable>::enable_save(
|
||||
#if !defined(__BORLANDC__)
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
Archive::is_saving());
|
||||
|
||||
export_impl<Archive, Serializable>::enable_load(
|
||||
#if !defined(__BORLANDC__)
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
#endif
|
||||
Archive::is_loading());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
struct guid_initializer
|
||||
{
|
||||
const guid_initializer &export_guid(char const * /* key */, mpl::false_)
|
||||
{
|
||||
// generates the statically-initialized objects whose constructors
|
||||
// register the information allowing serialization of T objects
|
||||
// through pointers to their base classes.
|
||||
instantiate_ptr_serialization((T *)0, 0, adl_tag());
|
||||
return *this;
|
||||
}
|
||||
const guid_initializer &export_guid(char const * /*key*/, mpl::true_)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
const guid_initializer &export_guid(char const *key)
|
||||
{
|
||||
BOOST_STATIC_WARNING(boost::is_polymorphic<T>::value);
|
||||
assert(NULL != key);
|
||||
boost::serialization::singleton<
|
||||
BOOST_DEDUCED_TYPENAME
|
||||
boost::serialization::type_info_implementation<T>::type>::get_mutable_instance()
|
||||
.key_register(key);
|
||||
// note: exporting an abstract base class will have no effect
|
||||
// and cannot be used to instantitiate serialization code
|
||||
// (one might be using this in a DLL to instantiate code)
|
||||
// BOOST_STATIC_WARNING(! boost::serialization::is_abstract<T>::value);
|
||||
return export_guid(key, boost::serialization::is_abstract<T>());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_CLASS_EXPORT_GUID(T, K) \
|
||||
namespace \
|
||||
{ \
|
||||
::boost::archive::detail::guid_initializer<T> const & \
|
||||
boost_serialization_guid_initializer_##T = ::boost::serialization::singleton< \
|
||||
::boost::archive::detail::guid_initializer<T>>::get_mutable_instance() \
|
||||
.export_guid(K); \
|
||||
}
|
||||
|
||||
// check for unnecessary export. T isn't polymorphic so there is no
|
||||
// need to export it.
|
||||
#define BOOST_CLASS_EXPORT_CHECK(T) \
|
||||
BOOST_STATIC_WARNING( \
|
||||
boost::is_polymorphic<U>::value); \
|
||||
/**/
|
||||
|
||||
// the default exportable class identifier is the class name
|
||||
// the default list of archives types for which code id generated
|
||||
// are the originally included with this serialization system
|
||||
#define BOOST_CLASS_EXPORT(T) \
|
||||
BOOST_CLASS_EXPORT_GUID( \
|
||||
T, \
|
||||
BOOST_PP_STRINGIZE(T) ) \
|
||||
/**/
|
||||
|
||||
#endif // _QX_USE_MODIFY_BOOST_SERIALIZATION_EXPORT_HPP
|
||||
#endif // _QX_BOOST_SERIALIZATION_EXPORT_HPP_
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
@@ -0,0 +1,104 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* \file portable_archive_exception.hpp
|
||||
* \brief Provides error handling and constants.
|
||||
* \author christian.pfligersdorffer@gmx.at
|
||||
*
|
||||
* Portable archive exceptions derive from the boost archive exceptions
|
||||
* and add failure causes specific to the portable binary usecase.
|
||||
*
|
||||
* Additionally this header serves as common include for important
|
||||
* constants or typedefs.
|
||||
*/
|
||||
/****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#ifndef _QX_PORTABLE_ARCHIVE_EXCEPTION_H_
|
||||
#define _QX_PORTABLE_ARCHIVE_EXCEPTION_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
|
||||
namespace eos {
|
||||
|
||||
// this value is written to the top of the stream
|
||||
const signed char magic_byte = 'e' | 'o' | 's';
|
||||
|
||||
// flag for fp serialization
|
||||
const unsigned no_infnan = 64;
|
||||
|
||||
// integral type for the archive version
|
||||
#if BOOST_VERSION < 104400
|
||||
typedef boost::archive::version_type archive_version_type;
|
||||
#else
|
||||
typedef boost::archive::library_version_type archive_version_type;
|
||||
#endif
|
||||
|
||||
// version of the linked boost archive library
|
||||
const archive_version_type archive_version(
|
||||
#if BOOST_VERSION < 103700
|
||||
boost::archive::ARCHIVE_VERSION()
|
||||
#else
|
||||
boost::archive::BOOST_ARCHIVE_VERSION()
|
||||
#endif
|
||||
);
|
||||
|
||||
/**
|
||||
* \brief Exception being thrown when serialization cannot proceed.
|
||||
*
|
||||
* There are several situations in which the portable archives may fail and
|
||||
* hence throw an exception:
|
||||
* -# deserialization of an integer value that exceeds the range of the type
|
||||
* -# (de)serialization of inf/nan through an archive with no_infnan flag set
|
||||
* -# deserialization of a denormalized value without the floating point type
|
||||
* supporting denormalized numbers
|
||||
*
|
||||
* Note that this exception will also be thrown if you mixed up your stream
|
||||
* position and accidentially interpret some value for size data (in this case
|
||||
* the reported size will be totally amiss most of the time).
|
||||
*/
|
||||
class portable_archive_exception : public boost::archive::archive_exception
|
||||
{
|
||||
std::string msg;
|
||||
|
||||
public:
|
||||
//! type size is not large enough for deserialized number
|
||||
portable_archive_exception(signed char invalid_size)
|
||||
: boost::archive::archive_exception(other_exception)
|
||||
, msg("requested integer size exceeds type size: ")
|
||||
{
|
||||
msg += boost::lexical_cast<std::string, int>(invalid_size);
|
||||
}
|
||||
|
||||
//! negative number in unsigned type
|
||||
portable_archive_exception()
|
||||
: boost::archive::archive_exception(other_exception)
|
||||
, msg("cannot read a negative number into an unsigned type")
|
||||
{
|
||||
}
|
||||
|
||||
//! serialization of inf, nan and denormals
|
||||
template <typename T>
|
||||
portable_archive_exception(const T& abnormal)
|
||||
: boost::archive::archive_exception(other_exception)
|
||||
, msg("serialization of illegal floating point value: ")
|
||||
{
|
||||
msg += boost::lexical_cast<std::string>(abnormal);
|
||||
}
|
||||
|
||||
//! override the base class function with our message
|
||||
const char* what() const throw() { return msg.c_str(); }
|
||||
~portable_archive_exception() throw() {}
|
||||
};
|
||||
|
||||
} // namespace eos
|
||||
|
||||
#endif // _QX_PORTABLE_ARCHIVE_EXCEPTION_H_
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
505
include/QxSerialize/boost/portable_binary/portable_iarchive.hpp
Normal file
505
include/QxSerialize/boost/portable_binary/portable_iarchive.hpp
Normal file
@@ -0,0 +1,505 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* \file portable_iarchive.hpp
|
||||
* \brief Provides an archive to read from portable binary files.
|
||||
* \author christian.pfligersdorffer@gmx.at
|
||||
* \version 5.1
|
||||
*
|
||||
* This pair of archives brings the advantages of binary streams to the cross
|
||||
* platform boost::serialization user. While being almost as fast as the native
|
||||
* binary archive it allows its files to be exchanged between cpu architectures
|
||||
* using different byte order (endianness). Speaking of speed: in serializing
|
||||
* numbers the (portable) binary approach is approximately ten times faster than
|
||||
* the ascii implementation (that is inherently portable)!
|
||||
*
|
||||
* Based on the portable archive example by Robert Ramey this implementation
|
||||
* uses Beman Dawes endian library and fp_utilities from Johan Rade, both being
|
||||
* in boost since 1.36. Prior to that you need to add them both (header only)
|
||||
* to your boost directory before you're able to use the archives provided.
|
||||
* Our archives have been tested successfully for boost versions 1.33 to 1.49!
|
||||
*
|
||||
* \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32
|
||||
* and x86-64 platforms featuring different byte order. So there is a good
|
||||
* chance it will instantly work for your specific setup. If you encounter
|
||||
* problems or have suggestions please contact the author.
|
||||
*
|
||||
* \note Version 5.1 is now compatible with boost up to version 1.59. Thanks to
|
||||
* ecotax for pointing to the issue with shared_ptr_helper.
|
||||
*
|
||||
* \note Version 5.0 is now compatible with boost up to version 1.49 and enables
|
||||
* serialization of std::wstring by converting it to/from utf8 (thanks to
|
||||
* Arash Abghari for this suggestion). With that all unit tests from the
|
||||
* serialization library pass again with the notable exception of user
|
||||
* defined primitive types. Those are not supported and as a result any
|
||||
* user defined type to be used with the portable archives are required
|
||||
* to be at least object_serializable.
|
||||
*
|
||||
* \note Version 4.2 maintains compatibility with the latest boost 1.45 and adds
|
||||
* serialization of special floating point values inf and NaN as proposed
|
||||
* by Francois Mauger.
|
||||
*
|
||||
* \note Version 4.1 makes the archives work together with boost 1.40 and 1.41.
|
||||
* Thanks to Francois Mauger for his suggestions.
|
||||
*
|
||||
* \note Version 4 removes one level of the inheritance hierarchy and directly
|
||||
* builds upon binary primitive and basic binary archive, thereby fixing
|
||||
* the last open issue regarding array serialization. Thanks to Robert
|
||||
* Ramey for the hint.
|
||||
*
|
||||
* \note A few fixes introduced in version 3.1 let the archives pass all of the
|
||||
* serialization tests. Thanks to Sergey Morozov for running the tests.
|
||||
* Wouter Bijlsma pointed out where to find the fp_utilities and endian
|
||||
* libraries headers inside the boost distribution. I would never have
|
||||
* found them so thank him it works out of the box since boost 1.36.
|
||||
*
|
||||
* \note With Version 3.0 the archives have been made portable across different
|
||||
* boost versions. For that purpose a header is added to the data that
|
||||
* supplies the underlying serialization library version. Backwards
|
||||
* compatibility is maintained by assuming library version boost 1.33 if
|
||||
* the iarchive is created using the no_header flag. Whether a header is
|
||||
* present or not can be guessed by peeking into the stream: the header's
|
||||
* first byte is the magic number 127 coinciding with 'e'|'o'|'s' :-)
|
||||
*
|
||||
* \note Version 2.1 removes several compiler warnings and enhances floating
|
||||
* point diagnostics to inform the user if some preconditions are violated
|
||||
* on his platform. We do not strive for the universally portable solution
|
||||
* in binary floating point serialization as desired by some boost users.
|
||||
* Instead we support only the most widely used IEEE 754 format and try to
|
||||
* detect when requirements are not met and hence our approach must fail.
|
||||
* Contributions we made by Johan Rade and Ákos Maróy.
|
||||
*
|
||||
* \note Version 2.0 fixes a serious bug that effectively transformed most
|
||||
* of negative integral values into positive values! For example the two
|
||||
* numbers -12 and 234 were stored in the same 8-bit pattern and later
|
||||
* always restored to 234. This was fixed in this version in a way that
|
||||
* does not change the interpretation of existing archives that did work
|
||||
* because there were no negative numbers. The other way round archives
|
||||
* created by version 2.0 and containing negative numbers will raise an
|
||||
* integer type size exception when reading it with version 1.0. Thanks
|
||||
* to Markus Frohnmaier for testing the archives and finding the bug.
|
||||
*
|
||||
* \copyright The boost software license applies.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#ifndef _QX_PORTABLE_BINARY_IARCHIVE_H_
|
||||
#define _QX_PORTABLE_BINARY_IARCHIVE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
#pragma warning(disable:4661)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <istream>
|
||||
|
||||
// basic headers
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/archive/basic_binary_iprimitive.hpp>
|
||||
#include <boost/archive/basic_binary_iarchive.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
#endif
|
||||
|
||||
// endian and fpclassify
|
||||
#if BOOST_VERSION < 103600
|
||||
#include <boost/integer/endian.hpp>
|
||||
#include <boost/math/fpclassify.hpp>
|
||||
#elif BOOST_VERSION < 104800
|
||||
#include <boost/spirit/home/support/detail/integer/endian.hpp>
|
||||
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
|
||||
#else
|
||||
#include <boost/spirit/home/support/detail/endian/endian.hpp>
|
||||
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
|
||||
#endif
|
||||
|
||||
// namespace alias
|
||||
#if BOOST_VERSION < 103800
|
||||
namespace fp = boost::math;
|
||||
#else
|
||||
namespace fp = boost::spirit::math;
|
||||
#endif
|
||||
|
||||
// namespace alias endian
|
||||
#if BOOST_VERSION < 104800
|
||||
namespace endian = boost::detail;
|
||||
#else
|
||||
namespace endian = boost::spirit::detail;
|
||||
#endif
|
||||
|
||||
#if BOOST_VERSION >= 104500 && !defined BOOST_NO_STD_WSTRING
|
||||
// used for wstring to utf8 conversion
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/detail/convert.hpp>
|
||||
#endif
|
||||
|
||||
// generic type traits for numeric types
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_unsigned.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
|
||||
#include "portable_archive_exception.hpp"
|
||||
|
||||
// hint from Johan Rade: on VMS there is still support for
|
||||
// the VAX floating point format and this macro detects it
|
||||
#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT
|
||||
#error "VAX floating point format is not supported!"
|
||||
#endif
|
||||
|
||||
namespace eos {
|
||||
|
||||
// forward declaration
|
||||
class portable_iarchive;
|
||||
|
||||
typedef boost::archive::basic_binary_iprimitive<
|
||||
portable_iarchive
|
||||
#if BOOST_VERSION < 103400
|
||||
, std::istream
|
||||
#else
|
||||
, std::istream::char_type
|
||||
, std::istream::traits_type
|
||||
#endif
|
||||
> portable_iprimitive;
|
||||
|
||||
/**
|
||||
* \brief Portable binary input archive using little endian format.
|
||||
*
|
||||
* This archive addresses integer size, endianness and floating point types so
|
||||
* that data can be transferred across different systems. There may still be
|
||||
* constraints as to what systems are compatible and the user will have to take
|
||||
* care that e.g. a very large int being saved on a 64 bit machine will result
|
||||
* in a portable_archive_exception if loaded into an int on a 32 bit system.
|
||||
* A possible workaround to this would be to use fixed types like
|
||||
* boost::uint64_t in your serialization structures.
|
||||
*
|
||||
* \note The class is based on the portable binary example by Robert Ramey and
|
||||
* uses Beman Dawes endian library plus fp_utilities by Johan Rade.
|
||||
*/
|
||||
class portable_iarchive : public portable_iprimitive
|
||||
|
||||
// the example derives from common_oarchive but that lacks the
|
||||
// load_override functions so we chose to stay one level higher
|
||||
, public boost::archive::basic_binary_iarchive<portable_iarchive>
|
||||
|
||||
#if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
|
||||
// mix-in helper class for serializing shared_ptr
|
||||
, public boost::archive::detail::shared_ptr_helper
|
||||
#endif
|
||||
{
|
||||
// only needed for Robert's hack in basic_binary_iarchive::init
|
||||
friend class boost::archive::basic_binary_iarchive<portable_iarchive>;
|
||||
|
||||
// workaround for gcc: use a dummy struct
|
||||
// as additional argument type for overloading
|
||||
template <int> struct dummy { dummy(int) {}};
|
||||
|
||||
// loads directly from stream
|
||||
inline signed char load_signed_char()
|
||||
{
|
||||
signed char c;
|
||||
portable_iprimitive::load(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
// archive initialization
|
||||
void init(unsigned flags)
|
||||
{
|
||||
using namespace boost::archive;
|
||||
archive_version_type input_library_version(3);
|
||||
|
||||
// it is vital to have version information!
|
||||
// if we don't have any we assume boost 1.33
|
||||
if (flags & no_header)
|
||||
set_library_version(input_library_version);
|
||||
|
||||
// extract and check the magic eos byte
|
||||
else if (load_signed_char() != magic_byte)
|
||||
throw archive_exception(archive_exception::invalid_signature);
|
||||
|
||||
else
|
||||
{
|
||||
// extract version information
|
||||
operator>>(input_library_version);
|
||||
|
||||
// throw if file version is newer than we are
|
||||
if (input_library_version > archive_version)
|
||||
throw archive_exception(archive_exception::unsupported_version);
|
||||
|
||||
// else set the library version accordingly
|
||||
else set_library_version(input_library_version);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor on a stream using ios::binary mode!
|
||||
*
|
||||
* We cannot call basic_binary_iprimitive::init which tries to detect
|
||||
* if the binary archive stems from a different platform by examining
|
||||
* type sizes.
|
||||
*
|
||||
* We could have called basic_binary_iarchive::init which would create
|
||||
* the boost::serialization standard archive header containing also the
|
||||
* library version. Due to efficiency we stick with our own.
|
||||
*/
|
||||
portable_iarchive(std::istream& is, unsigned flags = 0)
|
||||
#if BOOST_VERSION < 103400
|
||||
: portable_iprimitive(is, flags & boost::archive::no_codecvt)
|
||||
#else
|
||||
: portable_iprimitive(*is.rdbuf(), flags & boost::archive::no_codecvt)
|
||||
#endif
|
||||
, boost::archive::basic_binary_iarchive<portable_iarchive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
|
||||
#if BOOST_VERSION >= 103400
|
||||
portable_iarchive(std::streambuf& sb, unsigned flags = 0)
|
||||
: portable_iprimitive(sb, flags & boost::archive::no_codecvt)
|
||||
, boost::archive::basic_binary_iarchive<portable_iarchive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Load narrow strings.
|
||||
void load(std::string& s)
|
||||
{
|
||||
portable_iprimitive::load(s);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
/**
|
||||
* \brief Load wide strings.
|
||||
*
|
||||
* This is rather tricky to get right for true portability as there
|
||||
* are so many different character encodings around. However, wide
|
||||
* strings that are encoded in one of the Unicode schemes only need
|
||||
* to be _transcoded_ which is a lot easier actually.
|
||||
*
|
||||
* We generate the output string to be encoded in the system's native
|
||||
* format, ie. UTF-16 on Windows and UTF-32 on Linux machines. Don't
|
||||
* know about Mac here so I can't really say about that.
|
||||
*/
|
||||
void load(std::wstring& s)
|
||||
{
|
||||
std::string utf8;
|
||||
load(utf8);
|
||||
s = boost::from_utf8(utf8);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Loading bool type.
|
||||
*
|
||||
* Byte pattern is same as with integer types, so this function
|
||||
* is somewhat redundant but treating bool as integer generates
|
||||
* a lot of compiler warnings.
|
||||
*
|
||||
* \note If you cannot compile your application and it says something
|
||||
* about load(bool) cannot convert your type A& into bool& then you
|
||||
* should check your BOOST_CLASS_IMPLEMENTATION setting for A, as
|
||||
* portable_archive is not able to handle custom primitive types in
|
||||
* a general manner.
|
||||
*/
|
||||
void load(bool& b)
|
||||
{
|
||||
switch (signed char c = load_signed_char())
|
||||
{
|
||||
case 0: b = false; break;
|
||||
case 1: b = load_signed_char(); break;
|
||||
default: throw portable_archive_exception(c);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load integer types.
|
||||
*
|
||||
* First we load the size information ie. the number of bytes that
|
||||
* hold the actual data. Then we retrieve the data and transform it
|
||||
* to the original value by using load_little_endian.
|
||||
*/
|
||||
template <typename T>
|
||||
typename boost::enable_if<boost::is_integral<T> >::type
|
||||
load(T & t, dummy<2> = 0)
|
||||
{
|
||||
// get the number of bytes in the stream
|
||||
if (signed char size = load_signed_char())
|
||||
{
|
||||
// check for negative value in unsigned type
|
||||
if (size < 0 && boost::is_unsigned<T>::value)
|
||||
throw portable_archive_exception();
|
||||
|
||||
// check that our type T is large enough
|
||||
else if ((unsigned) abs(size) > sizeof(T))
|
||||
throw portable_archive_exception(size);
|
||||
|
||||
// reconstruct the value
|
||||
T temp = size < 0 ? -1 : 0;
|
||||
load_binary(&temp, abs(size));
|
||||
|
||||
// load the value from little endian - it is then converted
|
||||
// to the target type T and fits it because size <= sizeof(T)
|
||||
t = endian::load_little_endian<T, sizeof(T)>(&temp);
|
||||
}
|
||||
|
||||
else t = 0; // zero optimization
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Load floating point types.
|
||||
*
|
||||
* We simply rely on fp_traits to set the bit pattern from the (unsigned)
|
||||
* integral type that was stored in the stream. Francois Mauger provided
|
||||
* standardized behaviour for special values like inf and NaN, that need to
|
||||
* be serialized in his application.
|
||||
*
|
||||
* \note by Johan Rade (author of the floating point utilities library):
|
||||
* Be warned that the math::detail::fp_traits<T>::type::get_bits() function
|
||||
* is *not* guaranteed to give you all bits of the floating point number. It
|
||||
* will give you all bits if and only if there is an integer type that has
|
||||
* the same size as the floating point you are copying from. It will not
|
||||
* give you all bits for double if there is no uint64_t. It will not give
|
||||
* you all bits for long double if sizeof(long double) > 8 or there is no
|
||||
* uint64_t.
|
||||
*
|
||||
* The member fp_traits<T>::type::coverage will tell you whether all bits
|
||||
* are copied. This is a typedef for either math::detail::all_bits or
|
||||
* math::detail::not_all_bits.
|
||||
*
|
||||
* If the function does not copy all bits, then it will copy the most
|
||||
* significant bits. So if you serialize and deserialize the way you
|
||||
* describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits,
|
||||
* then your floating point numbers will be truncated. This will introduce
|
||||
* small rounding off errors.
|
||||
*/
|
||||
template <typename T>
|
||||
typename boost::enable_if<boost::is_floating_point<T> >::type
|
||||
load(T & t, dummy<3> = 0)
|
||||
{
|
||||
typedef typename fp::detail::fp_traits<T>::type traits;
|
||||
|
||||
// if you end here there are three possibilities:
|
||||
// 1. you're serializing a long double which is not portable
|
||||
// 2. you're serializing a double but have no 64 bit integer
|
||||
// 3. your machine is using an unknown floating point format
|
||||
// after reading the note above you still might decide to
|
||||
// deactivate this static assert and try if it works out.
|
||||
typename traits::bits bits;
|
||||
BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T));
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559);
|
||||
|
||||
load(bits);
|
||||
traits::set_bits(t, bits);
|
||||
|
||||
// if the no_infnan flag is set we must throw here
|
||||
if (get_flags() & no_infnan && !fp::isfinite(t))
|
||||
throw portable_archive_exception(t);
|
||||
|
||||
// if you end here your floating point type does not support
|
||||
// denormalized numbers. this might be the case even though
|
||||
// your type conforms to IEC 559 (and thus to IEEE 754)
|
||||
if (std::numeric_limits<T>::has_denorm == std::denorm_absent
|
||||
&& fp::fpclassify(t) == (int) FP_SUBNORMAL) // GCC4
|
||||
throw portable_archive_exception(t);
|
||||
}
|
||||
|
||||
// in boost 1.44 version_type was splitted into library_version_type and
|
||||
// item_version_type, plus a whole bunch of additional strong typedefs.
|
||||
template <typename T>
|
||||
typename boost::disable_if<boost::is_arithmetic<T> >::type
|
||||
load(T& t, dummy<4> = 0)
|
||||
{
|
||||
// we provide a generic load routine for all types that feature
|
||||
// conversion operators into an unsigned integer value like those
|
||||
// created through BOOST_STRONG_TYPEDEF(X, some unsigned int) like
|
||||
// library_version_type, collection_size_type, item_version_type,
|
||||
// class_id_type, object_id_type, version_type and tracking_type
|
||||
load((typename boost::uint_t<sizeof(T)*CHAR_BIT>::least&)(t));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace eos
|
||||
|
||||
// this is required by export which registers all of your
|
||||
// classes with all the inbuilt archives plus our archive.
|
||||
#if BOOST_VERSION < 103500
|
||||
#define BOOST_ARCHIVE_CUSTOM_IARCHIVE_TYPES eos::portable_iarchive
|
||||
#else
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_iarchive)
|
||||
#endif
|
||||
|
||||
// if you include this header multiple times and your compiler is picky
|
||||
// about multiple template instantiations (eg. gcc is) then you need to
|
||||
// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one
|
||||
// or you move the instantiation section into an implementation file
|
||||
#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||
|
||||
#ifndef _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
#define _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
|
||||
#include <boost/archive/impl/basic_binary_iarchive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#include <boost/archive/impl/basic_text_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iarchive.ipp>
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if (BOOST_VERSION < 104000)
|
||||
#include <boost/archive/impl/archive_pointer_iserializer.ipp>
|
||||
#include <boost/archive/impl/archive_pointer_oserializer.ipp>
|
||||
#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#define BOOST_ARCHIVE_SERIALIZER_INCLUDED
|
||||
#endif // (BOOST_VERSION < 104000)
|
||||
|
||||
#endif // _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
|
||||
namespace boost { namespace archive {
|
||||
|
||||
// explicitly instantiate for this type of binary stream
|
||||
template class basic_binary_iarchive<eos::portable_iarchive>;
|
||||
|
||||
template class basic_binary_iprimitive<
|
||||
eos::portable_iarchive
|
||||
#if BOOST_VERSION < 103400
|
||||
, std::istream
|
||||
#else
|
||||
, std::istream::char_type
|
||||
, std::istream::traits_type
|
||||
#endif
|
||||
>;
|
||||
|
||||
#if (! _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON)
|
||||
#if (BOOST_VERSION < 104000)
|
||||
template class detail::archive_pointer_iserializer<eos::portable_iarchive>;
|
||||
#else // (BOOST_VERSION < 104000)
|
||||
template class detail::archive_serializer_map<eos::portable_iarchive>;
|
||||
#endif // (BOOST_VERSION < 104000)
|
||||
#endif // (! _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON)
|
||||
|
||||
} } // namespace boost::archive
|
||||
|
||||
#endif // NO_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _QX_PORTABLE_BINARY_IARCHIVE_H_
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
488
include/QxSerialize/boost/portable_binary/portable_oarchive.hpp
Normal file
488
include/QxSerialize/boost/portable_binary/portable_oarchive.hpp
Normal file
@@ -0,0 +1,488 @@
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* \file portable_oarchive.hpp
|
||||
* \brief Provides an archive to create portable binary files.
|
||||
* \author christian.pfligersdorffer@gmx.at
|
||||
* \version 5.1
|
||||
*
|
||||
* This pair of archives brings the advantages of binary streams to the cross
|
||||
* platform boost::serialization user. While being almost as fast as the native
|
||||
* binary archive it allows its files to be exchanged between cpu architectures
|
||||
* using different byte order (endianness). Speaking of speed: in serializing
|
||||
* numbers the (portable) binary approach is approximately ten times faster than
|
||||
* the ascii implementation (that is inherently portable)!
|
||||
*
|
||||
* Based on the portable archive example by Robert Ramey this implementation
|
||||
* uses Beman Dawes endian library and fp_utilities from Johan Rade, both being
|
||||
* in boost since 1.36. Prior to that you need to add them both (header only)
|
||||
* to your boost directory before you're able to use the archives provided.
|
||||
* Our archives have been tested successfully for boost versions 1.33 to 1.49!
|
||||
*
|
||||
* \note Correct behaviour has so far been confirmed using PowerPC-32, x86-32
|
||||
* and x86-64 platforms featuring different byte order. So there is a good
|
||||
* chance it will instantly work for your specific setup. If you encounter
|
||||
* problems or have suggestions please contact the author.
|
||||
*
|
||||
* \note Version 5.1 is now compatible with boost up to version 1.59. Thanks to
|
||||
* ecotax for pointing to the issue with shared_ptr_helper.
|
||||
*
|
||||
* \note Version 5.0 is now compatible with boost up to version 1.49 and enables
|
||||
* serialization of std::wstring by converting it to/from utf8 (thanks to
|
||||
* Arash Abghari for this suggestion). With that all unit tests from the
|
||||
* serialization library pass again with the notable exception of user
|
||||
* defined primitive types. Those are not supported and as a result any
|
||||
* user defined type to be used with the portable archives are required
|
||||
* to be at least object_serializable.
|
||||
*
|
||||
* \note Oliver Putz pointed out that -0.0 was not serialized correctly, so
|
||||
* version 4.3 provides a fix for that. Thanks Ollie!
|
||||
*
|
||||
* \note Version 4.2 maintains compatibility with the latest boost 1.45 and adds
|
||||
* serialization of special floating point values inf and NaN as proposed
|
||||
* by Francois Mauger.
|
||||
*
|
||||
* \note Version 4.1 makes the archives work together with boost 1.40 and 1.41.
|
||||
* Thanks to Francois Mauger for his suggestions.
|
||||
*
|
||||
* \note Version 4 removes one level of the inheritance hierarchy and directly
|
||||
* builds upon binary primitive and basic binary archive, thereby fixing
|
||||
* the last open issue regarding array serialization. Thanks to Robert
|
||||
* Ramey for the hint.
|
||||
*
|
||||
* \note A few fixes introduced in version 3.1 let the archives pass all of the
|
||||
* serialization tests. Thanks to Sergey Morozov for running the tests.
|
||||
* Wouter Bijlsma pointed out where to find the fp_utilities and endian
|
||||
* libraries headers inside the boost distribution. I would never have
|
||||
* found them so thank him it works out of the box since boost 1.36.
|
||||
*
|
||||
* \note With Version 3.0 the archives have been made portable across different
|
||||
* boost versions. For that purpose a header is added to the data that
|
||||
* supplies the underlying serialization library version. Backwards
|
||||
* compatibility is maintained by assuming library version boost 1.33 if
|
||||
* the iarchive is created using the no_header flag. Whether a header is
|
||||
* present or not can be guessed by peeking into the stream: the header's
|
||||
* first byte is the magic number 127 coinciding with 'e'|'o'|'s' :-)
|
||||
*
|
||||
* \note Version 2.1 removes several compiler warnings and enhances floating
|
||||
* point diagnostics to inform the user if some preconditions are violated
|
||||
* on his platform. We do not strive for the universally portable solution
|
||||
* in binary floating point serialization as desired by some boost users.
|
||||
* Instead we support only the most widely used IEEE 754 format and try to
|
||||
* detect when requirements are not met and hence our approach must fail.
|
||||
* Contributions we made by Johan Rade and Ákos Maróy.
|
||||
*
|
||||
* \note Version 2.0 fixes a serious bug that effectively transformed most
|
||||
* of negative integral values into positive values! For example the two
|
||||
* numbers -12 and 234 were stored in the same 8-bit pattern and later
|
||||
* always restored to 234. This was fixed in this version in a way that
|
||||
* does not change the interpretation of existing archives that did work
|
||||
* because there were no negative numbers. The other way round archives
|
||||
* created by version 2.0 and containing negative numbers will raise an
|
||||
* integer type size exception when reading it with version 1.0. Thanks
|
||||
* to Markus Frohnmaier for testing the archives and finding the bug.
|
||||
*
|
||||
* \copyright The boost software license applies.
|
||||
*/
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifdef _QX_ENABLE_BOOST_SERIALIZATION
|
||||
#if _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#ifndef _QX_PORTABLE_BINARY_OARCHIVE_H_
|
||||
#define _QX_PORTABLE_BINARY_OARCHIVE_H_
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4996)
|
||||
#pragma warning(disable:4661)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#include <ostream>
|
||||
|
||||
// basic headers
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/archive/basic_binary_oprimitive.hpp>
|
||||
#include <boost/archive/basic_binary_oarchive.hpp>
|
||||
|
||||
#if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
|
||||
#include <boost/archive/shared_ptr_helper.hpp>
|
||||
#endif
|
||||
|
||||
// endian and fpclassify
|
||||
#if BOOST_VERSION < 103600
|
||||
#include <boost/integer/endian.hpp>
|
||||
#include <boost/math/fpclassify.hpp>
|
||||
#elif BOOST_VERSION < 104800
|
||||
#include <boost/spirit/home/support/detail/integer/endian.hpp>
|
||||
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
|
||||
#else
|
||||
#include <boost/spirit/home/support/detail/endian/endian.hpp>
|
||||
#include <boost/spirit/home/support/detail/math/fpclassify.hpp>
|
||||
#endif
|
||||
|
||||
// namespace alias fp_classify
|
||||
#if BOOST_VERSION < 103800
|
||||
namespace fp = boost::math;
|
||||
#else
|
||||
namespace fp = boost::spirit::math;
|
||||
#endif
|
||||
|
||||
// namespace alias endian
|
||||
#if BOOST_VERSION < 104800
|
||||
namespace endian = boost::detail;
|
||||
#else
|
||||
namespace endian = boost::spirit::detail;
|
||||
#endif
|
||||
|
||||
#if BOOST_VERSION >= 104500 && !defined BOOST_NO_STD_WSTRING
|
||||
// used for wstring to utf8 conversion
|
||||
#include <boost/program_options/config.hpp>
|
||||
#include <boost/program_options/detail/convert.hpp>
|
||||
#endif
|
||||
|
||||
// generic type traits for numeric types
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/type_traits/is_signed.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
|
||||
#include "portable_archive_exception.hpp"
|
||||
|
||||
// hint from Johan Rade: on VMS there is still support for
|
||||
// the VAX floating point format and this macro detects it
|
||||
#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT
|
||||
#error "VAX floating point format is not supported!"
|
||||
#endif
|
||||
|
||||
namespace eos {
|
||||
|
||||
// forward declaration
|
||||
class portable_oarchive;
|
||||
|
||||
typedef boost::archive::basic_binary_oprimitive<
|
||||
portable_oarchive
|
||||
#if BOOST_VERSION < 103400
|
||||
, std::ostream
|
||||
#else
|
||||
, std::ostream::char_type
|
||||
, std::ostream::traits_type
|
||||
#endif
|
||||
> portable_oprimitive;
|
||||
|
||||
/**
|
||||
* \brief Portable binary output archive using little endian format.
|
||||
*
|
||||
* This archive addresses integer size, endianness and floating point types so
|
||||
* that data can be transferred across different systems. The archive consists
|
||||
* primarily of three different save implementations for integral types,
|
||||
* floating point types and string types. Those functions are templates and use
|
||||
* enable_if to be correctly selected for overloading.
|
||||
*
|
||||
* \note The class is based on the portable binary example by Robert Ramey and
|
||||
* uses Beman Dawes endian library plus fp_utilities by Johan Rade.
|
||||
*/
|
||||
class portable_oarchive : public portable_oprimitive
|
||||
|
||||
// the example derives from common_oarchive but that lacks the
|
||||
// save_override functions so we chose to stay one level higher
|
||||
, public boost::archive::basic_binary_oarchive<portable_oarchive>
|
||||
|
||||
#if BOOST_VERSION >= 103500 && BOOST_VERSION < 105600
|
||||
// mix-in helper class for serializing shared_ptr
|
||||
, public boost::archive::detail::shared_ptr_helper
|
||||
#endif
|
||||
{
|
||||
// workaround for gcc: use a dummy struct
|
||||
// as additional argument type for overloading
|
||||
template<int> struct dummy { dummy(int) {}};
|
||||
|
||||
// stores a signed char directly to stream
|
||||
inline void save_signed_char(const signed char& c)
|
||||
{
|
||||
portable_oprimitive::save(c);
|
||||
}
|
||||
|
||||
// archive initialization
|
||||
void init(unsigned flags)
|
||||
{
|
||||
// it is vital to have version information if the archive is
|
||||
// to be parsed with a newer version of boost::serialization
|
||||
// therefor we create a header, no header means boost 1.33
|
||||
if (flags & boost::archive::no_header)
|
||||
BOOST_ASSERT(archive_version == 3);
|
||||
else
|
||||
{
|
||||
// write our minimalistic header (magic byte plus version)
|
||||
// the boost archives write a string instead - by calling
|
||||
// boost::archive::basic_binary_oarchive<derived_t>::init()
|
||||
save_signed_char(magic_byte);
|
||||
|
||||
// write current version
|
||||
// save<unsigned>(archive_version);
|
||||
operator<<(archive_version);
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
/**
|
||||
* \brief Constructor on a stream using ios::binary mode!
|
||||
*
|
||||
* We cannot call basic_binary_oprimitive::init which stores type
|
||||
* sizes to the archive in order to detect transfers to non-compatible
|
||||
* platforms.
|
||||
*
|
||||
* We could have called basic_binary_oarchive::init which would create
|
||||
* the boost::serialization standard archive header containing also the
|
||||
* library version. Due to efficiency we stick with our own.
|
||||
*/
|
||||
portable_oarchive(std::ostream& os, unsigned flags = 0)
|
||||
#if BOOST_VERSION < 103400
|
||||
: portable_oprimitive(os, flags & boost::archive::no_codecvt)
|
||||
#else
|
||||
: portable_oprimitive(*os.rdbuf(), flags & boost::archive::no_codecvt)
|
||||
#endif
|
||||
, boost::archive::basic_binary_oarchive<portable_oarchive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
|
||||
#if BOOST_VERSION >= 103400
|
||||
portable_oarchive(std::streambuf& sb, unsigned flags = 0)
|
||||
: portable_oprimitive(sb, flags & boost::archive::no_codecvt)
|
||||
, boost::archive::basic_binary_oarchive<portable_oarchive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
//! Save narrow strings.
|
||||
void save(const std::string& s)
|
||||
{
|
||||
portable_oprimitive::save(s);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
/**
|
||||
* \brief Save wide strings.
|
||||
*
|
||||
* This is rather tricky to get right for true portability as there
|
||||
* are so many different character encodings around. However, wide
|
||||
* strings that are encoded in one of the Unicode schemes only need
|
||||
* to be _transcoded_ which is a lot easier actually.
|
||||
*
|
||||
* We expect the input string to be encoded in the system's native
|
||||
* format, ie. UTF-16 on Windows and UTF-32 on Linux machines. Don't
|
||||
* know about Mac here so I can't really say about that.
|
||||
*/
|
||||
void save(const std::wstring& s)
|
||||
{
|
||||
save(boost::to_utf8(s));
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Saving bool type.
|
||||
*
|
||||
* Saving bool directly, not by const reference
|
||||
* because of tracking_type's operator (bool).
|
||||
*
|
||||
* \note If you cannot compile your application and it says something
|
||||
* about save(bool) cannot convert your type const A& into bool then
|
||||
* you should check your BOOST_CLASS_IMPLEMENTATION setting for A, as
|
||||
* portable_archive is not able to handle custom primitive types in
|
||||
* a general manner.
|
||||
*/
|
||||
void save(const bool& b)
|
||||
{
|
||||
save_signed_char(b);
|
||||
if (b) save_signed_char('T');
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Save integer types.
|
||||
*
|
||||
* First we save the size information ie. the number of bytes that hold the
|
||||
* actual data. We subsequently transform the data using store_little_endian
|
||||
* and store non-zero bytes to the stream.
|
||||
*/
|
||||
template <typename T>
|
||||
typename boost::enable_if<boost::is_integral<T> >::type
|
||||
save(const T & t, dummy<2> = 0)
|
||||
{
|
||||
if (T temp = t)
|
||||
{
|
||||
// examine the number of bytes
|
||||
// needed to represent the number
|
||||
signed char size = 0;
|
||||
do { temp >>= CHAR_BIT; ++size; }
|
||||
while (temp != 0 && temp != (T) -1);
|
||||
|
||||
// encode the sign bit into the size
|
||||
save_signed_char(t > 0 ? size : -size);
|
||||
BOOST_ASSERT(t > 0 || boost::is_signed<T>::value);
|
||||
|
||||
// we choose to use little endian because this way we just
|
||||
// save the first size bytes to the stream and skip the rest
|
||||
endian::store_little_endian<T, sizeof(T)>(&temp, t);
|
||||
|
||||
save_binary(&temp, size);
|
||||
}
|
||||
// zero optimization
|
||||
else save_signed_char(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Save floating point types.
|
||||
*
|
||||
* We simply rely on fp_traits to extract the bit pattern into an (unsigned)
|
||||
* integral type and store that into the stream. Francois Mauger provided
|
||||
* standardized behaviour for special values like inf and NaN, that need to
|
||||
* be serialized in his application.
|
||||
*
|
||||
* \note by Johan Rade (author of the floating point utilities library):
|
||||
* Be warned that the math::detail::fp_traits<T>::type::get_bits() function
|
||||
* is *not* guaranteed to give you all bits of the floating point number. It
|
||||
* will give you all bits if and only if there is an integer type that has
|
||||
* the same size as the floating point you are copying from. It will not
|
||||
* give you all bits for double if there is no uint64_t. It will not give
|
||||
* you all bits for long double if sizeof(long double) > 8 or there is no
|
||||
* uint64_t.
|
||||
*
|
||||
* The member fp_traits<T>::type::coverage will tell you whether all bits
|
||||
* are copied. This is a typedef for either math::detail::all_bits or
|
||||
* math::detail::not_all_bits.
|
||||
*
|
||||
* If the function does not copy all bits, then it will copy the most
|
||||
* significant bits. So if you serialize and deserialize the way you
|
||||
* describe, and fp_traits<T>::type::coverage is math::detail::not_all_bits,
|
||||
* then your floating point numbers will be truncated. This will introduce
|
||||
* small rounding off errors.
|
||||
*/
|
||||
template <typename T>
|
||||
typename boost::enable_if<boost::is_floating_point<T> >::type
|
||||
save(const T & t, dummy<3> = 0)
|
||||
{
|
||||
typedef typename fp::detail::fp_traits<T>::type traits;
|
||||
|
||||
// if the no_infnan flag is set we must throw here
|
||||
if (get_flags() & no_infnan && !fp::isfinite(t))
|
||||
throw portable_archive_exception(t);
|
||||
|
||||
// if you end here there are three possibilities:
|
||||
// 1. you're serializing a long double which is not portable
|
||||
// 2. you're serializing a double but have no 64 bit integer
|
||||
// 3. your machine is using an unknown floating point format
|
||||
// after reading the note above you still might decide to
|
||||
// deactivate this static assert and try if it works out.
|
||||
typename traits::bits bits;
|
||||
BOOST_STATIC_ASSERT(sizeof(bits) == sizeof(T));
|
||||
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_iec559);
|
||||
|
||||
// examine value closely
|
||||
switch (fp::fpclassify(t))
|
||||
{
|
||||
//case FP_ZERO: bits = 0; break;
|
||||
case FP_NAN: bits = traits::exponent | traits::mantissa; break;
|
||||
case FP_INFINITE: bits = traits::exponent | (t<0) * traits::sign; break;
|
||||
case FP_SUBNORMAL: assert(std::numeric_limits<T>::has_denorm); // pass
|
||||
case FP_ZERO: // note that floats can be ±0.0
|
||||
case FP_NORMAL: traits::get_bits(t, bits); break;
|
||||
default: throw portable_archive_exception(t);
|
||||
}
|
||||
|
||||
save(bits);
|
||||
}
|
||||
|
||||
// in boost 1.44 version_type was splitted into library_version_type and
|
||||
// item_version_type, plus a whole bunch of additional strong typedefs.
|
||||
template <typename T>
|
||||
typename boost::disable_if<boost::is_arithmetic<T> >::type
|
||||
save(const T& t, dummy<4> = 0)
|
||||
{
|
||||
// we provide a generic save routine for all types that feature
|
||||
// conversion operators into an unsigned integer value like those
|
||||
// created through BOOST_STRONG_TYPEDEF(X, some unsigned int) like
|
||||
// library_version_type, collection_size_type, item_version_type,
|
||||
// class_id_type, object_id_type, version_type and tracking_type
|
||||
save((typename boost::uint_t<sizeof(T)*CHAR_BIT>::least)(t));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace eos
|
||||
|
||||
// required by export
|
||||
#if BOOST_VERSION < 103500
|
||||
#define BOOST_ARCHIVE_CUSTOM_OARCHIVE_TYPES eos::portable_oarchive
|
||||
#else
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(eos::portable_oarchive)
|
||||
#endif
|
||||
|
||||
// if you include this header multiple times and your compiler is picky
|
||||
// about multiple template instantiations (eg. gcc is) then you need to
|
||||
// define NO_EXPLICIT_TEMPLATE_INSTANTIATION before every include but one
|
||||
// or you move the instantiation section into an implementation file
|
||||
#ifndef NO_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||
|
||||
#ifndef _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
#define _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
|
||||
#include <boost/archive/impl/basic_binary_iarchive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_binary_oprimitive.ipp>
|
||||
|
||||
#if _QX_SERIALIZE_TEXT
|
||||
#include <boost/archive/impl/basic_text_oprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iprimitive.ipp>
|
||||
#include <boost/archive/impl/basic_text_oarchive.ipp>
|
||||
#include <boost/archive/impl/basic_text_iarchive.ipp>
|
||||
#endif // _QX_SERIALIZE_TEXT
|
||||
|
||||
#if (BOOST_VERSION < 104000)
|
||||
#include <boost/archive/impl/archive_pointer_iserializer.ipp>
|
||||
#include <boost/archive/impl/archive_pointer_oserializer.ipp>
|
||||
#elif !defined BOOST_ARCHIVE_SERIALIZER_INCLUDED
|
||||
#include <boost/archive/impl/archive_serializer_map.ipp>
|
||||
#define BOOST_ARCHIVE_SERIALIZER_INCLUDED
|
||||
#endif // (BOOST_VERSION < 104000)
|
||||
|
||||
#endif // _QX_BOOST_ARCHIVE_SERIALIZER_IMPL_DEFINED_
|
||||
|
||||
namespace boost { namespace archive {
|
||||
|
||||
// explicitly instantiate for this type of binary stream
|
||||
template class basic_binary_oarchive<eos::portable_oarchive>;
|
||||
|
||||
template class basic_binary_oprimitive<
|
||||
eos::portable_oarchive
|
||||
#if BOOST_VERSION < 103400
|
||||
, std::ostream
|
||||
#else
|
||||
, std::ostream::char_type
|
||||
, std::ostream::traits_type
|
||||
#endif
|
||||
>;
|
||||
|
||||
#if (! _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON)
|
||||
#if (BOOST_VERSION < 104000)
|
||||
template class detail::archive_pointer_oserializer<eos::portable_oarchive>;
|
||||
#else // (BOOST_VERSION < 104000)
|
||||
template class detail::archive_serializer_map<eos::portable_oarchive>;
|
||||
#endif // (BOOST_VERSION < 104000)
|
||||
#endif // (! _QX_USE_EXPORT_DLL_BOOST_SERIALIZATION_SINGLETON)
|
||||
|
||||
} } // namespace boost::archive
|
||||
|
||||
#endif // NO_EXPLICIT_TEMPLATE_INSTANTIATION
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _QX_PORTABLE_BINARY_OARCHIVE_H_
|
||||
#endif // _QX_SERIALIZE_PORTABLE_BINARY
|
||||
#endif // _QX_ENABLE_BOOST_SERIALIZATION
|
||||
Reference in New Issue
Block a user