Compare commits

..

1 Commits

Author SHA1 Message Date
Peter Dimov 9bfcdb2106 Remove explicit check for <forward_list> 2016-11-10 14:44:08 +02:00
91 changed files with 885 additions and 1516 deletions
+48 -61
View File
@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -6,79 +6,66 @@ language: cpp
sudo: false
os:
- linux
- osx
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc
- os: linux
compiler: g++-5
env: TOOLSET=gcc-5
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc-6
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc-7
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang
- os: osx
compiler: clang++
env: TOOLSET=clang
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule init libs/align
- git submodule init libs/array
- git submodule init libs/assert
- git submodule init libs/bind
- git submodule init libs/compatibility
- git submodule init libs/concept_check
- git submodule init libs/config
- git submodule init libs/container
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/filesystem
- git submodule init libs/function
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/intrusive
- git submodule init libs/io
- git submodule init libs/iterator
- git submodule init libs/lexical_cast
- git submodule init libs/math
- git submodule init libs/move
- git submodule init libs/mpl
- git submodule init libs/numeric/conversion
- git submodule init libs/optional
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/range
- git submodule init libs/smart_ptr
- git submodule init libs/spirit
- git submodule init libs/static_assert
- git submodule init libs/system
- git submodule init libs/throw_exception
- git submodule init libs/tuple
- git submodule init libs/type_index
- git submodule init libs/type_traits
- git submodule init libs/unordered
- git submodule init libs/utility
- git submodule init libs/variant
- git submodule init tools/build
- git submodule update --depth 1
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
- python tools/boostdep/depinst/depinst.py serialization
- ./bootstrap.sh
- ./b2 headers
script:
- ./b2 -j 3 libs/serialization/test toolset=$TOOLSET
- TOOLSET=gcc,clang
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
- ./b2 libs/serialization/test toolset=$TOOLSET
notifications:
email:
+5 -21
View File
@@ -26,7 +26,7 @@ add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
add_definitions( -ftemplate-depth=300 )
# we use gcc to test for C++03 compatibility
add_definitions( -std=c++03 )
add_definitions( std=c++03 )
message(STATUS "compiler is g++ c++03")
set(COMPILER_SUPPORTS_CXX11 FALSE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
@@ -112,7 +112,6 @@ set(Boost_DETAILED_FAILURE_MSG true)
set(Boost_FOUND true)
find_package(Boost REQUIRED COMPONENTS system filesystem)
include(CheckIncludeFileCXX)
message(STATUS "Boost_FOUND is ${Boost_FOUND}")
@@ -166,6 +165,7 @@ add_library(serialization ${LINK_TYPE}
../src/extended_type_info.cpp
../src/polymorphic_iarchive.cpp
../src/polymorphic_oarchive.cpp
../src/singleton.cpp
../src/stl_port.cpp
../src/text_iarchive.cpp
../src/text_oarchive.cpp
@@ -251,8 +251,7 @@ endfunction(polymorphic_archive_test)
enable_testing()
serialization_test(test_dll_exported polymorphic_derived2 polymorphic_base)
# serialization(test_dll_exported dll_polymorphic_derived2_lib)
# serialization(test_dll_simple dll_a_lib)
# compile test_dll_plugin.cpp
# Running the following test requires that the test know the directory
@@ -266,7 +265,6 @@ serialization_test(test_mult_archive_types)
serialization_test(test_iterators)
serialization_test(test_iterators_base64)
serialization_test(test_inclusion)
serialization_test(test_inclusion2)
serialization_test(test_smart_cast)
serialization_test(test_codecvt_null ../src/codecvt_null)
serialization_test(test_strong_typedef)
@@ -322,14 +320,6 @@ archive_test(test_shared_ptr_multi_base)
archive_test(test_shared_ptr_132)
archive_test(test_simple_class A)
archive_test(test_simple_class_ptr A)
CHECK_INCLUDE_FILE_CXX(slist SLIST_FOUND)
if(SLIST_FOUND)
message(STATUS "slist header found")
archive_test(test_slist A)
archive_test(test_slist_ptr A)
else()
message(STATUS "slist header NOT found")
endif()
archive_test(test_stack A)
archive_test(test_split)
archive_test(test_tracking)
@@ -343,18 +333,12 @@ archive_test(test_set_boost_unordered A)
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_set_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
if(HASH_SET_FOUND)
archive_test(test_set_hashed A)
endif()
archive_test(test_set_hashed A)
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_map_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
if(HASH_MAP_FOUND)
archive_test(test_map_hashed A)
endif()
archive_test(test_map_hashed A)
endif()
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
-67
View File
@@ -1,67 +0,0 @@
# Copyright 2016 Peter Dimov
# Copyright 2016 Robert Ramey
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- develop
# - master
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/align
- git submodule init libs/array
- git submodule init libs/assert
- git submodule init libs/bind
- git submodule init libs/compatibility
- git submodule init libs/concept_check
- git submodule init libs/config
- git submodule init libs/container
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/filesystem
- git submodule init libs/function
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/intrusive
- git submodule init libs/io
- git submodule init libs/iterator
- git submodule init libs/lexical_cast
- git submodule init libs/math
- git submodule init libs/move
- git submodule init libs/mpl
- git submodule init libs/numeric/conversion
- git submodule init libs/optional
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/range
- git submodule init libs/smart_ptr
- git submodule init libs/spirit
- git submodule init libs/static_assert
- git submodule init libs/system
- git submodule init libs/throw_exception
- git submodule init libs/tuple
- git submodule init libs/type_index
- git submodule init libs/type_traits
- git submodule init libs/unordered
- git submodule init libs/utility
- git submodule init libs/variant
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\serialization
- set PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%CD%;%PATH%
- bootstrap gcc
- b2 headers
build: off
test_script:
- cd libs/serialization/test
- b2 toolset=gcc link=static,shared
+2 -1
View File
@@ -82,7 +82,8 @@ SOURCES =
xml_archive_exception
codecvt_null
utf8_codecvt_facet
;
singleton
;
WSOURCES =
basic_text_wiprimitive
+1 -1
View File
@@ -292,7 +292,7 @@ included in the code module containing the serialization code.
</code></pre>
All of these archives implement the same interface. Hence, it should suffice to describe only one
All of these archives implement the same inteface. Hence, it should suffice to describe only one
of them in detail. For this purpose we will use the text archive.
+2 -2
View File
@@ -568,10 +568,10 @@ void myclass::serialize(Archive & ar, const unsigned int version){
...
}
BOOST_CLASS_EXPORT_IMPLEMENT(my_class)
BOOST_EXPORT_CLASS_IMPLEMENT(my_class)
#include &lt;boost/archive/text_oarchive&gt;
#include &lt;boost/archive/text_iarchive&gt;
#include &lt;boost/archive/text_iarchive&lt;
template myclass::serialize(boost::archive::text_oarchive & ar, const unsigned int version);
template myclass::serialize(boost::archive::text_iarchive & ar, const unsigned int version);
... // repeat for each archive class to be used.
+5 -8
View File
@@ -127,11 +127,11 @@ public:
}
// used for text output
operator base_type () const {
operator int () const {
return t;
}
// used for text input
operator base_type &() {
operator int_least16_t &() {
return t;
}
bool operator==(const class_id_type & rhs) const {
@@ -151,10 +151,7 @@ private:
public:
object_id_type(): t(0) {};
// note: presumes that size_t >= unsigned int.
// use explicit cast to silence useless warning
explicit object_id_type(const std::size_t & t_) : t(static_cast<base_type>(t_)){
// make quadriple sure that we haven't lost any real integer
// precision
explicit object_id_type(const std::size_t & t_) : t(t_){
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
object_id_type(const object_id_type & t_) :
@@ -165,11 +162,11 @@ public:
return *this;
}
// used for text output
operator base_type () const {
operator uint_least32_t () const {
return t;
}
// used for text input
operator base_type & () {
operator uint_least32_t & () {
return t;
}
bool operator==(const object_id_type & rhs) const {
@@ -50,7 +50,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -45,7 +45,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -21,7 +21,7 @@
//
// note the fact that on libraries without wide characters, ostream is
// is not a specialization of basic_ostream which in fact is not defined
// in such cases. So we can't use basic_istream<IStream::char_type> but rather
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
// use two template parameters
#include <boost/config.hpp>
+2 -1
View File
@@ -89,7 +89,8 @@ protected:
// leaving the archive in an undetermined state
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_type & t);
void load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(object_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
+4 -8
View File
@@ -18,11 +18,8 @@
#include <locale>
#include <cstddef> // NULL, size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // for mbstate_t
#endif
#include <boost/config.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -63,10 +60,9 @@ public:
};
template<>
class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
public std::codecvt<wchar_t, char, std::mbstate_t>
class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
{
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_out(
std::mbstate_t & state,
const wchar_t * first1,
@@ -76,7 +72,7 @@ class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
char * last2,
char * & next2
) const;
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_in(
std::mbstate_t & state,
const char * first1,
@@ -96,7 +92,7 @@ public:
explicit codecvt_null(std::size_t no_locale_manage = 0) :
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
{}
//virtual ~codecvt_null(){};
virtual ~codecvt_null(){};
};
} // namespace archive
@@ -35,12 +35,11 @@ class extended_type_info;
// note: referred to as Curiously Recurring Template Patter (CRTP)
template<class Archive>
class BOOST_SYMBOL_VISIBLE common_iarchive :
class BOOST_SYMBOL_VISIBLE common_iarchive :
public basic_iarchive,
public interface_iarchive<Archive>
{
friend class interface_iarchive<Archive>;
friend class basic_iarchive;
private:
virtual void vload(version_type & t){
* this->This() >> t;
@@ -38,7 +38,6 @@ class BOOST_SYMBOL_VISIBLE common_oarchive :
public interface_oarchive<Archive>
{
friend class interface_oarchive<Archive>;
friend class basic_oarchive;
private:
virtual void vsave(const version_type t){
* this->This() << t;
+14 -15
View File
@@ -57,10 +57,11 @@ namespace std{
#include <boost/serialization/assume_abstract.hpp>
#if !defined(BOOST_MSVC) && \
(BOOST_WORKAROUND(__IBMCPP__, < 1210) || \
defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590))
#define DONT_USE_HAS_NEW_OPERATOR 1
#ifndef BOOST_MSVC
#define DONT_USE_HAS_NEW_OPERATOR ( \
BOOST_WORKAROUND(__IBMCPP__, < 1210) \
|| defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \
)
#else
#define DONT_USE_HAS_NEW_OPERATOR 0
#endif
@@ -76,10 +77,10 @@ namespace std{
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/array_wrapper.hpp>
// the following is need only for dynamic cast of polymorphic pointers
#include <boost/archive/archive_exception.hpp>
@@ -89,8 +90,6 @@ namespace std{
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -235,7 +234,7 @@ struct heap_allocation {
// that the class might have class specific new with NO
// class specific delete at all. Patches (compatible with
// C++03) welcome!
(operator delete)(t);
delete t;
}
};
struct doesnt_have_new_operator {
@@ -244,7 +243,7 @@ struct heap_allocation {
}
static void invoke_delete(T * t) {
// Note: I'm reliance upon automatic conversion from T * to void * here
(operator delete)(t);
delete t;
}
};
static T * invoke_new() {
@@ -407,7 +406,7 @@ struct load_non_pointer_type {
struct load_standard {
template<class T>
static void invoke(Archive &ar, const T & t){
void * x = boost::addressof(const_cast<T &>(t));
void * x = & const_cast<T &>(t);
ar.load_object(
x,
boost::serialization::singleton<
@@ -485,7 +484,7 @@ struct load_pointer_type {
};
template<class T>
static const basic_pointer_iserializer * register_type(Archive &ar, const T* const /*t*/){
static const basic_pointer_iserializer * register_type(Archive &ar, const T & /*t*/){
// there should never be any need to load an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
@@ -524,7 +523,7 @@ struct load_pointer_type {
}
template<class T>
static void check_load(T * const /* t */){
static void check_load(T & /* t */){
check_pointer_level< T >();
check_pointer_tracking< T >();
}
@@ -538,8 +537,8 @@ struct load_pointer_type {
template<class Tptr>
static void invoke(Archive & ar, Tptr & t){
check_load(t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, t);
check_load(*t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t);
const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer(
// note major hack here !!!
// I tried every way to convert Tptr &t (where Tptr might
@@ -606,7 +605,7 @@ template<class Archive, class T>
inline void load(Archive & ar, T &t){
// if this assertion trips. It means we're trying to load a
// const object with a compiler that doesn't have correct
// function template ordering. On other compilers, this is
// funtion template ordering. On other compilers, this is
// handled below.
detail::check_const_loading< T >();
typedef
+5 -11
View File
@@ -26,7 +26,6 @@
#include <cstddef> // NULL
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
@@ -57,9 +56,8 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -69,8 +67,6 @@
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -256,7 +252,7 @@ struct save_non_pointer_type {
template<class T>
static void invoke(Archive &ar, const T & t){
ar.save_object(
boost::addressof(t),
& t,
boost::serialization::singleton<
oserializer<Archive, T>
>::get_const_instance()
@@ -264,8 +260,6 @@ struct save_non_pointer_type {
}
};
// adds class information to the archive. This includes
// serialization level and class version
struct save_conditional {
@@ -343,7 +337,7 @@ struct save_pointer_type {
};
template<class T>
static const basic_pointer_oserializer * register_type(Archive &ar, T* const /*t*/){
static const basic_pointer_oserializer * register_type(Archive &ar, T & /*t*/){
// there should never be any need to save an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
@@ -410,7 +404,7 @@ struct save_pointer_type {
// if its not a pointer to a more derived type
const void *vp = static_cast<const void *>(&t);
if(*this_type == *true_type){
const basic_pointer_oserializer * bpos = register_type(ar, &t);
const basic_pointer_oserializer * bpos = register_type(ar, t);
ar.save_pointer(vp, bpos);
return;
}
@@ -469,7 +463,7 @@ struct save_pointer_type {
template<class TPtr>
static void invoke(Archive &ar, const TPtr t){
register_type(ar, t);
register_type(ar, * t);
if(NULL == t){
basic_oarchive & boa
= boost::serialization::smart_cast_reference<basic_oarchive &>(ar);
@@ -9,21 +9,26 @@
#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#endif
// std::codecvt_utf8 doesn't seem to work for msvc
// versions prior to MSVC 14.0
// use boost's utf8 codecvt facet
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#if defined(_MSC_VER) && _MSC_VER < 1900 \
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#else
#include <codecvt>
namespace boost { namespace archive { namespace detail {
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
} } }
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
@@ -47,10 +47,6 @@ archive_serializer_map<Archive>::insert(const basic_serializer * bs){
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
archive_serializer_map<Archive>::erase(const basic_serializer * bs){
BOOST_ASSERT(! boost::serialization::singleton<
extra_detail::map<Archive>
>::is_destroyed()
);
if(boost::serialization::singleton<
extra_detail::map<Archive>
>::is_destroyed())
@@ -84,8 +84,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::init()
);
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
@@ -95,8 +93,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
load_binary(ws, l * sizeof(wchar_t) / sizeof(char));
ws[l] = L'\0';
}
#endif
#endif
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
@@ -114,6 +110,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(std::string & s)
load_binary(&(*s.begin()), l);
}
#ifndef BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
@@ -123,6 +120,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
load_binary(s, l);
s[l] = '\0';
}
#endif
#ifndef BOOST_NO_STD_WSTRING
template<class Archive, class Elem, class Tr>
@@ -71,7 +71,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s)
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_oprimitive<Archive, Elem, Tr>::save(const wchar_t * ws)
@@ -92,7 +91,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::wstring &ws)
save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char));
}
#endif
#endif // BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL
@@ -56,7 +56,7 @@ text_wiarchive_impl<Archive>::load(std::string &s)
s.resize(0);
s.reserve(size);
while(size-- > 0){
char x = is.narrow(is.get(), '\0');
int x = is.narrow(is.get(), '\0');
s += x;
}
}
@@ -161,13 +161,13 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
gimpl(new xml_wgrammar())
{
if(0 == (flags & no_codecvt)){
archive_locale = std::locale(
std::locale l = std::locale(
is_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
// libstdc++ crashes without this
is_.sync();
is_.imbue(archive_locale);
is_.imbue(l);
}
if(0 == (flags & no_header))
init();
@@ -17,9 +17,7 @@
#include <cstring> // strlen
#include <cstdlib> // mbtowc
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // wcslen
#endif
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
@@ -103,6 +101,7 @@ xml_woarchive_impl<Archive>::save(const char * s){
template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const wchar_t * ws){
os << ws;
typedef iterators::xml_escape<const wchar_t *> xmbtows;
std::copy(
xmbtows(ws),
@@ -125,12 +124,12 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
basic_xml_oarchive<Archive>(flags)
{
if(0 == (flags & no_codecvt)){
archive_locale = std::locale(
std::locale l = std::locale(
os_.getloc(),
new boost::archive::detail::utf8_codecvt_facet
);
os_.flush();
os_.imbue(archive_locale);
os_.imbue(l);
}
if(0 == (flags & no_header))
this->init();
@@ -142,7 +141,7 @@ xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
if(std::uncaught_exception())
return;
if(0 == (this->get_flags() & no_header)){
os << L"</boost_serialization>";
save(L"</boost_serialization>\n");
}
}
@@ -41,7 +41,7 @@ template<class CharType>
struct from_6_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
static const char * lookup_table =
const char * lookup_table =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789"
@@ -37,7 +37,7 @@ template<class CharType>
struct to_6_bit {
typedef CharType result_type;
CharType operator()(CharType t) const{
static const signed char lookup_table[] = {
const signed char lookup_table[] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
+1 -2
View File
@@ -102,8 +102,7 @@ public:
super_t(base),
m_bnext(NULL),
m_bend(NULL),
m_full(false),
m_current_value(0)
m_full(false)
{
}
};
@@ -56,7 +56,7 @@ class istream_iterator :
//Access the value referred to
Elem dereference() const {
return static_cast<Elem>(m_istream->peek());
return m_istream->peek();
}
void increment(){
@@ -75,14 +75,14 @@ public:
}
istream_iterator() :
m_istream(NULL),
m_current_value(NULL)
m_istream(NULL)
{}
istream_iterator(const istream_iterator<Elem> & rhs) :
m_istream(rhs.m_istream),
m_current_value(rhs.m_current_value)
{}
};
} // namespace iterators
@@ -18,16 +18,14 @@
#include <boost/assert.hpp>
#include <cstddef> // size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // mbstate_t
#endif
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::mbstate_t;
} // namespace std
#endif
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
#include <boost/iterator/iterator_adaptor.hpp>
@@ -86,15 +84,12 @@ class mb_from_wchar
wchar_t value = * this->base_reference();
const wchar_t *wend;
char *bend;
BOOST_VERIFY(
m_codecvt_facet.out(
m_mbs,
& value, & value + 1, wend,
m_buffer, m_buffer + sizeof(m_buffer), bend
)
==
std::codecvt_base::ok
std::codecvt_base::result r = m_codecvt_facet.out(
m_mbs,
& value, & value + 1, wend,
m_buffer, m_buffer + sizeof(m_buffer), bend
);
BOOST_ASSERT(std::codecvt_base::ok == r);
m_bnext = 0;
m_bend = bend - m_buffer;
}
@@ -111,7 +111,6 @@ public:
transform_width(T start) :
super_t(Base(static_cast< T >(start))),
m_buffer_out_full(false),
m_buffer_out(0),
// To disable GCC warning, but not truly necessary
//(m_buffer_in will be initialized later before being
//used because m_remaining_bits == 0)
@@ -19,9 +19,7 @@
#include <boost/assert.hpp>
#include <cctype>
#include <cstddef> // size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // mbstate_t
#endif
#include <algorithm> // copy
#include <boost/config.hpp>
-2
View File
@@ -44,9 +44,7 @@ inline std::size_t wcslen(const wchar_t * ws)
#else
#ifndef BOOST_NO_CWCHAR
#include <cwchar>
#endif
#ifdef BOOST_NO_STDC_NAMESPACE
namespace std{ using ::wcslen; }
#endif
-1
View File
@@ -62,7 +62,6 @@ protected:
friend class basic_xml_iarchive<Archive>;
friend class load_access;
#endif
std::locale archive_locale;
boost::scoped_ptr<xml_wgrammar> gimpl;
std::wistream & get_is(){
return is;
+137 -14
View File
@@ -6,32 +6,135 @@
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// for serialization of <array>. If <array> not supported by the standard
// library - this file becomes empty. This is to avoid breaking backward
// compatibiliy for applications which used this header to support
// serialization of native arrays. Code to serialize native arrays is
// now always include by default. RR
//#include <iostream>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
#include <iostream>
#include <cstddef> // std::size_t
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/array_wrapper.hpp>
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/static_assert.hpp>
namespace boost { namespace serialization {
// traits to specify whether to use an optimized array serialization
template <class Archive>
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
template<class T>
class array_wrapper :
public wrapper_traits<const array_wrapper< T > >
{
private:
array_wrapper & operator=(const array_wrapper & rhs);
// note: I would like to make the copy constructor private but this breaks
// make_array. So I make make_array a friend
template<class Tx, class S>
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
public:
array_wrapper(const array_wrapper & rhs) :
m_t(rhs.m_t),
m_element_count(rhs.m_element_count)
{}
public:
array_wrapper(T * t, std::size_t s) :
m_t(t),
m_element_count(s)
{}
// default implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
{
// default implemention does the loop
std::size_t c = count();
T * t = address();
while(0 < c--)
ar & boost::serialization::make_nvp("item", *t++);
}
// optimized implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
{
boost::serialization::split_member(ar, *this, version);
}
// default implementation
template<class Archive>
void save(Archive &ar, const unsigned int version) const
{
ar.save_array(*this,version);
}
// default implementation
template<class Archive>
void load(Archive &ar, const unsigned int version)
{
ar.load_array(*this,version);
}
// default implementation
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
typedef typename
boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const< T >::type
>::type use_optimized;
serialize_optimized(ar,version,use_optimized());
}
T * address() const
{
return m_t;
}
std::size_t count() const
{
return m_element_count;
}
private:
T * const m_t;
const std::size_t m_element_count;
};
template<class T, class S>
inline
const array_wrapper< T > make_array(T* t, S s){
const array_wrapper< T > a(t, s);
return a;
}
} } // end namespace boost::serialization
// I can't figure out why BOOST_NO_CXX11_HDR_ARRAY
// has been set for clang-11. So just make sure
// it's reset now. Needs further research!!!
#if defined(_LIBCPP_VERSION)
#undef BOOST_NO_CXX11_HDR_ARRAY
#endif
#ifndef BOOST_NO_CXX11_HDR_ARRAY
#include <array>
namespace boost { namespace serialization {
// implement serialization for std::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */)
{
@@ -42,7 +145,27 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
}
} } // end namespace boost::serialization
#endif
#endif // BOOST_NO_CXX11_HDR_ARRAY
#include <boost/array.hpp>
namespace boost { namespace serialization {
// implement serialization for boost::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
ar & boost::serialization::make_nvp("elems", a.elems);
}
} } // end namespace boost::serialization
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
namespace boost { namespace serialization { \
template <> struct use_array_optimization<Archive> { \
template <class ValueType> \
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
, typename boost::remove_const<ValueType>::type \
>::type {}; \
}; }}
#endif //BOOST_SERIALIZATION_ARRAY_HPP
@@ -1,37 +0,0 @@
#ifndef BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
#define BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace serialization {
template <class Archive>
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
} } // end namespace boost::serialization
#define BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(Archive) \
namespace boost { namespace serialization { \
template <> struct use_array_optimization<Archive> { \
template <class ValueType> \
struct apply : boost::mpl::apply1<Archive::use_array_optimization \
, typename boost::remove_const<ValueType>::type \
>::type {}; \
}; }}
#endif //BOOST_SERIALIZATION_ARRAY_OPTIMIZATON_HPP
@@ -1,121 +0,0 @@
#ifndef BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
#define BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//#include <iostream>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/split_member.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_optimization.hpp>
#include <boost/mpl/always.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/type_traits/remove_const.hpp>
namespace boost { namespace serialization {
template<class T>
class array_wrapper :
public wrapper_traits<const array_wrapper< T > >
{
private:
array_wrapper & operator=(const array_wrapper & rhs);
// note: I would like to make the copy constructor private but this breaks
// make_array. So I make make_array a friend
template<class Tx, class S>
friend const boost::serialization::array_wrapper<Tx> make_array(Tx * t, S s);
public:
array_wrapper(const array_wrapper & rhs) :
m_t(rhs.m_t),
m_element_count(rhs.m_element_count)
{}
public:
array_wrapper(T * t, std::size_t s) :
m_t(t),
m_element_count(s)
{}
// default implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int, mpl::false_ ) const
{
// default implemention does the loop
std::size_t c = count();
T * t = address();
while(0 < c--)
ar & boost::serialization::make_nvp("item", *t++);
}
// optimized implementation
template<class Archive>
void serialize_optimized(Archive &ar, const unsigned int version, mpl::true_ )
{
boost::serialization::split_member(ar, *this, version);
}
// default implementation
template<class Archive>
void save(Archive &ar, const unsigned int version) const
{
ar.save_array(*this,version);
}
// default implementation
template<class Archive>
void load(Archive &ar, const unsigned int version)
{
ar.load_array(*this,version);
}
// default implementation
template<class Archive>
void serialize(Archive &ar, const unsigned int version)
{
typedef typename
boost::serialization::use_array_optimization<Archive>::template apply<
typename remove_const< T >::type
>::type use_optimized;
serialize_optimized(ar,version,use_optimized());
}
T * address() const
{
return m_t;
}
std::size_t count() const
{
return m_element_count;
}
private:
T * const m_t;
const std::size_t m_element_count;
};
template<class T, class S>
inline
const array_wrapper< T > make_array(T* t, S s){
const array_wrapper< T > a(t, s);
return a;
}
} } // end namespace boost::serialization
#endif //BOOST_SERIALIZATION_ARRAY_WRAPPER_HPP
@@ -55,7 +55,7 @@ struct binary_object :
m_size = rhs.m_size;
return *this;
}
binary_object(const void * const t, std::size_t size) :
binary_object(/* const */ void * const t, std::size_t size) :
m_t(t),
m_size(size)
{}
@@ -69,7 +69,7 @@ struct binary_object :
// wrappers follow the naming convention make_xxxxx
inline
const binary_object
make_binary_object(const void * t, std::size_t size){
make_binary_object(/* const */ void * t, std::size_t size){
return binary_object(t, size);
}
@@ -1,33 +0,0 @@
#ifndef BOOST_SERIALIZATION_ARRAY_HPP
#define BOOST_SERIALIZATION_ARRAY_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//#include <iostream>
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
} // namespace std
#endif
#include <boost/serialization/nvp.hpp>
#include <boost/array.hpp>
namespace boost { namespace serialization {
// implement serialization for boost::array
template <class Archive, class T, std::size_t N>
void serialize(Archive& ar, boost::array<T,N>& a, const unsigned int /* version */)
{
ar & boost::serialization::make_nvp("elems", a.elems);
}
} } // end namespace boost::serialization
#endif //BOOST_SERIALIZATION_ARRAY_HPP
@@ -64,7 +64,7 @@ collection_load_impl(
Archive & ar,
T & t,
collection_size_type count,
item_version_type /*item_version*/
item_version_type
){
t.resize(count);
typename T::iterator hint;
@@ -19,7 +19,6 @@
// helper function templates for serialization of collections
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/version.hpp>
@@ -61,7 +60,7 @@ inline void save_collection(
// note borland emits a no-op without the explicit namespace
boost::serialization::save_construct_data_adl(
ar,
boost::addressof(*it),
&(*it),
item_version
);
ar << boost::serialization::make_nvp("item", *it++);
@@ -0,0 +1,59 @@
// (C) Copyright 2005 Matthias Troyer
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
#define BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#define STD _STLP_STD
#else
#define STD std
#endif
#include <vector>
#include <valarray>
namespace boost {
namespace serialization {
namespace detail {
template <class T, class Allocator>
T* get_data(STD::vector<T,Allocator>& v)
{
return v.empty() ? 0 : &(v[0]);
}
template <class T, class Allocator>
T* get_data(STD::vector<T,Allocator> const & v)
{
return get_data(const_cast<STD::vector<T,Allocator>&>(v));
}
template <class T>
T* get_data(STD::valarray<T>& v)
{
return v.size()==0 ? 0 : &(v[0]);
}
template <class T>
const T* get_data(STD::valarray<T> const& v)
{
return get_data(const_cast<STD::valarray<T>&>(v));
}
} // detail
} // serialization
} // boost
#undef STD
#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
@@ -18,37 +18,31 @@
#include <boost/config.hpp>
#if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#if defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 1101) \
|| ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
#include <type_traits>
namespace boost{
namespace serialization {
namespace detail {
template<typename T>
struct is_default_constructible : public std::is_default_constructible<T> {};
struct is_default_constructible : std::is_default_constructible<T> {};
} // detail
} // serializaition
} // boost
#else
// we don't have standard library support for is_default_constructible
// so we fake it by using boost::has_trivial_construtor. But this is not
// actually correct because it's possible that a default constructor
// to be non trivial. So when using this, make sure you're not using your
// own definition of of T() but are using the actual default one!
#include <boost/type_traits/has_trivial_constructor.hpp>
namespace boost{
namespace serialization {
namespace detail {
template<typename T>
struct is_default_constructible : public boost::has_trivial_constructor<T> {};
struct is_default_constructible : boost::has_trivial_constructor<T> {};
} // detail
} // serializaition
} // boost
#endif
#endif // BOOST_SERIALIZATION_DETAIL_IS_DEFAULT_CONSTRUCTIBLE_HPP
+22 -23
View File
@@ -48,33 +48,32 @@ namespace boost { \
namespace serialization { \
template<> \
T * factory<T, N>(std::va_list ap){ \
BOOST_PP_IF(BOOST_PP_GREATER(N, 0) \
, A0 a0 = va_arg(ap, A0);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1) \
, A1 a1 = va_arg(ap, A1);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2) \
, A2 a2 = va_arg(ap, A2);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3) \
, A3 a3 = va_arg(ap, A3);, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
,A0 a0 = va_arg(ap, A0); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
,A1 a1 = va_arg(ap, A1); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
,A2 a2 = va_arg(ap, A2); \
,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
,A3 a3 = va_arg(ap, A3); \
,BOOST_PP_EMPTY() \
)))) \
return new T( \
BOOST_PP_IF(BOOST_PP_GREATER(N, 0) \
, a0, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 1) \
, a1, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 2) \
, a2, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3)) \
, BOOST_PP_COMMA, BOOST_PP_EMPTY)() \
BOOST_PP_IF(BOOST_PP_GREATER(N, 3) \
, a3, BOOST_PP_EMPTY()) \
BOOST_PP_IF(BOOST_PP_GREATER(N,0) \
,a0 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,1) \
,a1 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,2) \
,a2 \
,BOOST_PP_IF(BOOST_PP_GREATER(N,3) \
,a3 \
,BOOST_PP_EMPTY() \
)))) \
); \
} \
} \
} /**/
} \
/**/
#define BOOST_SERIALIZATION_FACTORY_4(T, A0, A1, A2, A3) \
BOOST_SERIALIZATION_FACTORY(4, T, A0, A1, A2, A3)
+1 -3
View File
@@ -28,8 +28,6 @@
#include <boost/serialization/traits.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -45,7 +43,7 @@ struct nvp :
public:
explicit nvp(const char * name_, T & t) :
// note: added _ to suppress useless gcc warning
std::pair<const char *, T *>(name_, boost::addressof(t))
std::pair<const char *, T *>(name_, & t)
{}
const char * name() const {
+30 -25
View File
@@ -29,7 +29,6 @@
#include <boost/type_traits/is_pointer.hpp>
#include <boost/serialization/detail/stack_constructor.hpp>
#include <boost/serialization/detail/is_default_constructible.hpp>
#include <boost/serialization/force_include.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -47,15 +46,24 @@ void save(
// default constructor. It's possible that this could change sometime
// in the future, but for now, one will have to work around it. This can
// be done by serialization the optional<T> as optional<T *>
#if ! defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS)
BOOST_STATIC_ASSERT(
boost::serialization::detail::is_default_constructible<T>::value
|| boost::is_pointer<T>::value
);
#endif
BOOST_STATIC_ASSERT(
boost::serialization::detail::is_default_constructible<T>::value
|| boost::is_pointer<T>::value
);
const bool tflag = t.is_initialized();
ar << boost::serialization::make_nvp("initialized", tflag);
if (tflag){
const boost::serialization::item_version_type item_version(version< T >::value);
#if 0
const boost::archive::library_version_type library_version(
ar.get_library_version()
};
if(boost::archive::library_version_type(3) < library_version){
ar << BOOST_SERIALIZATION_NVP(item_version);
}
#else
ar << BOOST_SERIALIZATION_NVP(item_version);
#endif
ar << boost::serialization::make_nvp("value", *t);
}
}
@@ -64,7 +72,7 @@ template<class Archive, class T>
void load(
Archive & ar,
boost::optional< T > & t,
const unsigned int version
const unsigned int /*version*/
){
bool tflag;
ar >> boost::serialization::make_nvp("initialized", tflag);
@@ -73,18 +81,20 @@ void load(
return;
}
if(0 == version){
boost::serialization::item_version_type item_version(0);
boost::archive::library_version_type library_version(
ar.get_library_version()
);
if(boost::archive::library_version_type(3) < library_version){
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
boost::serialization::item_version_type item_version(0);
boost::archive::library_version_type library_version(
ar.get_library_version()
);
if(boost::archive::library_version_type(3) < library_version){
ar >> BOOST_SERIALIZATION_NVP(item_version);
}
if(! t.is_initialized())
t = T();
ar >> boost::serialization::make_nvp("value", *t);
detail::stack_allocate<T> tp;
ar >> boost::serialization::make_nvp("value", tp.reference());
t.reset(boost::move(tp.reference()));
ar.reset_object_address(
t.get_ptr(),
& tp.reference()
);
}
template<class Archive, class T>
@@ -96,12 +106,7 @@ void serialize(
boost::serialization::split_free(ar, t, version);
}
template<class T>
struct version<boost::optional<T> > {
BOOST_STATIC_CONSTANT(int, value = 1);
};
} // serialization
} // boost
} // namespace boost
#endif // BOOST_SERIALIZATION_OPTIONAL_HPP_
+38 -64
View File
@@ -81,72 +81,57 @@ namespace serialization {
// attempt to retieve a mutable instances while locked will
// generate a assertion if compiled for debug.
class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
static bool & get_lock();
public:
BOOST_SERIALIZATION_DECL static void lock();
BOOST_SERIALIZATION_DECL static void unlock();
BOOST_SERIALIZATION_DECL static bool is_locked();
};
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
namespace detail {
template<class T>
class singleton_wrapper : public T
{
public:
static bool m_is_destroyed;
~singleton_wrapper(){
m_is_destroyed = true;
}
};
template<class T>
bool detail::singleton_wrapper< T >::m_is_destroyed = false;
} // detail
// note usage of BOOST_DLLEXPORT. These functions are in danger of
// being eliminated by the optimizer when building an application in
// release mode. Usage of the macro is meant to signal the compiler/linker
// to avoid dropping these functions which seem to be unreferenced.
// This usage is not related to autolinking.
class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
BOOST_DLLEXPORT static bool & get_lock() BOOST_USED {
static bool lock = false;
return lock;
}
public:
BOOST_DLLEXPORT static void lock(){
get_lock() = true;
}
BOOST_DLLEXPORT static void unlock(){
get_lock() = false;
}
BOOST_DLLEXPORT static bool is_locked(){
return get_lock();
}
};
template <class T>
class singleton : public singleton_module
{
private:
static T & m_instance;
BOOST_DLLEXPORT static T & instance;
// include this to provoke instantiation at pre-execution time
static void use(T const *) {}
static T & get_instance() {
// use a wrapper so that types T with protected constructors
// can be used
class singleton_wrapper : public T {};
// Use a heap-allocated instance to work around static variable
// destruction order issues: this inner singleton_wrapper<>
// instance may be destructed before the singleton<> instance.
// Using a 'dumb' static variable lets us precisely choose the
// time destructor is invoked.
static singleton_wrapper *t = 0;
BOOST_DLLEXPORT static T & get_instance() {
static detail::singleton_wrapper< T > t;
// refer to instance, causing it to be instantiated (and
// initialized at startup on working compilers)
BOOST_ASSERT(! is_destroyed());
// note that the following is absolutely essential.
// commenting out this statement will cause compilers to fail to
// construct the instance at pre-execution time. This would prevent
// our usage/implementation of "locking" and introduce uncertainty into
// the sequence of object initializaition.
use(& m_instance);
if (!t)
t = new singleton_wrapper;
return static_cast<T &>(*t);
BOOST_ASSERT(! detail::singleton_wrapper< T >::m_is_destroyed);
use(& instance);
return static_cast<T &>(t);
}
static bool & get_is_destroyed(){
static bool is_destroyed;
return is_destroyed;
}
public:
BOOST_DLLEXPORT static T & get_mutable_instance(){
BOOST_ASSERT(! is_locked());
@@ -156,27 +141,16 @@ public:
return get_instance();
}
BOOST_DLLEXPORT static bool is_destroyed(){
return get_is_destroyed();
}
BOOST_DLLEXPORT singleton(){
get_is_destroyed() = false;
}
BOOST_DLLEXPORT ~singleton() {
if (!get_is_destroyed()) {
delete &(get_instance());
}
get_is_destroyed() = true;
return detail::singleton_wrapper< T >::m_is_destroyed;
}
};
template<class T>
T & singleton< T >::m_instance = singleton< T >::get_instance();
BOOST_DLLEXPORT T & singleton< T >::instance = singleton< T >::get_instance();
} // namespace serialization
} // namespace boost
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
+6 -11
View File
@@ -18,13 +18,10 @@
#include <valarray>
#include <boost/config.hpp>
#include <boost/core/addressof.hpp>
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/detail/get_data.hpp>
// function specializations must be defined in the appropriate
// namespace - boost::serialization
@@ -45,13 +42,12 @@ void save( Archive & ar, const STD::valarray<U> &t, const unsigned int /*file_ve
{
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (t.size()){
if (t.size())
// explict template arguments to pass intel C++ compiler
ar << serialization::make_array<const U, collection_size_type>(
static_cast<const U *>( boost::addressof(t[0]) ),
static_cast<const U *>(&t[0]),
count
);
}
}
template<class Archive, class U>
@@ -60,13 +56,12 @@ void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version
collection_size_type count;
ar >> BOOST_SERIALIZATION_NVP(count);
t.resize(count);
if (t.size()){
if (t.size())
// explict template arguments to pass intel C++ compiler
ar >> serialization::make_array<U, collection_size_type>(
static_cast<U *>( boost::addressof(t[0]) ),
static_cast<U *>(&t[0]),
count
);
}
}
// split non-intrusive serialization function member into separate
+2 -1
View File
@@ -31,7 +31,8 @@
#include <boost/serialization/collections_save_imp.hpp>
#include <boost/serialization/collections_load_imp.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/mpl/bool_fwd.hpp>
#include <boost/mpl/if.hpp>
-16
View File
@@ -77,14 +77,6 @@ archive_exception::archive_exception(
break;
case input_stream_error:
length = append(length, "input stream error");
if(NULL != e1){
length = append(length, "-");
length = append(length, e1);
}
if(NULL != e2){
length = append(length, "-");
length = append(length, e2);
}
break;
case invalid_class_name:
length = append(length, "class name too long");
@@ -113,14 +105,6 @@ archive_exception::archive_exception(
break;
case output_stream_error:
length = append(length, "output stream error");
if(NULL != e1){
length = append(length, "-");
length = append(length, e1);
}
if(NULL != e2){
length = append(length, "-");
length = append(length, e2);
}
break;
default:
BOOST_ASSERT(false);
+1 -3
View File
@@ -77,12 +77,10 @@ BOOST_ARCHIVE_SIGNATURE(){
// 13- simplified visibility, removed Borland, removed pfto
// 14- improved visibility, refactor map/set
// 15- corrections to optional and collection loading
// 16- eliminated dependency on <codecvt> which is buggy in some libraries
// and now officially deprecated in the standard
BOOST_SYMBOL_VISIBLE library_version_type
BOOST_ARCHIVE_VERSION(){
return library_version_type(16);
return library_version_type(15);
}
} // namespace archive
+1 -7
View File
@@ -459,12 +459,6 @@ basic_iarchive_impl::load_pointer(
cobject_id & co = cobject_id_vector[i];
bpis_ptr = co.bpis_ptr;
if (bpis_ptr == NULL) {
boost::serialization::throw_exception(
archive_exception(archive_exception::unregistered_class)
);
}
load_preamble(ar, co);
// extra line to evade borland issue
@@ -493,7 +487,7 @@ basic_iarchive_impl::load_pointer(
m_pending.version = co.file_version;
// predict next object id to be created
const size_t ui = object_id_vector.size();
const unsigned int ui = object_id_vector.size();
serialization::state_saver<object_id_type> w_end(m_moveable_objects.end);
+2 -3
View File
@@ -106,9 +106,8 @@ class basic_oarchive_impl {
m_class_id(class_id),
m_initialized(false)
{}
cobject_type(const basic_oserializer & bos) :
m_bos_ptr(& bos),
m_initialized(false)
cobject_type(const basic_oserializer & bos)
: m_bos_ptr(& bos)
{}
cobject_type(
const cobject_type & rhs
+5 -12
View File
@@ -21,9 +21,6 @@
# pragma warning(disable : 4244 4511 4512)
#endif
#include <cerrno> // errno
#include <cstring> // strerror(errno)
// spirit stuff
#include <boost/spirit/include/classic_operators.hpp>
#include <boost/spirit/include/classic_actions.hpp>
@@ -34,6 +31,7 @@
#endif
// for head_iterator test
//#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/io/ios_state.hpp>
@@ -147,7 +145,8 @@ template<class String>
struct append_char {
String & contents;
void operator()(const unsigned int char_value) const {
contents += static_cast<typename String::value_type>(char_value);
const typename String::value_type z = char_value;
contents += z;
}
append_char(String & contents_)
: contents(contents_)
@@ -190,14 +189,8 @@ bool basic_xml_grammar<CharType>::my_parse(
for(;;){
CharType result;
is.get(result);
if(is.fail()){
boost::serialization::throw_exception(
boost::archive::archive_exception(
archive_exception::input_stream_error,
std::strerror(errno)
)
);
}
if(is.fail())
return false;
if(is.eof())
return false;
arg += result;
+2 -2
View File
@@ -18,7 +18,7 @@
namespace boost {
namespace archive {
std::codecvt_base::result
BOOST_WARCHIVE_DECL std::codecvt_base::result
codecvt_null<wchar_t>::do_out(
std::mbstate_t & /*state*/,
const wchar_t * first1,
@@ -46,7 +46,7 @@ codecvt_null<wchar_t>::do_out(
return std::codecvt_base::ok;
}
std::codecvt_base::result
BOOST_WARCHIVE_DECL std::codecvt_base::result
codecvt_null<wchar_t>::do_in(
std::mbstate_t & /*state*/,
const char * first1,
-1
View File
@@ -125,7 +125,6 @@ BOOST_SERIALIZATION_DECL void
extended_type_info::key_unregister() const{
if(NULL == get_key())
return;
BOOST_ASSERT(! singleton<detail::ktmap>::is_destroyed());
if(! singleton<detail::ktmap>::is_destroyed()){
detail::ktmap & x = singleton<detail::ktmap>::get_mutable_instance();
detail::ktmap::iterator start = x.lower_bound(this);
+10 -9
View File
@@ -95,18 +95,19 @@ BOOST_SERIALIZATION_DECL void
extended_type_info_typeid_0::type_unregister()
{
if(NULL != m_ti){
BOOST_ASSERT(! singleton<tkmap>::is_destroyed());
if(! singleton<tkmap>::is_destroyed()){
tkmap & x = singleton<tkmap>::get_mutable_instance();
tkmap::iterator start = x.lower_bound(this);
tkmap::iterator end = x.upper_bound(this);
BOOST_ASSERT(start != end);
// remove all entries in map which corresponds to this type
// make sure that we don't use any invalidated iterators
for(;;){
const tkmap::iterator & it = x.find(this);
if(it == x.end())
break;
x.erase(it);
};
// remove entry in map which corresponds to this type
do{
if(this == *start)
x.erase(start++);
else
++start;
}while(start != end);
}
}
m_ti = NULL;
+36
View File
@@ -0,0 +1,36 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// singleton.cpp
//
// Copyright (c) 201 5 Robert Ramey, Indiana University (garcia@osl.iu.edu)
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// it marks our code with proper attributes as being exported when
// we're compiling it while marking it import when just the headers
// is being included.
#define BOOST_SERIALIZATION_SOURCE
#include <boost/serialization/config.hpp>
#include <boost/serialization/singleton.hpp>
namespace boost {
namespace serialization {
bool & singleton_module::get_lock(){
static bool lock = false;
return lock;
}
BOOST_SERIALIZATION_DECL void singleton_module::lock(){
get_lock() = true;
}
BOOST_SERIALIZATION_DECL void singleton_module::unlock(){
get_lock() = false;
}
BOOST_SERIALIZATION_DECL bool singleton_module::is_locked() {
return get_lock();
}
} // namespace serialization
} // namespace boost
+15 -14
View File
@@ -4,19 +4,20 @@
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#endif
// include boost implementation of utf8 codecvt facet
# define BOOST_ARCHIVE_SOURCE
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.ipp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#else
// #ifdef BOOST_NO_CXX11_HDR_CODECVT
#if 1
# define BOOST_ARCHIVE_SOURCE
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.ipp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif // BOOST_NO_STD_WSTREAMBUF
-1
View File
@@ -276,7 +276,6 @@ void_caster::recursive_register(bool includes_virtual_base) const {
BOOST_SERIALIZATION_DECL void
void_caster::recursive_unregister() const {
BOOST_ASSERT(! void_caster_registry::is_destroyed());
if(void_caster_registry::is_destroyed())
return;
+8 -9
View File
@@ -48,7 +48,7 @@ void accumulate(std::size_t & s, const T & t){
s += *tptr++;
}
}
A_DLL_DECL
A::operator std::size_t () const {
std::size_t retval = 0;
accumulate(retval, b);
@@ -76,9 +76,8 @@ A::operator std::size_t () const {
#if defined(_MSC_VER)
#pragma warning(push) // Save warning settings.
#pragma warning(disable : 4244) // Disable possible loss of data warning
#endif
A_DLL_DECL
#endif
A::A() :
b(true),
#ifndef BOOST_NO_INT64_T
@@ -112,8 +111,8 @@ A::A() :
#pragma warning(pop) // Restore warnings to previous state.
#endif
A_DLL_DECL bool
A::operator==(const A &rhs) const {
bool A::operator==(const A &rhs) const
{
if(b != rhs.b)
return false;
if(l != rhs.l)
@@ -161,13 +160,13 @@ A::operator==(const A &rhs) const {
return true;
}
A_DLL_DECL bool
A::operator!=(const A &rhs) const {
bool A::operator!=(const A &rhs) const
{
return ! (*this == rhs);
}
A_DLL_DECL bool
A::operator<(const A &rhs) const {
bool A::operator<(const A &rhs) const
{
if(b != rhs.b)
return b < rhs.b;
#ifndef BOOST_NO_INT64_T
+77 -17
View File
@@ -18,42 +18,100 @@
#include <ostream> // for friend output operators
#include <cstddef> // size_t
#include <string>
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
}
#endif
#include <boost/detail/workaround.hpp>
#include <boost/limits.hpp>
#include <boost/cstdint.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/string.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if defined(A_IMPORT)
#define A_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message("A imported")
#elif defined(A_EXPORT)
#define A_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("A exported")
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#include <boost/detail/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
#endif
#endif
#ifndef A_DLL_DECL
#define A_DLL_DECL
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#if defined(A_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#elif defined(A_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#else
#define DLL_DECL
#endif
class A_DLL_DECL A {
class DLL_DECL A
{
private:
friend class boost::serialization::access;
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
);
// note: from an aesthetic perspective, I would much prefer to have this
// defined out of line. Unfortunately, this trips a bug in the VC 6.0
// compiler. So hold our nose and put it her to permit running of tests.
// mscvc 6.0 requires template functions to be implemented. For this
// reason we can't make abstract.
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_NVP(b);
#ifndef BOOST_NO_INT64_T
ar & BOOST_SERIALIZATION_NVP(f);
ar & BOOST_SERIALIZATION_NVP(g);
#endif
#if BOOST_WORKAROUND(__BORLANDC__, <= 0x551 )
int i;
if(BOOST_DEDUCED_TYPENAME Archive::is_saving::value){
i = l;
ar & BOOST_SERIALIZATION_NVP(i);
}
else{
ar & BOOST_SERIALIZATION_NVP(i);
l = i;
}
#else
ar & BOOST_SERIALIZATION_NVP(l);
#endif
ar & BOOST_SERIALIZATION_NVP(m);
ar & BOOST_SERIALIZATION_NVP(n);
ar & BOOST_SERIALIZATION_NVP(o);
ar & BOOST_SERIALIZATION_NVP(p);
ar & BOOST_SERIALIZATION_NVP(q);
#ifndef BOOST_NO_CWCHAR
ar & BOOST_SERIALIZATION_NVP(r);
#endif
ar & BOOST_SERIALIZATION_NVP(c);
ar & BOOST_SERIALIZATION_NVP(s);
ar & BOOST_SERIALIZATION_NVP(t);
ar & BOOST_SERIALIZATION_NVP(u);
ar & BOOST_SERIALIZATION_NVP(v);
ar & BOOST_SERIALIZATION_NVP(w);
ar & BOOST_SERIALIZATION_NVP(x);
ar & BOOST_SERIALIZATION_NVP(y);
#ifndef BOOST_NO_STD_WSTRING
ar & BOOST_SERIALIZATION_NVP(z);
#endif
}
#else
template<class Archive>
void serialize(
Archive &ar,
const unsigned int /* file_version */
);
#endif
bool b;
#ifndef BOOST_NO_INT64_T
boost::int64_t f;
@@ -94,4 +152,6 @@ public:
friend std::ostream & operator<<(std::ostream & os, A const & a);
};
#undef DLL_DECL
#endif // BOOST_SERIALIZATION_TEST_A_HPP
+6 -2
View File
@@ -8,11 +8,13 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/detail/workaround.hpp>
#if ! BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
#include <boost/archive/dinkumware.hpp>
#endif
#include <boost/serialization/nvp.hpp>
#include "A.hpp"
template<class Archive>
@@ -57,4 +59,6 @@ void A::serialize(
#ifndef BOOST_NO_STD_WSTRING
ar & BOOST_SERIALIZATION_NVP(z);
#endif
};
}
#endif // workaround BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+35 -25
View File
@@ -9,7 +9,6 @@
project libs/serialization/test
: id serialization_test
: requirements <source>/boost/filesystem
: requirements <source>/boost/system
;
# import rules for testing conditional on config file variables
@@ -29,21 +28,34 @@ import ../util/test :
;
BOOST_ARCHIVE_LIST = [ modules.peek : BOOST_ARCHIVE_LIST ] ;
lib a
lib dll_a_lib
:
dll_a.cpp
../build//boost_serialization
:
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
lib polymorphic_derived2
:
polymorphic_derived2.cpp
polymorphic_base.cpp
lib dll_base_lib
:
dll_base.cpp
../build//boost_serialization
:
;
lib dll_derived2_lib
:
dll_derived2.cpp
dll_base_lib
../build//boost_serialization
:
;
lib dll_polymorphic_derived2_lib
:
polymorphic_derived2.cpp
../build//boost_serialization
:
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
;
test-suite "serialization" :
@@ -72,7 +84,6 @@ test-suite "serialization" :
[ test-bsl-run_files test_list : A ]
[ test-bsl-run_files test_list_ptrs : A ]
[ test-bsl-run_files test_map : A ]
[ test-bsl-run_files test_map_hashed : A : : [ requires hash ] ] # BOOST_HAS_HASH
[ test-bsl-run_files test_map_unordered : A : : [ requires cxx11_hdr_unordered_map ] ] # BOOST_NO_CXX11_HDR_UNORDERED_MAP
[ test-bsl-run_files test_map_boost_unordered : A ]
[ test-bsl-run_files test_mi ]
@@ -96,8 +107,6 @@ test-suite "serialization" :
[ test-bsl-run_files test_set_boost_unordered : A ]
[ test-bsl-run_files test_simple_class : A ]
[ test-bsl-run_files test_simple_class_ptr : A ]
[ test-bsl-run_files test_slist : A : : [ requires slist ] ] # BOOST_HAS_SLIST ]
[ test-bsl-run_files test_slist_ptrs : A : : [ requires slist ] ] # BOOST_HAS_SLIST ] ]
[ test-bsl-run_files test_split ]
[ test-bsl-run_files test_stack : A ]
[ test-bsl-run_files test_tracking ]
@@ -110,7 +119,7 @@ test-suite "serialization" :
[ test-bsl-run_files test_optional ]
[ test-bsl-run_files test_shared_ptr ]
[ test-bsl-run_files test_shared_ptr_multi_base ]
[ test-bsl-run_files test_shared_ptr_132 : : : [ requires auto_ptr ] ] # BOOST_NO_AUTO_PTR
[ test-bsl-run_files test_shared_ptr_132 ]
[ test-bsl-run_polymorphic_archive test_polymorphic : test_polymorphic_A A ]
[ test-bsl-run_polymorphic_archive test_polymorphic2 : test_polymorphic2imp ]
[ test-bsl-run_polymorphic_archive test_polymorphic_helper ]
@@ -121,16 +130,13 @@ test-suite "serialization" :
if ! $(BOOST_ARCHIVE_LIST) {
test-suite "serialization2" :
[ test-bsl-run test_inclusion ]
[ test-bsl-run test_inclusion2 ]
# boost build has the feature that the building if libraries vs dll is automatic
# in that dependent libraries are built the same way - shared/static - that
# the application is. On some platforms (e.g windows) this is required to avoid
# problems of linking incompatible versions of the runtime library. So
# we suppress tests of our dlls when using static libraries
[ test-bsl-run test_dll_exported : : polymorphic_derived2 : <link>static:<build>no ]
# [ test-bsl-run test_dll_plugin : : polymorphic_derived2 : <link>static:<build>no <target-os>linux:<linkflags>-ldl ]
[ test-bsl-run test_dll_simple : : a : ]
[ test-bsl-run-no-lib test_inclusion ]
[ test-bsl-run test_dll_exported : : dll_polymorphic_derived2_lib ]
[ test-bsl-run test_dll_simple : : dll_a_lib ]
[ compile test_dll_plugin.cpp ]
# Running the following test requires that the test know the directory
# in which the dll is stored. I don't know how to extract this from bjam
# [ test-bsl-run test_dll_plugin : : dll_polymorphic_derived2_lib ]
[ test-bsl-run test_private_ctor ]
[ test-bsl-run test_reset_object_address : A ]
[ test-bsl-run test_void_cast ]
@@ -138,9 +144,13 @@ if ! $(BOOST_ARCHIVE_LIST) {
[ test-bsl-run test_iterators ]
[ test-bsl-run test_iterators_base64 ]
[ test-bsl-run test_smart_cast ]
[ test-bsl-run test_codecvt_null ]
[ test-bsl-run test_codecvt_null
: ../src/codecvt_null
:
: [ requires std_wstreambuf ]
]
# [ test-bsl-run test_z ]
#[ test-bsl-run test_z ]
# should fail compilation
[ compile-fail test_not_serializable.cpp ]
+4 -5
View File
@@ -1,4 +1,3 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// dll_a.cpp
@@ -21,12 +20,12 @@
#include <boost/archive/text_iarchive.hpp>
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::text_oarchive &ar,
const unsigned int /* file_version */
);
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::text_iarchive &ar,
const unsigned int /* file_version */
);
@@ -37,12 +36,12 @@ A_DLL_DECL void A::serialize(
#include <boost/archive/polymorphic_iarchive.hpp>
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::polymorphic_oarchive &ar,
const unsigned int /* file_version */
);
template
A_DLL_DECL void A::serialize(
BOOST_SYMBOL_EXPORT void A::serialize(
boost::archive::polymorphic_iarchive &ar,
const unsigned int /* file_version */
);
+7 -1
View File
@@ -11,7 +11,13 @@
#include <boost/serialization/export.hpp>
#define POLYMORPHIC_BASE_EXPORT
#include "polymorphic_base.hpp"
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_base)
const char * polymorphic_base::get_key() const{
return
boost::serialization::type_info_implementation<
polymorphic_base
>::type::get_const_instance().get_key();
}
+10 -15
View File
@@ -24,21 +24,15 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if defined(POLYMORPHIC_BASE_IMPORT)
#define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message ("polymorphic_base imported")
#elif defined(POLYMORPHIC_BASE_EXPORT)
#define POLYMORPHIC_BASE_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("polymorphic_base exported")
#endif
#if defined(POLYMORPHIC_BASE_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#elif defined(POLYMORPHIC_BASE_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#else
#define DLL_DECL
#endif
#ifndef POLYMORPHIC_BASE_DLL_DECL
#define POLYMORPHIC_BASE_DLL_DECL
#endif
class POLYMORPHIC_BASE_DLL_DECL polymorphic_base
class BOOST_SYMBOL_VISIBLE polymorphic_base
{
friend class boost::serialization::access;
template<class Archive>
@@ -54,15 +48,16 @@ public:
virtual ~polymorphic_base(){};
};
#undef DLL_DECL
BOOST_SERIALIZATION_ASSUME_ABSTRACT(polymorphic_base)
// the no_rtti system requires this !!!
BOOST_CLASS_EXPORT_KEY(polymorphic_base)
BOOST_CLASS_TYPE_INFO(
polymorphic_base,
extended_type_info_no_rtti<polymorphic_base>
boost::serialization::extended_type_info_no_rtti<polymorphic_base>
)
#endif // POLYMORPHIC_BASE_HPP
+13 -13
View File
@@ -12,23 +12,26 @@
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/export.hpp>
#define POLYMORPHIC_BASE_EXPORT
#include "polymorphic_base.hpp"
#define POLYMORPHIC_DERIVED2_EXPORT
#include "polymorphic_derived2.hpp"
template<class Archive>
void polymorphic_derived2::serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
}
// instantiate code for text archives
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
template
void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
boost::archive::text_oarchive & ar,
const unsigned int version
);
template
void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
boost::archive::text_iarchive & ar,
const unsigned int version
);
@@ -37,13 +40,11 @@ void polymorphic_derived2::serialize(
#include <boost/archive/polymorphic_iarchive.hpp>
#include <boost/archive/polymorphic_oarchive.hpp>
template
void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
boost::archive::polymorphic_oarchive & ar,
const unsigned int version
);
template
void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
boost::archive::polymorphic_iarchive & ar,
const unsigned int version
);
@@ -59,7 +60,6 @@ BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
BOOST_SERIALIZATION_FACTORY_0(polymorphic_derived2)
template
POLYMORPHIC_DERIVED2_DLL_DECL
void polymorphic_derived2 *
BOOST_SYMBOL_EXPORT void polymorphic_derived2 *
boost::serialization::factory<polymorphic_derived2, 0>(std::va_list ap);
#endif
+16 -23
View File
@@ -1,5 +1,5 @@
#ifndef BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_HPP
#define BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_HPP
#ifndef POLYMORPHIC_DERIVED2_HPP
#define POLYMORPHIC_DERIVED2_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
@@ -24,23 +24,19 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_typeid.hpp>
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
#if defined(POLYMORPHIC_DERIVED2_IMPORT)
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_IMPORT
#pragma message ("polymorphic_derived2 imported")
#elif defined(POLYMORPHIC_DERIVED2_EXPORT)
#define POLYMORPHIC_DERIVED2_DLL_DECL BOOST_SYMBOL_EXPORT
#pragma message ("polymorphic_derived2 exported")
#endif
#endif
#ifndef POLYMORPHIC_DERIVED2_DLL_DECL
#define POLYMORPHIC_DERIVED2_DLL_DECL
#endif
#include <boost/preprocessor/empty.hpp>
#include "polymorphic_base.hpp"
class POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2 :
#if defined(POLYMORPHIC_DERIVED2_IMPORT)
#define DLL_DECL BOOST_SYMBOL_IMPORT
#elif defined(POLYMORPHIC_DERIVED2_EXPORT)
#define DLL_DECL BOOST_SYMBOL_EXPORT
#else
#define DLL_DECL
#endif
class DLL_DECL polymorphic_derived2 :
public polymorphic_base
{
friend class boost::serialization::access;
@@ -48,15 +44,10 @@ class POLYMORPHIC_DERIVED2_DLL_DECL polymorphic_derived2 :
void serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
}
);
virtual const char * get_key() const {
return "polymorphic_derived2";
}
public:
polymorphic_derived2(){}
~polymorphic_derived2(){}
};
// we use this because we want to assign a key to this type
@@ -72,5 +63,7 @@ BOOST_CLASS_TYPE_INFO(
boost::serialization::extended_type_info_typeid<polymorphic_derived2>
)
#endif // BOOST_SERIALIZATION_TEST_POLYMORPHIC_DERIVED2_HPP
#undef DLL_DECL
#endif // POLYMORPHIC_DERIVED2_HPP
+1 -1
View File
@@ -23,7 +23,7 @@ namespace std{
#include "test_tools.hpp"
#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/serialization/boost_array.hpp>
#include <boost/array.hpp>
#include "A.hpp"
#include "A.ipp"
-1
View File
@@ -143,7 +143,6 @@ int test2(){
ia >> BOOST_SERIALIZATION_NVP(j2);
}
BOOST_CHECK(*j1 == *j2);
delete j1;
BOOST_CHECK(j2 == j2->j);
std::remove(testfile);
return EXIT_SUCCESS;
-1
View File
@@ -44,7 +44,6 @@ int test_main( int /* argc */, char* /* argv */[] )
}
BOOST_CHECK(tb != tb1);
BOOST_CHECK(*tb == *tb1);
delete tb;
std::remove(testfile);
return EXIT_SUCCESS;
}
-1
View File
@@ -198,7 +198,6 @@ test_main( int /* argc */, char* /* argv */[] )
BOOST_CHECK(1 == save_count);
BOOST_CHECK(1 == load_count);
BOOST_CHECK(*bp2 == *bp);
delete bp;
std::remove(testfile);
return EXIT_SUCCESS;
+6 -7
View File
@@ -45,6 +45,7 @@ namespace std{
#include <boost/serialization/export.hpp>
#include <boost/serialization/access.hpp>
#define POLYMORPHIC_BASE_IMPORT
#include "polymorphic_base.hpp"
class polymorphic_derived1 : public polymorphic_base
@@ -61,13 +62,12 @@ public:
virtual ~polymorphic_derived1(){}
};
BOOST_CLASS_EXPORT_KEY(polymorphic_derived1)
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived1)
BOOST_CLASS_EXPORT(polymorphic_derived1)
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived1)
#define POLYMORPHIC_DERIVED2_IMPORT
#define POLYMORPHIC_DERIVED_IMPORT
#include "polymorphic_derived2.hpp"
// save exported polymorphic class
@@ -86,9 +86,8 @@ void save_exported(const char *testfile)
oa << BOOST_SERIALIZATION_NVP(rb2);
oa << BOOST_SERIALIZATION_NVP(rd21);
delete rd21;
delete rb2;
delete rb1;
delete rb2;
}
// save exported polymorphic class
@@ -130,9 +129,9 @@ void load_exported(const char *testfile)
::type::get_const_instance().get_derived_extended_type_info(*rd21),
"restored pointer d2 not of correct type"
);
delete rd21;
delete rb2;
delete rb1;
delete rb2;
delete rd21;
}
int
+3 -4
View File
@@ -165,10 +165,10 @@ test_main( int /* argc */, char* /* argv */[] )
BOOST_REQUIRE(NULL != testfile);
HINSTANCE hDLL; // Handle to DLL
hDLL = LoadLibrary(_T("polymorphic_derived2.dll"));
hDLL = LoadLibrary(_T("plugin_polymorphic_derived2.dll"));
BOOST_CHECK_MESSAGE(
(0 != hDLL),
"Failed to find/load polymorphic_derived2"
"Failed to find/load plugin_polymorphic_derived2"
);
if(0 == hDLL)
return EXIT_FAILURE;
@@ -192,9 +192,8 @@ test_main( int /* argc */, char* /* argv */[] )
BOOST_REQUIRE(NULL != testfile);
void * hDLL; // Handle to DLL
hDLL = dlopen("polymorphic_derived2.so", RTLD_NOW | RTLD_GLOBAL);
hDLL = dlopen("plugin_polymorphic_derived2.so", RTLD_NOW | RTLD_GLOBAL);
BOOST_CHECK_MESSAGE((0 != hDLL), "Failed to find/load plugin_polymorphic_derived2" );
BOOST_CHECK_MESSAGE((0 != hDLL), dlerror() );
if(0 == hDLL)
return EXIT_FAILURE;
+10 -2
View File
@@ -56,13 +56,21 @@ BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derive
// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)
template<class Archive>
void polymorphic_derived2::serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
}
BOOST_CLASS_EXPORT_IMPLEMENT(polymorphic_derived2)
template void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
test_oarchive & ar,
const unsigned int version
);
template void polymorphic_derived2::serialize(
template BOOST_SYMBOL_EXPORT void polymorphic_derived2::serialize(
test_iarchive & ar,
const unsigned int version
);
+93 -6
View File
@@ -44,6 +44,89 @@ struct ptr_equal_to {
}
};
#include <boost/serialization/list.hpp>
void test_list(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> alist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
A * free_a_ptr = new A;
alist.push_back(free_a_ptr);
alist.push_back(new A);
// verify that first element is the same as the free pointer
BOOST_CHECK((*alist.begin()) == free_a_ptr);
oa << boost::serialization::make_nvp("alist", alist);
oa << boost::serialization::make_nvp("free_a_ptr", free_a_ptr);
}
std::list<A *> alist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
A * free_a_ptr1;
ia >> boost::serialization::make_nvp("alist", alist1);
ia >> boost::serialization::make_nvp("free_a_ptr", free_a_ptr1);
BOOST_CHECK(
alist.size() == alist1.size()
&& std::equal(alist.begin(),alist.end(),alist1.begin(),ptr_equal_to<A *>())
);
// verify that first element is the same as the free pointer
BOOST_CHECK((*alist1.begin()) == free_a_ptr1);
}
std::for_each(
alist.begin(),
alist.end(),
boost::checked_deleter<A>()
);
std::for_each(
alist1.begin(),
alist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_back(new A);
aslist.push_back(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
std::list<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#endif
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
#include <boost/serialization/forward_list.hpp>
void test_forward_list(){
const char * testfile = boost::archive::tmpnam(NULL);
@@ -63,12 +146,7 @@ void test_forward_list(){
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(
std::equal(
aslist.begin(),
aslist.end(),
aslist1.begin(),
ptr_equal_to<A *>()
)
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
@@ -83,10 +161,19 @@ void test_forward_list(){
);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
test_forward_list();
#endif
return EXIT_SUCCESS;
}
-1
View File
@@ -19,7 +19,6 @@
#include <boost/serialization/traits.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/singleton.hpp>
struct foo
{
-25
View File
@@ -1,25 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_const.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/archive/binary_iarchive.hpp>
#include <boost/serialization/vector.hpp>
#include <sstream>
#include <vector>
void f()
{
std::stringstream iss;
boost::archive::binary_iarchive ar(iss);
std::vector<int> out;
ar >> out;
}
int
main(int /*argc*/, char * /*argv*/[]){
return 0;
}
+3 -3
View File
@@ -29,7 +29,7 @@ namespace std{
struct test_dummy_out {
template<class Archive>
void save(Archive &, const unsigned int /*version*/) const {
void save(Archive & ar, const unsigned int /*version*/) const {
throw boost::archive::archive_exception(
boost::archive::archive_exception::other_exception
);
@@ -77,10 +77,10 @@ int test_out(){
struct test_dummy_in {
template<class Archive>
void save(Archive & /* ar */, const unsigned int /*version*/) const {
void save(Archive & ar, const unsigned int /*version*/) const {
}
template<class Archive>
void load(Archive & /* ar */, const unsigned int /*version*/){
void load(Archive & ar, const unsigned int /*version*/){
throw boost::archive::archive_exception(
boost::archive::archive_exception::other_exception
);
+27
View File
@@ -49,9 +49,36 @@ void test_list(){
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
aslist.push_front(A());
aslist.push_front(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
}
BOOST_CHECK(aslist == aslist1);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
return EXIT_SUCCESS;
}
+42
View File
@@ -89,9 +89,51 @@ void test_list(){
std::remove(testfile);
}
#ifdef BOOST_HAS_SLIST
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
std::list<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_back(new A);
aslist.push_back(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
std::list<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
#endif
int test_main( int /* argc */, char* /* argv */[] )
{
test_list();
#ifdef BOOST_HAS_SLIST
test_slist();
#endif
return EXIT_SUCCESS;
}
-3
View File
@@ -117,8 +117,5 @@ int test_main(int /* argc */, char * /* argv */[])
// Try to save and load pointers to Bs, to an xml archive
test_save_and_load<xml_oarchive, xml_iarchive>(b, b1);
delete a;
delete b;
return EXIT_SUCCESS;
}
+1
View File
@@ -23,6 +23,7 @@ namespace std{
#include "test_tools.hpp"
#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/array.hpp>
#include "A.hpp"
#include "A.ipp"
+8
View File
@@ -41,6 +41,14 @@ namespace std{
#include "polymorphic_derived1.hpp"
#include "polymorphic_derived2.hpp"
template<class Archive>
void polymorphic_derived2::serialize(
Archive &ar,
const unsigned int /* file_version */
){
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);
}
template void polymorphic_derived2::serialize(
test_oarchive & ar,
const unsigned int version
+2 -39
View File
@@ -24,25 +24,9 @@ namespace std{
#include "test_tools.hpp"
#include <boost/serialization/optional.hpp>
#include <boost/serialization/string.hpp>
struct A {
int m_x;
template<class Archive>
void serialize(Archive & ar, const unsigned int /* version */){
ar & boost::serialization::make_nvp("x", m_x);
};
bool operator==(const A & rhs) const {
return m_x == rhs.m_x;
}
// note that default constructor is not trivial
A() :
m_x(0)
{}
A(int x) :
m_x(x)
{}
};
#include "A.hpp"
#include "A.ipp"
int test_main( int /* argc */, char* /* argv */[] )
{
@@ -51,43 +35,22 @@ int test_main( int /* argc */, char* /* argv */[] )
const boost::optional<int> aoptional1;
const boost::optional<int> aoptional2(123);
const boost::optional<A> aoptional3;
A a(1);
const boost::optional<A> aoptional4(a);
const boost::optional<A *> aoptional5;
const boost::optional<A *> aoptional6(& a);
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << boost::serialization::make_nvp("aoptional1",aoptional1);
oa << boost::serialization::make_nvp("aoptional2",aoptional2);
oa << boost::serialization::make_nvp("aoptional3",aoptional3);
oa << boost::serialization::make_nvp("aoptional4",aoptional4);
oa << boost::serialization::make_nvp("aoptional5",aoptional5);
oa << boost::serialization::make_nvp("aoptional6",aoptional6);
}
boost::optional<int> aoptional1a(999);
boost::optional<int> aoptional2a;
boost::optional<A> aoptional3a;
boost::optional<A> aoptional4a;
boost::optional<A *> aoptional5a;
boost::optional<A *> aoptional6a;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aoptional1",aoptional1a);
ia >> boost::serialization::make_nvp("aoptional2",aoptional2a);
ia >> boost::serialization::make_nvp("aoptional3",aoptional3a);
ia >> boost::serialization::make_nvp("aoptional4",aoptional4a);
ia >> boost::serialization::make_nvp("aoptional5",aoptional5a);
ia >> boost::serialization::make_nvp("aoptional6",aoptional6a);
}
BOOST_CHECK(aoptional1 == aoptional1a);
BOOST_CHECK(aoptional2 == aoptional2a);
BOOST_CHECK(aoptional3 == aoptional3a);
BOOST_CHECK(aoptional4.get() == aoptional4a.get());
BOOST_CHECK(aoptional5 == aoptional5a);
BOOST_CHECK(*aoptional6.get() == *aoptional6a.get());
std::remove(testfile);
return EXIT_SUCCESS;
-1
View File
@@ -45,7 +45,6 @@ int test_main( int /* argc */, char* /* argv */[] )
}
BOOST_CHECK(ta != ta1);
BOOST_CHECK(*ta == *ta1);
delete ta;
std::remove(testfile);
return EXIT_SUCCESS;
}
-55
View File
@@ -1,55 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_list.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// should pass compilation and execution
#include <cstddef> // NULL
#include <fstream>
#include <boost/config.hpp>
#include <cstdio> // remove
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::remove;
}
#endif
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include "A.hpp"
#include "A.ipp"
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist;
aslist.push_front(A());
aslist.push_front(A());
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A> aslist1;{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
}
BOOST_CHECK(aslist == aslist1);
std::remove(testfile);
}
int test_main( int /* argc */, char* /* argv */[] )
{
test_slist();
return EXIT_SUCCESS;
}
// EOF
-88
View File
@@ -1,88 +0,0 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// test_list.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// should pass compilation and execution
#include <cstddef>
#include <fstream>
#include <boost/config.hpp>
#include <cstdio> // remove
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::remove;
}
#endif
#include <boost/type_traits/is_pointer.hpp>
#include <boost/static_assert.hpp>
#include <boost/checked_delete.hpp>
#include <boost/archive/archive_exception.hpp>
#include "test_tools.hpp"
#include <boost/serialization/nvp.hpp>
#include "A.hpp"
#include "A.ipp"
template<class T>
struct ptr_equal_to {
BOOST_STATIC_ASSERT(::boost::is_pointer< T >::value);
bool operator()(T const _Left, T const _Right) const
{
if(NULL == _Left && NULL == _Right)
return true;
if(typeid(*_Left) != typeid(*_Right))
return false;
return *_Left == *_Right;
}
};
#include <boost/serialization/slist.hpp>
void test_slist(){
const char * testfile = boost::archive::tmpnam(NULL);
BOOST_REQUIRE(NULL != testfile);
BOOST_STD_EXTENSION_NAMESPACE::slist<A *> aslist;
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
aslist.push_front(new A);
aslist.push_front(new A);
oa << boost::serialization::make_nvp("aslist", aslist);
}
BOOST_STD_EXTENSION_NAMESPACE::slist<A *> aslist1;
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
ia >> boost::serialization::make_nvp("aslist", aslist1);
BOOST_CHECK(aslist.size() == aslist1.size() &&
std::equal(aslist.begin(),aslist.end(),aslist1.begin(),ptr_equal_to<A *>())
);
}
std::for_each(
aslist.begin(),
aslist.end(),
boost::checked_deleter<A>()
);
std::for_each(
aslist1.begin(),
aslist1.end(),
boost::checked_deleter<A>()
);
std::remove(testfile);
}
int test_main( int /* argc */, char* /* argv */[] )
{
test_slist();
return EXIT_SUCCESS;
}
// EOF
+3
View File
@@ -19,6 +19,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <cstddef> // size_t
#include <boost/config.hpp>
#ifndef BOOST_NO_EXCEPTION_STD_NAMESPACE
#include <exception>
@@ -76,12 +77,14 @@ namespace boost {
namespace archive {
const char * test_filename(const char * dir = NULL, char *fname = NULL){
static char ibuffer [512];
std::size_t i;
ibuffer[0] = '\0';
if(NULL == dir){
dir = boost::archive::tmpdir();
}
STRCPY(ibuffer, dir);
std::strcat(ibuffer, "/");
i = std::strlen(ibuffer);
if(NULL == fname){
char old_dir[256];
_getcwd(old_dir, sizeof(old_dir) - 1);
+2 -70
View File
@@ -12,7 +12,6 @@
#include <cstddef> // NULL
#include <cstdio> // remove
#include <cstring> // strcmp
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
@@ -55,22 +54,6 @@ class polymorphic_derived2 : public polymorphic_base
}
};
struct type1 {
template<typename Archive>
void serialize(Archive&, unsigned int ver) {
BOOST_CHECK(ver == 1);
}
};
struct type2 {
template<typename Archive>
void serialize(Archive&, unsigned int ver) {
BOOST_CHECK(ver == 2);
}
};
BOOST_CLASS_VERSION(type1, 1);
BOOST_CLASS_VERSION(type2, 2);
// save unregistered polymorphic classes
void save_unregistered1(const char *testfile)
{
@@ -78,7 +61,7 @@ void save_unregistered1(const char *testfile)
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
polymorphic_base *rb1 = new polymorphic_derived1;
// registration IS necessary when serializing a polymorphic class
// through pointer to the base class
bool except = false;
@@ -115,7 +98,7 @@ void load_unregistered1(const char *testfile)
BOOST_CATCH(boost::archive::archive_exception aex){
except = true;
BOOST_CHECK_MESSAGE(
NULL == rb1,
NULL == rb1,
"failed load resulted in a non-null pointer"
);
}
@@ -244,55 +227,6 @@ void load_registered(const char *testfile)
delete rb2;
}
// store a pointer from slot0
void save_unregistered_pointer(const char *testfile)
{
test_ostream os(testfile, TEST_STREAM_FLAGS);
test_oarchive oa(os, TEST_ARCHIVE_FLAGS);
oa.register_type(static_cast<type2 *>(NULL));
type1 instance1;
type2 *pointer2 = new type2;
BOOST_TRY {
oa & BOOST_SERIALIZATION_NVP(instance1) & BOOST_SERIALIZATION_NVP(pointer2);
}
BOOST_CATCH(...) {
BOOST_CHECK_MESSAGE(false, "unexpected exception");
}
BOOST_CATCH_END
delete pointer2;
}
// load a pointer from slot0 which has no pointer serializer
void load_unregistered_pointer(const char *testfile)
{
test_istream is(testfile);
test_iarchive ia(is);
type1 instance1;
type2 *pointer2(NULL);
bool except = false;
BOOST_TRY {
ia & BOOST_SERIALIZATION_NVP(instance1) & BOOST_SERIALIZATION_NVP(pointer2);
}
BOOST_CATCH(boost::archive::archive_exception aex){
except = true;
BOOST_CHECK_MESSAGE(
std::strcmp(aex.what(), "unregistered class") == 0,
"incorrect exception"
);
}
BOOST_CATCH_END
BOOST_CHECK_MESSAGE(except, "lack of registration not detected !");
BOOST_CHECK_MESSAGE(NULL == pointer2, "expected failed load");
delete pointer2;
}
int
test_main( int /* argc */, char* /* argv */[] )
{
@@ -304,8 +238,6 @@ test_main( int /* argc */, char* /* argv */[] )
load_unregistered2(testfile);
save_registered(testfile);
load_registered(testfile);
save_unregistered_pointer(testfile);
load_unregistered_pointer(testfile);
std::remove(testfile);
return EXIT_SUCCESS;
}
+1 -424
View File
@@ -181,7 +181,7 @@ int test_main(int, char *argv[])
return 0;
}
#elif 0
#else
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/nvp.hpp>
@@ -194,427 +194,4 @@ int main() {
oa << boost::serialization::make_nvp( "bob", bob );
}
#elif 0
#include <fstream>
#include <vector>
#include <iostream>
//#include <boost/shared_ptr.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/shared_ptr.hpp>
#include <boost/serialization/vector.hpp>
struct boxed_int
{
boxed_int() : i(0) {}
boxed_int(int i) : i(i) {}
int i;
template<class Archive>
void serialize(Archive &ar, unsigned version)
{
ar & BOOST_SERIALIZATION_NVP(i);
}
};
typedef boost::shared_ptr<boxed_int> pi;
void go(std::istream &is) {
std::vector<pi> vv;
try
{
boost::archive::binary_iarchive ia(is);
ia & vv;
}
catch(std::exception &e) {}
}
int main(int argc, char **argv) {
if(argc > 1) {
std::ifstream is(argv[1]);
go(is);
} else {
go(std::cin);
}
return 0;
}
#elif 0
#include <cassert>
#include <string>
#include <boost/archive/iterators/base64_from_binary.hpp>
#include <boost/archive/iterators/transform_width.hpp>
namespace bai = boost::archive::iterators;
int main()
{
std::string input =
"A large rose-tree stood near the entrance of the garden: the roses growing on it were white, but there were "
"three gardeners at it, busily painting them red. Alice thought this a very curious thing, and she went nearer "
"to watch them, and just as she came up to them she heard one of them say, 'Look out now, Five! Don't go "
"splashing paint over me like that!''I couldn't help it,' said Five, in a sulky tone; 'Seven jogged my "
"elbow.'On which Seven looked up and said, 'That's right, Five! Always lay the blame on others!''You'd better "
"not talk!' said Five. 'I heard the Queen say only yesterday you deserved to be beheaded!''What for?' said the "
"one who had spoken first.'That's none of your business, Two!' said Seven.'Yes, it is his business!' said "
"Five, 'and I'll tell him—it was for bringing the cook tulip-roots instead of onions.'Seven flung down his "
"brush, and had just begun 'Well, of all the unjust things—' when his eye chanced to fall upon Alice, as she "
"stood watching them, and he checked himself suddenly: the others looked round also, and all of them bowed "
"low.'Would you tell me,' said Alice, a little timidly, 'why you are painting those roses?'Five and Seven said "
"nothing, but looked at Two. Two began in a low voice, 'Why the fact is, you see, Miss, this here ought to "
"have been a red rose-tree, and we put a white one in by mistake; and if the Queen was to find it out, we "
"should all have our heads cut off, you know. So you see, Miss, we're doing our best, afore she comes, to—' At "
"this moment Five, who had been anxiously looking across the garden, called out 'The Queen! The Queen!' and "
"the three gardeners instantly threw themselves flat upon their faces. There was a sound of many footsteps, "
"and Alice looked round, eager to see the Queen.First came ten soldiers carrying clubs; these were all shaped "
"like the three gardeners, oblong and flat, with their hands and feet at the corners: next the ten courtiers; "
"these were ornamented all over with diamonds, and walked two and two, as the soldiers did. After these came "
"the royal children; there were ten of them, and the little dears came jumping merrily along hand in hand, in "
"couples: they were all ornamented with hearts. Next came the guests, mostly Kings and Queens, and among them "
"Alice recognised the White Rabbit: it was talking in a hurried nervous manner, smiling at everything that was "
"said, and went by without noticing her. Then followed the Knave of Hearts, carrying the King's crown on a "
"crimson velvet cushion; and, last of all this grand procession, came THE KING AND QUEEN OF HEARTS.Alice was "
"rather doubtful whether she ought not to lie down on her face like the three gardeners, but she could not "
"remember ever having heard of such a rule at processions; 'and besides, what would be the use of a "
"procession,' thought she, 'if people had all to lie down upon their faces, so that they couldn't see it?' So "
"she stood still where she was, and waited.When the procession came opposite to Alice, they all stopped and "
"looked at her, and the Queen said severely 'Who is this?' She said it to the Knave of Hearts, who only bowed "
"and smiled in reply.'Idiot!' said the Queen, tossing her head impatiently; and, turning to Alice, she went "
"on, 'What's your name, child?''My name is Alice, so please your Majesty,' said Alice very politely; but she "
"added, to herself, 'Why, they're only a pack of cards, after all. I needn't be afraid of them!''And who are "
"these?' said the Queen, pointing to the three gardeners who were lying round the rosetree; for, you see, as "
"they were lying on their faces, and the pattern on their backs was the same as the rest of the pack, she "
"could not tell whether they were gardeners, or soldiers, or courtiers, or three of her own children.'How "
"should I know?' said Alice, surprised at her own courage. 'It's no business of mine.'The Queen turned crimson "
"with fury, and, after glaring at her for a moment like a wild beast, screamed 'Off with her head! "
"Off—''Nonsense!' said Alice, very loudly and decidedly, and the Queen was silent.The King laid his hand upon "
"her arm, and timidly said 'Consider, my dear: she is only a child!'The Queen turned angrily away from him, "
"and said to the Knave 'Turn them over!'The Knave did so, very carefully, with one foot.'Get up!' said the "
"Queen, in a shrill, loud voice, and the three gardeners instantly jumped up, and began bowing to the King, "
"the Queen, the royal children, and everybody else.'Leave off that!' screamed the Queen. 'You make me giddy.' "
"And then, turning to the rose-tree, she went on, 'What have you been doing here?''May it please your "
"Majesty,' said Two, in a very humble tone, going down on one knee as he spoke, 'we were trying—''I see!' said "
"the Queen, who had meanwhile been examining the roses. 'Off with their heads!' and the procession moved on, "
"three of the soldiers remaining behind to execute the unfortunate gardeners, who ran to Alice for "
"protection.'You shan't be beheaded!' said Alice, and she put them into a large flower-pot that stood near. "
"The three soldiers wandered about for a minute or two, looking for them, and then quietly marched off after "
"the others.'Are their heads off?' shouted the Queen.'Their heads are gone, if it please your Majesty!' the "
"soldiers shouted in reply.'That's right!' shouted the Queen. 'Can you play croquet?'The soldiers were silent, "
"and looked at Alice, as the question was evidently meant for her.'Yes!' shouted Alice.'Come on, then!' roared "
"the Queen, and Alice joined the procession, wondering very much what would happen next.'It's—it's a very fine "
"day!' said a timid voice at her side. She was walking by the White Rabbit, who was peeping anxiously into her "
"face.'Very,' said Alice: '—where's the Duchess?''Hush! Hush!' said the Rabbit in a low, hurried tone. He "
"looked anxiously over his shoulder as he spoke, and then raised himself upon tiptoe, put his mouth close to "
"her ear, and whispered 'She's under sentence of execution.''What for?' said Alice.'Did you say \"What a "
"pity!\"?' the Rabbit asked.'No, I didn't,' said Alice: 'I don't think it's at all a pity. I said \"What "
"for?\"''She boxed the Queen's ears—' the Rabbit began. Alice gave a little scream of laughter. 'Oh, hush!' "
"the Rabbit whispered in a frightened tone. 'The Queen will hear you! You see, she came rather late, and the "
"Queen said—''Get to your places!' shouted the Queen in a voice of thunder, and people began running about in "
"all directions, tumbling up against each other; however, they got settled down in a minute or two, and the "
"game began. Alice thought she had never seen such a curious croquet-ground in her life; it was all ridges and "
"furrows; the balls were live hedgehogs, the mallets live flamingoes, and the soldiers had to double "
"themselves up and to stand on their hands and feet, to make the arches.The chief difficulty Alice found at "
"first was in managing her flamingo: she succeeded in getting its body tucked away, comfortably enough, under "
"her arm, with its legs hanging down, but generally, just as she had got its neck nicely straightened out, and "
"was going to give the hedgehog a blow with its head, it would twist itself round and look up in her face, "
"with such a puzzled expression that she could not help bursting out laughing: and when she had got its head "
"down, and was going to begin again, it was very provoking to find that the hedgehog had unrolled itself, and "
"was in the act of crawling away: besides all this, there was generally a ridge or furrow in the way wherever "
"she wanted to send the hedgehog to, and, as the doubled-up soldiers were always getting up and walking off to "
"other parts of the ground, Alice soon came to the conclusion that it was a very difficult game indeed.The "
"players all played at once without waiting for turns, quarrelling all the while, and fighting for the "
"hedgehogs; and in a very short time the Queen was in a furious passion, and went stamping about, and shouting "
"'Off with his head!' or 'Off with her head!' about once in a minute.Alice began to feel very uneasy: to be "
"sure, she had not as yet had any dispute with the Queen, but she knew that it might happen any minute, 'and "
"then,' thought she, 'what would become of me? They're dreadfully fond of beheading people here; the great "
"wonder is, that there's any one left alive!'She was looking about for some way of escape, and wondering "
"whether she could get away without being seen, when she noticed a curious appearance in the air: it puzzled "
"her very much at first, but, after watching it a minute or two, she made it out to be a grin, and she said to "
"herself 'It's the Cheshire Cat: now I shall have somebody to talk to.''How are you getting on?' said the Cat, "
"as soon as there was mouth enough for it to speak with.Alice waited till the eyes appeared, and then nodded. "
"'It's no use speaking to it,' she thought, 'till its ears have come, or at least one of them.' In another "
"minute the whole head appeared, and then Alice put down her flamingo, and began an account of the game, "
"feeling very glad she had someone to listen to her. The Cat seemed to think that there was enough of it now "
"in sight, and no more of it appeared.'I don't think they play at all fairly,' Alice began, in rather a "
"complaining tone, 'and they all quarrel so dreadfully one can't hear oneself speak—and they don't seem to "
"have any rules in particular; at least, if there are, nobody attends to them—and you've no idea how confusing "
"it is all the things being alive; for instance, there's the arch I've got to go through next walking about at "
"the other end of the ground—and I should have croqueted the Queen's hedgehog just now, only it ran away when "
"it saw mine coming!''How do you like the Queen?' said the Cat in a low voice.'Not at all,' said Alice: 'she's "
"so extremely—' Just then she noticed that the Queen was close behind her, listening: so she went on, '—likely "
"to win, that it's hardly worth while finishing the game.'The Queen smiled and passed on.'Who are you talking "
"to?' said the King, going up to Alice, and looking at the Cat's head with great curiosity.'It's a friend of "
"mine—a Cheshire Cat,' said Alice: 'allow me to introduce it.''I don't like the look of it at all,' said the "
"King: 'however, it may kiss my hand if it likes.''I'd rather not,' the Cat remarked.'Don't be impertinent,' "
"said the King, 'and don't look at me like that!' He got behind Alice as he spoke.'A cat may look at a king,' "
"said Alice. 'I've read that in some book, but I don't remember where.''Well, it must be removed,' said the "
"King very decidedly, and he called the Queen, who was passing at the moment, 'My dear! I wish you would have "
"this cat removed!'The Queen had only one way of settling all difficulties, great or small. 'Off with his "
"head!' she said, without even looking round.'I'll fetch the executioner myself,' said the King eagerly, and "
"he hurried off.Alice thought she might as well go back, and see how the game was going on, as she heard the "
"Queen's voice in the distance, screaming with passion. She had already heard her sentence three of the "
"players to be executed for having missed their turns, and she did not like the look of things at all, as the "
"game was in such confusion that she never knew whether it was her turn or not. So she went in search of her "
"hedgehog.The hedgehog was engaged in a fight with another hedgehog, which seemed to Alice an excellent "
"opportunity for croqueting one of them with the other: the only difficulty was, that her flamingo was gone "
"across to the other side of the garden, where Alice could see it trying in a helpless sort of way to fly up "
"into a tree.By the time she had caught the flamingo and brought it back, the fight was over, and both the "
"hedgehogs were out of sight: 'but it doesn't matter much,' thought Alice, 'as all the arches are gone from "
"this side of the ground.' So she tucked it away under her arm, that it might not escape again, and went back "
"for a little more conversation with her friend.When she got back to the Cheshire Cat, she was surprised to "
"find quite a large crowd collected round it: there was a dispute going on between the executioner, the King, "
"and the Queen, who were all talking at once, while all the rest were quite silent, and looked very "
"uncomfortable.The moment Alice appeared, she was appealed to by all three to settle the question, and they "
"repeated their arguments to her, though, as they all spoke at once, she found it very hard indeed to make out "
"exactly what they said.The executioner's argument was, that you couldn't cut off a head unless there was a "
"body to cut it off from: that he had never had to do such a thing before, and he wasn't going to begin at his "
"time of life.The King's argument was, that anything that had a head could be beheaded, and that you weren't "
"to talk nonsense.The Queen's argument was, that if something wasn't done about it in less than no time she'd "
"have everybody executed, all round. (It was this last remark that had made the whole party look so grave and "
"anxious.)Alice could think of nothing else to say but 'It belongs to the Duchess: you'd better ask her about "
"it.''She's in prison,' the Queen said to the executioner: 'fetch her here.' And the executioner went off like "
"an arrow.The Cat's head began fading away the moment he was gone, and, by the time he had come back with the "
"Duchess, it had entirely disappeared; so the King and the executioner ran wildly up and down looking for it, "
"while the rest of the party went back to the game.";
std::string output =
"QSBsYXJnZSByb3NlLXRyZWUgc3Rvb2QgbmVhciB0aGUgZW50cmFuY2Ugb2YgdGhlIGdhcmRlbjogdGhlIHJvc2VzIGdyb3dpbmcgb24gaXQgd2"
"VyZSB3aGl0ZSwgYnV0IHRoZXJlIHdlcmUgdGhyZWUgZ2FyZGVuZXJzIGF0IGl0LCBidXNpbHkgcGFpbnRpbmcgdGhlbSByZWQuIEFsaWNlIHRo"
"b3VnaHQgdGhpcyBhIHZlcnkgY3VyaW91cyB0aGluZywgYW5kIHNoZSB3ZW50IG5lYXJlciB0byB3YXRjaCB0aGVtLCBhbmQganVzdCBhcyBzaG"
"UgY2FtZSB1cCB0byB0aGVtIHNoZSBoZWFyZCBvbmUgb2YgdGhlbSBzYXksICdMb29rIG91dCBub3csIEZpdmUhIERvbid0IGdvIHNwbGFzaGlu"
"ZyBwYWludCBvdmVyIG1lIGxpa2UgdGhhdCEnJ0kgY291bGRuJ3QgaGVscCBpdCwnIHNhaWQgRml2ZSwgaW4gYSBzdWxreSB0b25lOyAnU2V2ZW"
"4gam9nZ2VkIG15IGVsYm93LidPbiB3aGljaCBTZXZlbiBsb29rZWQgdXAgYW5kIHNhaWQsICdUaGF0J3MgcmlnaHQsIEZpdmUhIEFsd2F5cyBs"
"YXkgdGhlIGJsYW1lIG9uIG90aGVycyEnJ1lvdSdkIGJldHRlciBub3QgdGFsayEnIHNhaWQgRml2ZS4gJ0kgaGVhcmQgdGhlIFF1ZWVuIHNheS"
"Bvbmx5IHllc3RlcmRheSB5b3UgZGVzZXJ2ZWQgdG8gYmUgYmVoZW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hpbmcgd2Fzbid0IGRvbmUgYWJvdXQgaXQgaW4gbGVzcyB0aGFuIG5vIHRpbW"
"Ugc2hlJ2QgaGF2ZSBldmVyeWJvZHkgZXhlY3V0ZWQsIGFsbCByb3VuZC4gKEl0IHdhcyB0aGlzIGxhc3QgcmVtYXJrIHRoYXQgaGFkIG1hZGUg"
"dGhlIHdob2xlIHBhcnR5IGxvb2sgc28gZ3JhdmUgYW5kIGFueGlvdXMuKUFsaWNlIGNvdWxkIHRoaW5rIG9mIG5vdGhpbmcgZWxzZSB0byBzYX"
"kgYnV0ICdJdCBiZWxvbmdzIHRvIHRoZSBEdWNoZXNzOiB5b3UnZCBiZXR0ZXIgYXNrIGhlciBhYm91dCBpdC4nJ1NoZSdzIGluIHByaXNvbiwn"
"IHRoZSBRdWVlbiBzYWlkIHRvIHRoZSBleGVjdXRpb25lcjogJ2ZldGNoIGhlciBoZXJlLicgQW5kIHRoZSBleGVjdXRpb25lciB3ZW50IG9mZi"
"BsaWtlIGFuIGFycm93LlRoZSBDYXQncyBoZWFkIGJlZ2FuIGZhZGluZyBhd2F5IHRoZSBtb21lbnQgaGUgd2FzIGdvbmUsIGFuZCwgYnkgdGhl"
"IHRpbWUgaGUgaGFkIGNvbWUgYmFjayB3aXRoIHRoZSBEdWNoZXNzLCBpdCBoYWQgZW50aXJlbHkgZGlzYXBwZWFyZWQ7IHNvIHRoZSBLaW5nIG"
"FuZCB0aGUgZXhlY3V0aW9uZXIgcmFuIHdpbGRseSB1cCBhbmQgZG93biBsb29raW5nIGZvciBpdCwgd2hpbGUgdGhlIHJlc3Qgb2YgdGhlIHBh"
"cnR5IHdlbnQgYmFjayB0byB0aGUgZ2FtZS4=";
using it_base64_t = bai::base64_from_binary<bai::transform_width<std::string::const_iterator, 6, 8>>;
auto writePaddChars = (3 - input.length() % 3) % 3;
std::string base64(it_base64_t(input.begin()), it_base64_t(input.end()));
base64.append(writePaddChars, '=');
assert(base64 == output);
return 0;
}
#elif 0
#include <memory>
#include <sstream>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/shared_ptr.hpp>
struct S
{
int i;
char c;
template <class Archive>
void serialize(Archive & ar, const unsigned int version)
{
ar & i;
ar & c;
}
};
int main()
{
const auto s0 = std::make_shared<S>();
s0->i = 42;
s0->c = 'c';
std::stringstream ss;
{
boost::archive::text_oarchive oa(ss);
oa << s0;
}
std::shared_ptr<S> s1;
{
boost::archive::text_iarchive ia(ss);
ia >> s1;
}
return 0;
}
#else
#include <boost/archive/binary_iarchive.hpp>
#include <boost/serialization/vector.hpp>
#include <sstream>
#include <vector>
void f()
{
std::stringstream iss;
boost::archive::binary_iarchive ar(iss);
std::vector<int> out;
ar >> out;
}
int main(int argc, char* argv[])
{
return 0;
}
#endif
-1
View File
@@ -49,7 +49,6 @@ rule run-template ( test-name : sources * : requirements * ) {
<toolset>clang:<variant>debug:<cxxflags>"-fsanitize=memory"
# toolset optimizations
<toolset>gcc:<cxxflags>"-ftemplate-depth-255"
<toolset>qcc:<cxxflags>"-ftemplate-depth-255"
<toolset>clang:<cxxflags>"-ftemplate-depth-255"
<toolset>darwin:<cxxflags>"-ftemplate-depth-255"
<toolset>msvc:<cxxflags>"-Gy"