mirror of
https://github.com/boostorg/serialization.git
synced 2026-07-23 13:54:08 +00:00
Compare commits
105 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 | |||
| 3eb2bda80b | |||
| 42b5b6859b | |||
| fc9d311df9 | |||
| 69ecae6919 | |||
| b65e29cb5f | |||
| 9e2541b030 | |||
| 73ec60764a | |||
| e40ae62ced | |||
| d25475da16 | |||
| 1a65a19c20 | |||
| e629008d55 | |||
| 5988a816f9 | |||
| c0f17d6934 | |||
| 5fe6471b6f | |||
| 00459350f0 | |||
| ec0c2a2ba1 | |||
| 6128dfce37 | |||
| 1dcca5b67b | |||
| 150b7e8a5f | |||
| d9ad787f70 | |||
| 7ae4087c05 | |||
| 72ef8bf59a | |||
| 0040321a7c | |||
| 00ede57216 | |||
| d330deb82c | |||
| 2006c1633b | |||
| c5c233d857 | |||
| ccdb32bfe5 | |||
| 6facb61510 | |||
| eb6faaf428 | |||
| 587b081d1d | |||
| 67b16f8a9d | |||
| 9bb75492ff | |||
| 533dba12d7 | |||
| 2783e07993 | |||
| 4083f81e3c | |||
| ead783cfe8 | |||
| e4b18d9379 | |||
| e3b67eb299 | |||
| 41fd59b77b | |||
| 194ff67a05 | |||
| a76a511c95 | |||
| 494fa31e1c | |||
| edf1dffd70 | |||
| ae4c2321af | |||
| 160a3369db | |||
| a64bf6e4d5 | |||
| 53a0388fec | |||
| c05c59ca88 | |||
| 13f794d953 | |||
| e4219b35eb | |||
| d53d3159b4 | |||
| 72530c408d | |||
| 62c975820d | |||
| d1d6a4a100 | |||
| 5e6f0bd271 | |||
| 348a916a81 | |||
| 54a68ca9de | |||
| 42512bc128 | |||
| 88a4156aaa | |||
| 619f30aa8d | |||
| 153e7e635c | |||
| 40f6cfcc84 | |||
| 4d9fccbee5 | |||
| 763f204e80 | |||
| d8c26789e0 | |||
| e0b4403d61 | |||
| 45610e25e4 | |||
| ae22245b28 | |||
| 4f83fc163a | |||
| e3129464dc | |||
| 9542a9f78e | |||
| f6f040a7eb | |||
| 2d09112b24 | |||
| 599c53c5d0 | |||
| 6795c81995 |
+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
|
||||
+63
-19
@@ -2,6 +2,13 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
if (POLICY CMP0054)
|
||||
cmake_policy (SET CMP0054 NEW)
|
||||
endif (POLICY CMP0054)
|
||||
|
||||
if (POLICY CMP0063)
|
||||
cmake_policy (SET CMP0063 NEW)
|
||||
endif (POLICY CMP0063)
|
||||
|
||||
if(Boost_USE_STATIC_LIBS)
|
||||
project("Serialization-Static")
|
||||
@@ -14,15 +21,18 @@ 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 )
|
||||
# we use gcc to test for C++03 compatibility
|
||||
add_definitions( std=c++03 )
|
||||
message(STATUS "compiler is g++ c++03")
|
||||
set(COMPILER_SUPPORTS_CXX11 FALSE)
|
||||
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
|
||||
add_definitions( /wd4996 )
|
||||
message(STATUS "compiler is MSVC")
|
||||
set(COMPILER_SUPPORTS_CXX11 TRUE)
|
||||
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=300")
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
|
||||
@@ -30,6 +40,7 @@ elseif( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0" )
|
||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" )
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -dead_strip")
|
||||
set(COMPILER_SUPPORTS_CXX11 TRUE)
|
||||
endif()
|
||||
|
||||
#
|
||||
@@ -96,30 +107,45 @@ 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)
|
||||
set(BUILD_SHARED_LIBRARIES OFF)
|
||||
message(STATUS "Use static libraries")
|
||||
set(LINK_TYPE "STATIC")
|
||||
else()
|
||||
set(BUILD_SHARED_LIBRARIES ON)
|
||||
message(STATUS "Building shared libraries")
|
||||
set(LINK_TYPE "SHARED")
|
||||
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()
|
||||
|
||||
###########################
|
||||
# library builds
|
||||
|
||||
add_library(serialization
|
||||
add_library(serialization ${LINK_TYPE}
|
||||
../src/archive_exception.cpp
|
||||
../src/basic_archive.cpp
|
||||
../src/basic_iarchive.cpp
|
||||
@@ -134,34 +160,34 @@ add_library(serialization
|
||||
../src/basic_xml_archive.cpp
|
||||
../src/binary_iarchive.cpp
|
||||
../src/binary_oarchive.cpp
|
||||
../src/codecvt_null.cpp
|
||||
../src/extended_type_info_no_rtti.cpp
|
||||
../src/extended_type_info_typeid.cpp
|
||||
../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
|
||||
../src/utf8_codecvt_facet.cpp
|
||||
../src/void_cast.cpp
|
||||
../src/xml_archive_exception.cpp
|
||||
../src/xml_iarchive.cpp
|
||||
../src/xml_oarchive.cpp
|
||||
../src/xml_grammar.cpp
|
||||
# ../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
|
||||
../src/utf8_codecvt_facet.cpp
|
||||
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
|
||||
)
|
||||
|
||||
add_library(wserialization
|
||||
add_library(wserialization ${LINK_TYPE}
|
||||
../src/codecvt_null.cpp
|
||||
../src/basic_text_wiprimitive.cpp
|
||||
../src/basic_text_woprimitive.cpp
|
||||
../src/text_wiarchive.cpp
|
||||
../src/text_woarchive.cpp
|
||||
../src/utf8_codecvt_facet.cpp
|
||||
../src/xml_wiarchive.cpp
|
||||
../src/xml_woarchive.cpp
|
||||
../src/codecvt_null.cpp
|
||||
../src/xml_wgrammar.cpp
|
||||
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
|
||||
)
|
||||
|
||||
# end library build
|
||||
@@ -240,10 +266,14 @@ serialization_test(test_iterators)
|
||||
serialization_test(test_iterators_base64)
|
||||
serialization_test(test_inclusion)
|
||||
serialization_test(test_smart_cast)
|
||||
serialization_test(test_utf8_codecvt ../src/utf8_codecvt_facet)
|
||||
serialization_test(test_codecvt_null ../src/codecvt_null)
|
||||
serialization_test(test_strong_typedef)
|
||||
|
||||
archive_test(test_array A)
|
||||
archive_test(test_native_array A)
|
||||
archive_test(test_boost_array A)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_array A)
|
||||
endif()
|
||||
archive_test(test_binary)
|
||||
archive_test(test_bitset)
|
||||
archive_test(test_class_info_save)
|
||||
@@ -258,11 +288,14 @@ archive_test(test_derived_class A)
|
||||
archive_test(test_diamond)
|
||||
archive_test(test_diamond_complex)
|
||||
archive_test(test_exported polymorphic_base)
|
||||
archive_test(test_forward_list A)
|
||||
archive_test(test_forward_list_ptrs A)
|
||||
archive_test(test_helper_support)
|
||||
archive_test(test_interrupts)
|
||||
archive_test(test_list A)
|
||||
archive_test(test_list_ptrs A)
|
||||
archive_test(test_map A)
|
||||
archive_test(test_map_boost_unordered A)
|
||||
archive_test(test_mi)
|
||||
archive_test(test_multiple_ptrs A)
|
||||
archive_test(test_multiple_inheritance)
|
||||
@@ -277,11 +310,11 @@ archive_test(test_object)
|
||||
archive_test(test_optional)
|
||||
archive_test(test_primitive)
|
||||
archive_test(test_priority_queue A)
|
||||
# archive_test(test_private_base)
|
||||
archive_test(test_private_base)
|
||||
archive_test(test_private_base2)
|
||||
archive_test(test_queue A)
|
||||
archive_test(test_recursion A)
|
||||
archive_test(test_registered)
|
||||
archive_test(test_set A)
|
||||
archive_test(test_shared_ptr)
|
||||
archive_test(test_shared_ptr_multi_base)
|
||||
archive_test(test_shared_ptr_132)
|
||||
@@ -295,6 +328,18 @@ archive_test(test_unique_ptr)
|
||||
archive_test(test_valarray)
|
||||
archive_test(test_variant A)
|
||||
archive_test(test_vector A)
|
||||
archive_test(test_set A)
|
||||
archive_test(test_set_boost_unordered A)
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_set_unordered A)
|
||||
else()
|
||||
archive_test(test_set_hashed A)
|
||||
endif()
|
||||
if(COMPILER_SUPPORTS_CXX11)
|
||||
archive_test(test_map_unordered A)
|
||||
else()
|
||||
archive_test(test_map_hashed A)
|
||||
endif()
|
||||
|
||||
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
|
||||
polymorphic_archive_test(test_polymorphic2 test_polymorphic2imp)
|
||||
@@ -356,8 +401,7 @@ file(GLOB x
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/../include/boost/archive/*_w*.hpp"
|
||||
)
|
||||
|
||||
add_custom_target(wserialization_headers SOURCES ${x} "${CMAKE_CURRENT_SOURCE_DIR}/../include/boost/archive/codecvt_null.hpp")
|
||||
add_custom_target(wserialization_headers SOURCES ${x})
|
||||
set_property(TARGET wserialization_headers PROPERTY FOLDER "wserialization")
|
||||
|
||||
# end headers in IDE
|
||||
|
||||
+17
-11
@@ -80,6 +80,9 @@ SOURCES =
|
||||
xml_iarchive
|
||||
xml_oarchive
|
||||
xml_archive_exception
|
||||
codecvt_null
|
||||
utf8_codecvt_facet
|
||||
singleton
|
||||
;
|
||||
|
||||
WSOURCES =
|
||||
@@ -87,23 +90,22 @@ WSOURCES =
|
||||
basic_text_woprimitive
|
||||
text_wiarchive
|
||||
text_woarchive
|
||||
utf8_codecvt_facet
|
||||
xml_wgrammar
|
||||
xml_wiarchive
|
||||
xml_woarchive
|
||||
codecvt_null
|
||||
;
|
||||
|
||||
|
||||
lib boost_serialization
|
||||
: $(SOURCES).cpp
|
||||
:
|
||||
<toolset>msvc:<cxxflags>/Gy
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
<toolset>gcc:<cxxflags>"-fvisibility=hidden"
|
||||
<toolset>gcc:<cxxflags>"-fvisibility-inlines-hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility=hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility-inlines-hidden"
|
||||
<toolset>clang:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<toolset>gcc:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<toolset>gcc:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>clang:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>darwin:<cxxflags>"-ftemplate-depth-255"
|
||||
<link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
|
||||
;
|
||||
|
||||
@@ -112,10 +114,14 @@ lib boost_wserialization
|
||||
:
|
||||
<toolset>msvc:<cxxflags>/Gy
|
||||
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
|
||||
<toolset>gcc:<cxxflags>"-fvisibility=hidden"
|
||||
<toolset>gcc:<cxxflags>"-fvisibility-inlines-hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility=hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility-inlines-hidden"
|
||||
<toolset>clang:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<toolset>gcc:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<toolset>darwin:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
|
||||
<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
|
||||
;
|
||||
|
||||
|
||||
+2
-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">
|
||||
@@ -269,6 +269,7 @@ function initialize() {
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="shared_ptr.html">Template serialization - <code>shared_ptr<class T></code></a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="shared_ptr2.html"><code>shared_ptr<class T></code>Revisited</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="pimpl.html">PIMPL</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="private_base.html">Private Base Classes</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="simple_log.html">A Simple Logging Archive Class</a>
|
||||
<dt><img style="display:none" src="dot.gif"><a target="detail" href="derivation.html">Derivation from an Existing Archive Class</a>
|
||||
</dl></div></dd>
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<!--
|
||||
(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)
|
||||
-->
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="../../../boost.css">
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<title>Serialization - Private Base Classes</title>
|
||||
</head>
|
||||
<body link="#0000ff" vlink="#800080">
|
||||
<table border="0" cellpadding="7" cellspacing="0" width="100%" summary="header">
|
||||
<tr>
|
||||
<td valign="top" width="300">
|
||||
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
|
||||
</td>
|
||||
<td valign="top">
|
||||
<h1 align="center">Serialization</h1>
|
||||
<h2 align="center">Private Base Classes</h2>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
In many cases, serialization of private or protected base classes present no special problems.
|
||||
This is true for both simple classes and types as well as pointers to those
|
||||
classes and types. That is, the following program compiles and runs exactly as one would expect.
|
||||
<pre><code>
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// test_private_base.cpp
|
||||
|
||||
// (C) Copyright 2009 Eric Moyer - 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 <fstream>
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::remove;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/serialization/base_object.hpp>
|
||||
#include <boost/serialization/export.hpp>
|
||||
|
||||
class Base {
|
||||
friend class boost::serialization::access;
|
||||
int m_i;
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int version){
|
||||
ar & BOOST_SERIALIZATION_NVP(m_i);
|
||||
}
|
||||
protected:
|
||||
bool equals(const Base &rhs) const {
|
||||
return m_i == rhs.m_i;
|
||||
}
|
||||
Base(int i = 0) :
|
||||
m_i(i)
|
||||
{}
|
||||
};
|
||||
|
||||
class Derived : private Base {
|
||||
friend class boost::serialization::access;
|
||||
private:
|
||||
Base & base_cast(){
|
||||
return static_cast<Base &>(*this);
|
||||
}
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int version){
|
||||
ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
|
||||
}
|
||||
public:
|
||||
bool operator==(const Derived &rhs) const {
|
||||
return Base::equals(static_cast<const Base &>(rhs));
|
||||
}
|
||||
Derived(int i = 0) :
|
||||
Base(i)
|
||||
{}
|
||||
};
|
||||
|
||||
int
|
||||
main( int /* argc */, char* /* argv */[] )
|
||||
{
|
||||
const char * testfile = boost::archive::tmpnam(NULL);
|
||||
|
||||
// serialize Derived and Base
|
||||
Derived a(1), a1(2);
|
||||
{
|
||||
test_ostream os(testfile);
|
||||
test_oarchive oa(os);
|
||||
oa << boost::serialization::make_nvp("a", a);
|
||||
}
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("a", a1);
|
||||
}
|
||||
std::remove(testfile);
|
||||
|
||||
if(a != a1)
|
||||
return 1;
|
||||
|
||||
// serialize Derived and Base
|
||||
Derived *ta = &a;
|
||||
Derived *ta1 = NULL;
|
||||
{
|
||||
test_ostream os(testfile);
|
||||
test_oarchive oa(os);
|
||||
oa << boost::serialization::make_nvp("ta", ta);
|
||||
}
|
||||
{
|
||||
test_istream is(testfile, TEST_STREAM_FLAGS);
|
||||
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
|
||||
ia >> boost::serialization::make_nvp("ta", ta1);
|
||||
}
|
||||
std::remove(testfile);
|
||||
if(*ta != *ta1)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
</code></pre>
|
||||
Difficulties start to occur when the base class is made polymorphic by the designation
|
||||
of one or more functions as "virtual". If a class is polymorphic, the library
|
||||
presumes that one will want the ability to serialize a derived class through
|
||||
a pointer to the base class. Included in the macro
|
||||
<code>
|
||||
BOOST_SERIALIZATION_BASE_OBJECT_NVP
|
||||
</code>
|
||||
is code which links derived and base class definitions in tables used to serialize
|
||||
derived classes through pointers to a polymorphinc base class. This code requires
|
||||
the ability to invoke
|
||||
<code>
|
||||
static_cast<Base &>(Derived &)
|
||||
</code>
|
||||
which C++ will only permit from within the derived class if the base class is
|
||||
private or protected. The program will fail to compile with an error message
|
||||
indicating invalid cast.
|
||||
<p>
|
||||
In order for this
|
||||
code compiler the following alteration must be made:
|
||||
<pre><code>
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar, const unsigned int version){
|
||||
//ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(Base);
|
||||
ar & boost::serialization::make_nvp(
|
||||
"Base",
|
||||
static_cast<Base &>(*this)
|
||||
);
|
||||
}
|
||||
</code></pre>
|
||||
With this change the program will now compile.
|
||||
<p>
|
||||
If we made one of the functions of <code>Base></code> <code>virtual</code>
|
||||
in order to use the "export" functionality of the serialization library and permit serialization through
|
||||
a pointer the the base class, we'll be disappointed. Without the ability to
|
||||
cast to the base class, we can't use the functionality.
|
||||
<hr>
|
||||
<p><i>© Copyright <a href="http://www.rrsd.com">Robert Ramey</a> 2015.
|
||||
Distributed under 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)
|
||||
</i></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -792,7 +792,7 @@ class derived : public base {
|
||||
ar & boost::serialization::base_object<base>(*this);
|
||||
// method 2 : explicitly register base/derived relationship
|
||||
boost::serialization::void_cast_register<derived, base>(
|
||||
static_cast<derived *>=NULL),
|
||||
static_cast<derived *>(NULL),
|
||||
static_cast<base *>(NULL)
|
||||
)
|
||||
}
|
||||
|
||||
+24
-39
@@ -11,47 +11,32 @@ project libs/serialization/example
|
||||
: requirements <library>../build//boost_serialization
|
||||
;
|
||||
|
||||
rule demo_bsl_run ( demo-name : othersources * : requirements * )
|
||||
{
|
||||
return [ run
|
||||
# sources
|
||||
$(demo-name).cpp
|
||||
$(othersources).cpp
|
||||
: # command
|
||||
: # input files
|
||||
: # requirements
|
||||
# toolset suppress-warnings
|
||||
<toolset>gcc:<cxxflags>"-Wno-non-virtual-dtor -Wno-ctor-dtor-privacy"
|
||||
<toolset>msvc-8.0:<cxxflags>"-wd4996"
|
||||
<toolset>borland:<cxxflags>"-w-8080 -w-8071 -w-8057 -w-8062 -w-8008 -w-0018 -w-8066"
|
||||
# toolset optimizations
|
||||
<toolset>gcc:<cxxflags>"-ftemplate-depth-255"
|
||||
<toolset>msvc:<cxxflags>"-Gy"
|
||||
# toolset shared library support
|
||||
<toolset>como,<runtime-link>shared:<build>no
|
||||
<toolset>msvc,<stdlib>stlport,<runtime-link>shared:<build>no
|
||||
<toolset>cw,<runtime-link>static:<build>no
|
||||
$(requirements)
|
||||
: # test name
|
||||
$(demo-name)
|
||||
]
|
||||
;
|
||||
}
|
||||
import ../util/test :
|
||||
run-template
|
||||
run-invoke
|
||||
run-winvoke
|
||||
test-bsl-run-no-lib
|
||||
test-bsl-run
|
||||
test-bsl-run_archive
|
||||
test-bsl-run_files
|
||||
test-bsl-run_polymorphic_archive
|
||||
;
|
||||
|
||||
test-suite "demo-suite" :
|
||||
# demos
|
||||
[ demo_bsl_run demo ]
|
||||
[ demo_bsl_run demo_auto_ptr ]
|
||||
[ demo_bsl_run demo_exception ]
|
||||
[ demo_bsl_run demo_log : log_archive ]
|
||||
[ demo_bsl_run demo_pimpl : demo_pimpl_A ]
|
||||
[ demo_bsl_run demo_polymorphic : demo_polymorphic_A ]
|
||||
[ demo_bsl_run demo_portable_archive : portable_binary_iarchive portable_binary_oarchive ]
|
||||
[ demo_bsl_run demo_shared_ptr ]
|
||||
[ demo_bsl_run demo_simple_log ]
|
||||
[ demo_bsl_run demo_trivial_archive ]
|
||||
[ demo_bsl_run demo_xml ]
|
||||
[ demo_bsl_run demo_xml_save ]
|
||||
[ demo_bsl_run demo_xml_load : : <dependency>demo_xml_save ]
|
||||
[ test-bsl-run demo ]
|
||||
[ test-bsl-run demo_auto_ptr ]
|
||||
[ test-bsl-run demo_exception ]
|
||||
[ test-bsl-run demo_fast_archive ]
|
||||
[ test-bsl-run demo_log : log_archive ]
|
||||
[ test-bsl-run demo_pimpl : demo_pimpl_A ]
|
||||
[ test-bsl-run demo_polymorphic : demo_polymorphic_A ]
|
||||
[ test-bsl-run demo_portable_archive : portable_binary_iarchive portable_binary_oarchive ]
|
||||
[ test-bsl-run demo_shared_ptr ]
|
||||
[ test-bsl-run demo_simple_log ]
|
||||
[ test-bsl-run demo_trivial_archive ]
|
||||
[ test-bsl-run demo_xml ]
|
||||
[ test-bsl-run demo_xml_save ]
|
||||
[ test-bsl-run demo_xml_load : : : <dependency>demo_xml_save ]
|
||||
;
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_array.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
|
||||
#define BOOST_ARCHIVE_SOURCE
|
||||
#include <boost/archive/binary_oarchive_impl.hpp>
|
||||
@@ -61,26 +60,26 @@ public:
|
||||
// binary_oarchive_impl<derived_t>::load_override;
|
||||
// so we use the sure-fire method below. This failed to work as well
|
||||
template<class T>
|
||||
void save_override(T & t, BOOST_PFTO int){
|
||||
base_t::save_override(t, 0);
|
||||
void save_override(T & t){
|
||||
base_t::save_override(t);
|
||||
// verify that this program is in fact working by making sure
|
||||
// that arrays are getting passed here
|
||||
BOOST_STATIC_ASSERT(! (boost::is_array<T>::value) );
|
||||
}
|
||||
template<int N>
|
||||
void save_override(const int (& t)[N] , int){
|
||||
void save_override(const int (& t)[N]){
|
||||
save_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void save_override(const unsigned int (& t)[N], int){
|
||||
void save_override(const unsigned int (& t)[N]){
|
||||
save_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void save_override(const long (& t)[N], int){
|
||||
void save_override(const long (& t)[N]){
|
||||
save_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void save_override(const unsigned long (& t)[N], int){
|
||||
void save_override(const unsigned long (& t)[N]){
|
||||
save_binary(t, sizeof(t));
|
||||
}
|
||||
public:
|
||||
@@ -129,24 +128,24 @@ public:
|
||||
// binary_oarchive_impl<derived_t>::load_override;
|
||||
// so we use the sure-fire method below. This failed to work as well
|
||||
template<class T>
|
||||
void load_override(T & t, BOOST_PFTO int){
|
||||
base_t::load_override(t, 0);
|
||||
void load_override(T & t){
|
||||
base_t::load_override(t);
|
||||
BOOST_STATIC_ASSERT(! (boost::is_array<T>::value) );
|
||||
}
|
||||
template<int N>
|
||||
void load_override(int (& t)[N], int){
|
||||
void load_override(int (& t)[N]){
|
||||
load_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void load_override(unsigned int (& t)[N], int){
|
||||
void load_override(unsigned int (& t)[N]){
|
||||
load_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void load_override(long (& t)[N], int){
|
||||
void load_override(long (& t)[N]){
|
||||
load_binary(t, sizeof(t));
|
||||
}
|
||||
template<int N>
|
||||
void load_override(unsigned long (& t)[N], int){
|
||||
void load_override(unsigned long (& t)[N]){
|
||||
load_binary(t, sizeof(t));
|
||||
}
|
||||
public:
|
||||
|
||||
@@ -13,8 +13,7 @@
|
||||
#include "demo_gps.hpp"
|
||||
#include "log_archive.hpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int main(int argc, char *argv[]){
|
||||
// make the schedule
|
||||
bus_schedule schedule;
|
||||
|
||||
@@ -65,7 +64,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
// display the complete schedule
|
||||
log_archive oa(std::cout);
|
||||
//oa << BOOST_SERIALIZATION_NVP(schedule);
|
||||
oa << BOOST_SERIALIZATION_NVP(schedule);
|
||||
oa << schedule;
|
||||
|
||||
delete bs0;
|
||||
@@ -74,3 +73,4 @@ int main(int argc, char *argv[])
|
||||
delete bs3;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+19
-21
@@ -19,11 +19,12 @@
|
||||
#include <boost/archive/xml_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // boost
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// log data to an output stream. This illustrates a simpler implemenation
|
||||
@@ -43,34 +44,31 @@ class log_archive :
|
||||
// Override functions defined in basic_xml_oarchive
|
||||
|
||||
// Anything not an attribute and not a name-value pair is an
|
||||
// error and should be trapped here. Note the usage of
|
||||
// function argument matching (BOOST_PFTO) to permit usage
|
||||
// with compilers which fail to properly support
|
||||
// function template ordering
|
||||
// error and should be trapped here.
|
||||
template<class T>
|
||||
void save_override(T & t, BOOST_PFTO int){
|
||||
void save_override(T & t){
|
||||
// make it a name-value pair and pass it on.
|
||||
// this permits this to be used even with data types which
|
||||
// are not wrapped with the name
|
||||
base::save_override(boost::serialization::make_nvp(NULL, t), 0);
|
||||
base::save_override(boost::serialization::make_nvp(NULL, t));
|
||||
}
|
||||
template<class T>
|
||||
void save_override(const boost::serialization::nvp< T > & t, int){
|
||||
void save_override(const boost::serialization::nvp< T > & t){
|
||||
// this is here to remove the "const" requirement. Since
|
||||
// this class is to be used only for output, it's not required.
|
||||
base::save_override(t, 0);
|
||||
base::save_override(t);
|
||||
}
|
||||
// specific overrides for attributes - not name value pairs so we
|
||||
// want to trap them before the above "fall through"
|
||||
// since we don't want to see these in the output - make them no-ops.
|
||||
void save_override(const boost::archive::object_id_type & t, int){}
|
||||
void save_override(const boost::archive::object_reference_type & t, int){}
|
||||
void save_override(const boost::archive::version_type & t, int){}
|
||||
void save_override(const boost::archive::class_id_type & t, int){}
|
||||
void save_override(const boost::archive::class_id_optional_type & t, int){}
|
||||
void save_override(const boost::archive::class_id_reference_type & t, int){}
|
||||
void save_override(const boost::archive::class_name_type & t, int){}
|
||||
void save_override(const boost::archive::tracking_type & t, int){}
|
||||
void save_override(const boost::archive::object_id_type & t){}
|
||||
void save_override(const boost::archive::object_reference_type & t){}
|
||||
void save_override(const boost::archive::version_type & t){}
|
||||
void save_override(const boost::archive::class_id_type & t){}
|
||||
void save_override(const boost::archive::class_id_optional_type & t){}
|
||||
void save_override(const boost::archive::class_id_reference_type & t){}
|
||||
void save_override(const boost::archive::class_name_type & t){}
|
||||
void save_override(const boost::archive::tracking_type & t){}
|
||||
public:
|
||||
log_archive(std::ostream & os, unsigned int flags = 0) :
|
||||
boost::archive::xml_oarchive_impl<log_archive>(
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/serialization/pfto.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <climits>
|
||||
|
||||
@@ -47,7 +47,7 @@ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
|
||||
#else
|
||||
if(m_flags & endian_big)
|
||||
#endif
|
||||
reverse_bytes(size, cptr);
|
||||
reverse_bytes(size, cptr);
|
||||
|
||||
if(negative)
|
||||
l = -l;
|
||||
@@ -55,11 +55,11 @@ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
|
||||
|
||||
void
|
||||
portable_binary_iarchive::load_override(
|
||||
boost::archive::class_name_type & t, int
|
||||
boost::archive::class_name_type & t
|
||||
){
|
||||
std::string cn;
|
||||
cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
|
||||
load_override(cn, 0);
|
||||
load_override(cn);
|
||||
if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
|
||||
boost::serialization::throw_exception(
|
||||
boost::archive::archive_exception(
|
||||
|
||||
@@ -148,21 +148,15 @@ protected:
|
||||
void load(unsigned char & t){
|
||||
this->primitive_base_t::load(t);
|
||||
}
|
||||
// intermediate level to support override of operators
|
||||
// fot templates in the absence of partial function
|
||||
// template ordering
|
||||
typedef boost::archive::detail::common_iarchive<portable_binary_iarchive>
|
||||
detail_common_iarchive;
|
||||
template<class T>
|
||||
void load_override(T & t, BOOST_PFTO int){
|
||||
this->detail_common_iarchive::load_override(t, 0);
|
||||
void load_override(T & t){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
void load_override(boost::archive::class_name_type & t, int);
|
||||
void load_override(boost::archive::class_name_type & t);
|
||||
// binary files don't include the optional information
|
||||
void load_override(
|
||||
boost::archive::class_id_optional_type & /* t */,
|
||||
int
|
||||
){}
|
||||
void load_override(boost::archive::class_id_optional_type &){}
|
||||
|
||||
void init(unsigned int flags);
|
||||
public:
|
||||
|
||||
@@ -131,18 +131,17 @@ protected:
|
||||
typedef boost::archive::detail::common_oarchive<portable_binary_oarchive>
|
||||
detail_common_oarchive;
|
||||
template<class T>
|
||||
void save_override(T & t, BOOST_PFTO int){
|
||||
this->detail_common_oarchive::save_override(t, 0);
|
||||
void save_override(T & t){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
// explicitly convert to char * to avoid compile ambiguities
|
||||
void save_override(const boost::archive::class_name_type & t, int){
|
||||
void save_override(const boost::archive::class_name_type & t){
|
||||
const std::string s(t);
|
||||
* this << s;
|
||||
}
|
||||
// binary files don't include the optional information
|
||||
void save_override(
|
||||
const boost::archive::class_id_optional_type & /* t */,
|
||||
int
|
||||
const boost::archive::class_id_optional_type & /* t */
|
||||
){}
|
||||
|
||||
void init(unsigned int flags);
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#ifndef BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
#define BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// add_facet.hpp
|
||||
|
||||
// (C) Copyright 2003 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)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <locale>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
// does STLport uses native STL for locales?
|
||||
#if (defined(__SGI_STL_PORT)&& defined(_STLP_NO_OWN_IOSTREAMS))
|
||||
// and this native STL lib is old Dinkumware (has not defined _CPPLIB_VER)
|
||||
# if (defined(_YVALS) && !defined(__IBMCPP__)) || !defined(_CPPLIB_VER)
|
||||
# define BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Facet>
|
||||
inline std::locale *
|
||||
add_facet(const std::locale &l, Facet * f){
|
||||
return
|
||||
#if defined BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
// std namespace used for native locale
|
||||
new std::locale(std::_Addfac(l, f));
|
||||
#elif BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1) // old Dinkumwar
|
||||
// std namespace used for native locale
|
||||
new std::locale(std::_Addfac(l, f));
|
||||
#else
|
||||
// standard compatible
|
||||
new std::locale(l, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#undef BOOST_ARCHIVE_OLD_DINKUMWARE_BENEATH_STLPORT
|
||||
|
||||
#endif // BOOST_ARCHIVE_ADD_FACET_HPP
|
||||
@@ -87,6 +87,7 @@ public:
|
||||
const char * e1 = NULL,
|
||||
const char * e2 = NULL
|
||||
) BOOST_NOEXCEPT;
|
||||
BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT ;
|
||||
virtual BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
virtual BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
};
|
||||
|
||||
@@ -44,16 +44,16 @@ namespace std{
|
||||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
@@ -61,9 +61,6 @@ namespace std{
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// class binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive, class Elem, class Tr>
|
||||
@@ -81,9 +78,16 @@ public:
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
|
||||
// main template for serilization of primitive types
|
||||
@@ -139,7 +143,7 @@ public:
|
||||
|
||||
// the optimized load_array dispatches to load_binary
|
||||
template <class ValueType>
|
||||
void load_array(serialization::array<ValueType>& a, unsigned int)
|
||||
void load_array(serialization::array_wrapper<ValueType>& a, unsigned int)
|
||||
{
|
||||
load_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
|
||||
@@ -43,20 +43,19 @@ namespace std{
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/array.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oprimitive - binary output of prmitives
|
||||
|
||||
@@ -74,9 +73,16 @@ public:
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<codecvt_null<Elem> > codecvt_facet;
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
// default saving of primitives.
|
||||
template<class T>
|
||||
@@ -131,11 +137,10 @@ public:
|
||||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
// the optimized save_array dispatches to save_binary
|
||||
template <class ValueType>
|
||||
void save_array(boost::serialization::array<ValueType> const& a, unsigned int)
|
||||
void save_array(boost::serialization::array_wrapper<ValueType> const& a, unsigned int)
|
||||
{
|
||||
save_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
@@ -149,9 +154,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
//BOOST_ASSERT(
|
||||
// static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)()) >= count
|
||||
//);
|
||||
// BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
// note: if the following assertions fail
|
||||
// a likely cause is that the output stream is set to "text"
|
||||
// mode where by cr characters recieve special treatment.
|
||||
@@ -161,9 +164,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
// archive_exception(archive_exception::output_stream_error)
|
||||
// );
|
||||
// figure number of elements to output - round up
|
||||
count = ( count + sizeof(Elem) - 1)
|
||||
/ sizeof(Elem);
|
||||
BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
count = ( count + sizeof(Elem) - 1) / sizeof(Elem);
|
||||
std::streamsize scount = m_sb.sputn(
|
||||
static_cast<const Elem *>(address),
|
||||
static_cast<std::streamsize>(count)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
|
||||
#include <locale> // for std::locale
|
||||
#include <ios>
|
||||
#include <streambuf> // for std::basic_streambuf
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -45,25 +46,57 @@ class basic_streambuf_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
typedef ::std::basic_streambuf<Ch, Tr> state_type;
|
||||
typedef ::std::locale aspect_type;
|
||||
explicit basic_streambuf_locale_saver( state_type &s )
|
||||
: s_save_( s ), a_save_( s.getloc() )
|
||||
{}
|
||||
explicit basic_streambuf_locale_saver( state_type &s, aspect_type const &a )
|
||||
: s_save_( s ), a_save_( s.pubimbue(a) )
|
||||
{}
|
||||
~basic_streambuf_locale_saver()
|
||||
{ this->restore(); }
|
||||
void restore(){
|
||||
s_save_.pubsync();
|
||||
s_save_.pubimbue( a_save_ );
|
||||
explicit basic_streambuf_locale_saver(std::basic_streambuf<Ch, Tr> &s) :
|
||||
m_streambuf(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_streambuf_locale_saver(){
|
||||
m_streambuf.pubsync();
|
||||
m_streambuf.pubimbue(m_locale);
|
||||
}
|
||||
private:
|
||||
state_type & s_save_;
|
||||
aspect_type const a_save_;
|
||||
std::basic_streambuf<Ch, Tr> & m_streambuf;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_istream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_istream_locale_saver(std::basic_istream<Ch, Tr> &s) :
|
||||
m_istream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_istream_locale_saver(){
|
||||
// libstdc++ crashes without this
|
||||
m_istream.sync();
|
||||
m_istream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_istream<Ch, Tr> & m_istream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ostream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_ostream_locale_saver(std::basic_ostream<Ch, Tr> &s) :
|
||||
m_ostream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_ostream_locale_saver(){
|
||||
m_ostream.flush();
|
||||
m_ostream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_ostream<Ch, Tr> & m_ostream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
|
||||
} // archive
|
||||
} // boost
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
@@ -38,17 +37,15 @@ namespace std{
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
@@ -71,9 +68,17 @@ protected:
|
||||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename IStream::char_type,
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename IStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_istream_locale_saver<
|
||||
typename IStream::char_type,
|
||||
typename IStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
@@ -26,14 +26,13 @@
|
||||
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
@@ -52,10 +51,10 @@ namespace std{
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
@@ -72,9 +71,17 @@ protected:
|
||||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
boost::scoped_ptr<std::locale> archive_locale;
|
||||
basic_streambuf_locale_saver<
|
||||
typename OStream::char_type,
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename OStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_ostream_locale_saver<
|
||||
typename OStream::char_type,
|
||||
typename OStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
@@ -168,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);
|
||||
}
|
||||
|
||||
@@ -17,15 +17,12 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
@@ -41,24 +38,18 @@ namespace detail {
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class xml_iarchive - read serialized objects from a input text stream
|
||||
// class basic_xml_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_xml_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
unsigned int depth;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
unsigned int depth;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_start(const char *name);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
@@ -96,14 +87,15 @@ protected:
|
||||
// an xml archive. So we can skip it here. Note: we MUST override
|
||||
// it otherwise it will be loaded as a normal primitive w/o tag and
|
||||
// leaving the archive in an undetermined state
|
||||
void load_override(class_id_optional_type & /* t */){}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_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
|
||||
load_override(version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(tracking_type & t);
|
||||
// class_name_type can't be handled here as it depends upon the
|
||||
// char type used by the stream. So require the derived implementation
|
||||
|
||||
@@ -18,15 +18,11 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
@@ -47,28 +43,23 @@ template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool pending_preamble;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#endif
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
friend class save_access;
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool indent_next;
|
||||
bool pending_preamble;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
indent();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
windup();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
write_attribute(
|
||||
const char *attribute_name,
|
||||
int t,
|
||||
@@ -113,18 +104,18 @@ protected:
|
||||
// specific overrides for attributes - not name value pairs so we
|
||||
// want to trap them before the above "fall through"
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_optional_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_name_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const tracking_type & t);
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace detail {
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_iarchive_impl :
|
||||
class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
|
||||
public basic_binary_iprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_iarchive<Archive>
|
||||
{
|
||||
@@ -58,8 +58,9 @@ protected:
|
||||
this->basic_binary_iarchive<Archive>::load_override(t);
|
||||
}
|
||||
void init(unsigned int flags){
|
||||
if(0 != (flags & no_header))
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_iarchive<Archive>::init();
|
||||
this->basic_binary_iprimitive<Archive, Elem, Tr>::init();
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace detail {
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class binary_oarchive_impl :
|
||||
class BOOST_SYMBOL_VISIBLE binary_oarchive_impl :
|
||||
public basic_binary_oprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_oarchive<Archive>
|
||||
{
|
||||
@@ -59,8 +59,9 @@ protected:
|
||||
this->basic_binary_oarchive<Archive>::save_override(t);
|
||||
}
|
||||
void init(unsigned int flags) {
|
||||
if(0 != (flags & no_header))
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_oarchive<Archive>::init();
|
||||
this->basic_binary_oprimitive<Archive, Elem, Tr>::init();
|
||||
|
||||
@@ -56,10 +56,11 @@ public:
|
||||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
virtual ~codecvt_null(){};
|
||||
};
|
||||
|
||||
template<>
|
||||
class 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 BOOST_WARCHIVE_DECL std::codecvt_base::result
|
||||
do_out(
|
||||
@@ -91,6 +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(){};
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
|
||||
@@ -65,11 +65,7 @@ protected:
|
||||
public:
|
||||
// some msvc versions require that the following function be public
|
||||
// otherwise it should really protected.
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_iarchive();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iarchive();
|
||||
// note: NOT part of the public API.
|
||||
BOOST_ARCHIVE_DECL void next_object_pointer(void *t);
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
|
||||
@@ -51,11 +51,7 @@ protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_iserializer(
|
||||
const boost::serialization::extended_type_info & type
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_iserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpis != NULL;
|
||||
|
||||
@@ -61,14 +61,8 @@ class BOOST_SYMBOL_VISIBLE basic_oarchive :
|
||||
protected:
|
||||
BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0);
|
||||
BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection &
|
||||
get_helper_collection(){
|
||||
return *this;
|
||||
}
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_oarchive();
|
||||
get_helper_collection();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oarchive();
|
||||
public:
|
||||
// note: NOT part of the public interface
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
|
||||
@@ -52,11 +52,7 @@ protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_oserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpos != NULL;
|
||||
|
||||
@@ -46,11 +46,7 @@ protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_pointer_iserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer();
|
||||
public:
|
||||
virtual void * heap_allocation() const = 0;
|
||||
virtual const basic_iserializer & get_basic_serializer() const = 0;
|
||||
|
||||
@@ -47,11 +47,7 @@ protected:
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
public:
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL ~basic_pointer_oserializer();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer();
|
||||
virtual const basic_oserializer & get_basic_serializer() const = 0;
|
||||
virtual void save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
|
||||
@@ -41,9 +41,7 @@ protected:
|
||||
const boost::serialization::extended_type_info & eti
|
||||
) :
|
||||
m_eti(& eti)
|
||||
{
|
||||
BOOST_ASSERT(NULL != & eti);
|
||||
}
|
||||
{}
|
||||
public:
|
||||
inline bool
|
||||
operator<(const basic_serializer & rhs) const {
|
||||
|
||||
@@ -35,7 +35,7 @@ class extended_type_info;
|
||||
|
||||
// note: referred to as Curiously Recurring Template Patter (CRTP)
|
||||
template<class Archive>
|
||||
class common_iarchive :
|
||||
class BOOST_SYMBOL_VISIBLE common_iarchive :
|
||||
public basic_iarchive,
|
||||
public interface_iarchive<Archive>
|
||||
{
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace detail {
|
||||
|
||||
// note: referred to as Curiously Recurring Template Patter (CRTP)
|
||||
template<class Archive>
|
||||
class common_oarchive :
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE common_oarchive :
|
||||
public basic_oarchive,
|
||||
public interface_oarchive<Archive>
|
||||
{
|
||||
|
||||
@@ -29,14 +29,12 @@
|
||||
#else
|
||||
#define BOOST_ARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_WARCHIVE_SOURCE)
|
||||
#define BOOST_WARCHIVE_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
#define BOOST_WARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
#if !defined(BOOST_WARCHIVE_SOURCE) && !defined(BOOST_ARCHIVE_SOURCE)
|
||||
#define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_WARCHIVE_SOURCE) || defined(BOOST_ARCHIVE_SOURCE)
|
||||
#define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_EXPORT
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class BOOST_ARCHIVE_OR_WARCHIVE_DECL basic_pointer_oserializer;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
template<class Archive>
|
||||
class interface_oarchive
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
template<class T>
|
||||
Archive & operator&(const T & t){
|
||||
return * this ->This() << t;
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -39,7 +39,6 @@ namespace std{
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/greater_equal.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
@@ -57,10 +56,16 @@ namespace std{
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#define DONT_USE_HAS_NEW_OPERATOR ( \
|
||||
BOOST_WORKAROUND(__IBMCPP__, < 1210) \
|
||||
|| defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \
|
||||
)
|
||||
|
||||
#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
|
||||
|
||||
#if ! DONT_USE_HAS_NEW_OPERATOR
|
||||
#include <boost/type_traits/has_new_operator.hpp>
|
||||
#endif
|
||||
@@ -223,17 +228,13 @@ struct heap_allocation {
|
||||
static void invoke_delete(T * t) {
|
||||
// if compilation fails here, the likely cause that the class
|
||||
// T has a class specific new operator but no class specific
|
||||
// delete operator which matches the following signature. Fix
|
||||
// your program to have this. Note that adding operator delete
|
||||
// with only one parameter doesn't seem correct to me since
|
||||
// the standard(3.7.4.2) says "
|
||||
// "If a class T has a member deallocation function named
|
||||
// 'operator delete' with exactly one parameter, then that function
|
||||
// is a usual (non-placement) deallocation function" which I take
|
||||
// to mean that it will call the destructor of type T which we don't
|
||||
// want to do here.
|
||||
// Note: reliance upon automatic conversion from T * to void * here
|
||||
(T::operator delete)(t, sizeof(T));
|
||||
// delete operator which matches the following signature.
|
||||
// note that this solution addresses the issue that two
|
||||
// possible signatures. But it doesn't address the possibility
|
||||
// that the class might have class specific new with NO
|
||||
// class specific delete at all. Patches (compatible with
|
||||
// C++03) welcome!
|
||||
delete t;
|
||||
}
|
||||
};
|
||||
struct doesnt_have_new_operator {
|
||||
@@ -242,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() {
|
||||
@@ -587,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
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/greater_equal.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
#include <boost/serialization/extended_type_info_typeid.hpp>
|
||||
@@ -500,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
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace serialization {
|
||||
namespace archive {
|
||||
namespace detail{
|
||||
|
||||
class BOOST_ARCHIVE_DECL basic_iserializer;
|
||||
class BOOST_ARCHIVE_DECL basic_pointer_iserializer;
|
||||
class basic_iserializer;
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
|
||||
@@ -39,8 +39,8 @@ namespace serialization {
|
||||
namespace archive {
|
||||
namespace detail{
|
||||
|
||||
class BOOST_ARCHIVE_DECL basic_oserializer;
|
||||
class BOOST_ARCHIVE_DECL basic_pointer_oserializer;
|
||||
class basic_oserializer;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
|
||||
@@ -7,10 +7,17 @@
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// std::codecvt_utf8 doesn't seem to work for msvc
|
||||
// versions prior to MSVC 14.0
|
||||
|
||||
#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
|
||||
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
|
||||
#define BOOST_UTF8_END_NAMESPACE }}}
|
||||
|
||||
#include <boost/detail/utf8_codecvt_facet.hpp>
|
||||
@@ -18,6 +25,10 @@
|
||||
#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
|
||||
|
||||
|
||||
@@ -20,14 +20,9 @@ namespace std{
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp> // fixup for RogueWave
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/basic_binary_iprimitive.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -152,16 +147,13 @@ basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
locale_saver(m_sb)
|
||||
codecvt_null_facet(1),
|
||||
locale_saver(m_sb),
|
||||
archive_locale(sb.getloc(), & codecvt_null_facet)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new codecvt_null<Elem>
|
||||
)
|
||||
);
|
||||
//m_sb.pubimbue(* archive_locale);
|
||||
m_sb.pubsync();
|
||||
m_sb.pubimbue(archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -169,42 +161,11 @@ basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
|
||||
{}
|
||||
#endif
|
||||
|
||||
// some libraries including stl and libcomo fail if the
|
||||
// buffer isn't flushed before the code_cvt facet is changed.
|
||||
// I think this is a bug. We explicity invoke sync to when
|
||||
// we're done with the streambuf to work around this problem.
|
||||
// Note that sync is a protected member of stream buff so we
|
||||
// have to invoke it through a contrived derived class.
|
||||
namespace detail {
|
||||
// note: use "using" to get past msvc bug
|
||||
using namespace std;
|
||||
template<class Elem, class Tr>
|
||||
class input_streambuf_access : public std::basic_streambuf<Elem, Tr> {
|
||||
public:
|
||||
virtual int sync(){
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
|
||||
return this->basic_streambuf::sync();
|
||||
#else
|
||||
return this->basic_streambuf<Elem, Tr>::sync();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
} // detail
|
||||
|
||||
// scoped_ptr requires that archive_locale be a complete type at time of
|
||||
// scoped_ptr requires that g be a complete type at time of
|
||||
// destruction so define destructor here rather than in the header
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){
|
||||
// push back unread characters
|
||||
//destructor can't throw !
|
||||
BOOST_TRY{
|
||||
static_cast<detail::input_streambuf_access<Elem, Tr> &>(m_sb).sync();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -27,10 +27,6 @@ namespace std{ using ::wcslen; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/basic_binary_oprimitive.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
@@ -104,16 +100,13 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
locale_saver(m_sb)
|
||||
codecvt_null_facet(1),
|
||||
locale_saver(m_sb),
|
||||
archive_locale(sb.getloc(), & codecvt_null_facet)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new codecvt_null<Elem>
|
||||
)
|
||||
);
|
||||
//m_sb.pubimbue(* archive_locale);
|
||||
m_sb.pubsync();
|
||||
m_sb.pubimbue(archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -121,42 +114,11 @@ basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
|
||||
{}
|
||||
#endif
|
||||
|
||||
// some libraries including stl and libcomo fail if the
|
||||
// buffer isn't flushed before the code_cvt facet is changed.
|
||||
// I think this is a bug. We explicity invoke sync to when
|
||||
// we're done with the streambuf to work around this problem.
|
||||
// Note that sync is a protected member of stream buff so we
|
||||
// have to invoke it through a contrived derived class.
|
||||
namespace detail {
|
||||
// note: use "using" to get past msvc bug
|
||||
using namespace std;
|
||||
template<class Elem, class Tr>
|
||||
class output_streambuf_access : public std::basic_streambuf<Elem, Tr> {
|
||||
public:
|
||||
virtual int sync(){
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3206))
|
||||
return this->basic_streambuf::sync();
|
||||
#else
|
||||
return this->basic_streambuf<Elem, Tr>::sync();
|
||||
#endif
|
||||
}
|
||||
};
|
||||
} // detail
|
||||
|
||||
// scoped_ptr requires that g be a complete type at time of
|
||||
// destruction so define destructor here rather than in the header
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){
|
||||
// flush buffer
|
||||
//destructor can't throw
|
||||
BOOST_TRY{
|
||||
static_cast<detail::output_streambuf_access<Elem, Tr> &>(m_sb).sync();
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#include <cstddef> // NULL
|
||||
#include <cstddef> // size_t, NULL
|
||||
#include <limits> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
@@ -21,8 +21,6 @@ namespace std{
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
|
||||
#include <boost/archive/iterators/remove_whitespace.hpp>
|
||||
#include <boost/archive/iterators/istream_iterator.hpp>
|
||||
@@ -78,7 +76,7 @@ basic_text_iprimitive<IStream>::load_binary(
|
||||
iterators::remove_whitespace<
|
||||
iterators::istream_iterator<CharType>
|
||||
>
|
||||
,CharType
|
||||
,typename IStream::int_type
|
||||
>
|
||||
,8
|
||||
,6
|
||||
@@ -112,34 +110,27 @@ basic_text_iprimitive<IStream>::basic_text_iprimitive(
|
||||
IStream &is_,
|
||||
bool no_codecvt
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
is(is_),
|
||||
flags_saver(is_),
|
||||
precision_saver(is_),
|
||||
locale_saver(* is_.rdbuf())
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
codecvt_null_facet(1),
|
||||
archive_locale(is.getloc(), & codecvt_null_facet),
|
||||
locale_saver(is)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new boost::archive::codecvt_null<typename IStream::char_type>
|
||||
)
|
||||
);
|
||||
//is.imbue(* archive_locale);
|
||||
is_.sync();
|
||||
is_.imbue(archive_locale);
|
||||
}
|
||||
is >> std::noboolalpha;
|
||||
is_ >> std::noboolalpha;
|
||||
}
|
||||
#else
|
||||
is(is_),
|
||||
flags_saver(is_),
|
||||
precision_saver(is_)
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<class IStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_iprimitive<IStream>::~basic_text_iprimitive(){
|
||||
is.sync();
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
||||
@@ -10,10 +10,15 @@
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <algorithm> // std::copy
|
||||
#include <exception> // std::uncaught_exception
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_text_oprimitive.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
|
||||
#include <boost/archive/iterators/base64_from_binary.hpp>
|
||||
#include <boost/archive/iterators/insert_linebreaks.hpp>
|
||||
@@ -79,33 +84,30 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
|
||||
OStream & os_,
|
||||
bool no_codecvt
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
os(os_),
|
||||
flags_saver(os_),
|
||||
precision_saver(os_),
|
||||
locale_saver(* os_.rdbuf())
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
codecvt_null_facet(1),
|
||||
archive_locale(os.getloc(), & codecvt_null_facet),
|
||||
locale_saver(os)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
std::locale::classic(),
|
||||
new boost::archive::codecvt_null<typename OStream::char_type>
|
||||
)
|
||||
);
|
||||
//os.imbue(* archive_locale);
|
||||
os_.flush();
|
||||
os_.imbue(archive_locale);
|
||||
}
|
||||
os << std::noboolalpha;
|
||||
os_ << std::noboolalpha;
|
||||
}
|
||||
#else
|
||||
os(os_),
|
||||
flags_saver(os_),
|
||||
precision_saver(os_)
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
||||
template<class OStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive<OStream>::~basic_text_oprimitive(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
bool parse_end_tag(IStream & is) const;
|
||||
bool parse_string(IStream & is, StringType & s) /*const*/;
|
||||
void init(IStream & is);
|
||||
void windup(IStream & is);
|
||||
bool windup(IStream & is);
|
||||
basic_xml_grammar();
|
||||
};
|
||||
|
||||
|
||||
@@ -108,7 +108,8 @@ basic_xml_iarchive<Archive>::basic_xml_iarchive(unsigned int flags) :
|
||||
{}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_iarchive<Archive>::~basic_xml_iarchive(){}
|
||||
basic_xml_iarchive<Archive>::~basic_xml_iarchive(){
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -246,26 +246,26 @@ basic_xml_oarchive<Archive>::init(){
|
||||
this->This()->put(">\n");
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::windup(){
|
||||
// xml_trailer
|
||||
this->This()->put("</boost_serialization>\n");
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_oarchive<Archive>::basic_xml_oarchive(unsigned int flags) :
|
||||
detail::common_oarchive<Archive>(flags),
|
||||
depth(0),
|
||||
indent_next(false),
|
||||
pending_preamble(false)
|
||||
pending_preamble(false),
|
||||
indent_next(false)
|
||||
{
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_oarchive<Archive>::~basic_xml_oarchive(){
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
BOOST_TRY{
|
||||
this->This()->put("</boost_serialization>\n");
|
||||
}
|
||||
BOOST_CATCH(...){}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <string>
|
||||
#include <boost/config.hpp>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
@@ -27,7 +26,6 @@ namespace std{ using ::wcslen; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <cstring> // memcpy
|
||||
#include <cstddef> // NULL
|
||||
#include <exception>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
@@ -18,10 +20,11 @@ namespace std{
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cstdlib> // mbtowc
|
||||
#include <cwchar> // mbstate_t and mbrtowc
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::mbtowc;
|
||||
using ::mbstate_t;
|
||||
using ::mbrtowc;
|
||||
} // namespace std
|
||||
#endif
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
@@ -63,22 +66,23 @@ xml_iarchive_impl<Archive>::load(std::wstring &ws){
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != ws.data())
|
||||
#endif
|
||||
ws.resize(0);
|
||||
ws.resize(0);
|
||||
std::mbstate_t mbs = std::mbstate_t();
|
||||
const char * start = s.data();
|
||||
const char * end = start + s.size();
|
||||
while(start < end){
|
||||
wchar_t wc;
|
||||
int resultx = std::mbtowc(&wc, start, end - start);
|
||||
if(0 < resultx){
|
||||
start += resultx;
|
||||
ws += wc;
|
||||
std::size_t count = std::mbrtowc(&wc, start, end - start, &mbs);
|
||||
if(count == static_cast<std::size_t>(-1))
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
if(count == static_cast<std::size_t>(-2))
|
||||
continue;
|
||||
}
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
start += count;
|
||||
ws += wc;
|
||||
}
|
||||
}
|
||||
#endif // BOOST_NO_STD_WSTRING
|
||||
@@ -91,24 +95,28 @@ xml_iarchive_impl<Archive>::load(wchar_t * ws){
|
||||
bool result = gimpl->parse_string(is, s);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
xml_archive_exception(
|
||||
xml_archive_exception::xml_archive_parsing_error
|
||||
)
|
||||
);
|
||||
|
||||
std::mbstate_t mbs = std::mbstate_t();
|
||||
const char * start = s.data();
|
||||
const char * end = start + s.size();
|
||||
while(start < end){
|
||||
wchar_t wc;
|
||||
int length = std::mbtowc(&wc, start, end - start);
|
||||
if(0 < length){
|
||||
start += length;
|
||||
*ws++ = wc;
|
||||
std::size_t length = std::mbrtowc(&wc, start, end - start, &mbs);
|
||||
if(static_cast<std::size_t>(-1) == length)
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
if(static_cast<std::size_t>(-2) == length)
|
||||
continue;
|
||||
}
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
|
||||
start += length;
|
||||
*ws++ = wc;
|
||||
}
|
||||
*ws = L'\0';
|
||||
}
|
||||
@@ -181,12 +189,10 @@ xml_iarchive_impl<Archive>::xml_iarchive_impl(
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_iarchive_impl<Archive>::~xml_iarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
BOOST_TRY{
|
||||
gimpl->windup(is);
|
||||
}
|
||||
BOOST_CATCH(...){}
|
||||
BOOST_CATCH_END
|
||||
gimpl->windup(is);
|
||||
}
|
||||
}
|
||||
} // namespace archive
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <iomanip>
|
||||
#include <algorithm> // std::copy
|
||||
#include <string>
|
||||
#include <exception>
|
||||
|
||||
#include <cstring> // strlen
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
|
||||
@@ -113,5 +114,29 @@ xml_oarchive_impl<Archive>::xml_oarchive_impl(
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::ostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl<Archive>::~xml_oarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header))
|
||||
this->windup();
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace std{
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm> // std::copy
|
||||
|
||||
#include <exception> // uncaught exception
|
||||
#include <boost/detail/workaround.hpp> // Dinkumware and RogueWave
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
@@ -33,11 +33,11 @@ namespace std{
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/xml_wiarchive.hpp>
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include "basic_xml_grammar.hpp"
|
||||
|
||||
namespace boost {
|
||||
@@ -161,15 +161,13 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
|
||||
gimpl(new xml_wgrammar())
|
||||
{
|
||||
if(0 == (flags & no_codecvt)){
|
||||
// note usage of argument "1" so that the locale isn't
|
||||
// automatically delete the facet
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
is_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
)
|
||||
std::locale l = std::locale(
|
||||
is_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
//is.imbue(* archive_locale);
|
||||
// libstdc++ crashes without this
|
||||
is_.sync();
|
||||
is_.imbue(l);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
init();
|
||||
@@ -178,12 +176,10 @@ xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
BOOST_TRY{
|
||||
gimpl->windup(is);
|
||||
}
|
||||
BOOST_CATCH(...){}
|
||||
BOOST_CATCH_END
|
||||
gimpl->windup(is);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <string>
|
||||
#include <algorithm> // std::copy
|
||||
#include <locale>
|
||||
#include <exception>
|
||||
|
||||
#include <cstring> // strlen
|
||||
#include <cstdlib> // mbtowc
|
||||
@@ -30,6 +31,8 @@ namespace std{
|
||||
#endif
|
||||
|
||||
#include <boost/archive/xml_woarchive.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
@@ -37,8 +40,6 @@ namespace std{
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
#include <boost/archive/add_facet.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
@@ -122,19 +123,13 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
),
|
||||
basic_xml_oarchive<Archive>(flags)
|
||||
{
|
||||
// Standard behavior is that imbue can be called
|
||||
// a) before output is invoked or
|
||||
// b) after flush has been called. This prevents one-to-many
|
||||
// transforms (such as one to many transforms from getting
|
||||
// mixed up.
|
||||
if(0 == (flags & no_codecvt)){
|
||||
archive_locale.reset(
|
||||
add_facet(
|
||||
os_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
)
|
||||
std::locale l = std::locale(
|
||||
os_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
//os.imbue(* archive_locale);
|
||||
os_.flush();
|
||||
os_.imbue(l);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
@@ -143,6 +138,29 @@ xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
save(L"</boost_serialization>\n");
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::wostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/apply.hpp>
|
||||
#include <boost/mpl/plus.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
#ifndef BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// head_iterator.hpp
|
||||
|
||||
// (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)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
template<class Predicate, class Base>
|
||||
class head_iterator
|
||||
: public boost::iterator_adaptor<
|
||||
head_iterator<Predicate, Base>,
|
||||
Base,
|
||||
use_default,
|
||||
single_pass_traversal_tag
|
||||
>
|
||||
{
|
||||
private:
|
||||
friend class iterator_core_access;
|
||||
typedef boost::iterator_adaptor<
|
||||
head_iterator<Predicate, Base>,
|
||||
Base,
|
||||
use_default,
|
||||
single_pass_traversal_tag
|
||||
> super_t;
|
||||
|
||||
typedef head_iterator<Predicate, Base> this_t;
|
||||
typedef super_t::value_type value_type;
|
||||
typedef super_t::reference reference_type;
|
||||
|
||||
reference_type dereference_impl(){
|
||||
if(! m_end){
|
||||
while(! m_predicate(* this->base_reference()))
|
||||
++ this->base_reference();
|
||||
m_end = true;
|
||||
}
|
||||
return * this->base_reference();
|
||||
}
|
||||
|
||||
reference_type dereference() const {
|
||||
return const_cast<this_t *>(this)->dereference_impl();
|
||||
}
|
||||
|
||||
void increment(){
|
||||
++base_reference();
|
||||
}
|
||||
Predicate m_predicate;
|
||||
bool m_end;
|
||||
public:
|
||||
template<class T>
|
||||
head_iterator(Predicate f, T start) :
|
||||
super_t(Base(start)),
|
||||
m_predicate(f),
|
||||
m_end(false)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_HEAD_ITERATOR_HPP
|
||||
@@ -54,21 +54,6 @@ class istream_iterator :
|
||||
return m_istream == rhs.m_istream;
|
||||
}
|
||||
|
||||
/*
|
||||
//Access the value referred to
|
||||
Elem dereference() const {
|
||||
return m_current_value;
|
||||
}
|
||||
|
||||
void increment(){
|
||||
if(NULL != m_istream){
|
||||
m_current_value = static_cast<Elem>(m_istream->get());
|
||||
if(! m_istream->good()){
|
||||
const_cast<this_t *>(this)->m_istream = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//Access the value referred to
|
||||
Elem dereference() const {
|
||||
return m_istream->peek();
|
||||
|
||||
@@ -18,16 +18,15 @@
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // for wctomb()
|
||||
#include <cwchar> // mbstate_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
using ::wctomb;
|
||||
using ::mbstate_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
namespace boost {
|
||||
@@ -66,10 +65,10 @@ class mb_from_wchar
|
||||
}
|
||||
return m_buffer[m_bnext];
|
||||
}
|
||||
|
||||
char dereference() const {
|
||||
return (const_cast<this_t *>(this))->dereference_impl();
|
||||
}
|
||||
|
||||
// test for iterator equality
|
||||
bool equal(const mb_from_wchar<Base> & rhs) const {
|
||||
// once the value is filled, the base_reference has been incremented
|
||||
@@ -83,16 +82,16 @@ class mb_from_wchar
|
||||
|
||||
void fill(){
|
||||
wchar_t value = * this->base_reference();
|
||||
#if (defined(__MINGW32__) && ((__MINGW32_MAJOR_VERSION > 3) \
|
||||
|| ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION >= 8))))
|
||||
m_bend = std::wcrtomb(m_buffer, value,0);
|
||||
#else
|
||||
m_bend = std::wctomb(m_buffer, value);
|
||||
#endif
|
||||
BOOST_ASSERT(-1 != m_bend);
|
||||
BOOST_ASSERT((std::size_t)m_bend <= sizeof(m_buffer));
|
||||
BOOST_ASSERT(m_bend > 0);
|
||||
const wchar_t *wend;
|
||||
char *bend;
|
||||
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;
|
||||
}
|
||||
|
||||
void increment(){
|
||||
@@ -104,10 +103,12 @@ class mb_from_wchar
|
||||
m_full = false;
|
||||
}
|
||||
|
||||
boost::archive::detail::utf8_codecvt_facet m_codecvt_facet;
|
||||
std::mbstate_t m_mbs;
|
||||
// buffer to handle pending characters
|
||||
int m_bend;
|
||||
int m_bnext;
|
||||
char m_buffer[9];
|
||||
char m_buffer[9 /* MB_CUR_MAX */];
|
||||
std::size_t m_bend;
|
||||
std::size_t m_bnext;
|
||||
bool m_full;
|
||||
|
||||
public:
|
||||
@@ -115,6 +116,7 @@ public:
|
||||
template<class T>
|
||||
mb_from_wchar(T start) :
|
||||
super_t(Base(static_cast< T >(start))),
|
||||
m_mbs(std::mbstate_t()),
|
||||
m_bend(0),
|
||||
m_bnext(0),
|
||||
m_full(false)
|
||||
|
||||
@@ -19,20 +19,22 @@
|
||||
#include <boost/assert.hpp>
|
||||
#include <cctype>
|
||||
#include <cstddef> // size_t
|
||||
#include <cstdlib> // mblen
|
||||
#include <cwchar> // mbstate_t
|
||||
#include <algorithm> // copy
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::mblen;
|
||||
using ::mbtowc;
|
||||
using ::mbstate_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
@@ -62,63 +64,125 @@ class wchar_from_mb
|
||||
|
||||
typedef wchar_from_mb<Base> this_t;
|
||||
|
||||
wchar_t drain();
|
||||
|
||||
wchar_t dereference_impl() {
|
||||
if(! m_full){
|
||||
m_current_value = drain();
|
||||
m_full = true;
|
||||
}
|
||||
return m_current_value;
|
||||
}
|
||||
void drain();
|
||||
|
||||
wchar_t dereference() const {
|
||||
return const_cast<this_t *>(this)->dereference_impl();
|
||||
if(m_output.m_next == m_output.m_next_available)
|
||||
return static_cast<wchar_t>(0);
|
||||
return * m_output.m_next;
|
||||
}
|
||||
|
||||
void increment(){
|
||||
dereference_impl();
|
||||
m_full = false;
|
||||
++(this->base_reference());
|
||||
if(m_output.m_next == m_output.m_next_available)
|
||||
return;
|
||||
if(++m_output.m_next == m_output.m_next_available){
|
||||
if(m_input.m_done)
|
||||
return;
|
||||
drain();
|
||||
}
|
||||
}
|
||||
|
||||
bool equal(this_t const & rhs) const {
|
||||
return dereference() == rhs.dereference();
|
||||
}
|
||||
|
||||
boost::archive::detail::utf8_codecvt_facet m_codecvt_facet;
|
||||
std::mbstate_t m_mbs;
|
||||
|
||||
template<typename T>
|
||||
struct sliding_buffer {
|
||||
boost::array<T, 32> m_buffer;
|
||||
typename boost::array<T, 32>::const_iterator m_next_available;
|
||||
typename boost::array<T, 32>::iterator m_next;
|
||||
bool m_done;
|
||||
// default ctor
|
||||
sliding_buffer() :
|
||||
m_next_available(m_buffer.begin()),
|
||||
m_next(m_buffer.begin()),
|
||||
m_done(false)
|
||||
{}
|
||||
// copy ctor
|
||||
sliding_buffer(const sliding_buffer & rhs) :
|
||||
m_next_available(
|
||||
std::copy(
|
||||
rhs.m_buffer.begin(),
|
||||
rhs.m_next_available,
|
||||
m_buffer.begin()
|
||||
)
|
||||
),
|
||||
m_next(
|
||||
m_buffer.begin() + (rhs.m_next - rhs.m_buffer.begin())
|
||||
),
|
||||
m_done(rhs.m_done)
|
||||
{}
|
||||
};
|
||||
|
||||
wchar_t m_current_value;
|
||||
bool m_full;
|
||||
sliding_buffer<typename iterator_value<Base>::type> m_input;
|
||||
sliding_buffer<typename iterator_value<this_t>::type> m_output;
|
||||
|
||||
public:
|
||||
// make composible buy using templated constructor
|
||||
template<class T>
|
||||
wchar_from_mb(T start) :
|
||||
super_t(Base(static_cast< T >(start))),
|
||||
m_full(false)
|
||||
{}
|
||||
// intel 7.1 doesn't like default copy constructor
|
||||
wchar_from_mb(const wchar_from_mb & rhs) :
|
||||
m_mbs(std::mbstate_t())
|
||||
{
|
||||
BOOST_ASSERT(std::mbsinit(&m_mbs));
|
||||
drain();
|
||||
}
|
||||
// default constructor used as an end iterator
|
||||
wchar_from_mb(){}
|
||||
|
||||
// copy ctor
|
||||
wchar_from_mb(const wchar_from_mb & rhs) :
|
||||
super_t(rhs.base_reference()),
|
||||
m_full(rhs.m_full)
|
||||
m_mbs(rhs.m_mbs),
|
||||
m_input(rhs.m_input),
|
||||
m_output(rhs.m_output)
|
||||
{}
|
||||
};
|
||||
|
||||
template<class Base>
|
||||
wchar_t wchar_from_mb<Base>::drain(){
|
||||
char buffer[9];
|
||||
char * bptr = buffer;
|
||||
char val;
|
||||
for(std::size_t i = 0; i++ < (unsigned)MB_CUR_MAX;){
|
||||
val = * this->base_reference();
|
||||
*bptr++ = val;
|
||||
int result = std::mblen(buffer, i);
|
||||
if(-1 != result)
|
||||
void wchar_from_mb<Base>::drain(){
|
||||
BOOST_ASSERT(! m_input.m_done);
|
||||
for(;;){
|
||||
typename boost::iterators::iterator_reference<Base>::type c = *(this->base_reference());
|
||||
// a null character in a multibyte stream is takes as end of string
|
||||
if(0 == c){
|
||||
m_input.m_done = true;
|
||||
break;
|
||||
}
|
||||
++(this->base_reference());
|
||||
* const_cast<typename iterator_value<Base>::type *>(
|
||||
(m_input.m_next_available++)
|
||||
) = c;
|
||||
// if input buffer is full - we're done for now
|
||||
if(m_input.m_buffer.end() == m_input.m_next_available)
|
||||
break;
|
||||
}
|
||||
wchar_t retval;
|
||||
int result = std::mbtowc(& retval, buffer, MB_CUR_MAX);
|
||||
if(0 >= result)
|
||||
boost::serialization::throw_exception(iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
));
|
||||
return retval;
|
||||
const typename boost::iterators::iterator_value<Base>::type * input_new_start;
|
||||
typename iterator_value<this_t>::type * next_available;
|
||||
|
||||
std::codecvt_base::result r = m_codecvt_facet.in(
|
||||
m_mbs,
|
||||
m_input.m_buffer.begin(),
|
||||
m_input.m_next_available,
|
||||
input_new_start,
|
||||
m_output.m_buffer.begin(),
|
||||
m_output.m_buffer.end(),
|
||||
next_available
|
||||
);
|
||||
BOOST_ASSERT(std::codecvt_base::ok == r);
|
||||
m_output.m_next_available = next_available;
|
||||
m_output.m_next = m_output.m_buffer.begin();
|
||||
|
||||
// we're done with some of the input so shift left.
|
||||
m_input.m_next_available = std::copy(
|
||||
input_new_start,
|
||||
m_input.m_next_available,
|
||||
m_input.m_buffer.begin()
|
||||
);
|
||||
m_input.m_next = m_input.m_buffer.begin();
|
||||
}
|
||||
|
||||
} // namespace iterators
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace serialization {
|
||||
} // namespace serialization
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
class BOOST_ARCHIVE_DECL basic_iarchive;
|
||||
class BOOST_ARCHIVE_DECL basic_iarchive;
|
||||
class basic_iarchive;
|
||||
class basic_iserializer;
|
||||
}
|
||||
|
||||
class polymorphic_iarchive;
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace serialization {
|
||||
} // namespace serialization
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
class BOOST_ARCHIVE_DECL basic_oarchive;
|
||||
class BOOST_ARCHIVE_DECL basic_oserializer;
|
||||
class basic_oarchive;
|
||||
class basic_oserializer;
|
||||
}
|
||||
|
||||
class polymorphic_oarchive;
|
||||
|
||||
@@ -48,15 +48,8 @@ class BOOST_SYMBOL_VISIBLE text_iarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
template<class T>
|
||||
void load(T & t){
|
||||
|
||||
@@ -55,17 +55,9 @@ class BOOST_SYMBOL_VISIBLE text_oarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
friend basic_text_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_text_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_text_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
|
||||
@@ -45,6 +45,8 @@ public:
|
||||
const char * e1 = NULL,
|
||||
const char * e2 = NULL
|
||||
);
|
||||
BOOST_ARCHIVE_DECL xml_archive_exception(xml_archive_exception const &) ;
|
||||
virtual BOOST_ARCHIVE_DECL ~xml_archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
};
|
||||
|
||||
}// namespace archive
|
||||
|
||||
@@ -52,17 +52,9 @@ class BOOST_SYMBOL_VISIBLE xml_iarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
friend basic_xml_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
// use boost:scoped_ptr to implement automatic deletion;
|
||||
boost::scoped_ptr<xml_grammar> gimpl;
|
||||
|
||||
@@ -55,21 +55,10 @@ class BOOST_SYMBOL_VISIBLE xml_oarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
friend basic_xml_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
//void end_preamble(){
|
||||
// basic_xml_oarchive<Archive>::end_preamble();
|
||||
//}
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
basic_text_oprimitive<std::ostream>::save(t);
|
||||
@@ -96,22 +85,29 @@ protected:
|
||||
#endif
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl(std::ostream & os, unsigned int flags);
|
||||
~xml_oarchive_impl(){}
|
||||
BOOST_ARCHIVE_DECL
|
||||
~xml_oarchive_impl();
|
||||
public:
|
||||
void save_binary(const void *address, std::size_t count){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::ostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
BOOST_ARCHIVE_DECL
|
||||
void save_binary(const void *address, std::size_t count);
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// we use the following because we can't use
|
||||
// typedef xml_oarchive_impl<xml_oarchive_impl<...> > xml_oarchive;
|
||||
|
||||
@@ -138,6 +134,4 @@ BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_XML_OARCHIVE_HPP
|
||||
|
||||
@@ -29,15 +29,7 @@
|
||||
#include <boost/archive/basic_xml_iarchive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#else
|
||||
#include <codecvt>
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
|
||||
} } }
|
||||
#endif
|
||||
// #include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
@@ -66,17 +58,9 @@ class BOOST_SYMBOL_VISIBLE xml_wiarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
friend basic_xml_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_xml_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
boost::scoped_ptr<xml_wgrammar> gimpl;
|
||||
std::wistream & get_is(){
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#else
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
@@ -30,21 +29,13 @@ namespace std{
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <boost/smart_ptr/scoped_ptr.hpp>
|
||||
//#include <boost/smart_ptr/scoped_ptr.hpp>
|
||||
#include <boost/archive/detail/auto_link_warchive.hpp>
|
||||
#include <boost/archive/basic_text_oprimitive.hpp>
|
||||
#include <boost/archive/basic_xml_oarchive.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#ifdef BOOST_NO_CXX11_HDR_CODECVT
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#else
|
||||
#include <codecvt>
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
|
||||
} } }
|
||||
#endif
|
||||
//#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
@@ -69,27 +60,19 @@ class BOOST_SYMBOL_VISIBLE xml_woarchive_impl :
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
friend basic_xml_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_xml_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
//void end_preamble(){
|
||||
// basic_xml_oarchive<Archive>::end_preamble();
|
||||
//}
|
||||
template<class T>
|
||||
void
|
||||
void
|
||||
save(const T & t){
|
||||
basic_text_oprimitive<std::wostream>::save(t);
|
||||
}
|
||||
void
|
||||
void
|
||||
save(const version_type & t){
|
||||
save(static_cast<const unsigned int>(t));
|
||||
}
|
||||
@@ -111,22 +94,12 @@ protected:
|
||||
#endif
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl(std::wostream & os, unsigned int flags);
|
||||
BOOST_WARCHIVE_DECL
|
||||
BOOST_WARCHIVE_DECL
|
||||
~xml_woarchive_impl();
|
||||
public:
|
||||
void
|
||||
save_binary(const void *address, std::size_t count){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::wostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
BOOST_WARCHIVE_DECL void
|
||||
save_binary(const void *address, std::size_t count);
|
||||
|
||||
};
|
||||
|
||||
// we use the following because we can't use
|
||||
@@ -135,7 +108,7 @@ public:
|
||||
// do not derive from this class. If you want to extend this functionality
|
||||
// via inhertance, derived from xml_woarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
class BOOST_SYMBOL_VISIBLE xml_woarchive :
|
||||
class BOOST_SYMBOL_VISIBLE xml_woarchive :
|
||||
public xml_woarchive_impl<xml_woarchive>
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
#ifndef BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
|
||||
#define BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// serialization/unordered_map.hpp:
|
||||
// serialization for stl unordered_map templates
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// (C) Copyright 2014 Jim Bell
|
||||
// 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.
|
||||
|
||||
#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 {
|
||||
namespace stl {
|
||||
|
||||
// map input
|
||||
template<class Archive, class Container>
|
||||
struct archive_input_unordered_map
|
||||
{
|
||||
inline void operator()(
|
||||
Archive &ar,
|
||||
Container &s,
|
||||
const unsigned int v
|
||||
){
|
||||
typedef typename Container::value_type type;
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
std::pair<typename Container::const_iterator, bool> result =
|
||||
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.
|
||||
if(result.second){
|
||||
ar.reset_object_address(
|
||||
& (result.first->second),
|
||||
& t.reference().second
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// multimap input
|
||||
template<class Archive, class Container>
|
||||
struct archive_input_unordered_multimap
|
||||
{
|
||||
inline void operator()(
|
||||
Archive &ar,
|
||||
Container &s,
|
||||
const unsigned int v
|
||||
){
|
||||
typedef typename Container::value_type type;
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result =
|
||||
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.
|
||||
ar.reset_object_address(
|
||||
& result->second,
|
||||
& t.reference()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} // stl
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_MAP_HPP
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_SET_HPP
|
||||
#define BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_SET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// archive_input_unordered_set.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// (C) Copyright 2014 Jim Bell
|
||||
// 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.
|
||||
|
||||
#include <utility>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/detail/stack_constructor.hpp>
|
||||
#include <boost/move/utility_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
namespace stl {
|
||||
|
||||
// unordered_set input
|
||||
template<class Archive, class Container>
|
||||
struct archive_input_unordered_set
|
||||
{
|
||||
inline void operator()(
|
||||
Archive &ar,
|
||||
Container &s,
|
||||
const unsigned int v
|
||||
){
|
||||
typedef typename Container::value_type type;
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
// 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(boost::move(t.reference()));
|
||||
if(result.second)
|
||||
ar.reset_object_address(& (* result.first), & t.reference());
|
||||
}
|
||||
};
|
||||
|
||||
// unordered_multiset input
|
||||
template<class Archive, class Container>
|
||||
struct archive_input_unordered_multiset
|
||||
{
|
||||
inline void operator()(
|
||||
Archive &ar,
|
||||
Container &s,
|
||||
const unsigned int v
|
||||
){
|
||||
typedef typename Container::value_type type;
|
||||
detail::stack_construct<Archive, type> t(ar, v);
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::const_iterator result =
|
||||
s.insert(boost::move(t.reference()));
|
||||
ar.reset_object_address(& (* result), & t.reference());
|
||||
}
|
||||
};
|
||||
|
||||
} // stl
|
||||
} // serialization
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_SERIALIZATION_ARCHIVE_INPUT_UNORDERED_SET_HPP
|
||||
@@ -6,13 +6,9 @@
|
||||
// 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
|
||||
//#include <iostream>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstddef> // std::size_t
|
||||
#ifndef BOOST_NO_CXX11_HDR_ARRAY
|
||||
#include <array>
|
||||
#endif
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this for warning suppression
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
@@ -23,11 +19,13 @@ namespace std{
|
||||
#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.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost { namespace serialization {
|
||||
|
||||
@@ -37,24 +35,26 @@ template <class Archive>
|
||||
struct use_array_optimization : boost::mpl::always<boost::mpl::false_> {};
|
||||
|
||||
template<class T>
|
||||
class array :
|
||||
public wrapper_traits<const array< T > >
|
||||
class array_wrapper :
|
||||
public wrapper_traits<const array_wrapper< T > >
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
array(value_type* t, std::size_t s) :
|
||||
m_t(t),
|
||||
m_element_count(s)
|
||||
{}
|
||||
array(const array & rhs) :
|
||||
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)
|
||||
{}
|
||||
array & operator=(const array & 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>
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
{
|
||||
// default implemention does the loop
|
||||
std::size_t c = count();
|
||||
value_type * t = address();
|
||||
T * t = address();
|
||||
while(0 < c--)
|
||||
ar & boost::serialization::make_nvp("item", *t++);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
serialize_optimized(ar,version,use_optimized());
|
||||
}
|
||||
|
||||
value_type* address() const
|
||||
T * address() const
|
||||
{
|
||||
return m_t;
|
||||
}
|
||||
@@ -108,26 +108,32 @@ public:
|
||||
{
|
||||
return m_element_count;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
value_type* m_t;
|
||||
std::size_t m_element_count;
|
||||
T * const m_t;
|
||||
const std::size_t m_element_count;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
template<class T, class S>
|
||||
inline
|
||||
const array< T > make_array( T* t, std::size_t s){
|
||||
return array< T >(t, s);
|
||||
const array_wrapper< T > make_array(T* t, S s){
|
||||
const array_wrapper< T > a(t, s);
|
||||
return a;
|
||||
}
|
||||
|
||||
// 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
|
||||
|
||||
// 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 */)
|
||||
@@ -138,8 +144,19 @@ void serialize(Archive& ar, std::array<T,N>& a, const unsigned int /* version */
|
||||
);
|
||||
|
||||
}
|
||||
} } // end namespace boost::serialization
|
||||
#endif
|
||||
|
||||
#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) \
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
// this is useful for compilers which don't support the boost::is_abstract
|
||||
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
|
||||
#ifndef BOOST_NO_IS_ABSTRACT
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
|
||||
#include <boost/type_traits/is_base_and_derived.hpp>
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
#ifndef BOOST_SERIALIZATION_UNORDERED_MAP_HPP
|
||||
#define BOOST_SERIALIZATION_UNORDERED_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// serialization/unordered_map.hpp:
|
||||
// serialization for stl unordered_map templates
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// (C) Copyright 2014 Jim Bell
|
||||
// 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.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#include <boost/serialization/utility.hpp>
|
||||
#include <boost/serialization/unordered_collections_save_imp.hpp>
|
||||
#include <boost/serialization/unordered_collections_load_imp.hpp>
|
||||
#include <boost/serialization/archive_input_unordered_map.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
const boost::unordered_map<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::save_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_map<Key, HashFcn, EqualKey, Allocator>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
boost::unordered_map<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::load_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_map<Key, HashFcn, EqualKey, Allocator>,
|
||||
boost::serialization::stl::archive_input_unordered_map<
|
||||
Archive,
|
||||
boost::unordered_map<Key, HashFcn, EqualKey, Allocator>
|
||||
>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
// non intrusive save/load member functions
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void serialize(
|
||||
Archive & ar,
|
||||
boost::unordered_map<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
){
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
// unordered_multimap
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
const boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::save_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
boost::unordered_multimap<
|
||||
Key, HashFcn, EqualKey, Allocator
|
||||
> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::load_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator>,
|
||||
boost::serialization::stl::archive_input_unordered_multimap<
|
||||
Archive,
|
||||
boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator>
|
||||
>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
// non intrusive save/load member functions
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void serialize(
|
||||
Archive & ar,
|
||||
boost::unordered_multimap<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
){
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_SERIALIZATION_UNORDERED_MAP_HPP
|
||||
@@ -0,0 +1,150 @@
|
||||
#ifndef BOOST_SERIALIZATION_BOOST_UNORDERED_SET_HPP
|
||||
#define BOOST_SERIALIZATION_BOOST_UNORDERED_SET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// unordered_set.hpp: serialization for boost unordered_set templates
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// (C) Copyright 2014 Jim Bell
|
||||
// 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.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/unordered_set.hpp>
|
||||
|
||||
#include <boost/serialization/unordered_collections_save_imp.hpp>
|
||||
#include <boost/serialization/unordered_collections_load_imp.hpp>
|
||||
#include <boost/serialization/archive_input_unordered_set.hpp>
|
||||
#include <boost/serialization/split_free.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
const boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::save_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_set<Key, HashFcn, EqualKey, Allocator>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::load_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_set<Key, HashFcn, EqualKey, Allocator>,
|
||||
boost::serialization::stl::archive_input_unordered_set<
|
||||
Archive,
|
||||
boost::unordered_set<Key, HashFcn, EqualKey, Allocator>
|
||||
>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
// non intrusive save/load member functions
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void serialize(
|
||||
Archive & ar,
|
||||
boost::unordered_set<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
){
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
// unordered_multiset
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
const boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::save_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
boost::serialization::stl::load_unordered_collection<
|
||||
Archive,
|
||||
boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>,
|
||||
boost::serialization::stl::archive_input_unordered_multiset<
|
||||
Archive,
|
||||
boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator>
|
||||
>
|
||||
>(ar, t);
|
||||
}
|
||||
|
||||
// split non-intrusive serialization function member into separate
|
||||
// non intrusive save/load member functions
|
||||
template<
|
||||
class Archive,
|
||||
class Key,
|
||||
class HashFcn,
|
||||
class EqualKey,
|
||||
class Allocator
|
||||
>
|
||||
inline void serialize(
|
||||
Archive & ar,
|
||||
boost::unordered_multiset<Key, HashFcn, EqualKey, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
){
|
||||
boost::serialization::split_free(ar, t, file_version);
|
||||
}
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_SERIALIZATION_BOOST_UNORDERED_SET_HPP
|
||||
@@ -23,7 +23,7 @@
|
||||
// exists for archives to be non-portable if class information for primitive
|
||||
// types is included. This is addressed by the following macros.
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/integral_c.hpp>
|
||||
//#include <boost/mpl/integral_c.hpp>
|
||||
#include <boost/mpl/integral_c_tag.hpp>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
@@ -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 {
|
||||
@@ -63,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;
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,10 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
|
||||
#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 {
|
||||
|
||||
@@ -54,8 +54,6 @@ const T* get_data(STD::valarray<T> const& v)
|
||||
} // serialization
|
||||
} // boost
|
||||
|
||||
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
|
||||
#undef STD
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SERIALIZATION_DETAIL_GET_DATA_HPP
|
||||
|
||||
@@ -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)
|
||||
@@ -17,6 +17,7 @@
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/aligned_storage.hpp>
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
|
||||
namespace boost{
|
||||
namespace serialization {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#define BOOST_SERIALIZATION_EPHEMERAL_HPP
|
||||
|
||||
// MS compatible compilers support
|
||||
#pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/mpl/and.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
|
||||
#include <boost/serialization/extended_type_info.hpp> // for guid_defined only
|
||||
#include <boost/serialization/static_warning.hpp>
|
||||
|
||||
@@ -65,11 +65,7 @@ protected:
|
||||
const unsigned int type_info_key,
|
||||
const char * key
|
||||
);
|
||||
// account for bogus gcc warning
|
||||
#if defined(__GNUC__)
|
||||
virtual
|
||||
#endif
|
||||
BOOST_SERIALIZATION_DECL ~extended_type_info();
|
||||
virtual BOOST_SERIALIZATION_DECL ~extended_type_info();
|
||||
public:
|
||||
const char * get_key() const {
|
||||
return m_key;
|
||||
|
||||
@@ -84,7 +84,9 @@ class extended_type_info_typeid :
|
||||
{
|
||||
public:
|
||||
extended_type_info_typeid() :
|
||||
typeid_system::extended_type_info_typeid_0(get_key())
|
||||
typeid_system::extended_type_info_typeid_0(
|
||||
boost::serialization::guid< T >()
|
||||
)
|
||||
{
|
||||
type_register(typeid(T));
|
||||
key_register();
|
||||
|
||||
@@ -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,6 +16,8 @@
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <forward_list>
|
||||
#include <iterator> // distance
|
||||
|
||||
@@ -28,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 {
|
||||
@@ -36,7 +39,7 @@ template<class Archive, class U, class Allocator>
|
||||
inline void save(
|
||||
Archive & ar,
|
||||
const std::forward_list<U, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
const collection_size_type count(std::distance(t.cbegin(), t.cend()));
|
||||
boost::serialization::stl::save_collection<
|
||||
@@ -67,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.push_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.insert_after(last, u.reference());
|
||||
last = t.insert_after(last, boost::move(u.reference()));
|
||||
ar.reset_object_address(&(*last) , & u.reference());
|
||||
}
|
||||
}
|
||||
@@ -85,7 +88,7 @@ template<class Archive, class U, class Allocator>
|
||||
inline void load(
|
||||
Archive & ar,
|
||||
std::forward_list<U, Allocator> &t,
|
||||
const unsigned int file_version
|
||||
const unsigned int /*file_version*/
|
||||
){
|
||||
const boost::archive::library_version_type library_version(
|
||||
ar.get_library_version()
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -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 {
|
||||
@@ -57,11 +58,12 @@ inline void load_map_collection(Archive & ar, Container &s)
|
||||
while(count-- > 0){
|
||||
typedef typename Container::value_type type;
|
||||
detail::stack_construct<Archive, type> t(ar, item_version);
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::iterator result = s.insert(hint, t.reference());
|
||||
typename Container::iterator result =
|
||||
s.insert(hint, boost::move(t.reference()));
|
||||
ar.reset_object_address(& (result->second), & t.reference().second);
|
||||
hint = result;
|
||||
++hint;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/mpl/integral_c.hpp>
|
||||
#include <boost/mpl/integral_c_tag.hpp>
|
||||
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
@@ -39,14 +36,14 @@ struct nvp :
|
||||
public std::pair<const char *, T *>,
|
||||
public wrapper_traits<const nvp< T > >
|
||||
{
|
||||
explicit nvp(const char * name_, T & t) :
|
||||
// note: redundant cast works around borland issue
|
||||
// note: added _ to suppress useless gcc warning
|
||||
std::pair<const char *, T *>(name_, (T*)(& t))
|
||||
//private:
|
||||
nvp(const nvp & rhs) :
|
||||
std::pair<const char *, T *>(rhs.first, rhs.second)
|
||||
{}
|
||||
nvp(const nvp & rhs) :
|
||||
// note: redundant cast works around borland issue
|
||||
std::pair<const char *, T *>(rhs.first, (T*)rhs.second)
|
||||
public:
|
||||
explicit nvp(const char * name_, T & t) :
|
||||
// note: added _ to suppress useless gcc warning
|
||||
std::pair<const char *, T *>(name_, & t)
|
||||
{}
|
||||
|
||||
const char * name() const {
|
||||
@@ -60,26 +57,18 @@ struct nvp :
|
||||
return *(this->second);
|
||||
}
|
||||
|
||||
// True64 compiler complains with a warning about the use of
|
||||
// the name "Archive" hiding some higher level usage. I'm sure this
|
||||
// is an error but I want to accomodated as it generates a long warning
|
||||
// listing and might be related to a lot of test failures.
|
||||
// default treatment for name-value pairs. The name is
|
||||
// just discarded and only the value is serialized.
|
||||
template<class Archivex>
|
||||
template<class Archive>
|
||||
void save(
|
||||
Archivex & ar,
|
||||
Archive & ar,
|
||||
const unsigned int /* file_version */
|
||||
) const {
|
||||
// CodeWarrior 8.x can't seem to resolve the << op for a rhs of "const T *"
|
||||
ar.operator<<(const_value());
|
||||
}
|
||||
template<class Archivex>
|
||||
template<class Archive>
|
||||
void load(
|
||||
Archivex & ar,
|
||||
Archive & ar,
|
||||
const unsigned int /* file_version */
|
||||
){
|
||||
// CodeWarrior 8.x can't seem to resolve the >> op for a rhs of "const T *"
|
||||
ar.operator>>(value());
|
||||
}
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
@@ -115,7 +104,6 @@ struct tracking_level<nvp< T > >
|
||||
BOOST_STATIC_CONSTANT(int, value = tracking_level::type::value);
|
||||
};
|
||||
|
||||
|
||||
} // seralization
|
||||
} // boost
|
||||
|
||||
|
||||
@@ -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 {
|
||||
@@ -54,7 +55,8 @@ inline void load_set_collection(Archive & ar, Container &s)
|
||||
detail::stack_construct<Archive, type> t(ar, item_version);
|
||||
// borland fails silently w/o full namespace
|
||||
ar >> boost::serialization::make_nvp("item", t.reference());
|
||||
typename Container::iterator result = s.insert(hint, t.reference());
|
||||
typename Container::iterator result =
|
||||
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
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/serialization/force_include.hpp>
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/serialization/config.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
@@ -81,25 +85,15 @@ class BOOST_SYMBOL_VISIBLE singleton_module :
|
||||
public boost::noncopyable
|
||||
{
|
||||
private:
|
||||
static bool & get_lock(){
|
||||
static bool lock = false;
|
||||
return lock;
|
||||
}
|
||||
static bool & get_lock();
|
||||
public:
|
||||
// static const void * get_module_handle(){
|
||||
// return static_cast<const void *>(get_module_handle);
|
||||
// }
|
||||
static void lock(){
|
||||
get_lock() = true;
|
||||
}
|
||||
static void unlock(){
|
||||
get_lock() = false;
|
||||
}
|
||||
static bool is_locked() {
|
||||
return get_lock();
|
||||
}
|
||||
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>
|
||||
@@ -117,19 +111,25 @@ 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
|
||||
{
|
||||
private:
|
||||
BOOST_DLLEXPORT static T & instance;
|
||||
// include this to provoke instantiation at pre-execution time
|
||||
static void use(T const &) {}
|
||||
static void use(T const *) {}
|
||||
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(! detail::singleton_wrapper< T >::m_is_destroyed);
|
||||
use(instance);
|
||||
use(& instance);
|
||||
return static_cast<T &>(t);
|
||||
}
|
||||
public:
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user