mirror of
https://github.com/boostorg/serialization.git
synced 2026-07-22 13:43:39 +00:00
Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9bfcdb2106 | |||
| 06fe1b7154 | |||
| e653bfe110 | |||
| 682c371e11 | |||
| 5b47212c01 | |||
| f09c9b197e | |||
| 3bc713367e | |||
| 7f801c3d85 | |||
| 3e0f302eee | |||
| 19e2ef234b | |||
| a1ffe9b19b | |||
| c90e97eb1e | |||
| fe8b390588 | |||
| 8e26bc59db | |||
| 9a2c1f11ab | |||
| df38b48016 | |||
| 7c97ddd99e | |||
| d1b5c47e16 | |||
| 3765166f4b | |||
| 03865e70cb | |||
| 0458a89fc3 | |||
| 49f84d7d7a | |||
| 5203ecdd65 | |||
| 1bfecdfc82 | |||
| e9ed873275 | |||
| e32c5c5e28 | |||
| e15ca7257f | |||
| 8f7b3be1d2 | |||
| c545c1fa60 |
+72
@@ -0,0 +1,72 @@
|
||||
# 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)
|
||||
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
install:
|
||||
- cd ..
|
||||
- git clone -b $TRAVIS_BRANCH --depth 1 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 --depth 1
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
script:
|
||||
- TOOLSET=gcc,clang
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
|
||||
- ./b2 libs/serialization/test toolset=$TOOLSET
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
+19
-14
@@ -21,6 +21,7 @@ endif()
|
||||
#
|
||||
|
||||
message(STATUS "compiler is ${CMAKE_CXX_COMPILER_ID}" )
|
||||
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
|
||||
|
||||
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
|
||||
add_definitions( -ftemplate-depth=300 )
|
||||
@@ -106,22 +107,30 @@ endif()
|
||||
# end special note for Xcode
|
||||
############################
|
||||
|
||||
set(Boost_DEBUG true)
|
||||
set(Boost_DETAILED_FAILURE_MSG true)
|
||||
set(Boost_FOUND true)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS system filesystem)
|
||||
|
||||
message(STATUS "Boost_FOUND is ${Boost_FOUND}")
|
||||
|
||||
if(Boost_FOUND)
|
||||
message(STATUS "Boost Found!")
|
||||
message(STATUS "Boost is ${BOOST_ROOT}")
|
||||
message(STATUS "Boost directories found at ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS "Boost libraries found at ${Boost_LIBRARY_DIRS}")
|
||||
message(STATUS "Boost libraries prefix is ${Boost_LIB_PREFIX}")
|
||||
message(STATUS "Boost component libraries to be linked are ${Boost_LIBRARIES}")
|
||||
message(STATUS "Boost version found is ${Boost_VERSION}")
|
||||
include_directories("../include" "${Boost_INCLUDE_DIRS}")
|
||||
link_directories("${Boost_LIBRARY_DIRS}")
|
||||
elseif()
|
||||
message("Boost NOT Found!")
|
||||
#include_directories("../include" "${Boost_INCLUDE_DIRS}")
|
||||
#link_directories("${Boost_LIBRARY_DIRS}")
|
||||
else()
|
||||
message(STATUS "Boost NOT Found!")
|
||||
endif()
|
||||
|
||||
if(Boost_USE_STATIC_LIBS)
|
||||
message(STATUS "Building static libraries")
|
||||
message(STATUS "Use static libraries")
|
||||
set(LINK_TYPE "STATIC")
|
||||
else()
|
||||
message(STATUS "Building shared libraries")
|
||||
@@ -129,9 +138,9 @@ else()
|
||||
add_definitions( "-DBOOST_ALL_DYN_LINK=1")
|
||||
add_definitions( "-DBOOST_ALL_NO_LIB=1")
|
||||
add_definitions( "-DBOOST_LIB_DIAGNOSTICS=1")
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(VISIBILITY_INLINES_HIDDEN)
|
||||
endif()
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
set(VISIBILITY_INLINES_HIDDEN)
|
||||
|
||||
###########################
|
||||
# library builds
|
||||
@@ -169,8 +178,6 @@ add_library(serialization ${LINK_TYPE}
|
||||
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
|
||||
)
|
||||
|
||||
# target_compile_options(serialization PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden )
|
||||
|
||||
add_library(wserialization ${LINK_TYPE}
|
||||
../src/codecvt_null.cpp
|
||||
../src/basic_text_wiprimitive.cpp
|
||||
@@ -183,8 +190,6 @@ add_library(wserialization ${LINK_TYPE}
|
||||
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
|
||||
)
|
||||
|
||||
#target_compile_options(wserialization PRIVATE -fvisibility=hidden -fvisibility-inlines-hidden )
|
||||
|
||||
# end library build
|
||||
###########################
|
||||
|
||||
@@ -261,8 +266,8 @@ serialization_test(test_iterators)
|
||||
serialization_test(test_iterators_base64)
|
||||
serialization_test(test_inclusion)
|
||||
serialization_test(test_smart_cast)
|
||||
serialization_test(test_utf8_codecvt )
|
||||
serialization_test(test_codecvt_null ../src/codecvt_null)
|
||||
serialization_test(test_strong_typedef)
|
||||
|
||||
archive_test(test_native_array A)
|
||||
archive_test(test_boost_array A)
|
||||
@@ -327,12 +332,12 @@ archive_test(test_set A)
|
||||
archive_test(test_set_boost_unordered A)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_set_unordered A)
|
||||
elseif()
|
||||
else()
|
||||
archive_test(test_set_hashed A)
|
||||
endif()
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_map_unordered A)
|
||||
elseif()
|
||||
else()
|
||||
archive_test(test_map_hashed A)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -120,6 +120,8 @@ lib boost_wserialization
|
||||
<toolset>gcc:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>clang:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>darwin:<cxxflags>"-ftemplate-depth-255"
|
||||
# note: both serialization and wserialization are conditioned on the this
|
||||
# switch - don't change it to BOOST_WSERIALIZATION_DYN_LINK
|
||||
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
|
||||
;
|
||||
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ function initialize() {
|
||||
<dd><div id="userincludes_detail"><dl class="page-index">
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="headers.html#archiveimplementations">Archive Implementations</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="headers.html#serializationdeclarations">Serialization Declarations</a>
|
||||
<dt><img style="display:none" 'rc="dot.gif"><a target="detail" href="headers.html#serializationimplementations">Serialization Implementations</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="headers.html#serializationimplementations">Serialization Implementations</a>
|
||||
</dl></div>
|
||||
<dt><img style="display:none" src="plus.gif" id="libraryimplementation"><a target="detail" href="headers.html#libraryimplementation">Files Which Implement the Library</a>
|
||||
<dd><div id="libraryimplementation_detail"><dl class="page-index">
|
||||
|
||||
@@ -175,8 +175,6 @@ protected:
|
||||
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
boost::io::ios_flags_saver fs(os);
|
||||
boost::io::ios_precision_saver ps(os);
|
||||
typename is_float<T>::type tf;
|
||||
save_impl(t, tf);
|
||||
}
|
||||
|
||||
@@ -588,7 +588,14 @@ struct load_array_type {
|
||||
boost::archive::archive_exception::array_size_too_short
|
||||
)
|
||||
);
|
||||
ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count);
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar >> serialization::make_array<
|
||||
value_type,
|
||||
boost::serialization::collection_size_type
|
||||
>(
|
||||
static_cast<value_type *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -501,7 +501,14 @@ struct save_array_type
|
||||
);
|
||||
boost::serialization::collection_size_type count(c);
|
||||
ar << BOOST_SERIALIZATION_NVP(count);
|
||||
ar << serialization::make_array(static_cast<value_type const*>(&t[0]),count);
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar << serialization::make_array<
|
||||
const value_type,
|
||||
boost::serialization::collection_size_type
|
||||
>(
|
||||
static_cast<const value_type *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -19,8 +19,10 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -39,11 +41,7 @@ struct archive_input_unordered_map
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
std::pair<typename Container::const_iterator, bool> result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
s.insert(t.reference());
|
||||
#else
|
||||
s.emplace(t.reference());
|
||||
#endif
|
||||
s.insert(boost::move(t.reference()));
|
||||
// note: the following presumes that the map::value_type was NOT tracked
|
||||
// in the archive. This is the usual case, but here there is no way
|
||||
// to determine that.
|
||||
@@ -69,11 +67,7 @@ struct archive_input_unordered_multimap
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
s.insert(t.reference());
|
||||
#else
|
||||
s.emplace(t.reference());
|
||||
#endif
|
||||
s.insert(t.reference());
|
||||
// note: the following presumes that the map::value_type was NOT tracked
|
||||
// in the archive. This is the usual case, but here there is no way
|
||||
// to determine that.
|
||||
|
||||
@@ -17,6 +17,11 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <utility>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
@@ -36,11 +41,7 @@ struct archive_input_unordered_set
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
std::pair<typename Container::const_iterator, bool> result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
s.insert(t.reference());
|
||||
#else
|
||||
s.emplace(t.reference());
|
||||
#endif
|
||||
s.insert(boost::move(t.reference()));
|
||||
if(result.second)
|
||||
ar.reset_object_address(& (* result.first), & t.reference());
|
||||
}
|
||||
@@ -59,11 +60,7 @@ struct archive_input_unordered_multiset
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
s.insert(t.reference());
|
||||
#else
|
||||
s.emplace(t.reference());
|
||||
#endif
|
||||
s.insert(boost::move(t.reference()));
|
||||
ar.reset_object_address(& (* result), & t.reference());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -40,12 +40,11 @@ class array_wrapper :
|
||||
{
|
||||
private:
|
||||
array_wrapper & operator=(const array_wrapper & rhs);
|
||||
public:
|
||||
// note: I would like to make the copy constructor private but this breaks
|
||||
// make_array. So I try to make make_array a friend - but that doesn't
|
||||
// build. Need a C++ guru to explain this!
|
||||
template<class S>
|
||||
friend const boost::serialization::array_wrapper<T> make_array( T* t, S s);
|
||||
// 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),
|
||||
@@ -117,7 +116,7 @@ private:
|
||||
|
||||
template<class T, class S>
|
||||
inline
|
||||
const array_wrapper< T > make_array( T* t, S s){
|
||||
const array_wrapper< T > make_array(T* t, S s){
|
||||
const array_wrapper< T > a(t, s);
|
||||
return a;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ namespace std{
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/serialization/detail/is_default_constructible.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace serialization {
|
||||
@@ -93,7 +94,7 @@ collection_load_impl(
|
||||
while(count-- > 0){
|
||||
detail::stack_construct<Archive, typename T::value_type> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
t.push_back(u.reference());
|
||||
t.push_back(boost::move(u.reference()));
|
||||
ar.reset_object_address(& t.back() , & u.reference());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP
|
||||
#define BOOST_SERIALIZATION_DETAIL_STACH_CONSTRUCTOR_HPP
|
||||
#ifndef BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
|
||||
#define BOOST_SERIALIZATION_DETAIL_STACK_CONSTRUCTOR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define BOOST_SERIALIZATION_EPHEMERAL_HPP
|
||||
|
||||
// MS compatible compilers support
|
||||
#pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <boost/preprocessor/control/if.hpp>
|
||||
#include <boost/preprocessor/comparison/greater.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace std{
|
||||
#if defined(__LIBCOMO__)
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <forward_list>
|
||||
#include <iterator> // distance
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
#error "not supported for versions earlier than c++11
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/collections_load_imp.hpp>
|
||||
#include <boost/archive/detail/basic_iarchive.hpp>
|
||||
@@ -33,6 +30,7 @@
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/detail/is_default_constructible.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -72,14 +70,14 @@ collection_load_impl(
|
||||
t.clear();
|
||||
boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
t.emplace_front(u.reference());
|
||||
t.push_front(boost::move(u.reference()));
|
||||
typename std::forward_list<T, Allocator>::iterator last;
|
||||
last = t.begin();
|
||||
ar.reset_object_address(&(*t.begin()) , & u.reference());
|
||||
while(--count > 0){
|
||||
detail::stack_construct<Archive, T> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
last = t.emplace_after(last, u.reference());
|
||||
last = t.insert_after(last, boost::move(u.reference()));
|
||||
ar.reset_object_address(&(*last) , & u.reference());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <boost/serialization/hash_collections_save_imp.hpp>
|
||||
#include <boost/serialization/hash_collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -45,7 +46,7 @@ struct archive_input_hash_map
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
std::pair<typename Container::const_iterator, bool> result =
|
||||
s.insert(t.reference());
|
||||
s.insert(boost::move(t.reference()));
|
||||
// note: the following presumes that the map::value_type was NOT tracked
|
||||
// in the archive. This is the usual case, but here there is no way
|
||||
// to determine that.
|
||||
@@ -72,7 +73,7 @@ struct archive_input_hash_multimap
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result
|
||||
= s.insert(t.reference());
|
||||
= s.insert(boost::move(t.reference()));
|
||||
// note: the following presumes that the map::value_type was NOT tracked
|
||||
// in the archive. This is the usual case, but here there is no way
|
||||
// to determine that.
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <boost/serialization/hash_collections_save_imp.hpp>
|
||||
#include <boost/serialization/hash_collections_load_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -43,7 +44,7 @@ struct archive_input_hash_set
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
std::pair<typename Container::const_iterator, bool> result =
|
||||
s.insert(t.reference());
|
||||
s.insert(boost::move(t.reference()));
|
||||
if(result.second)
|
||||
ar.reset_object_address(& (* result.first), & t.reference());
|
||||
}
|
||||
@@ -63,7 +64,7 @@ struct archive_input_hash_multiset
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result
|
||||
= s.insert(t.reference());
|
||||
= s.insert(boost::move(t.reference()));
|
||||
ar.reset_object_address(& (* result), & t.reference());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -59,11 +60,7 @@ inline void load_map_collection(Archive & ar, Container &s)
|
||||
detail::stack_construct<Archive, type> t(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::iterator result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_MAP
|
||||
s.insert(hint, t.reference());
|
||||
#else
|
||||
s.emplace_hint(hint, t.reference());
|
||||
#endif
|
||||
s.insert(hint, boost::move(t.reference()));
|
||||
ar.reset_object_address(& (result->second), & t.reference().second);
|
||||
hint = result;
|
||||
++hint;
|
||||
|
||||
@@ -19,12 +19,16 @@
|
||||
#include <boost/archive/detail/basic_iarchive.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/detail/is_default_constructible.hpp>
|
||||
|
||||
// function specializations must be defined in the appropriate
|
||||
// namespace - boost::serialization
|
||||
@@ -37,6 +41,15 @@ void save(
|
||||
const boost::optional< T > & t,
|
||||
const unsigned int /*version*/
|
||||
){
|
||||
// It is an inherent limitation to the serialization of optional.hpp
|
||||
// that the underlying type must be either a pointer or must have a
|
||||
// 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 *>
|
||||
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){
|
||||
@@ -63,22 +76,25 @@ void load(
|
||||
){
|
||||
bool tflag;
|
||||
ar >> boost::serialization::make_nvp("initialized", tflag);
|
||||
if (tflag){
|
||||
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){
|
||||
// item_version is handled as an attribute so it doesnt need an NVP
|
||||
ar >> BOOST_SERIALIZATION_NVP(item_version);
|
||||
}
|
||||
detail::stack_construct<Archive, T> aux(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("value", aux.reference());
|
||||
t.reset(aux.reference());
|
||||
}
|
||||
else {
|
||||
if(! tflag){
|
||||
t.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
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>
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <queue>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
// function specializations must be defined in the appropriate
|
||||
// namespace - boost::serialization
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <queue>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
// function specializations must be defined in the appropriate
|
||||
// namespace - boost::serialization
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
#include <boost/serialization/collections_save_imp.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -55,11 +56,7 @@ inline void load_set_collection(Archive & ar, Container &s)
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::iterator result =
|
||||
#ifdef BOOST_NO_CXX11_HDR_UNORDERED_SET
|
||||
s.insert(hint, t.reference());
|
||||
#else
|
||||
s.emplace_hint(hint, t.reference());
|
||||
#endif
|
||||
s.insert(hint, boost::move(t.reference()));
|
||||
ar.reset_object_address(& (* result), & t.reference());
|
||||
hint = result;
|
||||
}
|
||||
|
||||
@@ -31,9 +31,6 @@
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last headern
|
||||
|
||||
namespace boost_132 {
|
||||
template<class T> class shared_ptr;
|
||||
@@ -94,7 +91,7 @@ public:
|
||||
// by a change in load_construct_data below. It makes this file suitable
|
||||
// only for loading pointers into a 1.33 or later boost system.
|
||||
std::list<boost_132::shared_ptr<const void> > * m_pointers_132;
|
||||
BOOST_ARCHIVE_DECL void
|
||||
void
|
||||
append(const boost_132::shared_ptr<const void> & t){
|
||||
if(NULL == m_pointers_132)
|
||||
m_pointers_132 = new std::list<boost_132::shared_ptr<const void> >;
|
||||
@@ -209,6 +206,4 @@ public:
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_SERIALIZATION_SHARED_PTR_HELPER_HPP
|
||||
|
||||
@@ -111,6 +111,12 @@ 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.
|
||||
|
||||
template <class T>
|
||||
class singleton : public singleton_module
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/detail/is_default_constructible.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
@@ -67,14 +68,14 @@ collection_load_impl(
|
||||
t.clear();
|
||||
boost::serialization::detail::stack_construct<Archive, T> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
t.push_front(u.reference());
|
||||
t.push_front(boost::move(u.reference()));
|
||||
typename BOOST_STD_EXTENSION_NAMESPACE::slist<T, Allocator>::iterator last;
|
||||
last = t.begin();
|
||||
ar.reset_object_address(&(*t.begin()) , & u.reference());
|
||||
while(--count > 0){
|
||||
detail::stack_construct<Archive, T> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
last = t.insert_after(last, u.reference());
|
||||
last = t.insert_after(last, boost::move(u.reference()));
|
||||
ar.reset_object_address(&(*last) , & u.reference());
|
||||
}
|
||||
}
|
||||
@@ -109,14 +110,14 @@ inline void load(
|
||||
t.clear();
|
||||
boost::serialization::detail::stack_construct<Archive, U> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
t.push_front(u.reference());
|
||||
t.push_front(boost::move(u.reference()));
|
||||
typename BOOST_STD_EXTENSION_NAMESPACE::slist<U, Allocator>::iterator last;
|
||||
last = t.begin();
|
||||
ar.reset_object_address(&(*t.begin()) , & u.reference());
|
||||
while(--count > 0){
|
||||
detail::stack_construct<Archive, U> u(ar, item_version);
|
||||
ar >> boost::serialization::make_nvp("item", u.reference());
|
||||
last = t.insert_after(last, u.reference());
|
||||
last = t.insert_after(last, boost::move(u.reference()));
|
||||
ar.reset_object_address(&(*last) , & u.reference());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <stack>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
// function specializations must be defined in the appropriate
|
||||
// namespace - boost::serialization
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// strong_typedef.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// (C) Copyright 2016 Ashish Sadanandan
|
||||
// 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)
|
||||
@@ -24,23 +25,26 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/operators.hpp>
|
||||
#include <boost/type_traits/has_nothrow_assign.hpp>
|
||||
#include <boost/type_traits/has_nothrow_constructor.hpp>
|
||||
#include <boost/type_traits/has_nothrow_copy.hpp>
|
||||
|
||||
#define BOOST_STRONG_TYPEDEF(T, D) \
|
||||
struct D \
|
||||
: boost::totally_ordered1< D \
|
||||
, boost::totally_ordered2< D, T \
|
||||
> > \
|
||||
{ \
|
||||
T t; \
|
||||
explicit D(const T t_) : t(t_) {}; \
|
||||
D(): t() {}; \
|
||||
D(const D & t_) : t(t_.t){} \
|
||||
D & operator=(const D & rhs) { t = rhs.t; return *this;} \
|
||||
D & operator=(const T & rhs) { t = rhs; return *this;} \
|
||||
operator const T & () const {return t; } \
|
||||
operator T & () { return t; } \
|
||||
bool operator==(const D & rhs) const { return t == rhs.t; } \
|
||||
bool operator<(const D & rhs) const { return t < rhs.t; } \
|
||||
#define BOOST_STRONG_TYPEDEF(T, D) \
|
||||
struct D \
|
||||
: boost::totally_ordered1< D \
|
||||
, boost::totally_ordered2< D, T \
|
||||
> > \
|
||||
{ \
|
||||
T t; \
|
||||
explicit D(const T& t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_) {} \
|
||||
D() BOOST_NOEXCEPT_IF(boost::has_nothrow_default_constructor<T>::value) : t() {} \
|
||||
D(const D & t_) BOOST_NOEXCEPT_IF(boost::has_nothrow_copy_constructor<T>::value) : t(t_.t) {} \
|
||||
D& operator=(const D& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs.t; return *this;} \
|
||||
D& operator=(const T& rhs) BOOST_NOEXCEPT_IF(boost::has_nothrow_assign<T>::value) {t = rhs; return *this;} \
|
||||
operator const T&() const {return t;} \
|
||||
operator T&() {return t;} \
|
||||
bool operator==(const D& rhs) const {return t == rhs.t;} \
|
||||
bool operator<(const D& rhs) const {return t < rhs.t;} \
|
||||
};
|
||||
|
||||
#endif // BOOST_SERIALIZATION_STRONG_TYPEDEF_HPP
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace std{
|
||||
#include <boost/archive/detail/basic_iarchive.hpp>
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
|
||||
@@ -43,7 +43,11 @@ 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())
|
||||
ar << make_array(detail::get_data(t), t.size());
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar << serialization::make_array<const U, collection_size_type>(
|
||||
static_cast<const U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive, class U>
|
||||
@@ -53,7 +57,11 @@ void load( Archive & ar, STD::valarray<U> &t, const unsigned int /*file_version
|
||||
ar >> BOOST_SERIALIZATION_NVP(count);
|
||||
t.resize(count);
|
||||
if (t.size())
|
||||
ar >> make_array(detail::get_data(t), t.size());
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar >> serialization::make_array<U, collection_size_type>(
|
||||
static_cast<U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
|
||||
@@ -33,7 +33,6 @@
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
#include <boost/serialization/detail/get_data.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
|
||||
@@ -103,7 +102,11 @@ inline void save(
|
||||
const collection_size_type count(t.size());
|
||||
ar << BOOST_SERIALIZATION_NVP(count);
|
||||
if (!t.empty())
|
||||
ar << boost::serialization::make_array(detail::get_data(t),t.size());
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar << serialization::make_array<const U, collection_size_type>(
|
||||
static_cast<const U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive, class U, class Allocator>
|
||||
@@ -121,7 +124,11 @@ inline void load(
|
||||
ar >> BOOST_SERIALIZATION_NVP(item_version);
|
||||
}
|
||||
if (!t.empty())
|
||||
ar >> boost::serialization::make_array(detail::get_data(t),t.size());
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar >> serialization::make_array<U, collection_size_type>(
|
||||
static_cast<U *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
|
||||
// dispatch to either default or optimized versions
|
||||
|
||||
@@ -76,10 +76,11 @@ BOOST_ARCHIVE_SIGNATURE(){
|
||||
// 12- improved serialization of collections
|
||||
// 13- simplified visibility, removed Borland, removed pfto
|
||||
// 14- improved visibility, refactor map/set
|
||||
// 15- corrections to optional and collection loading
|
||||
|
||||
BOOST_SYMBOL_VISIBLE library_version_type
|
||||
BOOST_ARCHIVE_VERSION(){
|
||||
return library_version_type(14);
|
||||
return library_version_type(15);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
||||
+10
-10
@@ -182,22 +182,22 @@ bool basic_xml_grammar<CharType>::my_parse(
|
||||
return false;
|
||||
}
|
||||
|
||||
boost::io::ios_flags_saver ifs(is);
|
||||
is >> std::noskipws;
|
||||
|
||||
std::basic_string<CharType> arg;
|
||||
|
||||
CharType val;
|
||||
do{
|
||||
typename basic_xml_grammar<CharType>::IStream::int_type
|
||||
result = is.get();
|
||||
for(;;){
|
||||
CharType result;
|
||||
is.get(result);
|
||||
if(is.fail())
|
||||
return false;
|
||||
val = static_cast<CharType>(result);
|
||||
arg += val;
|
||||
if(is.eof())
|
||||
return false;
|
||||
arg += result;
|
||||
if(result == delimiter)
|
||||
break;
|
||||
}
|
||||
while(val != delimiter);
|
||||
|
||||
|
||||
// read just one more character. This will be the newline after the tag
|
||||
// this is so that the next operation will return fail if the archive
|
||||
// is terminated. This will permit the archive to be used for debug
|
||||
@@ -227,7 +227,7 @@ bool basic_xml_grammar<CharType>::parse_string(IStream & is, StringType & s){
|
||||
bool result = my_parse(is, content, '<');
|
||||
// note: unget caused a problem with dinkumware. replace with
|
||||
// is.unget();
|
||||
// putback another dilimiter instead
|
||||
// putback another delimiter instead
|
||||
is.putback('<');
|
||||
if(result)
|
||||
s = rv.contents;
|
||||
|
||||
+4
-6
@@ -123,6 +123,9 @@ test-suite "serialization" :
|
||||
[ 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 ]
|
||||
|
||||
# should compile
|
||||
[ compile test_strong_typedef.cpp ]
|
||||
;
|
||||
|
||||
if ! $(BOOST_ARCHIVE_LIST) {
|
||||
@@ -141,15 +144,10 @@ 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_utf8_codecvt
|
||||
:
|
||||
:
|
||||
: <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
|
||||
]
|
||||
[ test-bsl-run test_codecvt_null
|
||||
: ../src/codecvt_null
|
||||
:
|
||||
: <dependency>../../config/test/all//BOOST_NO_STD_WSTREAMBUF
|
||||
: [ requires std_wstreambuf ]
|
||||
]
|
||||
|
||||
#[ test-bsl-run test_z ]
|
||||
|
||||
+19
-19
@@ -40,29 +40,29 @@ struct test_data
|
||||
|
||||
template<>
|
||||
wchar_t test_data<2>::wchar_encoding[] = {
|
||||
0x0001,
|
||||
0x007f,
|
||||
0x0080,
|
||||
0x07ff,
|
||||
0x0800,
|
||||
0x7fff
|
||||
(wchar_t) 0x0001,
|
||||
(wchar_t) 0x007f,
|
||||
(wchar_t) 0x0080,
|
||||
(wchar_t) 0x07ff,
|
||||
(wchar_t) 0x0800,
|
||||
(wchar_t) 0x7fff
|
||||
};
|
||||
|
||||
template<>
|
||||
wchar_t test_data<4>::wchar_encoding[] = {
|
||||
0x00000001,
|
||||
0x0000007f,
|
||||
0x00000080,
|
||||
0x000007ff,
|
||||
0x00000800,
|
||||
0x0000ffff,
|
||||
0x00010000,
|
||||
0x0010ffff,
|
||||
0x001fffff,
|
||||
0x00200000,
|
||||
0x03ffffff,
|
||||
0x04000000,
|
||||
0x7fffffff
|
||||
(wchar_t) 0x00000001,
|
||||
(wchar_t) 0x0000007f,
|
||||
(wchar_t) 0x00000080,
|
||||
(wchar_t) 0x000007ff,
|
||||
(wchar_t) 0x00000800,
|
||||
(wchar_t) 0x0000ffff,
|
||||
(wchar_t) 0x00010000,
|
||||
(wchar_t) 0x0010ffff,
|
||||
(wchar_t) 0x001fffff,
|
||||
(wchar_t) 0x00200000,
|
||||
(wchar_t) 0x03ffffff,
|
||||
(wchar_t) 0x04000000,
|
||||
(wchar_t) 0x7fffffff
|
||||
};
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_list.cpp
|
||||
// test_forward_list.cpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
@@ -18,9 +18,6 @@ namespace std{
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
#error this test presumes support for forward_list.hpp
|
||||
#endif
|
||||
#include <boost/serialization/forward_list.hpp>
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
|
||||
@@ -32,8 +32,7 @@ namespace std{
|
||||
#include "A.ipp"
|
||||
|
||||
template<class T>
|
||||
struct ptr_equal_to : public std::binary_function<T, T, bool>
|
||||
{
|
||||
struct ptr_equal_to {
|
||||
BOOST_STATIC_ASSERT(::boost::is_pointer< T >::value);
|
||||
bool operator()(T const _Left, T const _Right) const
|
||||
{
|
||||
|
||||
+1
-27
@@ -71,28 +71,6 @@ void test_slist(){
|
||||
}
|
||||
#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);
|
||||
std::forward_list<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);
|
||||
}
|
||||
std::forward_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 == aslist1);
|
||||
std::remove(testfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
int test_main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
test_list();
|
||||
@@ -100,11 +78,7 @@ int test_main( int /* argc */, char* /* argv */[] )
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
test_slist();
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
test_forward_list();
|
||||
#endif
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
+2
-44
@@ -32,8 +32,7 @@ namespace std{
|
||||
#include "A.ipp"
|
||||
|
||||
template<class T>
|
||||
struct ptr_equal_to : public std::binary_function<T, T, bool>
|
||||
{
|
||||
struct ptr_equal_to {
|
||||
BOOST_STATIC_ASSERT(::boost::is_pointer< T >::value);
|
||||
bool operator()(T const _Left, T const _Right) const
|
||||
{
|
||||
@@ -127,43 +126,6 @@ void test_slist(){
|
||||
}
|
||||
#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);
|
||||
BOOST_REQUIRE(NULL != testfile);
|
||||
|
||||
std::forward_list<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);
|
||||
}
|
||||
std::forward_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(
|
||||
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();
|
||||
@@ -171,11 +133,7 @@ int test_main( int /* argc */, char* /* argv */[] )
|
||||
#ifdef BOOST_HAS_SLIST
|
||||
test_slist();
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CXX11_HDR_FORWARD_LIST
|
||||
test_forward_list();
|
||||
#endif
|
||||
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_strong_typedef.cpp
|
||||
|
||||
// (C) Copyright 2016 Ashish Sadanandan
|
||||
// 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
|
||||
#include <stdlib.h> // EXIT_SUCCESS
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/serialization/strong_typedef.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/type_traits/has_nothrow_assign.hpp>
|
||||
#include <boost/type_traits/has_nothrow_constructor.hpp>
|
||||
#include <boost/type_traits/has_nothrow_copy.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Define a strong typedef for int.
|
||||
// The new type should be nothrow constructible and assignable.
|
||||
|
||||
BOOST_STRONG_TYPEDEF(int, strong_int)
|
||||
|
||||
#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_default_constructor<strong_int>::value);
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_copy_constructor<strong_int>::value);
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_assign<strong_int>::value);
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// strong_int can now be placed in another type, which can also be
|
||||
// nothrow constructible and assignable.
|
||||
|
||||
struct type1
|
||||
{
|
||||
long some_long;
|
||||
strong_int sint;
|
||||
};
|
||||
|
||||
#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_default_constructor<type1>::value);
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_copy_constructor<type1>::value);
|
||||
BOOST_STATIC_ASSERT(boost::has_nothrow_assign<type1>::value);
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// Now define a type that throws, and a strong_typedef for it
|
||||
// The strong_typedef should also not have nothrow construction/assign.
|
||||
|
||||
struct not_noexcept
|
||||
{
|
||||
not_noexcept() {}
|
||||
not_noexcept(not_noexcept const&) {}
|
||||
not_noexcept& operator=(not_noexcept const&) {return *this;}
|
||||
bool operator==(not_noexcept const&) const {return false;}
|
||||
bool operator<(not_noexcept const&) const {return false;}
|
||||
};
|
||||
BOOST_STRONG_TYPEDEF(not_noexcept, strong_not_noexcept)
|
||||
|
||||
#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR
|
||||
BOOST_STATIC_ASSERT(! boost::has_nothrow_default_constructor<strong_not_noexcept>::value);
|
||||
BOOST_STATIC_ASSERT(! boost::has_nothrow_copy_constructor<strong_not_noexcept>::value);
|
||||
BOOST_STATIC_ASSERT(! boost::has_nothrow_assign<strong_not_noexcept>::value);
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
@@ -1,252 +0,0 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_utf8_codecvt.cpp
|
||||
|
||||
// (C) Copyright 2002-4 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 <algorithm> // std::copy
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <locale>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <cwchar>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
using ::wcslen;
|
||||
#if !defined(UNDER_CE) && !defined(__PGIC__)
|
||||
using ::w_int;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
// Note: copied from boost/iostreams/char_traits.hpp
|
||||
//
|
||||
// Dinkumware that comes with QNX Momentics 6.3.0, 4.0.2, incorrectly defines
|
||||
// the EOF and WEOF macros to not std:: qualify the wint_t type (and so does
|
||||
// Sun C++ 5.8 + STLport 4). Fix by placing the def in this scope.
|
||||
// NOTE: Use BOOST_WORKAROUND?
|
||||
#if (defined(__QNX__) && defined(BOOST_DINKUMWARE_STDLIB)) \
|
||||
|| defined(__SUNPRO_CC)
|
||||
using ::std::wint_t;
|
||||
#endif
|
||||
|
||||
#include "test_tools.hpp"
|
||||
|
||||
template<std::size_t s>
|
||||
struct test_data
|
||||
{
|
||||
static unsigned char utf8_encoding[];
|
||||
static wchar_t wchar_encoding[];
|
||||
};
|
||||
|
||||
template<>
|
||||
unsigned char test_data<2>::utf8_encoding[] = {
|
||||
0x01,
|
||||
0x7f,
|
||||
0xc2, 0x80,
|
||||
0xdf, 0xbf,
|
||||
0xe0, 0xa0, 0x80,
|
||||
0xe7, 0xbf, 0xbf
|
||||
};
|
||||
|
||||
template<>
|
||||
wchar_t test_data<2>::wchar_encoding[] = {
|
||||
0x0001,
|
||||
0x007f,
|
||||
0x0080,
|
||||
0x07ff,
|
||||
0x0800,
|
||||
0x7fff
|
||||
};
|
||||
|
||||
template<>
|
||||
unsigned char test_data<4>::utf8_encoding[] = {
|
||||
0x01,
|
||||
0x7f,
|
||||
0xc2, 0x80,
|
||||
0xdf, 0xbf,
|
||||
0xe0, 0xa0, 0x80,
|
||||
0xef, 0xbf, 0xbf,
|
||||
0xf0, 0x90, 0x80, 0x80,
|
||||
0xf4, 0x8f, 0xbf, 0xbf,
|
||||
/* codecvt implementations for clang and gcc don't handle more than 21 bits and
|
||||
* return eof accordlingly. So don't test the whole 32 range
|
||||
*/
|
||||
/*
|
||||
0xf7, 0xbf, 0xbf, 0xbf,
|
||||
0xf8, 0x88, 0x80, 0x80, 0x80,
|
||||
0xfb, 0xbf, 0xbf, 0xbf, 0xbf,
|
||||
0xfc, 0x84, 0x80, 0x80, 0x80, 0x80,
|
||||
0xfd, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf
|
||||
*/
|
||||
};
|
||||
|
||||
template<>
|
||||
wchar_t test_data<4>::wchar_encoding[] = {
|
||||
(wchar_t)0x00000001,
|
||||
(wchar_t)0x0000007f,
|
||||
(wchar_t)0x00000080,
|
||||
(wchar_t)0x000007ff,
|
||||
(wchar_t)0x00000800,
|
||||
(wchar_t)0x0000ffff,
|
||||
(wchar_t)0x00010000,
|
||||
(wchar_t)0x0010ffff,
|
||||
/* codecvt implementations for clang and gcc don't handle more than 21 bits and
|
||||
* return eof accordlingly. So don't test the whole 32 range
|
||||
*/
|
||||
/*
|
||||
(wchar_t)0x001fffff,
|
||||
(wchar_t)0x00200000,
|
||||
(wchar_t)0x03ffffff,
|
||||
(wchar_t)0x04000000,
|
||||
(wchar_t)0x7fffffff
|
||||
*/
|
||||
};
|
||||
|
||||
int
|
||||
test_main(int /* argc */, char * /* argv */[]) {
|
||||
std::locale utf8_locale
|
||||
= std::locale(
|
||||
std::locale::classic(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
|
||||
typedef char utf8_t;
|
||||
// define test data compatible with the wchar_t implementation
|
||||
// as either ucs-2 or ucs-4 depending on the compiler/library.
|
||||
typedef test_data<sizeof(wchar_t)> td;
|
||||
|
||||
// Send our test UTF-8 data to file
|
||||
{
|
||||
std::ofstream ofs;
|
||||
ofs.open("test.dat");
|
||||
std::copy(
|
||||
td::utf8_encoding,
|
||||
td::utf8_encoding + sizeof(td::utf8_encoding) / sizeof(unsigned char),
|
||||
std::ostream_iterator<utf8_t>(ofs)
|
||||
);
|
||||
}
|
||||
|
||||
// Read the test data back in, converting to UCS-4 on the way in
|
||||
std::vector<wchar_t> from_file;
|
||||
{
|
||||
std::wifstream ifs;
|
||||
ifs.imbue(utf8_locale);
|
||||
ifs.open("test.dat");
|
||||
|
||||
std::wint_t item = 0;
|
||||
// note can't use normal vector from iterator constructor because
|
||||
// dinkumware doesn't have it.
|
||||
for(;;){
|
||||
item = ifs.get();
|
||||
if(item == WEOF)
|
||||
break;
|
||||
//ifs >> item;
|
||||
//if(ifs.eof())
|
||||
// break;
|
||||
from_file.push_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_CHECK(std::equal(from_file.begin(), from_file.end(), td::wchar_encoding));
|
||||
|
||||
// Send the UCS4_data back out, converting to UTF-8
|
||||
{
|
||||
std::wofstream ofs;
|
||||
ofs.imbue(utf8_locale);
|
||||
ofs.open("test2.dat");
|
||||
std::copy(
|
||||
from_file.begin(),
|
||||
from_file.end(),
|
||||
std::ostream_iterator<wchar_t, wchar_t>(ofs)
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure that both files are the same
|
||||
{
|
||||
typedef std::istream_iterator<utf8_t> is_iter;
|
||||
is_iter end_iter;
|
||||
|
||||
std::ifstream ifs1("test.dat");
|
||||
is_iter it1(ifs1);
|
||||
std::vector<utf8_t> data1;
|
||||
std::copy(it1, end_iter, std::back_inserter(data1));
|
||||
|
||||
std::ifstream ifs2("test2.dat");
|
||||
is_iter it2(ifs2);
|
||||
std::vector<utf8_t> data2;
|
||||
std::copy(it2, end_iter, std::back_inserter(data2));
|
||||
|
||||
BOOST_CHECK(data1 == data2);
|
||||
}
|
||||
|
||||
// some libraries have trouble that only shows up with longer strings
|
||||
|
||||
const wchar_t * test3_data = L"\
|
||||
<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\
|
||||
<!DOCTYPE boost_serialization>\
|
||||
<boost_serialization signature=\"serialization::archive\" version=\"3\">\
|
||||
<a class_id=\"0\" tracking_level=\"0\">\
|
||||
<b>1</b>\
|
||||
<f>96953204</f>\
|
||||
<g>177129195</g>\
|
||||
<l>1</l>\
|
||||
<m>5627</m>\
|
||||
<n>23010</n>\
|
||||
<o>7419</o>\
|
||||
<p>16212</p>\
|
||||
<q>4086</q>\
|
||||
<r>2749</r>\
|
||||
<c>-33</c>\
|
||||
<s>124</s>\
|
||||
<t>28</t>\
|
||||
<u>32225</u>\
|
||||
<v>17543</v>\
|
||||
<w>0.84431422</w>\
|
||||
<x>1.0170664757130923</x>\
|
||||
<y>tjbx</y>\
|
||||
<z>cuwjentqpkejp</z>\
|
||||
</a>\
|
||||
</boost_serialization>\
|
||||
";
|
||||
|
||||
// Send the UCS4_data back out, converting to UTF-8
|
||||
std::size_t l = std::wcslen(test3_data);
|
||||
{
|
||||
std::wofstream ofs;
|
||||
ofs.imbue(utf8_locale);
|
||||
ofs.open("test3.dat");
|
||||
std::copy(
|
||||
test3_data,
|
||||
test3_data + l,
|
||||
std::ostream_iterator<wchar_t, wchar_t>(ofs)
|
||||
);
|
||||
}
|
||||
|
||||
// Make sure that both files are the same
|
||||
{
|
||||
std::wifstream ifs;
|
||||
ifs.imbue(utf8_locale);
|
||||
ifs.open("test3.dat");
|
||||
ifs >> std::noskipws;
|
||||
BOOST_CHECK(
|
||||
std::equal(
|
||||
test3_data,
|
||||
test3_data + l,
|
||||
std::istream_iterator<wchar_t, wchar_t>(ifs)
|
||||
)
|
||||
);
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
+77
-2
@@ -1,4 +1,79 @@
|
||||
#if 0
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
#include <boost/serialization/optional.hpp>
|
||||
|
||||
struct Foo
|
||||
{
|
||||
Foo(int aBar) :
|
||||
mBar(aBar)
|
||||
{
|
||||
if (mBar > 10)
|
||||
{
|
||||
throw std::logic_error("too big bar");
|
||||
}
|
||||
}
|
||||
int bar() const
|
||||
{
|
||||
return mBar;
|
||||
}
|
||||
bool operator==(const Foo & rhs) const {
|
||||
return mBar == rhs.mBar;
|
||||
}
|
||||
private:
|
||||
int mBar;
|
||||
};
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
template<class Archive>
|
||||
inline void serialize(Archive & ar, Foo& foo, const unsigned int /*version*/)
|
||||
{
|
||||
std::cout << __FUNCTION__ << " called" << std::endl;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
inline void save_construct_data(Archive & ar, const Foo* foo, const unsigned int /*version*/)
|
||||
{
|
||||
std::cout << __FUNCTION__ << " called" << std::endl;
|
||||
ar & foo->bar();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
inline void load_construct_data(Archive & ar, Foo* foo, const unsigned int /*version*/)
|
||||
{
|
||||
std::cout << __FUNCTION__ << " called" << std::endl;
|
||||
int bar;
|
||||
ar & bar;
|
||||
::new(foo) Foo(bar);
|
||||
}
|
||||
|
||||
} // serialization
|
||||
} // boost
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::optional<Foo> oldFoo = Foo(10);
|
||||
std::ostringstream outStream;
|
||||
boost::archive::text_oarchive outArchive(outStream);
|
||||
outArchive & oldFoo;
|
||||
|
||||
boost::optional<Foo> newFoo;
|
||||
std::istringstream inStream(outStream.str());
|
||||
boost::archive::text_iarchive inArchive(inStream);
|
||||
inArchive & newFoo;
|
||||
|
||||
return !(newFoo == oldFoo);
|
||||
}
|
||||
|
||||
#elif 0
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_optional.cpp
|
||||
|
||||
@@ -63,7 +138,7 @@ int test_main( int /* argc */, char* /* argv */[] )
|
||||
|
||||
// EOF
|
||||
|
||||
#elseif 0
|
||||
#elif 0
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -119,4 +194,4 @@ int main() {
|
||||
oa << boost::serialization::make_nvp( "bob", bob );
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,8 @@ rule run-template ( test-name : sources * : requirements * ) {
|
||||
<toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
|
||||
#<toolset>gcc:<warnings>all # ?
|
||||
<toolset>gcc:<cxxflags>"-Wno-unused-variable -Wno-long-long"
|
||||
# <toolset>gcc:<variant>debug><define>_STLP_DEBUG
|
||||
# <toolset>gcc:<variant>debug><define>_GLIBCXX_DEBUG
|
||||
<toolset>darwin:<cxxflags>"-Wno-unused-variable -Wno-long-long"
|
||||
<toolset>msvc:<warnings>all # == /W4
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
@@ -50,6 +52,9 @@ rule run-template ( test-name : sources * : requirements * ) {
|
||||
<toolset>clang:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>darwin:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>msvc:<cxxflags>"-Gy"
|
||||
# linking
|
||||
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
|
||||
<link>shared:<define>BOOST_WSERIALIZATION_DYN_LINK=1
|
||||
$(requirements)
|
||||
: # test name
|
||||
$(test-name)
|
||||
|
||||
Reference in New Issue
Block a user