Compare commits

..

1 Commits

Author SHA1 Message Date
Peter Dimov 9bfcdb2106 Remove explicit check for <forward_list> 2016-11-10 14:44:08 +02:00
397 changed files with 3197 additions and 8676 deletions
+47 -78
View File
@@ -1,4 +1,4 @@
# Copyright 2016, 2017 Peter Dimov
# Copyright 2016 Peter Dimov
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
@@ -6,97 +6,66 @@ language: cpp
sudo: false
cache:
ccache: true
os:
- linux
- osx
branches:
only:
- master
- develop
- /feature\/.*/
env:
matrix:
- BOGUS_JOB=true
matrix:
exclude:
- env: BOGUS_JOB=true
include:
- os: linux
compiler: g++
env: TOOLSET=gcc LINK=static,shared
- os: linux
compiler: g++-5
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-5
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-6
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-6
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: g++-7
env: TOOLSET=gcc LINK=static,shared
addons:
apt:
packages:
- g++-7
sources:
- ubuntu-toolchain-r-test
- os: linux
compiler: clang++
env: TOOLSET=clang LINK=static,shared
- os: linux
compiler: clang++-libc++
env: TOOLSET=clang LINK=static,shared
addons:
apt:
packages:
- libc++-dev
- os: osx
compiler: clang++
env: TOOLSET=clang LINK=static,shared
- os: osx
osx_image: xcode10
compiler: clang++
env: TOOLSET=clang LINK=static,shared
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- cd ..
- git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root
- git clone -b $TRAVIS_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule update --init tools/build
- git submodule update --init libs/config
- git submodule update --init tools/boostdep
- git submodule init libs/align
- git submodule init libs/array
- git submodule init libs/assert
- git submodule init libs/bind
- git submodule init libs/compatibility
- git submodule init libs/concept_check
- git submodule init libs/config
- git submodule init libs/container
- git submodule init libs/core
- git submodule init libs/detail
- git submodule init libs/filesystem
- git submodule init libs/function
- git submodule init libs/functional
- git submodule init libs/integer
- git submodule init libs/intrusive
- git submodule init libs/io
- git submodule init libs/iterator
- git submodule init libs/lexical_cast
- git submodule init libs/math
- git submodule init libs/move
- git submodule init libs/mpl
- git submodule init libs/numeric/conversion
- git submodule init libs/optional
- git submodule init libs/predef
- git submodule init libs/preprocessor
- git submodule init libs/range
- git submodule init libs/smart_ptr
- git submodule init libs/spirit
- git submodule init libs/static_assert
- git submodule init libs/system
- git submodule init libs/throw_exception
- git submodule init libs/tuple
- git submodule init libs/type_index
- git submodule init libs/type_traits
- git submodule init libs/unordered
- git submodule init libs/utility
- git submodule init libs/variant
- git submodule init tools/build
- git submodule update --depth 1
- cp -r $TRAVIS_BUILD_DIR/* libs/serialization
- python tools/boostdep/depinst/depinst.py serialization
- ./bootstrap.sh
- ./b2 headers
script:
- |-
echo "using $TOOLSET : : $TRAVIS_COMPILER ;" > ~/user-config.jam
- ./b2 -j 3 libs/serialization/test toolset=$TOOLSET link=${LINK:-shared}
- TOOLSET=gcc,clang
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
- ./b2 libs/serialization/test toolset=$TOOLSET
notifications:
email:
+62 -109
View File
@@ -26,7 +26,7 @@ add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
add_definitions( -ftemplate-depth=300 )
# we use gcc to test for C++03 compatibility
add_definitions( -std=c++03 )
add_definitions( std=c++03 )
message(STATUS "compiler is g++ c++03")
set(COMPILER_SUPPORTS_CXX11 FALSE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
@@ -35,12 +35,29 @@ elseif( CMAKE_CXX_COMPILER_ID STREQUAL "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++03")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
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 FALSE)
set(COMPILER_SUPPORTS_CXX11 TRUE)
endif()
#
# IDE settings
#
if( CMAKE_HOST_APPLE )
# note: it seems that bjam builds both address models in any case
# so we can defer this decision to the IDE just as we do for debug/release
# so we'll not use this now
# set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits")
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Link to Boost static libraries")
set(Boost_USE_MULTITHREADED ON)
else()
set(Boost_ADDRESS_MODEL 64 CACHE INTEGER "32/64 bits")
set(Boost_USE_STATIC_LIBS ON CACHE BOOL "Link to Boost static libraries")
set(Boost_USE_MULTITHREADED ON)
endif()
#
@@ -90,58 +107,45 @@ endif()
# end special note for Xcode
############################
#
# IDE settings
#
set(Boost_DEBUG true)
set(Boost_ADDRESS_MODEL 64 CACHE STRING "32/64 bits")
set(Boost_USE_STATIC_LIBS TRUE CACHE BOOL "Use static libraries")
set(Boost_USE_MULTITHREADED ON)
set(Boost_DETAILED_FAILURE_MSG true)
set(Boost_FOUND true)
get_filename_component(BOOST_ROOT "../../.." ABSOLUTE)
string(CONCAT boost_headers ${BOOST_ROOT} "/boost")
if(NOT IS_DIRECTORY ${boost_headers})
message(FATAL_ERROR "BOOST_ROOT not found")
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}")
else()
message(STATUS "BOOST_ROOT is ${BOOST_ROOT}")
message(STATUS "Boost NOT Found!")
endif()
if(Boost_USE_STATIC_LIBS)
message(STATUS "Link to Boost static libraries")
set(BUILD_SHARED_LIBS NO)
string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/static")
message(STATUS "Use static libraries")
set(LINK_TYPE "STATIC")
else()
message(STATUS "Link to Boost shared libraries")
set(BUILD_SHARED_LIBS YES)
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 YES)
string(CONCAT boost_stage ${BOOST_ROOT} "/stage/Debug/shared")
set(VISIBILITY_INLINES_HIDDEN)
endif()
include(CheckIncludeFileCXX)
message(STATUS "Boost directories found at ${boost_headers}")
message(STATUS "Boost libraries found at ${boost_stage}")
set(CMAKE_LIBRARY_PATH ${boost_stage})
# list of archive names for which tests should be generated
#set(archive_list text_archive text_warchive binary_archive xml_archive xml_warchive)
set(archive_list text_archive)
# list of tests generated by each function call
set(test_list)
include_directories(BEFORE ${BOOST_ROOT})
###########################
# library builds
add_library(serialization
add_library(serialization ${LINK_TYPE}
../src/archive_exception.cpp
../src/basic_archive.cpp
../src/basic_iarchive.cpp
@@ -161,8 +165,7 @@ add_library(serialization
../src/extended_type_info.cpp
../src/polymorphic_iarchive.cpp
../src/polymorphic_oarchive.cpp
../src/polymorphic_text_iarchive.cpp
../src/polymorphic_text_oarchive.cpp
../src/singleton.cpp
../src/stl_port.cpp
../src/text_iarchive.cpp
../src/text_oarchive.cpp
@@ -175,7 +178,7 @@ add_library(serialization
../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
@@ -187,18 +190,9 @@ add_library(wserialization
../src/basic_xml_grammar.ipp # doesn't show up in "Source Files" in Xcode"'
)
set_property(TARGET wserialization PROPERTY LINK_LIBRARIES serialization)
# end library build
###########################
add_library(filesystem SHARED IMPORTED GLOBAL ) # or STATIC instead of SHARED
set_target_properties(filesystem PROPERTIES
IMPORTED_LOCATION "${CMAKE_LIBRARY_PATH}/libboost_filesystem-clang-darwin-mt-d-x64-1_69.dylib"
)
get_property(loc TARGET filesystem PROPERTY LOCATION)
message(STATUS "filesystem library located at:${loc}")
###########################
# test targets
@@ -209,73 +203,56 @@ function( serialization_test test_name)
endforeach()
message(STATUS ${test_name})
add_executable( ${test_name} ../test/${test_name}.cpp ${arglist} )
target_link_libraries(${test_name} serialization wserialization filesystem)
target_link_libraries(${test_name} serialization wserialization ${Boost_LIBRARIES})
add_test( ${test_name} ${test_name} )
endfunction(serialization_test)
function(archive_test test_name)
set(test_list)
set(arglist)
foreach(a IN ITEMS ${ARGN} )
set(arglist ${arglist} ../test/${a}.cpp)
endforeach()
foreach(
archive-name
IN ITEMS ${archive_list}
IN ITEMS text_archive text_warchive binary_archive xml_archive xml_warchive
)
set(amended_test_name ${test_name}_${archive-name})
message(STATUS ${amended_test_name})
add_executable(${amended_test_name} ../test/${test_name}.cpp ${arglist})
set_property(
TARGET ${amended_test_name}
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${archive-name}.hpp
)
message(STATUS ${amended_test_name} " " ${arglist} " " ${archive-name})
target_link_libraries(${amended_test_name} serialization wserialization filesystem)
target_link_libraries(${amended_test_name} serialization wserialization ${Boost_LIBRARIES})
add_test(${amended_test_name} ${amended_test_name})
set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE)
endforeach()
endfunction(archive_test)
function(polymorphic_archive_test test_name)
set(test_list)
set(arglist)
foreach(a IN ITEMS ${ARGN} )
set(arglist ${arglist} ../test/${a}.cpp)
endforeach()
foreach(
archive-name
IN ITEMS ${archive_list}
IN ITEMS text_archive text_warchive binary_archive xml_archive xml_warchive
)
set(amended_archive_name polymorphic_${archive-name})
set(amended_test_name ${test_name}_${amended_archive_name})
set(amended_test_name ${test_name}_polymorphic_${archive-name})
message(STATUS ${amended_test_name})
add_executable(${amended_test_name} ../test/${test_name}.cpp ${arglist})
set_property(
TARGET ${amended_test_name}
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=${amended_archive_name}.hpp
PROPERTY COMPILE_DEFINITIONS BOOST_ARCHIVE_TEST=polymorphic_${archive-name}.hpp
)
message(STATUS ${amended_test_name} " " ${arglist} " " ${amended_archive_name})
target_link_libraries(${amended_test_name} serialization wserialization filesystem)
target_link_libraries(${amended_test_name} serialization wserialization ${Boost_LIBRARIES})
add_test(${amended_test_name} ${amended_test_name})
set(test_list ${test_list} ${amended_test_name} PARENT_SCOPE)
endforeach()
endfunction(polymorphic_archive_test)
enable_testing()
message(STATUS dll_a)
add_library(dll_a SHARED ../test/dll_a.cpp)
target_link_libraries(dll_a serialization)
serialization_test(test_dll_simple)
target_link_libraries(test_dll_simple dll_a serialization)
message(STATUS dll_polymorphic_base)
add_library(dll_polymorphic_base SHARED ../test/dll_polymorphic_base.cpp)
target_link_libraries(dll_polymorphic_base serialization)
message(STATUS dll_polymorphic_derived2)
add_library(dll_polymorphic_derived2 SHARED ../test/dll_polymorphic_derived2.cpp)
target_link_libraries(dll_polymorphic_derived2 dll_polymorphic_base serialization)
# serialization(test_dll_exported dll_polymorphic_derived2_lib)
# serialization(test_dll_simple dll_a_lib)
# compile test_dll_plugin.cpp
# Running the following test requires that the test know the directory
# in which the dll is stored. I don't know how to extract this from bjam
@@ -288,13 +265,9 @@ serialization_test(test_mult_archive_types)
serialization_test(test_iterators)
serialization_test(test_iterators_base64)
serialization_test(test_inclusion)
serialization_test(test_inclusion2)
serialization_test(test_smart_cast)
serialization_test(test_codecvt_null ../src/codecvt_null)
serialization_test(test_strong_typedef)
serialization_test(test_singleton)
serialization_test(test_singleton_inherited)
serialization_test(test_singleton_plain)
archive_test(test_native_array A)
archive_test(test_boost_array A)
@@ -314,6 +287,7 @@ archive_test(test_derived)
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)
@@ -325,6 +299,7 @@ archive_test(test_map_boost_unordered A)
archive_test(test_mi)
archive_test(test_multiple_ptrs A)
archive_test(test_multiple_inheritance)
archive_test(test_no_rtti polymorphic_base polymorphic_derived1)
archive_test(test_new_operator A)
archive_test(test_non_intrusive)
archive_test(test_non_default_ctor)
@@ -345,14 +320,6 @@ archive_test(test_shared_ptr_multi_base)
archive_test(test_shared_ptr_132)
archive_test(test_simple_class A)
archive_test(test_simple_class_ptr A)
CHECK_INCLUDE_FILE_CXX(slist SLIST_FOUND)
if(SLIST_FOUND)
message(STATUS "slist header found")
archive_test(test_slist A)
archive_test(test_slist_ptr A)
else()
message(STATUS "slist header NOT found")
endif()
archive_test(test_stack A)
archive_test(test_split)
archive_test(test_tracking)
@@ -366,31 +333,17 @@ archive_test(test_set_boost_unordered A)
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_set_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
if(HASH_SET_FOUND)
archive_test(test_set_hashed A)
endif()
archive_test(test_set_hashed A)
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_map_unordered A)
else()
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
if(HASH_MAP_FOUND)
archive_test(test_map_hashed A)
endif()
archive_test(test_map_hashed A)
endif()
polymorphic_archive_test(test_dll_exported polymorphic_derived1)
foreach(test_name IN ITEMS ${test_list} )
target_link_libraries(${test_name} dll_polymorphic_derived2 dll_polymorphic_base)
message(STATUS " " target_link_libraries " " dll_polymorphic_derived2 " " dll_polymorphic_base)
endforeach()
polymorphic_archive_test(test_no_rtti polymorphic_base polymorphic_derived1 polymorphic_derived2)
polymorphic_archive_test(test_exported polymorphic_base polymorphic_derived1 polymorphic_derived2)
polymorphic_archive_test(test_polymorphic test_polymorphic_A A)
polymorphic_archive_test(test_polymorphic2 test_polymorphic2imp)
polymorphic_archive_test(test_p_helper)
polymorphic_archive_test(test_polymorphic_helper)
# end test targets
####################
@@ -398,7 +351,7 @@ polymorphic_archive_test(test_p_helper)
####################
# add headers in IDE
# for serialization
# for serialisation
file(GLOB x
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
-83
View File
@@ -1,83 +0,0 @@
# Copyright 2016 Peter Dimov
# Copyright 2016 Robert Ramey
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
version: 1.0.{build}-{branch}
shallow_clone: true
branches:
only:
- develop
# - master
environment:
matrix:
- BUILD_TOOLSET: gcc
BUILD_LINK: static
- BUILD_TOOLSET: gcc
BUILD_LINK: shared
- BUILD_TOOLSET: msvc-14.0
BUILD_LINK: static
- BUILD_TOOLSET: msvc-14.0
BUILD_LINK: shared
install:
- cd ..
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
- cd boost-root
- git submodule init libs/align
- git submodule init libs/array
- git submodule init libs/assert
- git submodule init libs/bind
- git submodule init libs/compatibility
- git submodule init libs/concept_check
- git submodule init libs/config
- git submodule init libs/container
- git submodule init libs/container_hash
- 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 libs/winapi
- git submodule init tools/boost_install
- git submodule init libs/headers
- git submodule init tools/build
- git submodule update
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\serialization
- set PATH=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin;%CD%;%PATH%
- bootstrap gcc
- b2 headers
build: off
test_script:
- cd libs/serialization/test
- b2 -j2 toolset=%BUILD_TOOLSET% link=%BUILD_LINK%
+2 -13
View File
@@ -74,12 +74,6 @@ SOURCES =
stl_port
text_iarchive
text_oarchive
polymorphic_text_iarchive
polymorphic_text_oarchive
polymorphic_binary_iarchive
polymorphic_binary_oarchive
polymorphic_xml_iarchive
polymorphic_xml_oarchive
void_cast
archive_exception
xml_grammar
@@ -88,20 +82,17 @@ SOURCES =
xml_archive_exception
codecvt_null
utf8_codecvt_facet
;
singleton
;
WSOURCES =
basic_text_wiprimitive
basic_text_woprimitive
text_wiarchive
text_woarchive
polymorphic_text_wiarchive
polymorphic_text_woarchive
xml_wgrammar
xml_wiarchive
xml_woarchive
polymorphic_xml_wiarchive
polymorphic_xml_woarchive
;
lib boost_serialization
@@ -109,7 +100,6 @@ lib boost_serialization
:
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
<toolset>clang:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
<toolset>gcc:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
<toolset>darwin:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
@@ -124,7 +114,6 @@ lib boost_wserialization
:
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
<toolset>clang:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
<toolset>gcc:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
<toolset>darwin:<cxxflags>"-fvisibility=hidden -fvisibility-inlines-hidden"
+11 -1
View File
@@ -182,6 +182,11 @@ to the archive in some special way. For example, XML archives implement special
name-value pairs by overriding this function template for name-value pairs.
This replaces the default name-value pair handling, which is just to throw away the name,
with one appropriate for XML which writes out the start of an XML tag with the correct object name.
<p>
The second argument must be part of the function signature even though it is not used.
Its purpose is to be sure that code is portable to compilers which fail to correctly
implement partial function template ordering. For more information see
<a href="implementation.html#functiontemplateordering">this</a>.
</dd>
</dl>
@@ -226,6 +231,11 @@ explicitly provided for these types. For an example see
In real practice, we probably won't be quite done.
One or more of the following issues may need to be addressed:
<ul>
<li>Many compilers fail to implement correct partial ordering of
function templates. The archives included with this library work around
this using argument overloading. This technique is described in
<a target="detail" href="implementation.html#functiontemplateordering">
another section of this manual</a>
<li>Even if we are using a conforming compiler, we might want our new archive class
to be portable to non-conforming compilers.
<li>Our archive format might require extra information inserted into it. For
@@ -257,7 +267,7 @@ EXCEPT for one special case.
To make this work, the following should be included after the archive
class definition.
<pre><code>
BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive)
#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive)
</code></pre>
Failure to do this will not inhibit the program from compiling, linking
and executing properly - except in one case. If an instance of a derived
+1 -1
View File
@@ -292,7 +292,7 @@ included in the code module containing the serialization code.
</code></pre>
All of these archives implement the same interface. Hence, it should suffice to describe only one
All of these archives implement the same inteface. Hence, it should suffice to describe only one
of them in detail. For this purpose we will use the text archive.
+3 -7
View File
@@ -101,10 +101,7 @@ function initialize() {
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#stl">STL Collections</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#versioning">Class Versioning</a>
<dt><img style="display:none" src="dot.gif">
<a target="detail" href="tutorial.html#splitting">
Splitting <code>serialize</code> into <code>save/load</code>
</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#splitting">Splitting <code>serialize</code> into <code>save/load</code></a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#archives">Archives</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#examples">List of Examples</a>
</dl></div></dd>
@@ -136,9 +133,7 @@ function initialize() {
<dt><img style="display:none" src="dot.gif"><a target="detail" href="serialization.html#templates">Templates</a>
</dl></div></dd>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="serialization.html#versioning">Versioning</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="tutorial.html#splitting">
Splitting <code>serialize</code> into <code>save/load</code>
</a>
<dt><img style="display:none" s'c="dot.gif"><a target="detail" href="serialization.html#splitting">Splitting <code>serialize</code> into <code>save/load</code></a>
</dl></div></dd>
<dt><img style="display:none" src="plus.gif" id="pointers"><a target="detail" href="serialization.html#pointeroperators">Pointers</a>
<dd><div id="pointers_detail"><dl class="page-index">
@@ -232,6 +227,7 @@ function initialize() {
</dl></div></dd>
<dt><img style="display:none" src="plus.gif" id="implementation"><a target="detail" href="implementation.html">Implementation Notes</a>
<dd><div id="implementation_detail"><dl class="page-index">
<dt><img style="display:none" src="dot.gif"><a target="detail" href="implementation.html#functiontemplateordering">Partial Function Template Ordering</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="implementation.html#charencoding">Character Encoding</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="implementation.html#tempatesyntax">Template Invocation syntax</a>
<dt><img style="display:none" src="dot.gif"><a target="detail" href="implementation.html#partialtemplatespecialization">Partial Template Specialization</a>
+14
View File
@@ -112,6 +112,20 @@ constructor <code style="white-space: normal">base64_text(const char *)</code>
Iterator Adaptors include a <code style="white-space: normal">make_xxx_iterator</code> to fulfill this function.
However, I believe these are unwieldy to use compared to the above solution using
Templated constructors.
<p>
Unfortunately, some systems which fail to properly support partial function template
ordering cannot support the concept of a templated constructor as implemented above.
A special "wrapper" macro has been created to work around this problem. With this "wrapper"
the above example is modified to:
<pre><code>
std::copy(
base64_text(BOOST_MAKE_PFTO_WRAPPER(address)),
base64_text(BOOST_MAKE_PFTO_WRAPPER(address + count)),
ostream_iterator&lt;char&gt;(os)
);
</code></pre>
This macro is defined in <a target="pfto" href="../../../boost/serialization/pfto.hpp">&lt;boost/serialization/pfto.hpp&gt;</a>.
For more information about this topic, check the source.
<h4>Dereferencing</h4>
Dereferencing some iterators can cause problems. For example, a natural
+6
View File
@@ -83,6 +83,12 @@ the base classes.
<li><i></i>Reread <a target="detail" href="headers.html#archiveinternals">Archive Internals</a>.
This describes the class hierarchy so that you know what to override.
<li><i>Note the usage of PFTO.</i> Some compilers fail to provide support for
partial function template ordering. The serialization library works around this by
using <a target="detail" href="implementation.html#functiontemplateordering">
<b>P</b>artial <b>F</b>unction <b>T</b>emplate <b>O</b>rdering</a> in several places.
This is done
in several places, including the archive classes themselves.
<li><i>Base class functions will usually need to be explicitly invoked.</i>
We commonly specialize the function name <code style="white-space: normal">save_override</code>
for saving primitives. Usage of a function name in a derived class
+2 -2
View File
@@ -568,10 +568,10 @@ void myclass::serialize(Archive & ar, const unsigned int version){
...
}
BOOST_CLASS_EXPORT_IMPLEMENT(my_class)
BOOST_EXPORT_CLASS_IMPLEMENT(my_class)
#include &lt;boost/archive/text_oarchive&gt;
#include &lt;boost/archive/text_iarchive&gt;
#include &lt;boost/archive/text_iarchive&lt;
template myclass::serialize(boost::archive::text_oarchive & ar, const unsigned int version);
template myclass::serialize(boost::archive::text_iarchive & ar, const unsigned int version);
... // repeat for each archive class to be used.
+7 -7
View File
@@ -26,11 +26,11 @@
/////////////////////////////////////////////////////////////
// The intent of this program is to serve as a tutorial for
// users of the serialization package. An attempt has been made
// to illustrate most of the facilities of the package.
// to illustrate most of the facilities of the package.
//
// The intent is to create an example suffciently complete to
// illustrate the usage and utility of the package while
// including a minimum of other code.
// including a minimum of other code.
//
// This illustration models the bus system of a small city.
// This includes, multiple bus stops, bus routes and schedules.
@@ -57,7 +57,7 @@ class gps_position
public:
// every serializable class needs a constructor
gps_position(){};
gps_position(int _d, int _m, float _s) :
gps_position(int _d, int _m, float _s) :
degrees(_d), minutes(_m), seconds(_s)
{}
};
@@ -147,7 +147,7 @@ class bus_stop_destination : public bus_stop
ar & boost::serialization::base_object<bus_stop>(*this) & name;
}
public:
bus_stop_destination(){}
bus_stop_destination(
const gps_position & _lat, const gps_position & _long, const std::string & _name
@@ -213,7 +213,7 @@ std::ostream & operator<<(std::ostream &os, const bus_route &br)
// Illustrates serialization of STL objects(pair) in a non-intrusive way.
// See definition of operator<< <pair<F, S> >(ar, pair) and others in
// serialization.hpp
//
//
// illustrates nesting of serializable classes
//
// illustrates use of version number to automatically grandfather older
@@ -299,7 +299,7 @@ restore_schedule(bus_schedule &s, const char * filename)
}
int main(int argc, char *argv[])
{
{
// make the schedule
bus_schedule original_schedule;
@@ -351,7 +351,7 @@ int main(int argc, char *argv[])
// display the complete schedule
std::cout << "original schedule";
std::cout << original_schedule;
std::string filename(boost::archive::tmpdir());
filename += "/demofile.txt";
+3 -3
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_auto_ptr.cpp
// (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -14,7 +14,7 @@
#include <cstdio> // remove, std::autoptr inteface wrong in dinkumware
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
namespace std{
using ::remove;
}
#endif
@@ -25,7 +25,7 @@ namespace std{
#include <boost/serialization/split_free.hpp>
namespace boost {
namespace boost {
namespace serialization {
/////////////////////////////////////////////////////////////
+9 -9
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// A.hpp simple class test
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -25,7 +25,7 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::rand;
using ::rand;
using ::fabs;
using ::size_t;
}
@@ -229,12 +229,12 @@ inline bool A::operator==(const A &rhs) const
if(o != rhs.o)
return false;
if(p != rhs.p)
return false;
return false;
if(q != rhs.q)
return false;
#ifndef BOOST_NO_CWCHAR
if(r != rhs.r)
return false;
return false;
#endif
if(c != rhs.c)
return false;
@@ -243,9 +243,9 @@ inline bool A::operator==(const A &rhs) const
if(t != rhs.t)
return false;
if(u != rhs.u)
return false;
return false;
if(v != rhs.v)
return false;
return false;
if(std::abs( boost::math::float_distance(w, rhs.w)) > 1)
return false;
if(std::abs( boost::math::float_distance(x, rhs.x)) > 1)
@@ -255,7 +255,7 @@ inline bool A::operator==(const A &rhs) const
#ifndef BOOST_NO_STD_WSTRING
if(0 != z.compare(rhs.z))
return false;
#endif
#endif
return true;
}
@@ -297,11 +297,11 @@ inline bool A::operator<(const A &rhs) const
if(t != rhs.t )
return t < rhs.t;
if(u != rhs.u )
return u < rhs.u;
return u < rhs.u;
if(v != rhs.v )
return v < rhs.v;
if(w != rhs.w )
return w < rhs.w;
return w < rhs.w;
if(x != rhs.x )
return x < rhs.x;
int i = y.compare(rhs.y);
+6 -6
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// B.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -22,7 +22,7 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::rand;
using ::rand;
}
#endif
@@ -101,10 +101,10 @@ inline bool B::operator==(const B &rhs) const
{
return
A::operator==(rhs)
&& s == rhs.s
&& t == rhs.t
&& u == rhs.u
&& v == rhs.v
&& s == rhs.s
&& t == rhs.t
&& u == rhs.u
&& v == rhs.v
&& std::abs( boost::math::float_distance(w, rhs.w)) < 2
&& std::abs( boost::math::float_distance(x, rhs.x)) < 2
;
+5 -5
View File
@@ -1,20 +1,20 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_exception.cpp
// (C) Copyright 2002-4 Robert Ramey - http://www.rrsd.com .
// (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)
// Example of safe exception handling for pointer de-serialization
//
// This example was prepared by Robert Ramey to demonstrate and test
//
// This example was prepared by Robert Ramey to demonstrate and test
// safe exception handling during the de-serialization of pointers in
// a non-trivial example.
//
// Hopefully, this addresses exception issues raised by
// Vahan Margaryan who spent considerable time and effort
// in the analysis and testing of issues of exception safety
// in the analysis and testing of issues of exception safety
// of the serialization library.
#include <algorithm>
@@ -26,7 +26,7 @@
#include <cstdio> // remove
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
namespace std{
using ::remove;
}
#endif
+18 -18
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_fast_binary_archive.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -27,19 +27,19 @@
using namespace boost::archive;
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// "Fast" output binary archive. This is a variation of the native binary
// "Fast" output binary archive. This is a variation of the native binary
class fast_binary_oarchive :
// don't derive from binary_oarchive !!!
public binary_oarchive_impl<
fast_binary_oarchive,
std::ostream::char_type,
fast_binary_oarchive,
std::ostream::char_type,
std::ostream::traits_type
>
{
typedef fast_binary_oarchive derived_t;
typedef binary_oarchive_impl<
fast_binary_oarchive,
std::ostream::char_type,
fast_binary_oarchive,
std::ostream::char_type,
std::ostream::traits_type
> base_t;
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -48,15 +48,15 @@ public:
friend class boost::archive::detail::interface_oarchive<derived_t>;
friend class basic_binary_oarchive<derived_t>;
friend class basic_binary_oprimitive<
derived_t,
std::ostream::char_type,
derived_t,
std::ostream::char_type,
std::ostream::traits_type
>;
friend class boost::archive::save_access;
#endif
// add base class to the places considered when matching
// save function to a specific set of arguments. Note, this didn't
// work on my MSVC 7.0 system using
// work on my MSVC 7.0 system using
// binary_oarchive_impl<derived_t>::load_override;
// so we use the sure-fire method below. This failed to work as well
template<class T>
@@ -95,19 +95,19 @@ public:
BOOST_SERIALIZATION_REGISTER_ARCHIVE(fast_binary_oarchive)
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// "Fast" input binary archive. This is a variation of the native binary
// "Fast" input binary archive. This is a variation of the native binary
class fast_binary_iarchive :
// don't derive from binary_oarchive !!!
public binary_iarchive_impl<
fast_binary_iarchive,
std::istream::char_type,
fast_binary_iarchive,
std::istream::char_type,
std::istream::traits_type
>
{
typedef fast_binary_iarchive derived_t;
typedef binary_iarchive_impl<
fast_binary_iarchive,
std::istream::char_type,
fast_binary_iarchive,
std::istream::char_type,
std::istream::traits_type
> base_t;
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -116,15 +116,15 @@ public:
friend class boost::archive::detail::interface_iarchive<derived_t>;
friend class basic_binary_iarchive<derived_t>;
friend class basic_binary_iprimitive<
derived_t,
std::ostream::char_type,
derived_t,
std::ostream::char_type,
std::ostream::traits_type
>;
friend class boost::archive::load_access;
#endif
// add base class to the places considered when matching
// save function to a specific set of arguments. Note, this didn't
// work on my MSVC 7.0 system using
// work on my MSVC 7.0 system using
// binary_oarchive_impl<derived_t>::load_override;
// so we use the sure-fire method below. This failed to work as well
template<class T>
@@ -166,7 +166,7 @@ int main( int argc, char* argv[] )
int a1[3] = {4, 5, 6};
std::stringstream ss;
{
{
fast_binary_oarchive pboa(ss);
pboa << a;
}
+2 -2
View File
@@ -51,7 +51,7 @@ class gps_position
public:
// every serializable class needs a constructor
gps_position(){};
gps_position(int _d, int _m, float _s) :
gps_position(int _d, int _m, float _s) :
degrees(_d), minutes(_m), seconds(_s)
{}
};
@@ -209,7 +209,7 @@ std::ostream & operator<<(std::ostream &os, const bus_route &br)
//
// Illustrates serialization of STL objects(pair) in a non-intrusive way.
// See definition of operator<< <pair<F, S> >(ar, pair)
//
//
// illustrates nesting of serializable classes
//
// illustrates use of version number to automatically grandfather older
+1 -1
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_pimpl.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
+4 -4
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_pimpl_A.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -31,15 +31,15 @@ template<class Archive>
void A::serialize(Archive & ar, const unsigned int /* file_version */){
ar & pimpl;
}
// without the explicit instantiations below, the program will
// fail to link for lack of instantiantiation of the above function
// note: the following failed to fix link errors for vc 7.0 !
template void A::serialize<boost::archive::text_iarchive>(
boost::archive::text_iarchive & ar,
boost::archive::text_iarchive & ar,
const unsigned int file_version
);
template void A::serialize<boost::archive::text_oarchive>(
boost::archive::text_oarchive & ar,
boost::archive::text_oarchive & ar,
const unsigned int file_version
);
+1 -1
View File
@@ -4,7 +4,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_pimpl_A.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
+3 -3
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_polymorphic.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -29,7 +29,7 @@ int main(int argc, char* argv[])
// instantiate archive which inhertis polymorphic interface
// and the normal text archive implementation
boost::archive::polymorphic_text_oarchive oa(ss);
boost::archive::polymorphic_oarchive & oa_interface = oa;
boost::archive::polymorphic_oarchive & oa_interface = oa;
// we can just just the interface for saving
oa_interface << a;
}
@@ -53,7 +53,7 @@ int main(int argc, char* argv[])
{
// see above
boost::archive::polymorphic_binary_iarchive ia(ss);
boost::archive::polymorphic_iarchive & ia_interface = ia;
boost::archive::polymorphic_iarchive & ia_interface = ia;
// use just the polymorphic interface for loading.
ia_interface >> a1;
}
+3 -3
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_polymorphic_A.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -16,11 +16,11 @@
// used by this demo.
template
void A::serialize<boost::archive::polymorphic_iarchive>(
boost::archive::polymorphic_iarchive &,
boost::archive::polymorphic_iarchive &,
const unsigned int
);
template
void A::serialize<boost::archive::polymorphic_oarchive>(
boost::archive::polymorphic_oarchive &,
boost::archive::polymorphic_oarchive &,
const unsigned int
);
+2 -2
View File
@@ -4,7 +4,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// demo_polymorphic_A.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -22,7 +22,7 @@ struct A {
// class a contains a pointer to a "hidden" declaration
template<class Archive>
void serialize(
Archive & ar,
Archive & ar,
const unsigned int file_version
){
ar & data;
+5 -5
View File
@@ -43,8 +43,8 @@ public:
c == rhs.c
&& i == rhs.i
&& i2 == rhs.i2
&& ui == rhs.ui
&& l == rhs.l
&& ui == rhs.ui
&& l == rhs.l
&& ul == rhs.ul
;
}
@@ -65,7 +65,7 @@ int main( int /* argc */, char* /* argv */[] )
A a1;
std::stringstream ss;
{
{
portable_binary_oarchive pboa(ss);
pboa << a;
}
@@ -77,7 +77,7 @@ int main( int /* argc */, char* /* argv */[] )
return 1;
ss.clear();
{
{
portable_binary_oarchive pboa(ss, endian_big);
pboa << a;
}
@@ -89,7 +89,7 @@ int main( int /* argc */, char* /* argv */[] )
return 1;
ss.clear();
{
{
portable_binary_oarchive pboa(ss, endian_big);
pboa << a;
}
+1 -1
View File
@@ -18,7 +18,7 @@
#include <cstdio> // remove
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
namespace std{
using ::remove;
}
#endif
+1 -1
View File
@@ -14,7 +14,7 @@
#include "simple_log_archive.hpp"
int main(int argc, char *argv[])
{
{
// make the schedule
bus_schedule schedule;
+2 -2
View File
@@ -18,7 +18,7 @@ public:
//////////////////////////////////////////////////////////
// public interface used by programs that use the
// serialization library
typedef boost::mpl::bool_<true> is_saving;
typedef boost::mpl::bool_<true> is_saving;
typedef boost::mpl::bool_<false> is_loading;
template<class T> void register_type(){}
template<class T> trivial_oarchive & operator<<(const T & t){
@@ -33,7 +33,7 @@ public:
#include "demo_gps.hpp"
int main(int argc, char *argv[])
{
{
// make the schedule
bus_schedule schedule;
+3 -3
View File
@@ -15,7 +15,7 @@
#include <cstdio> // remove
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
namespace std{
using ::remove;
}
#endif
@@ -47,7 +47,7 @@ restore_schedule(bus_schedule &s, const char * filename)
}
int main(int argc, char *argv[])
{
{
// make the schedule
bus_schedule original_schedule;
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
// display the complete schedule
std::cout << "original schedule";
std::cout << original_schedule;
std::string filename(boost::archive::tmpdir());
filename += "/demo.xml";
+2 -2
View File
@@ -51,7 +51,7 @@ class gps_position
public:
// every serializable class needs a constructor
gps_position(){};
gps_position(int _d, int _m, float _s) :
gps_position(int _d, int _m, float _s) :
degrees(_d), minutes(_m), seconds(_s)
{}
};
@@ -209,7 +209,7 @@ std::ostream & operator<<(std::ostream &os, const bus_route &br)
//
// Illustrates serialization of STL objects(pair) in a non-intrusive way.
// See definition of operator<< <pair<F, S> >(ar, pair)
//
//
// illustrates nesting of serializable classes
//
// illustrates use of version number to automatically grandfather older
+1 -1
View File
@@ -28,7 +28,7 @@ restore_schedule(bus_schedule &s, const char * filename)
}
int main(int argc, char *argv[])
{
{
// make a new schedule
bus_schedule new_schedule;
+2 -2
View File
@@ -24,7 +24,7 @@ void save_schedule(const bus_schedule &s, const char * filename){
}
int main(int argc, char *argv[])
{
{
// make the schedule
bus_schedule original_schedule;
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
// display the complete schedule
std::cout << "original schedule";
std::cout << original_schedule;
std::string filename(boost::archive::tmpdir());
filename += "/demo_save.xml";
+1 -1
View File
@@ -17,7 +17,7 @@ int main(int argc, char *argv[]){
}
std::filebuf fb;
fb.open(
argv[1],
argv[1],
std::ios_base::binary | std::ios_base::in | std::ios_base::out
);
if(!fb.is_open()){
+1 -1
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// log_archive.cpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
+3 -3
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// log_archive.hpp
// (C) Copyright 2010 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2010 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)
@@ -31,7 +31,7 @@ namespace boost {
// of text output which is useful for getting a formatted display of
// any serializable class. Intended to be useful as a debugging aid.
class log_archive :
/* protected ? */
/* protected ? */
public boost::archive::xml_oarchive_impl<log_archive>
{
typedef boost::archive::xml_oarchive_impl<log_archive> base;
@@ -72,7 +72,7 @@ class log_archive :
public:
log_archive(std::ostream & os, unsigned int flags = 0) :
boost::archive::xml_oarchive_impl<log_archive>(
os,
os,
flags | boost::archive::no_header
)
{}
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_portable_binary_iarchive.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -22,8 +22,8 @@ namespace boost {
namespace archive {
template class binary_iarchive_impl<
polymorphic_portable_binary_iarchive,
std::istream::char_type,
polymorphic_portable_binary_iarchive,
std::istream::char_type,
std::istream::traits_type
>;
template class detail::archive_pointer_iserializer<
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_portable_binary_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_portable_binary_oarchive.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -23,8 +23,8 @@ namespace archive {
// explicitly instantiate for this type of binary stream
template class binary_oarchive_impl<
polymorphic_portable_binary_oarchive,
std::ostream::char_type,
polymorphic_portable_binary_oarchive,
std::ostream::char_type,
std::ostream::traits_type
>;
template class detail::archive_pointer_oserializer<
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// polymorphic_portable_binary_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
+2 -2
View File
@@ -1,7 +1,7 @@
#ifndef PORTABLE_BINARY_ARCHIVE_HPP
#define PORTABLE_BINARY_ARCHIVE_HPP
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -21,7 +21,7 @@
#endif
#include <boost/archive/basic_archive.hpp>
#include <boost/predef/other/endian.h>
#include <boost/detail/endian.hpp>
enum portable_binary_archive_flags {
endian_big = 0x4000,
+9 -9
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// portable_binary_iarchive.cpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -11,13 +11,13 @@
#include <istream>
#include <string>
#include <boost/predef/other/endian.h>
#include <boost/detail/endian.hpp>
#include <boost/serialization/throw_exception.hpp>
#include <boost/archive/archive_exception.hpp>
#include "portable_binary_iarchive.hpp"
void
void
portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
char size;
l = 0;
@@ -37,18 +37,18 @@ portable_binary_iarchive::load_impl(boost::intmax_t & l, char maxsize){
);
char * cptr = reinterpret_cast<char *>(& l);
#if BOOST_ENDIAN_BIG_BYTE
#ifdef BOOST_BIG_ENDIAN
cptr += (sizeof(boost::intmax_t) - size);
#endif
this->primitive_base_t::load_binary(cptr, size);
#if BOOST_ENDIAN_BIG_BYTE
#ifdef BOOST_BIG_ENDIAN
if(m_flags & endian_little)
#else
if(m_flags & endian_big)
#endif
reverse_bytes(size, cptr);
if(negative)
l = -l;
}
@@ -70,7 +70,7 @@ portable_binary_iarchive::load_override(
t.t[cn.size()] = '\0';
}
void
void
portable_binary_iarchive::init(unsigned int flags){
if(0 == (flags & boost::archive::no_header)){
// read signature in an archive version independent manner
@@ -94,7 +94,7 @@ portable_binary_iarchive::init(unsigned int flags){
boost::archive::archive_exception::unsupported_version
)
);
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
this->set_library_version(input_library_version);
//#else
@@ -123,7 +123,7 @@ namespace detail {
template class basic_binary_iprimitive<
portable_binary_iarchive,
std::istream::char_type,
std::istream::char_type,
std::istream::traits_type
> ;
+11 -11
View File
@@ -14,7 +14,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// portable_binary_iarchive.hpp
// (C) Copyright 2002-7 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2002-7 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)
@@ -34,7 +34,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// exception to be thrown if integer read from archive doesn't fit
// variable being loaded
class portable_binary_iarchive_exception :
class portable_binary_iarchive_exception :
public boost::archive::archive_exception
{
public:
@@ -62,13 +62,13 @@ public:
};
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// "Portable" input binary archive. It addresses integer size and endienness so
// "Portable" input binary archive. It addresses integer size and endienness so
// that binary archives can be passed across systems. Note:floating point types
// not addressed here
class portable_binary_iarchive :
public boost::archive::basic_binary_iprimitive<
portable_binary_iarchive,
std::istream::char_type,
std::istream::char_type,
std::istream::traits_type
>,
public boost::archive::detail::common_iarchive<
@@ -77,7 +77,7 @@ class portable_binary_iarchive :
{
typedef boost::archive::basic_binary_iprimitive<
portable_binary_iarchive,
std::istream::char_type,
std::istream::char_type,
std::istream::traits_type
> primitive_base_t;
typedef boost::archive::detail::common_iarchive<
@@ -148,21 +148,21 @@ protected:
void load(unsigned char & t){
this->primitive_base_t::load(t);
}
typedef boost::archive::detail::common_iarchive<portable_binary_iarchive>
typedef boost::archive::detail::common_iarchive<portable_binary_iarchive>
detail_common_iarchive;
template<class T>
void load_override(T & t){
this->detail_common_iarchive::load_override(t);
}
void load_override(boost::archive::class_name_type & t);
// binary files don't include the optional information
// binary files don't include the optional information
void load_override(boost::archive::class_id_optional_type &){}
void init(unsigned int flags);
public:
portable_binary_iarchive(std::istream & is, unsigned flags = 0) :
primitive_base_t(
* is.rdbuf(),
* is.rdbuf(),
0 != (flags & boost::archive::no_codecvt)
),
archive_base_t(flags),
@@ -173,13 +173,13 @@ public:
portable_binary_iarchive(
std::basic_streambuf<
std::istream::char_type,
std::istream::char_type,
std::istream::traits_type
> & bsb,
> & bsb,
unsigned int flags
) :
primitive_base_t(
bsb,
bsb,
0 != (flags & boost::archive::no_codecvt)
),
archive_base_t(flags),
+6 -6
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// portable_binary_oarchive.cpp
// (C) Copyright 2002-7 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2002-7 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)
@@ -9,10 +9,10 @@
// See http://www.boost.org for updates, documentation, and revision history.
#include <ostream>
#include <boost/predef/other/endian.h>
#include <boost/detail/endian.hpp>
#include "portable_binary_oarchive.hpp"
void
void
portable_binary_oarchive::save_impl(
const boost::intmax_t l,
const char maxsize
@@ -45,7 +45,7 @@ portable_binary_oarchive::save_impl(
else
ll = l;
char * cptr = reinterpret_cast<char *>(& ll);
#if BOOST_ENDIAN_BIG_BYTE
#ifdef BOOST_BIG_ENDIAN
cptr += (sizeof(boost::intmax_t) - size);
if(m_flags & endian_little)
reverse_bytes(size, cptr);
@@ -56,7 +56,7 @@ portable_binary_oarchive::save_impl(
this->primitive_base_t::save_binary(cptr, size);
}
void
void
portable_binary_oarchive::init(unsigned int flags) {
if(m_flags == (endian_big | endian_little)){
boost::serialization::throw_exception(
@@ -90,7 +90,7 @@ namespace detail {
template class basic_binary_oprimitive<
portable_binary_oarchive,
std::ostream::char_type,
std::ostream::char_type,
std::ostream::traits_type
> ;
+11 -11
View File
@@ -14,7 +14,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// portable_binary_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -33,12 +33,12 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// exception to be thrown if integer read from archive doesn't fit
// variable being loaded
class portable_binary_oarchive_exception :
class portable_binary_oarchive_exception :
public boost::archive::archive_exception
{
public:
typedef enum {
invalid_flags
invalid_flags
} exception_code;
portable_binary_oarchive_exception(exception_code c = invalid_flags )
{}
@@ -56,14 +56,14 @@ public:
};
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// "Portable" output binary archive. This is a variation of the native binary
// "Portable" output binary archive. This is a variation of the native binary
// archive. it addresses integer size and endienness so that binary archives can
// be passed across systems. Note:floating point types not addressed here
class portable_binary_oarchive :
public boost::archive::basic_binary_oprimitive<
portable_binary_oarchive,
std::ostream::char_type,
std::ostream::char_type,
std::ostream::traits_type
>,
public boost::archive::detail::common_oarchive<
@@ -72,7 +72,7 @@ class portable_binary_oarchive :
{
typedef boost::archive::basic_binary_oprimitive<
portable_binary_oarchive,
std::ostream::char_type,
std::ostream::char_type,
std::ostream::traits_type
> primitive_base_t;
typedef boost::archive::detail::common_oarchive<
@@ -128,7 +128,7 @@ protected:
// default processing - kick back to base class. Note the
// extra stuff to get it passed borland compilers
typedef boost::archive::detail::common_oarchive<portable_binary_oarchive>
typedef boost::archive::detail::common_oarchive<portable_binary_oarchive>
detail_common_oarchive;
template<class T>
void save_override(T & t){
@@ -139,7 +139,7 @@ protected:
const std::string s(t);
* this << s;
}
// binary files don't include the optional information
// binary files don't include the optional information
void save_override(
const boost::archive::class_id_optional_type & /* t */
){}
@@ -159,13 +159,13 @@ public:
portable_binary_oarchive(
std::basic_streambuf<
std::ostream::char_type,
std::ostream::char_type,
std::ostream::traits_type
> & bsb,
> & bsb,
unsigned int flags
) :
primitive_base_t(
bsb,
bsb,
0 != (flags & boost::archive::no_codecvt)
),
archive_base_t(flags),
+10 -10
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// simple_log_archive.hpp
// (C) Copyright 2010 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2010 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)
@@ -21,8 +21,8 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
namespace std{
using ::size_t;
} // namespace std
#endif
@@ -65,15 +65,15 @@ class simple_log_archive {
// make sure call is routed through the highest interface that might
// be specialized by the user.
boost::serialization::serialize_adl(
ar,
const_cast<T &>(t),
ar,
const_cast<T &>(t),
::boost::serialization::version< T >::value
);
}
};
template<class T>
void save(const T &t){
typedef
typedef
BOOST_DEDUCED_TYPENAME boost::mpl::eval_if<boost::is_enum< T >,
boost::mpl::identity<save_enum_type<simple_log_archive> >,
//else
@@ -88,7 +88,7 @@ class simple_log_archive {
boost::mpl::identity<save_only<simple_log_archive> >
> >::type typex;
typex::invoke(*this, t);
}
}
#ifndef BOOST_NO_STD_WSTRING
void save(const std::wstring &ws){
m_os << "wide string types not suported in log archive";
@@ -110,12 +110,12 @@ public:
return 0;
}
void
void
save_binary(const void *address, std::size_t count){
m_os << "save_binary not implemented";
}
// the << operators
// the << operators
template<class T>
simple_log_archive & operator<<(T const & t){
m_os << ' ';
@@ -151,7 +151,7 @@ public:
return * this;
}
// the & operator
// the & operator
template<class T>
simple_log_archive & operator&(const T & t){
return * this << t;
+11 -11
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// archive/archive_exception.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -20,16 +20,16 @@
#include <boost/assert.hpp>
#include <string>
#include <boost/config.hpp>
#include <boost/config.hpp>
#include <boost/archive/detail/decl.hpp>
// note: the only reason this is in here is that windows header
// includes #define exception_code _exception_code (arrrgghhhh!).
// the most expedient way to address this is be sure that this
// header is always included whenever this header file is included.
#if defined(BOOST_WINDOWS)
#include <excpt.h>
#endif
#if defined(BOOST_WINDOWS)
#include <excpt.h>
#endif
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -39,7 +39,7 @@ namespace archive {
//////////////////////////////////////////////////////////////////////
// exceptions thrown by archives
//
class BOOST_SYMBOL_VISIBLE archive_exception :
class BOOST_SYMBOL_VISIBLE archive_exception :
public virtual std::exception
{
private:
@@ -61,8 +61,8 @@ public:
// subsequent to this one
pointer_conflict, // an attempt has been made to directly
// serialize an object which has
// already been serialized through a pointer.
// Were this permitted, the archive load would result
// already been serialized through a pointer.
// Were this permitted, the archive load would result
// in the creation of an extra copy of the obect.
incompatible_native_format, // attempt to read native binary format
// on incompatible platform
@@ -71,9 +71,9 @@ public:
invalid_class_name, // class name greater than the maximum permitted.
// most likely a corrupted archive or an attempt
// to insert virus via buffer overrun method.
unregistered_cast, // base - derived relationship not registered with
unregistered_cast, // base - derived relationship not registered with
// void_cast_register
unsupported_class_version, // type saved with a version # greater than the
unsupported_class_version, // type saved with a version # greater than the
// one used by the program. This indicates that the program
// needs to be rebuilt.
multiple_code_instantiation, // code for implementing serialization for some
@@ -83,7 +83,7 @@ public:
exception_code code;
BOOST_ARCHIVE_DECL archive_exception(
exception_code c,
exception_code c,
const char * e1 = NULL,
const char * e2 = NULL
) BOOST_NOEXCEPT;
+37 -40
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_archive.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -46,27 +46,27 @@ public:
explicit library_version_type(const unsigned int & t_) : t(t_){
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
library_version_type(const library_version_type & t_) :
library_version_type(const library_version_type & t_) :
t(t_.t)
{}
library_version_type & operator=(const library_version_type & rhs){
t = rhs.t;
t = rhs.t;
return *this;
}
// used for text output
operator base_type () const {
return t;
}
}
// used for text input
operator base_type & (){
return t;
}
}
bool operator==(const library_version_type & rhs) const {
return t == rhs.t;
}
}
bool operator<(const library_version_type & rhs) const {
return t < rhs.t;
}
}
};
BOOST_ARCHIVE_DECL library_version_type
@@ -82,27 +82,27 @@ public:
explicit version_type(const unsigned int & t_) : t(t_){
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
version_type(const version_type & t_) :
version_type(const version_type & t_) :
t(t_.t)
{}
version_type & operator=(const version_type & rhs){
t = rhs.t;
t = rhs.t;
return *this;
}
// used for text output
operator base_type () const {
return t;
}
}
// used for text intput
operator base_type & (){
return t;
}
}
bool operator==(const version_type & rhs) const {
return t == rhs.t;
}
}
bool operator<(const version_type & rhs) const {
return t < rhs.t;
}
}
};
class class_id_type {
@@ -118,31 +118,31 @@ public:
explicit class_id_type(const std::size_t t_) : t(t_){
// BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
class_id_type(const class_id_type & t_) :
class_id_type(const class_id_type & t_) :
t(t_.t)
{}
class_id_type & operator=(const class_id_type & rhs){
t = rhs.t;
t = rhs.t;
return *this;
}
// used for text output
operator base_type () const {
operator int () const {
return t;
}
}
// used for text input
operator base_type &() {
operator int_least16_t &() {
return t;
}
}
bool operator==(const class_id_type & rhs) const {
return t == rhs.t;
}
}
bool operator<(const class_id_type & rhs) const {
return t < rhs.t;
}
}
};
#define BOOST_SERIALIZATION_NULL_POINTER_TAG boost::archive::class_id_type(-1)
#define NULL_POINTER_TAG boost::archive::class_id_type(-1)
class object_id_type {
private:
@@ -151,33 +151,30 @@ private:
public:
object_id_type(): t(0) {};
// note: presumes that size_t >= unsigned int.
// use explicit cast to silence useless warning
explicit object_id_type(const std::size_t & t_) : t(static_cast<base_type>(t_)){
// make quadriple sure that we haven't lost any real integer
// precision
explicit object_id_type(const std::size_t & t_) : t(t_){
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
}
object_id_type(const object_id_type & t_) :
object_id_type(const object_id_type & t_) :
t(t_.t)
{}
object_id_type & operator=(const object_id_type & rhs){
t = rhs.t;
t = rhs.t;
return *this;
}
// used for text output
operator base_type () const {
operator uint_least32_t () const {
return t;
}
}
// used for text input
operator base_type & () {
operator uint_least32_t & () {
return t;
}
}
bool operator==(const object_id_type & rhs) const {
return t == rhs.t;
}
}
bool operator<(const object_id_type & rhs) const {
return t < rhs.t;
}
}
};
#if defined(_MSC_VER)
@@ -214,8 +211,8 @@ struct tracking_type {
}
};
struct class_name_type :
private boost::noncopyable
struct class_name_type :
private boost::noncopyable
{
char *t;
operator const char * & () const {
@@ -227,9 +224,9 @@ struct class_name_type :
std::size_t size() const {
return std::strlen(t);
}
explicit class_name_type(const char *key_)
explicit class_name_type(const char *key_)
: t(const_cast<char *>(key_)){}
explicit class_name_type(char *key_)
explicit class_name_type(char *key_)
: t(key_){}
class_name_type & operator=(const class_name_type & rhs){
t = rhs.t;
@@ -249,7 +246,7 @@ BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_SIGNATURE();
/* NOTE : Warning : Warning : Warning : Warning : Warning
* If any of these are changed to different sized types,
* If any of these are changed to different sized types,
* binary_iarchive won't be able to read older archives
* unless you rev the library version and include conditional
* code based on the library version. There is nothing
@@ -291,7 +288,7 @@ BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
#include <boost/serialization/is_bitwise_serializable.hpp>
// set types used internally by the serialization library
// set types used internally by the serialization library
// to be bitwise serializable
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::library_version_type)
+14 -26
View File
@@ -16,7 +16,7 @@
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -40,7 +40,7 @@
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace boost {
namespace archive {
namespace detail {
@@ -50,7 +50,7 @@ namespace detail {
/////////////////////////////////////////////////////////////////////////
// class basic_binary_iarchive - read serialized objects from a input binary stream
template<class Archive>
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
public detail::common_iarchive<Archive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -66,7 +66,7 @@ protected:
#endif
#endif
// intermediate level to support override of operators
// fot templates in the absence of partial function
// fot templates in the absence of partial function
// template ordering. If we get here pass to base class
// note extra nonsense to sneak it pass the borland compiers
typedef detail::common_iarchive<Archive> detail_common_iarchive;
@@ -84,7 +84,7 @@ protected:
BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
// binary files don't include the optional information
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */){}
void load_override(tracking_type & t, int /*version*/){
@@ -102,32 +102,20 @@ protected:
}
void load_override(class_id_type & t){
library_version_type lvt = this->get_library_version();
/*
* library versions:
* boost 1.39 -> 5
* boost 1.43 -> 7
* boost 1.47 -> 9
*
*
* 1) in boost 1.43 and inferior, class_id_type is always a 16bit value, with no check on the library version
* --> this means all archives with version v <= 7 are written with a 16bit class_id_type
* 2) in boost 1.44 this load_override has disappeared (and thus boost 1.44 is not backward compatible at all !!)
* 3) recent boosts reintroduced load_override with a test on the version :
* - v > 7 : this->detail_common_iarchive::load_override(t, version)
* - v > 6 : 16bit
* - other : 32bit
* --> which is obviously incorrect, see point 1
*
* the fix here decodes class_id_type on 16bit for all v <= 7, which seems to be the correct behaviour ...
*/
if(boost::archive::library_version_type(7) < lvt){
this->detail_common_iarchive::load_override(t);
}
else{
else
if(boost::archive::library_version_type(6) < lvt){
int_least16_t x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
else{
int x=0;
* this->This() >> x;
t = boost::archive::class_id_type(x);
}
}
void load_override(class_id_reference_type & t){
load_override(static_cast<class_id_type &>(t));
@@ -191,14 +179,14 @@ protected:
unsigned int x=0;
* this->This() >> x;
t = serialization::collection_size_type(x);
}
}
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_name_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
init();
basic_binary_iarchive(unsigned int flags) :
detail::common_iarchive<Archive>(flags)
{}
@@ -20,7 +20,7 @@
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
// ON PLATFORM APART FROM THE ONE THEY ARE CREATED ON
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -37,8 +37,8 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::memcpy;
namespace std{
using ::memcpy;
using ::size_t;
} // namespace std
#endif
@@ -50,7 +50,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -58,7 +58,7 @@ namespace std{
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace boost {
namespace archive {
/////////////////////////////////////////////////////////////////////////////
@@ -98,8 +98,8 @@ public:
/////////////////////////////////////////////////////////
// fundamental types that need special treatment
// trap usage of invalid uninitialized boolean
// trap usage of invalid uninitialized boolean
void load(bool & t){
load_binary(& t, sizeof(t));
int i = t;
@@ -119,29 +119,29 @@ public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
init();
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_binary_iprimitive(
std::basic_streambuf<Elem, Tr> & sb,
std::basic_streambuf<Elem, Tr> & sb,
bool no_codecvt
);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
~basic_binary_iprimitive();
public:
// we provide an optimized load for all fundamental types
// typedef serialization::is_bitwise_serializable<mpl::_1>
// typedef serialization::is_bitwise_serializable<mpl::_1>
// use_array_optimization;
struct use_array_optimization {
template <class T>
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
struct apply {
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
struct use_array_optimization {
template <class T>
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
struct apply {
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
};
#else
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
#endif
};
// the optimized load_array dispatches to load_binary
// the optimized load_array dispatches to load_binary
template <class ValueType>
void load_array(serialization::array_wrapper<ValueType>& a, unsigned int)
{
@@ -155,17 +155,17 @@ public:
template<class Archive, class Elem, class Tr>
inline void
basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
void *address,
void *address,
std::size_t count
){
// note: an optimizer should eliminate the following for char files
BOOST_ASSERT(
static_cast<std::streamsize>(count / sizeof(Elem))
static_cast<std::streamsize>(count / sizeof(Elem))
<= boost::integer_traits<std::streamsize>::const_max
);
std::streamsize s = static_cast<std::streamsize>(count / sizeof(Elem));
std::streamsize scount = m_sb.sgetn(
static_cast<Elem *>(address),
static_cast<Elem *>(address),
s
);
if(scount != s)
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_binary_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -58,7 +58,7 @@ namespace detail {
// does have the virtue of buiding the smalles archive in the minimum amount
// of time. So under some circumstances it may be he right choice.
template<class Archive>
class BOOST_SYMBOL_VISIBLE basic_binary_oarchive :
class BOOST_SYMBOL_VISIBLE basic_binary_oarchive :
public detail::common_oarchive<Archive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -90,7 +90,7 @@ protected:
BOOST_STATIC_ASSERT(sizeof(object_id_type) == sizeof(uint_least32_t));
BOOST_STATIC_ASSERT(sizeof(object_reference_type) == sizeof(uint_least32_t));
// binary files don't include the optional information
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */){}
// enable this if we decide to support generation of previous versions
@@ -159,7 +159,7 @@ protected:
unsigned int x=0;
* this->This() >> x;
t = serialization::collection_size_type(x);
}
}
else{
* this->This() >> t;
}
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_binary_oprimitive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -32,8 +32,8 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
namespace std{
using ::size_t;
} // namespace std
#endif
@@ -45,7 +45,7 @@ namespace std{
//#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/codecvt_null.hpp>
@@ -93,7 +93,7 @@ public:
/////////////////////////////////////////////////////////
// fundamental types that need special treatment
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
void save(const bool t){
@@ -113,32 +113,32 @@ public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
init();
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_binary_oprimitive(
std::basic_streambuf<Elem, Tr> & sb,
std::basic_streambuf<Elem, Tr> & sb,
bool no_codecvt
);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
~basic_binary_oprimitive();
public:
// we provide an optimized save for all fundamental types
// typedef serialization::is_bitwise_serializable<mpl::_1>
// typedef serialization::is_bitwise_serializable<mpl::_1>
// use_array_optimization;
// workaround without using mpl lambdas
struct use_array_optimization {
template <class T>
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
struct apply {
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
template <class T>
#if defined(BOOST_NO_DEPENDENT_NESTED_DERIVATIONS)
struct apply {
typedef typename boost::serialization::is_bitwise_serializable< T >::type type;
};
#else
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
#endif
};
// the optimized save_array dispatches to save_binary
// the optimized save_array dispatches to save_binary
template <class ValueType>
void save_array(boost::serialization::array_wrapper<ValueType> const& a, unsigned int)
{
@@ -149,9 +149,9 @@ public:
};
template<class Archive, class Elem, class Tr>
inline void
inline void
basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
const void *address,
const void *address,
std::size_t count
){
// BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
@@ -166,7 +166,7 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
// figure number of elements to output - round up
count = ( count + sizeof(Elem) - 1) / sizeof(Elem);
std::streamsize scount = m_sb.sputn(
static_cast<const Elem *>(address),
static_cast<const Elem *>(address),
static_cast<std::streamsize>(count)
);
if(count != static_cast<std::size_t>(scount))
@@ -174,14 +174,14 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
archive_exception(archive_exception::output_stream_error)
);
//os.write(
// static_cast<const typename OStream::char_type *>(address),
// static_cast<const typename OStream::char_type *>(address),
// count
//);
//BOOST_ASSERT(os.good());
}
} //namespace boost
} //namespace archive
} //namespace boost
} //namespace archive
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_text_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -21,7 +21,7 @@
//
// note the fact that on libraries without wide characters, ostream is
// is not a specialization of basic_ostream which in fact is not defined
// in such cases. So we can't use basic_istream<IStream::char_type> but rather
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
// use two template parameters
#include <boost/config.hpp>
@@ -46,7 +46,7 @@ namespace detail {
/////////////////////////////////////////////////////////////////////////
// class basic_text_iarchive - read serialized objects from a input text stream
template<class Archive>
class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
public detail::common_iarchive<Archive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -62,14 +62,14 @@ protected:
#endif
#endif
// intermediate level to support override of operators
// fot templates in the absence of partial function
// fot templates in the absence of partial function
// template ordering
typedef detail::common_iarchive<Archive> detail_common_iarchive;
template<class T>
void load_override(T & t){
this->detail_common_iarchive::load_override(t);
}
// text file don't include the optional information
// text file don't include the optional information
void load_override(class_id_optional_type & /*t*/){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
@@ -78,7 +78,7 @@ protected:
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
init(void);
basic_text_iarchive(unsigned int flags) :
basic_text_iarchive(unsigned int flags) :
detail::common_iarchive<Archive>(flags)
{}
~basic_text_iarchive(){}
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_text_iprimitive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -29,8 +29,8 @@
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
namespace std{
using ::size_t;
#if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
using ::locale;
#endif
@@ -121,9 +121,9 @@ protected:
t = i;
}
#endif
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_text_iprimitive(IStream &is, bool no_codecvt);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
~basic_text_iprimitive();
public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_text_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -44,9 +44,9 @@ namespace detail {
} // namespace detail
/////////////////////////////////////////////////////////////////////////
// class basic_text_oarchive
// class basic_text_oarchive
template<class Archive>
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
public detail::common_oarchive<Archive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@@ -89,7 +89,7 @@ protected:
this->detail_common_oarchive::save_override(t);
}
// text file don't include the optional information
// text file don't include the optional information
void save_override(const class_id_optional_type & /* t */){}
void save_override(const class_name_type & t){
+10 -11
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_text_oprimitive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -38,7 +38,7 @@
#endif
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
namespace std{
using ::size_t;
#if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
using ::locale;
@@ -142,23 +142,22 @@ protected:
template<class T>
struct is_float {
typedef typename mpl::bool_<
boost::is_floating_point<T>::value
typedef typename mpl::bool_<
boost::is_floating_point<T>::value
|| (std::numeric_limits<T>::is_specialized
&& !std::numeric_limits<T>::is_integer
&& !std::numeric_limits<T>::is_exact
&& std::numeric_limits<T>::max_exponent)
&& std::numeric_limits<T>::max_exponent)
>::type type;
};
template<class T>
void save_impl(const T &t, boost::mpl::bool_<true> &){
// must be a user mistake - can't serialize un-initialized data
if(os.fail()){
if(os.fail())
boost::serialization::throw_exception(
archive_exception(archive_exception::output_stream_error)
);
}
// The formulae for the number of decimla digits required is given in
// http://www2.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1822.pdf
// which is derived from Kahan's paper:
@@ -182,7 +181,7 @@ protected:
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_text_oprimitive(OStream & os, bool no_codecvt);
BOOST_ARCHIVE_OR_WARCHIVE_DECL
BOOST_ARCHIVE_OR_WARCHIVE_DECL
~basic_text_oprimitive();
public:
// unformatted append of one character
@@ -198,12 +197,12 @@ public:
while('\0' != *s)
os.put(*s++);
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
save_binary(const void *address, std::size_t count);
};
} //namespace boost
} //namespace archive
} //namespace boost
} //namespace archive
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
+10 -10
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_archive.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -21,40 +21,40 @@
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace boost {
namespace archive {
// constant strings used in xml i/o
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_OBJECT_ID();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_OBJECT_REFERENCE();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_CLASS_ID();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_CLASS_NAME();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_TRACKING();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_VERSION();
extern
extern
BOOST_ARCHIVE_DECL const char *
BOOST_ARCHIVE_XML_SIGNATURE();
+2 -1
View File
@@ -89,7 +89,8 @@ protected:
// leaving the archive in an undetermined state
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_type & t);
void load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(class_id_optional_type & /* t */){}
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
load_override(object_id_type & t);
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
+5 -9
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -33,8 +33,8 @@ namespace archive {
// preserve correct static polymorphism.
class BOOST_SYMBOL_VISIBLE binary_iarchive :
public binary_iarchive_impl<
boost::archive::binary_iarchive,
std::istream::char_type,
boost::archive::binary_iarchive,
std::istream::char_type,
std::istream::traits_type
>{
public:
@@ -42,16 +42,12 @@ public:
binary_iarchive_impl<
binary_iarchive, std::istream::char_type, std::istream::traits_type
>(is, flags)
{
init(flags);
}
{}
binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
binary_iarchive_impl<
binary_iarchive, std::istream::char_type, std::istream::traits_type
>(bsb, flags)
{
init(flags);
}
{}
};
} // namespace archive
+13 -9
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_iarchive_impl.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -25,7 +25,7 @@
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace boost {
namespace archive {
namespace detail {
@@ -33,7 +33,7 @@ namespace detail {
} // namespace detail
template<class Archive, class Elem, class Tr>
class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
public basic_binary_iprimitive<Archive, Elem, Tr>,
public basic_binary_iarchive<Archive>
{
@@ -70,25 +70,29 @@ protected:
#endif
}
binary_iarchive_impl(
std::basic_streambuf<Elem, Tr> & bsb,
std::basic_streambuf<Elem, Tr> & bsb,
unsigned int flags
) :
basic_binary_iprimitive<Archive, Elem, Tr>(
bsb,
bsb,
0 != (flags & no_codecvt)
),
basic_binary_iarchive<Archive>(flags)
{}
{
init(flags);
}
binary_iarchive_impl(
std::basic_istream<Elem, Tr> & is,
std::basic_istream<Elem, Tr> & is,
unsigned int flags
) :
basic_binary_iprimitive<Archive, Elem, Tr>(
* is.rdbuf(),
* is.rdbuf(),
0 != (flags & no_codecvt)
),
basic_binary_iarchive<Archive>(flags)
{}
{
init(flags);
}
};
} // namespace archive
+5 -9
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -26,13 +26,13 @@
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace boost {
namespace archive {
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from binary_oarchive_impl instead. This will
// preserve correct static polymorphism.
class BOOST_SYMBOL_VISIBLE binary_oarchive :
class BOOST_SYMBOL_VISIBLE binary_oarchive :
public binary_oarchive_impl<
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
>
@@ -42,16 +42,12 @@ public:
binary_oarchive_impl<
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
>(os, flags)
{
init(flags);
}
{}
binary_oarchive(std::streambuf & bsb, unsigned int flags = 0) :
binary_oarchive_impl<
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
>(bsb, flags)
{
init(flags);
}
{}
};
} // namespace archive
+13 -9
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_oarchive_impl.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -26,7 +26,7 @@
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace boost {
namespace archive {
namespace detail {
@@ -34,7 +34,7 @@ namespace detail {
} // namespace detail
template<class Archive, class Elem, class Tr>
class BOOST_SYMBOL_VISIBLE binary_oarchive_impl :
class BOOST_SYMBOL_VISIBLE binary_oarchive_impl :
public basic_binary_oprimitive<Archive, Elem, Tr>,
public basic_binary_oarchive<Archive>
{
@@ -71,25 +71,29 @@ protected:
#endif
}
binary_oarchive_impl(
std::basic_streambuf<Elem, Tr> & bsb,
std::basic_streambuf<Elem, Tr> & bsb,
unsigned int flags
) :
basic_binary_oprimitive<Archive, Elem, Tr>(
bsb,
bsb,
0 != (flags & no_codecvt)
),
basic_binary_oarchive<Archive>(flags)
{}
{
init(flags);
}
binary_oarchive_impl(
std::basic_ostream<Elem, Tr> & os,
std::basic_ostream<Elem, Tr> & os,
unsigned int flags
) :
basic_binary_oprimitive<Archive, Elem, Tr>(
* os.rdbuf(),
* os.rdbuf(),
0 != (flags & no_codecvt)
),
basic_binary_oarchive<Archive>(flags)
{}
{
init(flags);
}
};
} // namespace archive
+3 -3
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_wiarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -25,10 +25,10 @@
#include <boost/archive/binary_iarchive_impl.hpp>
#include <boost/archive/detail/register_archive.hpp>
namespace boost {
namespace boost {
namespace archive {
class binary_wiarchive :
class binary_wiarchive :
public binary_iarchive_impl<
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
>
+3 -3
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// binary_woarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -25,13 +25,13 @@
#include <boost/archive/binary_oarchive_impl.hpp>
#include <boost/archive/detail/register_archive.hpp>
namespace boost {
namespace boost {
namespace archive {
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from binary_oarchive_impl instead. This will
// preserve correct static polymorphism.
class binary_woarchive :
class binary_woarchive :
public binary_oarchive_impl<
binary_woarchive, std::wostream::char_type, std::wostream::traits_type
>
+4 -8
View File
@@ -18,11 +18,8 @@
#include <locale>
#include <cstddef> // NULL, size_t
#ifndef BOOST_NO_CWCHAR
#include <cwchar> // for mbstate_t
#endif
#include <boost/config.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@@ -63,10 +60,9 @@ public:
};
template<>
class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
public std::codecvt<wchar_t, char, std::mbstate_t>
class BOOST_SYMBOL_VISIBLE codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
{
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_out(
std::mbstate_t & state,
const wchar_t * first1,
@@ -76,7 +72,7 @@ class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
char * last2,
char * & next2
) const;
virtual std::codecvt_base::result
virtual BOOST_WARCHIVE_DECL std::codecvt_base::result
do_in(
std::mbstate_t & state,
const char * first1,
@@ -96,7 +92,7 @@ public:
explicit codecvt_null(std::size_t no_locale_manage = 0) :
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
{}
//virtual ~codecvt_null(){};
virtual ~codecvt_null(){};
};
} // namespace archive
+1 -1
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// abi_prefix.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
+1 -1
View File
@@ -1,7 +1,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// abi_suffix.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -7,10 +7,10 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// archive_serializer_map.hpp: extenstion of type_info required for
// archive_serializer_map.hpp: extenstion of type_info required for
// serialization.
// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2009 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)
@@ -18,7 +18,7 @@
// See http://www.boost.org for updates, documentation, and revision history.
// note: this is nothing more than the thinest of wrappers around
// basic_serializer_map so we can have a one map / archive type.
// basic_serializer_map so we can have a one map / archive type.
#include <boost/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
@@ -16,12 +16,12 @@
// See library home page at http://www.boost.org/libs/serialization
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
// enable automatic library variant selection ------------------------------//
// enable automatic library variant selection ------------------------------//
#include <boost/archive/detail/decl.hpp>
@@ -16,12 +16,12 @@
// See library home page at http://www.boost.org/libs/serialization
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
// enable automatic library variant selection ------------------------------//
// enable automatic library variant selection ------------------------------//
#include <boost/archive/detail/decl.hpp>
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_iarchive.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -72,27 +72,27 @@ public:
const basic_iserializer & bis
);
BOOST_ARCHIVE_DECL void load_object(
void *t,
void *t,
const basic_iserializer & bis
);
BOOST_ARCHIVE_DECL const basic_pointer_iserializer *
BOOST_ARCHIVE_DECL const basic_pointer_iserializer *
load_pointer(
void * & t,
void * & t,
const basic_pointer_iserializer * bpis_ptr,
const basic_pointer_iserializer * (*finder)(
const boost::serialization::extended_type_info & eti
)
);
// real public API starts here
BOOST_ARCHIVE_DECL void
BOOST_ARCHIVE_DECL void
set_library_version(library_version_type archive_library_version);
BOOST_ARCHIVE_DECL library_version_type
BOOST_ARCHIVE_DECL library_version_type
get_library_version() const;
BOOST_ARCHIVE_DECL unsigned int
get_flags() const;
BOOST_ARCHIVE_DECL void
BOOST_ARCHIVE_DECL void
reset_object_address(const void * new_address, const void * old_address);
BOOST_ARCHIVE_DECL void
BOOST_ARCHIVE_DECL void
delete_created_pointers();
};
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_iserializer.hpp: extenstion of type_info required for serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -42,7 +42,7 @@ namespace detail {
class basic_iarchive;
class basic_pointer_iserializer;
class BOOST_SYMBOL_VISIBLE basic_iserializer :
class BOOST_SYMBOL_VISIBLE basic_iserializer :
public basic_serializer
{
private:
@@ -63,7 +63,7 @@ public:
return m_bpis;
}
virtual void load_object_data(
basic_iarchive & ar,
basic_iarchive & ar,
void *x,
const unsigned int file_version
) const = 0;
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_oarchive.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -69,15 +69,15 @@ public:
const basic_oserializer & bos
);
BOOST_ARCHIVE_DECL void save_object(
const void *x,
const void *x,
const basic_oserializer & bos
);
BOOST_ARCHIVE_DECL void save_pointer(
const void * t,
const void * t,
const basic_pointer_oserializer * bpos_ptr
);
void save_null_pointer(){
vsave(BOOST_SERIALIZATION_NULL_POINTER_TAG);
vsave(NULL_POINTER_TAG);
}
// real public interface starts here
BOOST_ARCHIVE_DECL void end_preamble(); // default implementation does nothing
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_oserializer.hpp: extenstion of type_info required for serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -7,10 +7,10 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_pointer_oserializer.hpp: extenstion of type_info required for
// basic_pointer_oserializer.hpp: extenstion of type_info required for
// serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -51,7 +51,7 @@ public:
virtual void * heap_allocation() const = 0;
virtual const basic_iserializer & get_basic_serializer() const = 0;
virtual void load_object_ptr(
basic_iarchive & ar,
basic_iarchive & ar,
void * x,
const unsigned int file_version
) const = 0;
@@ -7,10 +7,10 @@
#endif
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_pointer_oserializer.hpp: extenstion of type_info required for
// basic_pointer_oserializer.hpp: extenstion of type_info required for
// serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -39,7 +39,7 @@ namespace detail {
class basic_oarchive;
class basic_oserializer;
class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer :
class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer :
public basic_serializer
{
protected:
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_serializer.hpp: extenstion of type_info required for serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -32,18 +32,18 @@ namespace boost {
namespace archive {
namespace detail {
class basic_serializer :
class basic_serializer :
private boost::noncopyable
{
const boost::serialization::extended_type_info * m_eti;
protected:
explicit basic_serializer(
const boost::serialization::extended_type_info & eti
) :
) :
m_eti(& eti)
{}
public:
inline bool
inline bool
operator<(const basic_serializer & rhs) const {
// can't compare address since there can be multiple eti records
// for the same type in different execution modules (that is, DLLS)
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_serializer_map.hpp: extenstion of type_info required for serialization.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -24,7 +24,7 @@
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace boost {
namespace serialization {
class extended_type_info;
}
@@ -45,7 +45,7 @@ basic_serializer_map : public
) const ;
};
typedef std::set<
const basic_serializer *,
const basic_serializer *,
type_info_pointer_compare
> map_type;
map_type m_map;
+8 -8
View File
@@ -15,7 +15,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// check.hpp: interface for serialization system.
// (C) Copyright 2009 Robert Ramey - http://www.rrsd.com .
// (C) Copyright 2009 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)
@@ -49,7 +49,7 @@ namespace detail {
template<class T>
inline void check_object_level(){
typedef
typedef
typename mpl::greater_equal<
serialization::implementation_level< T >,
mpl::int_<serialization::primitive_type>
@@ -62,7 +62,7 @@ inline void check_object_level(){
template<class T>
inline void check_object_versioning(){
typedef
typedef
typename mpl::or_<
typename mpl::greater<
serialization::implementation_level< T >,
@@ -90,8 +90,8 @@ inline void check_object_tracking(){
// saving an non-const object of a type not marked "track_never)
// may be an indicator of an error usage of the
// serialization library and should be double checked.
// See documentation on object tracking. Also, see the
// serialization library and should be double checked.
// See documentation on object tracking. Also, see the
// "rationale" section of the documenation
// for motivation for this checking.
@@ -104,7 +104,7 @@ template<class T>
inline void check_pointer_level(){
// we should only invoke this once we KNOW that T
// has been used as a pointer!!
typedef
typedef
typename mpl::or_<
typename mpl::greater<
serialization::implementation_level< T >,
@@ -126,12 +126,12 @@ inline void check_pointer_level(){
// in this case, indication that an object is tracked is
// not stored in the archive itself - see level == object_serializable
// but rather the existence of the operation ar >> T * is used to
// but rather the existence of the operation ar >> T * is used to
// infer that an object of this type should be tracked. So, if
// you save via a pointer but don't load via a pointer the operation
// will fail on load without given any valid reason for the failure.
// So if your program traps here, consider changing the
// So if your program traps here, consider changing the
// tracking or implementation level traits - or not
// serializing via a pointer.
BOOST_STATIC_WARNING(typex::value);
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// common_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -35,15 +35,14 @@ class extended_type_info;
// note: referred to as Curiously Recurring Template Patter (CRTP)
template<class Archive>
class BOOST_SYMBOL_VISIBLE common_iarchive :
class BOOST_SYMBOL_VISIBLE common_iarchive :
public basic_iarchive,
public interface_iarchive<Archive>
{
friend class interface_iarchive<Archive>;
friend class basic_iarchive;
private:
virtual void vload(version_type & t){
* this->This() >> t;
* this->This() >> t;
}
virtual void vload(object_id_type & t){
* this->This() >> t;
@@ -71,7 +70,7 @@ protected:
void load_start(const char * /*name*/){}
void load_end(const char * /*name*/){}
// default archive initialization
common_iarchive(unsigned int flags = 0) :
common_iarchive(unsigned int flags = 0) :
basic_iarchive(flags),
interface_iarchive<Archive>()
{}
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// common_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -38,7 +38,6 @@ class BOOST_SYMBOL_VISIBLE common_oarchive :
public interface_oarchive<Archive>
{
friend class interface_oarchive<Archive>;
friend class basic_oarchive;
private:
virtual void vsave(const version_type t){
* this->This() << t;
@@ -72,7 +71,7 @@ protected:
}
void save_start(const char * /*name*/){}
void save_end(const char * /*name*/){}
common_oarchive(unsigned int flags = 0) :
common_oarchive(unsigned int flags = 0) :
basic_oarchive(flags),
interface_oarchive<Archive>()
{}
+3 -3
View File
@@ -1,10 +1,10 @@
#ifndef BOOST_ARCHIVE_DETAIL_DECL_HPP
#define BOOST_ARCHIVE_DETAIL_DECL_HPP
#define BOOST_ARCHIVE_DETAIL_DECL_HPP
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#endif
/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8
// decl.hpp
@@ -16,7 +16,7 @@
// See library home page at http://www.boost.org/libs/serialization
//----------------------------------------------------------------------------//
//----------------------------------------------------------------------------//
// This header implements separate compilation features as described in
// http://www.boost.org/more/separate_compilation.html
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// interface_iarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -31,7 +31,7 @@ namespace detail {
class basic_pointer_iserializer;
template<class Archive>
class interface_iarchive
class interface_iarchive
{
protected:
interface_iarchive(){};
@@ -47,11 +47,11 @@ public:
}
template<class T>
const basic_pointer_iserializer *
const basic_pointer_iserializer *
register_type(T * = NULL){
const basic_pointer_iserializer & bpis =
boost::serialization::singleton<
pointer_iserializer<Archive, T>
pointer_iserializer<Archive, T>
>::get_const_instance();
this->This()->register_basic_serializer(bpis.get_basic_serializer());
return & bpis;
@@ -62,14 +62,14 @@ public:
helper_collection & hc = this->This()->get_helper_collection();
return hc.template find_helper<Helper>(id);
}
template<class T>
Archive & operator>>(T & t){
this->This()->load_override(t);
return * this->This();
}
// the & operator
// the & operator
template<class T>
Archive & operator&(T & t){
return *(this->This()) >> t;
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// interface_oarchive.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -32,7 +32,7 @@ namespace detail {
class basic_pointer_oserializer;
template<class Archive>
class interface_oarchive
class interface_oarchive
{
protected:
interface_oarchive(){};
@@ -48,7 +48,7 @@ public:
}
template<class T>
const basic_pointer_oserializer *
const basic_pointer_oserializer *
register_type(const T * = NULL){
const basic_pointer_oserializer & bpos =
boost::serialization::singleton<
@@ -57,7 +57,7 @@ public:
this->This()->register_basic_serializer(bpos.get_basic_serializer());
return & bpos;
}
template<class Helper>
Helper &
get_helper(void * const id = 0){
@@ -70,8 +70,8 @@ public:
this->This()->save_override(t);
return * this->This();
}
// the & operator
// the & operator
template<class T>
Archive & operator&(const T & t){
return * this ->This() << t;
+50 -49
View File
@@ -15,7 +15,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// iserializer.hpp: interface for serialization system.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -28,8 +28,8 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
using ::size_t;
namespace std{
using ::size_t;
} // namespace std
#endif
@@ -41,8 +41,8 @@ namespace std{
#include <boost/mpl/equal_to.hpp>
#include <boost/core/no_exceptions_support.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
#endif
#include <boost/serialization/throw_exception.hpp>
#include <boost/serialization/smart_cast.hpp>
@@ -57,15 +57,16 @@ namespace std{
#include <boost/serialization/assume_abstract.hpp>
#if !defined(BOOST_MSVC) && \
(BOOST_WORKAROUND(__IBMCPP__, < 1210) || \
defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590))
#define BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR 1
#ifndef BOOST_MSVC
#define DONT_USE_HAS_NEW_OPERATOR ( \
BOOST_WORKAROUND(__IBMCPP__, < 1210) \
|| defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590) \
)
#else
#define BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR 0
#define DONT_USE_HAS_NEW_OPERATOR 0
#endif
#if ! BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR
#if ! DONT_USE_HAS_NEW_OPERATOR
#include <boost/type_traits/has_new_operator.hpp>
#endif
@@ -76,10 +77,10 @@ namespace std{
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/serialization/wrapper.hpp>
#include <boost/serialization/array_wrapper.hpp>
// the following is need only for dynamic cast of polymorphic pointers
#include <boost/archive/archive_exception.hpp>
@@ -89,8 +90,6 @@ namespace std{
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -123,28 +122,30 @@ private:
virtual void destroy(/*const*/ void *address) const {
boost::serialization::access::destroy(static_cast<T *>(address));
}
public:
protected:
// protected constructor since it's always created by singleton
explicit iserializer() :
basic_iserializer(
boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance()
)
{}
public:
virtual BOOST_DLLEXPORT void load_object_data(
basic_iarchive & ar,
void *x,
void *x,
const unsigned int file_version
) const BOOST_USED;
virtual bool class_info() const {
return boost::serialization::implementation_level< T >::value
return boost::serialization::implementation_level< T >::value
>= boost::serialization::object_class_info;
}
virtual bool tracking(const unsigned int /* flags */) const {
return boost::serialization::tracking_level< T >::value
return boost::serialization::tracking_level< T >::value
== boost::serialization::track_always
|| ( boost::serialization::tracking_level< T >::value
|| ( boost::serialization::tracking_level< T >::value
== boost::serialization::track_selectively
&& serialized_as_pointer());
}
@@ -164,12 +165,12 @@ public:
template<class Archive, class T>
BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
basic_iarchive & ar,
void *x,
void *x,
const unsigned int file_version
) const {
// note: we now comment this out. Before we permited archive
// version # to be very large. Now we don't. To permit
// readers of these old archives, we have to suppress this
// readers of these old archives, we have to suppress this
// code. Perhaps in the future we might re-enable it but
// permit its suppression with a runtime switch.
#if 0
@@ -186,7 +187,7 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
// be specialized by the user.
boost::serialization::serialize_adl(
boost::serialization::smart_cast_reference<Archive &>(ar),
* static_cast<T *>(x),
* static_cast<T *>(x),
file_version
);
}
@@ -199,7 +200,7 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
// the purpose of this code is to allocate memory for an object
// without requiring the constructor to be called. Presumably
// the allocated object will be subsequently initialized with
// "placement new".
// "placement new".
// note: we have the boost type trait has_new_operator but we
// have no corresponding has_delete_operator. So we presume
// that the former being true would imply that the a delete
@@ -208,7 +209,7 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
template<class T>
struct heap_allocation {
// boost::has_new_operator< T > doesn't work on these compilers
#if BOOST_SERIALIZATION_DONT_USE_HAS_NEW_OPERATOR
#if DONT_USE_HAS_NEW_OPERATOR
// This doesn't handle operator new overload for class T
static T * invoke_new(){
return static_cast<T *>(operator new(sizeof(T)));
@@ -233,7 +234,7 @@ struct heap_allocation {
// that the class might have class specific new with NO
// class specific delete at all. Patches (compatible with
// C++03) welcome!
(operator delete)(t);
delete t;
}
};
struct doesnt_have_new_operator {
@@ -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() {
@@ -250,7 +251,7 @@ struct heap_allocation {
mpl::eval_if<
boost::has_new_operator< T >,
mpl::identity<has_new_operator >,
mpl::identity<doesnt_have_new_operator >
mpl::identity<doesnt_have_new_operator >
>::type typex;
return typex::invoke_new();
}
@@ -259,7 +260,7 @@ struct heap_allocation {
mpl::eval_if<
boost::has_new_operator< T >,
mpl::identity<has_new_operator >,
mpl::identity<doesnt_have_new_operator >
mpl::identity<doesnt_have_new_operator >
>::type typex;
typex::invoke_delete(t);
}
@@ -301,11 +302,11 @@ private:
>::get_const_instance();
}
BOOST_DLLEXPORT virtual void load_object_ptr(
basic_iarchive & ar,
basic_iarchive & ar,
void * x,
const unsigned int file_version
) const BOOST_USED;
public:
protected:
// this should alway be a singleton so make the constructor protected
pointer_iserializer();
~pointer_iserializer();
@@ -319,12 +320,12 @@ public:
// serialized only through base class won't get optimized out
template<class Archive, class T>
BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
basic_iarchive & ar,
basic_iarchive & ar,
void * t,
const unsigned int file_version
) const
{
Archive & ar_impl =
Archive & ar_impl =
boost::serialization::smart_cast_reference<Archive &>(ar);
// note that the above will throw std::bad_alloc if the allocation
@@ -334,7 +335,7 @@ BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
// automatically delete the t which is most likely not fully
// constructed
BOOST_TRY {
// this addresses an obscure situation that occurs when
// this addresses an obscure situation that occurs when
// load_constructor de-serializes something through a pointer.
ar.next_object_pointer(t);
boost::serialization::load_construct_data_adl<Archive, T>(
@@ -358,7 +359,7 @@ template<class Archive, class T>
pointer_iserializer<Archive, T>::pointer_iserializer() :
basic_pointer_iserializer(
boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance()
)
@@ -393,8 +394,8 @@ struct load_non_pointer_type {
// make sure call is routed through the higest interface that might
// be specialized by the user.
boost::serialization::serialize_adl(
ar,
const_cast<T &>(t),
ar,
const_cast<T &>(t),
boost::serialization::version< T >::value
);
}
@@ -405,9 +406,9 @@ struct load_non_pointer_type {
struct load_standard {
template<class T>
static void invoke(Archive &ar, const T & t){
void * x = boost::addressof(const_cast<T &>(t));
void * x = & const_cast<T &>(t);
ar.load_object(
x,
x,
boost::serialization::singleton<
iserializer<Archive, T>
>::get_const_instance()
@@ -483,8 +484,8 @@ struct load_pointer_type {
};
template<class T>
static const basic_pointer_iserializer * register_type(Archive &ar, const T* const /*t*/){
// there should never be any need to load an abstract polymorphic
static const basic_pointer_iserializer * register_type(Archive &ar, const T & /*t*/){
// there should never be any need to load an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
// virtual serialize functions used for plug-ins
@@ -492,7 +493,7 @@ struct load_pointer_type {
mpl::eval_if<
boost::serialization::is_abstract<const T>,
boost::mpl::identity<abstract>,
boost::mpl::identity<non_abstract>
boost::mpl::identity<non_abstract>
>::type typex;
return typex::template register_type< T >(ar);
}
@@ -508,7 +509,7 @@ struct load_pointer_type {
boost::serialization::void_upcast(
eti,
boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance(),
t
@@ -522,7 +523,7 @@ struct load_pointer_type {
}
template<class T>
static void check_load(T * const /* t */){
static void check_load(T & /* t */){
check_pointer_level< T >();
check_pointer_tracking< T >();
}
@@ -536,8 +537,8 @@ struct load_pointer_type {
template<class Tptr>
static void invoke(Archive & ar, Tptr & t){
check_load(t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, t);
check_load(*t);
const basic_pointer_iserializer * bpis_ptr = register_type(ar, *t);
const basic_pointer_iserializer * newbpis_ptr = ar.load_pointer(
// note major hack here !!!
// I tried every way to convert Tptr &t (where Tptr might
@@ -570,13 +571,13 @@ struct load_array_type {
template<class T>
static void invoke(Archive &ar, T &t){
typedef typename remove_extent< T >::type value_type;
// convert integers to correct enum to load
// determine number of elements in the array. Consider the
// fact that some machines will align elements on boundries
// other than characters.
std::size_t current_count = sizeof(t) / (
static_cast<char *>(static_cast<void *>(&t[1]))
static_cast<char *>(static_cast<void *>(&t[1]))
- static_cast<char *>(static_cast<void *>(&t[0]))
);
boost::serialization::collection_size_type count;
@@ -604,7 +605,7 @@ template<class Archive, class T>
inline void load(Archive & ar, T &t){
// if this assertion trips. It means we're trying to load a
// const object with a compiler that doesn't have correct
// function template ordering. On other compilers, this is
// funtion template ordering. On other compilers, this is
// handled below.
detail::check_const_loading< T >();
typedef
+39 -45
View File
@@ -15,7 +15,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// oserializer.hpp: interface for serialization system.
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -26,7 +26,6 @@
#include <cstddef> // NULL
#include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
@@ -36,8 +35,8 @@
#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>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
#endif
#include <boost/serialization/throw_exception.hpp>
#include <boost/serialization/smart_cast.hpp>
@@ -57,9 +56,8 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/singleton.hpp>
#include <boost/archive/archive_exception.hpp>
@@ -69,8 +67,6 @@
#include <boost/archive/detail/archive_serializer_map.hpp>
#include <boost/archive/detail/check.hpp>
#include <boost/core/addressof.hpp>
namespace boost {
namespace serialization {
@@ -105,23 +101,23 @@ template<class Archive, class T>
class oserializer : public basic_oserializer
{
private:
// private constructor to inhibit any existence other than the
// private constructor to inhibit any existence other than the
// static one
public:
explicit BOOST_DLLEXPORT oserializer() :
basic_oserializer(
boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance()
)
{}
virtual BOOST_DLLEXPORT void save_object_data(
basic_oarchive & ar,
basic_oarchive & ar,
const void *x
) const BOOST_USED;
virtual bool class_info() const {
return boost::serialization::implementation_level< T >::value
return boost::serialization::implementation_level< T >::value
>= boost::serialization::object_class_info;
}
virtual bool tracking(const unsigned int /* flags */) const {
@@ -144,7 +140,7 @@ public:
template<class Archive, class T>
BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data(
basic_oarchive & ar,
basic_oarchive & ar,
const void *x
) const {
// make sure call is routed through the highest interface that might
@@ -167,7 +163,7 @@ class pointer_oserializer :
public basic_pointer_oserializer
{
private:
const basic_oserializer &
const basic_oserializer &
get_basic_serializer() const {
return boost::serialization::singleton<
oserializer<Archive, T>
@@ -196,11 +192,11 @@ BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
// be specialized by the user.
T * t = static_cast<T *>(const_cast<void *>(x));
const unsigned int file_version = boost::serialization::version< T >::value;
Archive & ar_impl
Archive & ar_impl
= boost::serialization::smart_cast_reference<Archive &>(ar);
boost::serialization::save_construct_data_adl<Archive, T>(
ar_impl,
t,
ar_impl,
t,
file_version
);
ar_impl << boost::serialization::make_nvp(NULL, * t);
@@ -210,14 +206,14 @@ template<class Archive, class T>
pointer_oserializer<Archive, T>::pointer_oserializer() :
basic_pointer_oserializer(
boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance()
)
{
// make sure appropriate member function is instantiated
boost::serialization::singleton<
oserializer<Archive, T>
oserializer<Archive, T>
>::get_mutable_instance().set_bpos(this);
archive_serializer_map<Archive>::insert(this);
}
@@ -244,8 +240,8 @@ struct save_non_pointer_type {
// make sure call is routed through the highest interface that might
// be specialized by the user.
boost::serialization::serialize_adl(
ar,
const_cast<T &>(t),
ar,
const_cast<T &>(t),
::boost::serialization::version< T >::value
);
}
@@ -256,7 +252,7 @@ struct save_non_pointer_type {
template<class T>
static void invoke(Archive &ar, const T & t){
ar.save_object(
boost::addressof(t),
& t,
boost::serialization::singleton<
oserializer<Archive, T>
>::get_const_instance()
@@ -264,8 +260,6 @@ struct save_non_pointer_type {
}
};
// adds class information to the archive. This includes
// serialization level and class version
struct save_conditional {
@@ -281,7 +275,7 @@ struct save_non_pointer_type {
template<class T>
static void invoke(Archive & ar, const T & t){
typedef
typedef
typename mpl::eval_if<
// if its primitive
mpl::equal_to<
@@ -310,7 +304,7 @@ struct save_non_pointer_type {
// else
// do a fast save only tracking is turned off
mpl::identity<save_conditional>
> > >::type typex;
> > >::type typex;
check_object_versioning< T >();
typex::invoke(ar, t);
}
@@ -343,16 +337,16 @@ struct save_pointer_type {
};
template<class T>
static const basic_pointer_oserializer * register_type(Archive &ar, T* const /*t*/){
// there should never be any need to save an abstract polymorphic
static const basic_pointer_oserializer * register_type(Archive &ar, T & /*t*/){
// there should never be any need to save an abstract polymorphic
// class pointer. Inhibiting code generation for this
// permits abstract base classes to be used - note: exception
// virtual serialize functions used for plug-ins
typedef
typedef
typename mpl::eval_if<
boost::serialization::is_abstract< T >,
mpl::identity<abstract>,
mpl::identity<non_abstract>
mpl::identity<non_abstract>
>::type typex;
return typex::template register_type< T >(ar);
}
@@ -361,10 +355,10 @@ struct save_pointer_type {
{
template<class T>
static void save(
Archive &ar,
Archive &ar,
T & t
){
const basic_pointer_oserializer & bpos =
const basic_pointer_oserializer & bpos =
boost::serialization::singleton<
pointer_oserializer<Archive, T>
>::get_const_instance();
@@ -377,13 +371,13 @@ struct save_pointer_type {
{
template<class T>
static void save(
Archive &ar,
Archive &ar,
T & t
){
typename
typename
boost::serialization::type_info_implementation< T >::type const
& i = boost::serialization::singleton<
typename
typename
boost::serialization::type_info_implementation< T >::type
>::get_const_instance();
@@ -410,15 +404,15 @@ struct save_pointer_type {
// if its not a pointer to a more derived type
const void *vp = static_cast<const void *>(&t);
if(*this_type == *true_type){
const basic_pointer_oserializer * bpos = register_type(ar, &t);
const basic_pointer_oserializer * bpos = register_type(ar, t);
ar.save_pointer(vp, bpos);
return;
}
// convert pointer to more derived type. if this is thrown
// it means that the base/derived relationship hasn't be registered
vp = serialization::void_downcast(
*true_type,
*this_type,
*true_type,
*this_type,
static_cast<const void *>(&t)
);
if(NULL == vp){
@@ -431,7 +425,7 @@ struct save_pointer_type {
);
}
// since true_type is valid, and this only gets made if the
// since true_type is valid, and this only gets made if the
// pointer oserializer object has been created, this should never
// fail
const basic_pointer_oserializer * bpos
@@ -454,7 +448,7 @@ struct save_pointer_type {
template<class T>
static void save(
Archive & ar,
Archive & ar,
const T & t
){
check_pointer_level< T >();
@@ -469,9 +463,9 @@ struct save_pointer_type {
template<class TPtr>
static void invoke(Archive &ar, const TPtr t){
register_type(ar, t);
register_type(ar, * t);
if(NULL == t){
basic_oarchive & boa
basic_oarchive & boa
= boost::serialization::smart_cast_reference<basic_oarchive &>(ar);
boa.save_null_pointer();
save_access::end_preamble(ar);
@@ -498,11 +492,11 @@ struct save_array_type
template<class T>
static void invoke(Archive &ar, const T &t){
typedef typename boost::remove_extent< T >::type value_type;
save_access::end_preamble(ar);
// consider alignment
std::size_t c = sizeof(t) / (
static_cast<const char *>(static_cast<const void *>(&t[1]))
static_cast<const char *>(static_cast<const void *>(&t[1]))
- static_cast<const char *>(static_cast<const void *>(&t[0]))
);
boost::serialization::collection_size_type count(c);
@@ -522,7 +516,7 @@ struct save_array_type
template<class Archive, class T>
inline void save(Archive & ar, /*const*/ T &t){
typedef
typedef
typename mpl::eval_if<is_pointer< T >,
mpl::identity<detail::save_pointer_type<Archive> >,
//else
@@ -190,7 +190,7 @@ public:
}
// register type function
template<class T>
const basic_pointer_iserializer *
const basic_pointer_iserializer *
register_type(T * t = NULL){
return ArchiveImplementation::register_type(t);
}
@@ -181,7 +181,7 @@ public:
}
// register type function
template<class T>
const basic_pointer_oserializer *
const basic_pointer_oserializer *
register_type(T * t = NULL){
return ArchiveImplementation::register_type(t);
}
@@ -4,7 +4,7 @@
#ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
namespace boost { namespace archive { namespace detail {
namespace boost { namespace archive { namespace detail {
// No instantiate_ptr_serialization overloads generated by
// BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call
@@ -9,21 +9,26 @@
#include <boost/config.hpp>
#ifdef BOOST_NO_STD_WSTREAMBUF
#error "wide char i/o not supported on this platform"
#endif
// std::codecvt_utf8 doesn't seem to work for msvc
// versions prior to MSVC 14.0
// use boost's utf8 codecvt facet
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#if defined(_MSC_VER) && _MSC_VER < 1900 \
|| defined( BOOST_NO_CXX11_HDR_CODECVT )
#include <boost/archive/detail/decl.hpp>
#define BOOST_UTF8_BEGIN_NAMESPACE \
namespace boost { namespace archive { namespace detail {
#define BOOST_UTF8_DECL BOOST_ARCHIVE_DECL
#define BOOST_UTF8_END_NAMESPACE }}}
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#include <boost/detail/utf8_codecvt_facet.hpp>
#undef BOOST_UTF8_END_NAMESPACE
#undef BOOST_UTF8_DECL
#undef BOOST_UTF8_BEGIN_NAMESPACE
#else
#include <codecvt>
namespace boost { namespace archive { namespace detail {
typedef std::codecvt_utf8<wchar_t> utf8_codecvt_facet;
} } }
#endif // BOOST_NO_CXX11_HDR_CODECVT
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
+11 -11
View File
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// dinkumware.hpp:
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -29,7 +29,7 @@ namespace std {
// define i/o operators for 64 bit integers
template<class CharType>
basic_ostream<CharType> &
basic_ostream<CharType> &
operator<<(basic_ostream<CharType> & os, boost::uint64_t t){
// octal rendering of 64 bit number would be 22 octets + eos
CharType d[23];
@@ -66,7 +66,7 @@ operator<<(basic_ostream<CharType> & os, boost::uint64_t t){
}
template<class CharType>
basic_ostream<CharType> &
basic_ostream<CharType> &
operator<<(basic_ostream<CharType> &os, boost::int64_t t){
if(0 <= t){
os << static_cast<boost::uint64_t>(t);
@@ -79,7 +79,7 @@ operator<<(basic_ostream<CharType> &os, boost::int64_t t){
}
template<class CharType>
basic_istream<CharType> &
basic_istream<CharType> &
operator>>(basic_istream<CharType> &is, boost::int64_t & t){
CharType d;
do{
@@ -119,7 +119,7 @@ operator>>(basic_istream<CharType> &is, boost::int64_t & t){
}
template<class CharType>
basic_istream<CharType> &
basic_istream<CharType> &
operator>>(basic_istream<CharType> &is, boost::uint64_t & t){
boost::int64_t it;
is >> it;
@@ -130,7 +130,7 @@ operator>>(basic_istream<CharType> &is, boost::uint64_t & t){
//#endif
template<>
class back_insert_iterator<basic_string<char> > : public
class back_insert_iterator<basic_string<char> > : public
iterator<output_iterator_tag, char>
{
public:
@@ -140,7 +140,7 @@ public:
explicit back_insert_iterator(container_type & s)
: container(& s)
{} // construct with container
back_insert_iterator<container_type> & operator=(
container_type::const_reference Val_
){ // push value into container
@@ -167,7 +167,7 @@ protected:
container_type *container; // pointer to container
};
template<char>
template<char>
inline back_insert_iterator<basic_string<char> > back_inserter(
basic_string<char> & s
){
@@ -175,7 +175,7 @@ inline back_insert_iterator<basic_string<char> > back_inserter(
}
template<>
class back_insert_iterator<basic_string<wchar_t> > : public
class back_insert_iterator<basic_string<wchar_t> > : public
iterator<output_iterator_tag, wchar_t>
{
public:
@@ -185,7 +185,7 @@ public:
explicit back_insert_iterator(container_type & s)
: container(& s)
{} // construct with container
back_insert_iterator<container_type> & operator=(
container_type::const_reference Val_
){ // push value into container
@@ -212,7 +212,7 @@ protected:
container_type *container; // pointer to container
};
template<wchar_t>
template<wchar_t>
inline back_insert_iterator<basic_string<wchar_t> > back_inserter(
basic_string<wchar_t> & s
){
@@ -47,10 +47,6 @@ archive_serializer_map<Archive>::insert(const basic_serializer * bs){
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
archive_serializer_map<Archive>::erase(const basic_serializer * bs){
// note: previously this conditional was a runtime assertion with
// BOOST_ASSERT. We've changed it because we've discovered that at
// least one platform is not guaranteed to destroy singletons in
// reverse order of distruction.
if(boost::serialization::singleton<
extra_detail::map<Archive>
>::is_destroyed())
@@ -22,7 +22,7 @@ namespace std{
#endif
#include <boost/detail/workaround.hpp>
#include <boost/predef/other/endian.h>
#include <boost/detail/endian.hpp>
#include <boost/archive/basic_binary_iarchive.hpp>
@@ -89,7 +89,7 @@ basic_binary_iarchive<Archive>::init(void){
{
int v = 0;
v = this->This()->m_sb.sbumpc();
#if BOOST_ENDIAN_LITTLE_BYTE
#if defined(BOOST_LITTLE_ENDIAN)
if(v < 6){
;
}
@@ -111,7 +111,7 @@ basic_binary_iarchive<Archive>::init(void){
// version 8+ followed by a zero
this->This()->m_sb.sbumpc();
}
#elif BOOST_ENDIAN_BIG_BYTE
#elif defined(BOOST_BIG_ENDIAN)
if(v == 0)
v = this->This()->m_sb.sbumpc();
#endif
@@ -84,8 +84,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::init()
);
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
@@ -95,8 +93,6 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
load_binary(ws, l * sizeof(wchar_t) / sizeof(char));
ws[l] = L'\0';
}
#endif
#endif
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
@@ -114,6 +110,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(std::string & s)
load_binary(&(*s.begin()), l);
}
#ifndef BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
@@ -123,6 +120,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
load_binary(s, l);
s[l] = '\0';
}
#endif
#ifndef BOOST_NO_STD_WSTRING
template<class Archive, class Elem, class Tr>
@@ -71,7 +71,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s)
}
#ifndef BOOST_NO_CWCHAR
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
basic_binary_oprimitive<Archive, Elem, Tr>::save(const wchar_t * ws)
@@ -92,7 +91,6 @@ basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::wstring &ws)
save_binary(ws.data(), l * sizeof(wchar_t) / sizeof(char));
}
#endif
#endif // BOOST_NO_CWCHAR
template<class Archive, class Elem, class Tr>
BOOST_ARCHIVE_OR_WARCHIVE_DECL
@@ -10,6 +10,7 @@
#include <cstddef> // NULL
#include <algorithm> // std::copy
#include <exception> // std::uncaught_exception
#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
@@ -17,8 +18,6 @@ namespace std{
} // namespace std
#endif
#include <boost/core/uncaught_exceptions.hpp>
#include <boost/archive/basic_text_oprimitive.hpp>
#include <boost/archive/iterators/base64_from_binary.hpp>
@@ -107,7 +106,7 @@ basic_text_oprimitive<OStream>::basic_text_oprimitive(
template<class OStream>
BOOST_ARCHIVE_OR_WARCHIVE_DECL
basic_text_oprimitive<OStream>::~basic_text_oprimitive(){
if(boost::core::uncaught_exceptions() > 0)
if(std::uncaught_exception())
return;
os << std::endl;
}
@@ -9,7 +9,7 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// basic_xml_grammar.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// (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)
@@ -64,13 +64,13 @@ namespace archive {
// XML grammar parsing
template<class CharType>
class BOOST_SYMBOL_VISIBLE basic_xml_grammar {
class basic_xml_grammar {
public:
// The following is not necessary according to DR45, but at least
// one compiler (Compaq C++ 6.5 in strict_ansi mode) chokes otherwise.
struct return_values;
friend struct return_values;
private:
typedef typename std::basic_istream<CharType> IStream;
typedef typename std::basic_string<CharType> StringType;
@@ -81,16 +81,16 @@ private:
> scanner_t;
typedef typename boost::spirit::classic::rule<scanner_t> rule_t;
// Start grammar definition
rule_t
rule_t
Reference,
Eq,
Eq,
STag,
ETag,
LetterOrUnderscoreOrColon,
AttValue,
CharRef1,
CharRef2,
CharRef,
AttValue,
CharRef1,
CharRef2,
CharRef,
AmpRef,
LTRef,
GTRef,
@@ -127,11 +127,11 @@ private:
chset_t
BaseChar,
Ideographic,
Char,
Letter,
Char,
Letter,
Digit,
CombiningChar,
Extender,
Extender,
Sch,
NameChar;
@@ -139,7 +139,7 @@ private:
bool my_parse(
IStream & is,
const rule_t &rule_,
const rule_t &rule_,
const CharType delimiter = L'>'
) const ;
public:
@@ -115,7 +115,14 @@ text_iarchive_impl<Archive>::text_iarchive_impl(
0 != (flags & no_codecvt)
),
basic_text_iarchive<Archive>(flags)
{}
{
if(0 == (flags & no_header))
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
this->init();
#else
this->basic_text_iarchive<Archive>::init();
#endif
}
} // namespace archive
} // namespace boost
@@ -93,6 +93,12 @@ text_oarchive_impl<Archive>::text_oarchive_impl(
),
basic_text_oarchive<Archive>(flags)
{
if(0 == (flags & no_header))
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
this->init();
#else
this->basic_text_oarchive<Archive>::init();
#endif
}
template<class Archive>
@@ -56,7 +56,7 @@ text_wiarchive_impl<Archive>::load(std::string &s)
s.resize(0);
s.reserve(size);
while(size-- > 0){
char x = is.narrow(is.get(), '\0');
int x = is.narrow(is.get(), '\0');
s += x;
}
}
@@ -108,6 +108,8 @@ text_wiarchive_impl<Archive>::text_wiarchive_impl(
),
basic_text_iarchive<Archive>(flags)
{
if(0 == (flags & no_header))
basic_text_iarchive<Archive>::init();
}
} // archive
@@ -11,6 +11,7 @@
#include <boost/config.hpp>
#include <cstring> // memcpy
#include <cstddef> // NULL
#include <exception>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
@@ -33,7 +34,6 @@ namespace std{
#include <boost/archive/dinkumware.hpp>
#endif
#include <boost/core/uncaught_exceptions.hpp>
#include <boost/core/no_exceptions_support.hpp>
#include <boost/archive/xml_archive_exception.hpp>
@@ -181,12 +181,15 @@ xml_iarchive_impl<Archive>::xml_iarchive_impl(
),
basic_xml_iarchive<Archive>(flags),
gimpl(new xml_grammar())
{}
{
if(0 == (flags & no_header))
init();
}
template<class Archive>
BOOST_ARCHIVE_DECL
xml_iarchive_impl<Archive>::~xml_iarchive_impl(){
if(boost::core::uncaught_exceptions() > 0)
if(std::uncaught_exception())
return;
if(0 == (this->get_flags() & no_header)){
gimpl->windup(is);
@@ -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
@@ -19,7 +20,6 @@ namespace std{
} // namespace std
#endif
#include <boost/core/uncaught_exceptions.hpp>
#include <boost/archive/iterators/xml_escape.hpp>
#include <boost/archive/iterators/ostream_iterator.hpp>
@@ -109,7 +109,10 @@ xml_oarchive_impl<Archive>::xml_oarchive_impl(
0 != (flags & no_codecvt)
),
basic_xml_oarchive<Archive>(flags)
{}
{
if(0 == (flags & no_header))
this->init();
}
template<class Archive>
BOOST_ARCHIVE_DECL void
@@ -129,7 +132,7 @@ xml_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
template<class Archive>
BOOST_ARCHIVE_DECL
xml_oarchive_impl<Archive>::~xml_oarchive_impl(){
if(boost::core::uncaught_exceptions() > 0)
if(std::uncaught_exception())
return;
if(0 == (this->get_flags() & no_header))
this->windup();

Some files were not shown because too many files have changed in this diff Show More