mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-05-04 11:14:48 +12:00
Initial commit (I really need to remove Boost)
This commit is contained in:
commit
b5371dc66c
3226 changed files with 668081 additions and 0 deletions
third_party/boost
JamrootLICENSE_1_0.txtReadme.md
boost
algorithm/string
case_conv.hppcompare.hppconcept.hppconfig.hppconstants.hpp
aligned_storage.hppdetail
case_conv.hppfind_format.hppfind_format_all.hppfind_format_store.hppfinder.hppformatter.hppreplace_storage.hppsequence.hpputil.hpp
erase.hppfind_format.hppfinder.hppformatter.hppreplace.hppsequence_traits.hppyes_no_type.hpparchive
archive_exception.hppbasic_archive.hppbasic_binary_iarchive.hppbasic_binary_iprimitive.hppbasic_binary_oarchive.hppbasic_binary_oprimitive.hppbasic_streambuf_locale_saver.hppbasic_text_iarchive.hppbasic_text_iprimitive.hppbasic_text_oarchive.hppbasic_text_oprimitive.hppbasic_xml_archive.hppbasic_xml_iarchive.hppbasic_xml_oarchive.hppbinary_iarchive.hppbinary_iarchive_impl.hppbinary_oarchive.hppbinary_oarchive_impl.hppbinary_wiarchive.hppbinary_woarchive.hppcodecvt_null.hpp
detail
abi_prefix.hppabi_suffix.hpparchive_serializer_map.hppauto_link_archive.hppauto_link_warchive.hppbasic_iarchive.hppbasic_iserializer.hppbasic_oarchive.hppbasic_oserializer.hppbasic_pointer_iserializer.hppbasic_pointer_oserializer.hppbasic_serializer.hppbasic_serializer_map.hppcheck.hppcommon_iarchive.hppcommon_oarchive.hppdecl.hpphelper_collection.hppinterface_iarchive.hppinterface_oarchive.hppiserializer.hpposerializer.hpppolymorphic_iarchive_route.hpppolymorphic_oarchive_route.hppregister_archive.hpputf8_codecvt_facet.hpp
dinkumware.hppimpl
archive_serializer_map.ippbasic_binary_iarchive.ippbasic_binary_iprimitive.ippbasic_binary_oarchive.ippbasic_binary_oprimitive.ippbasic_text_iarchive.ippbasic_text_iprimitive.ippbasic_text_oarchive.ippbasic_text_oprimitive.ippbasic_xml_grammar.hppbasic_xml_iarchive.ippbasic_xml_oarchive.ipptext_iarchive_impl.ipptext_oarchive_impl.ipptext_wiarchive_impl.ipptext_woarchive_impl.ippxml_iarchive_impl.ippxml_oarchive_impl.ippxml_wiarchive_impl.ippxml_woarchive_impl.ipp
iterators
329
third_party/boost/Jamroot
vendored
Normal file
329
third_party/boost/Jamroot
vendored
Normal file
|
@ -0,0 +1,329 @@
|
|||
# Copyright Vladimir Prus 2002-2006.
|
||||
# Copyright Dave Abrahams 2005-2006.
|
||||
# Copyright Rene Rivera 2005-2007.
|
||||
# Copyright Douglas Gregor 2005.
|
||||
#
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
# Usage:
|
||||
#
|
||||
# b2 [options] [properties] [install|stage]
|
||||
#
|
||||
# Builds and installs Boost.
|
||||
#
|
||||
# Targets and Related Options:
|
||||
#
|
||||
# install Install headers and compiled library files to the
|
||||
# ======= configured locations (below).
|
||||
#
|
||||
# --prefix=<PREFIX> Install architecture independent files here.
|
||||
# Default: C:\Boost on Windows
|
||||
# Default: /usr/local on Unix, Linux, etc.
|
||||
#
|
||||
# --exec-prefix=<EPREFIX> Install architecture dependent files here.
|
||||
# Default: <PREFIX>
|
||||
#
|
||||
# --libdir=<LIBDIR> Install library files here.
|
||||
# Default: <EPREFIX>/lib
|
||||
#
|
||||
# --includedir=<HDRDIR> Install header files here.
|
||||
# Default: <PREFIX>/include
|
||||
#
|
||||
# --cmakedir=<CMAKEDIR> Install CMake configuration files here.
|
||||
# Default: <LIBDIR>/cmake
|
||||
#
|
||||
# --no-cmake-config Do not install CMake configuration files.
|
||||
#
|
||||
# stage Build and install only compiled library files to the
|
||||
# ===== stage directory.
|
||||
#
|
||||
# --stagedir=<STAGEDIR> Install library files here
|
||||
# Default: ./stage
|
||||
#
|
||||
# Other Options:
|
||||
#
|
||||
# --build-type=<type> Build the specified pre-defined set of variations of
|
||||
# the libraries. Note, that which variants get built
|
||||
# depends on what each library supports.
|
||||
#
|
||||
# -- minimal -- (default) Builds a minimal set of
|
||||
# variants. On Windows, these are static
|
||||
# multithreaded libraries in debug and release
|
||||
# modes, using shared runtime. On Linux, these are
|
||||
# static and shared multithreaded libraries in
|
||||
# release mode.
|
||||
#
|
||||
# -- complete -- Build all possible variations.
|
||||
#
|
||||
# --build-dir=DIR Build in this location instead of building within
|
||||
# the distribution tree. Recommended!
|
||||
#
|
||||
# --show-libraries Display the list of Boost libraries that require
|
||||
# build and installation steps, and then exit.
|
||||
#
|
||||
# --layout=<layout> Determine whether to choose library names and header
|
||||
# locations such that multiple versions of Boost or
|
||||
# multiple compilers can be used on the same system.
|
||||
#
|
||||
# -- versioned -- Names of boost binaries include
|
||||
# the Boost version number, name and version of
|
||||
# the compiler and encoded build properties. Boost
|
||||
# headers are installed in a subdirectory of
|
||||
# <HDRDIR> whose name contains the Boost version
|
||||
# number.
|
||||
#
|
||||
# -- tagged -- Names of boost binaries include the
|
||||
# encoded build properties such as variant and
|
||||
# threading, but do not including compiler name
|
||||
# and version, or Boost version. This option is
|
||||
# useful if you build several variants of Boost,
|
||||
# using the same compiler.
|
||||
#
|
||||
# -- system -- Binaries names do not include the
|
||||
# Boost version number or the name and version
|
||||
# number of the compiler. Boost headers are
|
||||
# installed directly into <HDRDIR>. This option is
|
||||
# intended for system integrators building
|
||||
# distribution packages.
|
||||
#
|
||||
# The default value is 'versioned' on Windows, and
|
||||
# 'system' on Unix.
|
||||
#
|
||||
# --buildid=ID Add the specified ID to the name of built libraries.
|
||||
# The default is to not add anything.
|
||||
#
|
||||
# --python-buildid=ID Add the specified ID to the name of built libraries
|
||||
# that depend on Python. The default is to not add
|
||||
# anything. This ID is added in addition to --buildid.
|
||||
#
|
||||
# --help This message.
|
||||
#
|
||||
# --with-<library> Build and install the specified <library>. If this
|
||||
# option is used, only libraries specified using this
|
||||
# option will be built.
|
||||
#
|
||||
# --without-<library> Do not build, stage, or install the specified
|
||||
# <library>. By default, all libraries are built.
|
||||
#
|
||||
# Properties:
|
||||
#
|
||||
# toolset=toolset Indicate the toolset to build with.
|
||||
#
|
||||
# variant=debug|release Select the build variant
|
||||
#
|
||||
# link=static|shared Whether to build static or shared libraries
|
||||
#
|
||||
# threading=single|multi Whether to build single or multithreaded binaries
|
||||
#
|
||||
# runtime-link=static|shared
|
||||
# Whether to link to static or shared C and C++
|
||||
# runtime.
|
||||
#
|
||||
|
||||
# TODO:
|
||||
# - handle boost version
|
||||
# - handle python options such as pydebug
|
||||
|
||||
import boostcpp ;
|
||||
import package ;
|
||||
|
||||
import sequence ;
|
||||
import xsltproc ;
|
||||
import set ;
|
||||
import path ;
|
||||
import link ;
|
||||
import notfile ;
|
||||
import virtual-target ;
|
||||
import "class" : new ;
|
||||
import property-set ;
|
||||
import threadapi-feature ;
|
||||
import option ;
|
||||
# Backslash because of `bcp --namespace`
|
||||
import tools/boost\_install/boost-install ;
|
||||
|
||||
path-constant BOOST_ROOT : . ;
|
||||
constant BOOST_VERSION : 1.71.0 ;
|
||||
constant BOOST_JAMROOT_MODULE : $(__name__) ;
|
||||
|
||||
boostcpp.set-version $(BOOST_VERSION) ;
|
||||
|
||||
use-project /boost/architecture : libs/config/checks/architecture ;
|
||||
|
||||
local all-headers =
|
||||
[ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
|
||||
|
||||
for dir in $(all-headers)
|
||||
{
|
||||
link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
|
||||
explicit $(dir)-headers ;
|
||||
}
|
||||
|
||||
if $(all-headers)
|
||||
{
|
||||
constant BOOST_MODULARLAYOUT : $(all-headers) ;
|
||||
}
|
||||
|
||||
project boost
|
||||
: requirements <include>.
|
||||
|
||||
[ boostcpp.architecture ]
|
||||
[ boostcpp.address-model ]
|
||||
|
||||
# Disable auto-linking for all targets here, primarily because it caused
|
||||
# troubles with V2.
|
||||
<define>BOOST_ALL_NO_LIB=1
|
||||
# Used to encode variant in target name. See the 'tag' rule below.
|
||||
<tag>@$(__name__).tag
|
||||
<conditional>@handle-static-runtime
|
||||
# Comeau does not support shared lib
|
||||
<toolset>como:<link>static
|
||||
<toolset>como-linux:<define>_GNU_SOURCE=1
|
||||
# When building docs within Boost, we want the standard Boost style
|
||||
<xsl:param>boost.defaults=Boost
|
||||
<conditional>@threadapi-feature.detect
|
||||
: usage-requirements <include>.
|
||||
: default-build
|
||||
<visibility>hidden
|
||||
<threading>multi
|
||||
: build-dir bin.v2
|
||||
;
|
||||
|
||||
# This rule is called by Boost.Build to determine the name of target. We use it
|
||||
# to encode the build variant, compiler name and boost version in the target
|
||||
# name.
|
||||
#
|
||||
rule tag ( name : type ? : property-set )
|
||||
{
|
||||
return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
|
||||
}
|
||||
|
||||
rule python-tag ( name : type ? : property-set )
|
||||
{
|
||||
return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
|
||||
}
|
||||
|
||||
rule handle-static-runtime ( properties * )
|
||||
{
|
||||
# Using static runtime with shared libraries is impossible on Linux, and
|
||||
# dangerous on Windows. Therefore, we disallow it. This might be drastic,
|
||||
# but it was disabled for a while without anybody complaining.
|
||||
|
||||
# For CW, static runtime is needed so that std::locale works.
|
||||
if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
|
||||
! ( <toolset>cw in $(properties) )
|
||||
{
|
||||
if ! $(.shared-static-warning-emitted)
|
||||
{
|
||||
ECHO "warning: skipping configuration link=shared, runtime-link=static" ;
|
||||
ECHO "warning: this combination is either impossible or too dangerous" ;
|
||||
ECHO "warning: to be of any use" ;
|
||||
.shared-static-warning-emitted = 1 ;
|
||||
}
|
||||
|
||||
return <build>no ;
|
||||
}
|
||||
}
|
||||
|
||||
all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
|
||||
[ glob libs/*/build/Jamfile ] ] ;
|
||||
|
||||
all-libraries = [ sequence.unique $(all-libraries) ] ;
|
||||
# The function_types library has a Jamfile, but it's used for maintenance
|
||||
# purposes, there's no library to build and install.
|
||||
all-libraries = [ set.difference $(all-libraries) : function_types ] ;
|
||||
|
||||
# Setup convenient aliases for all libraries.
|
||||
|
||||
local rule explicit-alias ( id : targets + )
|
||||
{
|
||||
alias $(id) : $(targets) ;
|
||||
explicit $(id) ;
|
||||
}
|
||||
|
||||
# First, the complicated libraries: where the target name in Jamfile is
|
||||
# different from its directory name.
|
||||
explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
|
||||
explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
|
||||
explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
|
||||
explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
|
||||
explicit-alias serialization : libs/serialization/build//boost_serialization ;
|
||||
explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
|
||||
for local l in $(all-libraries)
|
||||
{
|
||||
if ! $(l) in test graph serialization headers
|
||||
{
|
||||
explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
|
||||
}
|
||||
}
|
||||
|
||||
# Log has an additional target
|
||||
explicit-alias log_setup : libs/log/build//boost_log_setup ;
|
||||
|
||||
rule do-nothing { }
|
||||
|
||||
rule generate-alias ( project name : property-set : sources * )
|
||||
{
|
||||
local action-name = [ $(property-set).get <action> ] ;
|
||||
local m = [ MATCH ^@(.*) : $(action-name) ] ;
|
||||
property-set = [ property-set.empty ] ;
|
||||
local action = [ new action $(sources) : $(m[1]) : $(property-set) ] ;
|
||||
local t = [ new notfile-target $(name) : $(project) : $(action) ] ;
|
||||
return [ virtual-target.register $(t) ] ;
|
||||
}
|
||||
|
||||
generate headers : $(all-headers)-headers : <generating-rule>@generate-alias <action>@do-nothing : : <include>. ;
|
||||
|
||||
#alias headers : $(all-headers)-headers : : : <include>. ;
|
||||
explicit headers ;
|
||||
|
||||
# Make project ids of all libraries known.
|
||||
for local l in $(all-libraries)
|
||||
{
|
||||
use-project /boost/$(l) : libs/$(l)/build ;
|
||||
}
|
||||
|
||||
if [ path.exists $(BOOST_ROOT)/tools/inspect/build ]
|
||||
{
|
||||
use-project /boost/tools/inspect : tools/inspect/build ;
|
||||
}
|
||||
|
||||
if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ]
|
||||
{
|
||||
use-project /boost/libs/wave/tool : libs/wave/tool/build ;
|
||||
}
|
||||
|
||||
# Make the boost-install rule visible in subprojects
|
||||
|
||||
# This rule should be called from libraries' Jamfiles and will create two
|
||||
# targets, "install" and "stage", that will install or stage that library. The
|
||||
# --prefix option is respected, but --with and --without options, naturally, are
|
||||
# ignored.
|
||||
#
|
||||
# - libraries -- list of library targets to install.
|
||||
|
||||
rule boost-install ( libraries * )
|
||||
{
|
||||
boost-install.boost-install $(libraries) ;
|
||||
}
|
||||
|
||||
# Creates a library target, adding autolink support and also creates
|
||||
# stage and install targets via boost-install, above.
|
||||
rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
|
||||
{
|
||||
autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
|
||||
name = boost_$(name) ;
|
||||
lib $(name)
|
||||
: $(sources)
|
||||
: $(requirements) $(autolink)
|
||||
: $(default-build)
|
||||
: $(usage-requirements) $(autolink)
|
||||
;
|
||||
boost-install $(name) ;
|
||||
}
|
||||
|
||||
|
||||
# Declare special top-level targets that build and install the desired variants
|
||||
# of the libraries.
|
||||
boostcpp.declare-targets $(all-libraries) ;
|
23
third_party/boost/LICENSE_1_0.txt
vendored
Normal file
23
third_party/boost/LICENSE_1_0.txt
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Boost Software License - Version 1.0 - August 17th, 2003
|
||||
|
||||
Permission is hereby granted, free of charge, to any person or organization
|
||||
obtaining a copy of the software and accompanying documentation covered by
|
||||
this license (the "Software") to use, reproduce, display, distribute,
|
||||
execute, and transmit the Software, and to prepare derivative works of the
|
||||
Software, and to permit third-parties to whom the Software is furnished to
|
||||
do so, all subject to the following:
|
||||
|
||||
The copyright notices in the Software and this entire statement, including
|
||||
the above license grant, this restriction and the following disclaimer,
|
||||
must be included in all copies of the Software, in whole or in part, and
|
||||
all derivative works of the Software, unless such copies or derivative
|
||||
works are solely in the form of machine-executable object code generated by
|
||||
a source language processor.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
||||
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
23
third_party/boost/Readme.md
vendored
Normal file
23
third_party/boost/Readme.md
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
Boost libraries - trimmed down for Citra
|
||||
========================================
|
||||
|
||||
This is a subset of Boost v1.71.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script.
|
||||
|
||||
Updating this repo (on Windows)
|
||||
===============================
|
||||
|
||||
To update the Boost version (or to add a new library) follow these steps:
|
||||
|
||||
- Download Boost and extract the package, then launch Powershell and `cd` to the `boost_1_xx_0` directory.
|
||||
- Build the `bcp` tool:
|
||||
```
|
||||
.\bootstrap.bat
|
||||
.\b2 tools\bcp
|
||||
```
|
||||
|
||||
- Store the boost directory in a variable for later use: `$boost_dir = $pwd`.
|
||||
- Add bcp to your path: `$env:Path += ";$boost_dir\bin.v2\tools\bcp\msvc-14.2\release\link-static\threading-multi"` (The correct output path should be printed by b2 during the build.)
|
||||
- `cd` to this repo's directory (`...\externals\boost\`)
|
||||
- Remove the existing boost from the repo: `rm -r boost` (This is only necessary if doing a Boost version upgrade, in case they removed any files in the new version.)
|
||||
- Run `.\build.cmd $boost_dir` to build a new trimmed down distro.
|
||||
- Add/remove all files in git and commit.
|
176
third_party/boost/boost/algorithm/string/case_conv.hpp
vendored
Normal file
176
third_party/boost/boost/algorithm/string/case_conv.hpp
vendored
Normal file
|
@ -0,0 +1,176 @@
|
|||
// Boost string_algo library case_conv.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_CASE_CONV_HPP
|
||||
#define BOOST_STRING_CASE_CONV_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
#include <boost/range/as_literal.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
|
||||
#include <boost/algorithm/string/detail/case_conv.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines sequence case-conversion algorithms.
|
||||
Algorithms convert each element in the input sequence to the
|
||||
desired case using provided locales.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// to_lower -----------------------------------------------//
|
||||
|
||||
//! Convert to lower case
|
||||
/*!
|
||||
Each element of the input sequence is converted to lower
|
||||
case. The result is a copy of the input converted to lower case.
|
||||
It is returned as a sequence or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input range
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
a copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT
|
||||
to_lower_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ::boost::algorithm::detail::transform_range_copy(
|
||||
Output,
|
||||
::boost::as_literal(Input),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT to_lower_copy(
|
||||
const SequenceT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
|
||||
Input,
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<SequenceT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to lower case
|
||||
/*!
|
||||
Each element of the input sequence is converted to lower
|
||||
case. The input sequence is modified in-place.
|
||||
|
||||
\param Input A range
|
||||
\param Loc a locale used for conversion
|
||||
*/
|
||||
template<typename WritableRangeT>
|
||||
inline void to_lower(
|
||||
WritableRangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
::boost::algorithm::detail::transform_range(
|
||||
::boost::as_literal(Input),
|
||||
::boost::algorithm::detail::to_lowerF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
// to_upper -----------------------------------------------//
|
||||
|
||||
//! Convert to upper case
|
||||
/*!
|
||||
Each element of the input sequence is converted to upper
|
||||
case. The result is a copy of the input converted to upper case.
|
||||
It is returned as a sequence or copied to the output iterator
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input range
|
||||
\param Loc A locale used for conversion
|
||||
\return
|
||||
An output iterator pointing just after the last inserted character or
|
||||
a copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT
|
||||
to_upper_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ::boost::algorithm::detail::transform_range_copy(
|
||||
Output,
|
||||
::boost::as_literal(Input),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<RangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to upper case
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT to_upper_copy(
|
||||
const SequenceT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
|
||||
Input,
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<SequenceT>::type >(Loc));
|
||||
}
|
||||
|
||||
//! Convert to upper case
|
||||
/*!
|
||||
Each element of the input sequence is converted to upper
|
||||
case. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input range
|
||||
\param Loc a locale used for conversion
|
||||
*/
|
||||
template<typename WritableRangeT>
|
||||
inline void to_upper(
|
||||
WritableRangeT& Input,
|
||||
const std::locale& Loc=std::locale())
|
||||
{
|
||||
::boost::algorithm::detail::transform_range(
|
||||
::boost::as_literal(Input),
|
||||
::boost::algorithm::detail::to_upperF<
|
||||
typename range_value<WritableRangeT>::type >(Loc));
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::to_lower;
|
||||
using algorithm::to_lower_copy;
|
||||
using algorithm::to_upper;
|
||||
using algorithm::to_upper_copy;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_CASE_CONV_HPP
|
199
third_party/boost/boost/algorithm/string/compare.hpp
vendored
Normal file
199
third_party/boost/boost/algorithm/string/compare.hpp
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
// Boost string_algo library compare.hpp header file -------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2006.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_COMPARE_HPP
|
||||
#define BOOST_STRING_COMPARE_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <locale>
|
||||
|
||||
/*! \file
|
||||
Defines element comparison predicates. Many algorithms in this library can
|
||||
take an additional argument with a predicate used to compare elements.
|
||||
This makes it possible, for instance, to have case insensitive versions
|
||||
of the algorithms.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// is_equal functor -----------------------------------------------//
|
||||
|
||||
//! is_equal functor
|
||||
/*!
|
||||
Standard STL equal_to only handle comparison between arguments
|
||||
of the same type. This is a less restrictive version which wraps operator ==.
|
||||
*/
|
||||
struct is_equal
|
||||
{
|
||||
//! Function operator
|
||||
/*!
|
||||
Compare two operands for equality
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
return Arg1==Arg2;
|
||||
}
|
||||
};
|
||||
|
||||
//! case insensitive version of is_equal
|
||||
/*!
|
||||
Case insensitive comparison predicate. Comparison is done using
|
||||
specified locales.
|
||||
*/
|
||||
struct is_iequal
|
||||
{
|
||||
//! Constructor
|
||||
/*!
|
||||
\param Loc locales used for comparison
|
||||
*/
|
||||
is_iequal( const std::locale& Loc=std::locale() ) :
|
||||
m_Loc( Loc ) {}
|
||||
|
||||
//! Function operator
|
||||
/*!
|
||||
Compare two operands. Case is ignored.
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)==std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)==std::toupper<T2>(Arg2,m_Loc);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_Loc;
|
||||
};
|
||||
|
||||
// is_less functor -----------------------------------------------//
|
||||
|
||||
//! is_less functor
|
||||
/*!
|
||||
Convenient version of standard std::less. Operation is templated, therefore it is
|
||||
not required to specify the exact types upon the construction
|
||||
*/
|
||||
struct is_less
|
||||
{
|
||||
//! Functor operation
|
||||
/*!
|
||||
Compare two operands using > operator
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
return Arg1<Arg2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! case insensitive version of is_less
|
||||
/*!
|
||||
Case insensitive comparison predicate. Comparison is done using
|
||||
specified locales.
|
||||
*/
|
||||
struct is_iless
|
||||
{
|
||||
//! Constructor
|
||||
/*!
|
||||
\param Loc locales used for comparison
|
||||
*/
|
||||
is_iless( const std::locale& Loc=std::locale() ) :
|
||||
m_Loc( Loc ) {}
|
||||
|
||||
//! Function operator
|
||||
/*!
|
||||
Compare two operands. Case is ignored.
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)<std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)<std::toupper<T2>(Arg2,m_Loc);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_Loc;
|
||||
};
|
||||
|
||||
// is_not_greater functor -----------------------------------------------//
|
||||
|
||||
//! is_not_greater functor
|
||||
/*!
|
||||
Convenient version of standard std::not_greater_to. Operation is templated, therefore it is
|
||||
not required to specify the exact types upon the construction
|
||||
*/
|
||||
struct is_not_greater
|
||||
{
|
||||
//! Functor operation
|
||||
/*!
|
||||
Compare two operands using > operator
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
return Arg1<=Arg2;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//! case insensitive version of is_not_greater
|
||||
/*!
|
||||
Case insensitive comparison predicate. Comparison is done using
|
||||
specified locales.
|
||||
*/
|
||||
struct is_not_igreater
|
||||
{
|
||||
//! Constructor
|
||||
/*!
|
||||
\param Loc locales used for comparison
|
||||
*/
|
||||
is_not_igreater( const std::locale& Loc=std::locale() ) :
|
||||
m_Loc( Loc ) {}
|
||||
|
||||
//! Function operator
|
||||
/*!
|
||||
Compare two operands. Case is ignored.
|
||||
*/
|
||||
template< typename T1, typename T2 >
|
||||
bool operator()( const T1& Arg1, const T2& Arg2 ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper(Arg1)<=std::toupper(Arg2);
|
||||
#else
|
||||
return std::toupper<T1>(Arg1,m_Loc)<=std::toupper<T2>(Arg2,m_Loc);
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
std::locale m_Loc;
|
||||
};
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::is_equal;
|
||||
using algorithm::is_iequal;
|
||||
using algorithm::is_less;
|
||||
using algorithm::is_iless;
|
||||
using algorithm::is_not_greater;
|
||||
using algorithm::is_not_igreater;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_COMPARE_HPP
|
83
third_party/boost/boost/algorithm/string/concept.hpp
vendored
Normal file
83
third_party/boost/boost/algorithm/string/concept.hpp
vendored
Normal file
|
@ -0,0 +1,83 @@
|
|||
// Boost string_algo library concept.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_CONCEPT_HPP
|
||||
#define BOOST_STRING_CONCEPT_HPP
|
||||
|
||||
#include <boost/concept_check.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines concepts used in string_algo library
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
//! Finder concept
|
||||
/*!
|
||||
Defines the Finder concept. Finder is a functor which selects
|
||||
an arbitrary part of a string. Search is performed on
|
||||
the range specified by starting and ending iterators.
|
||||
|
||||
Result of the find operation must be convertible to iterator_range.
|
||||
*/
|
||||
template<typename FinderT, typename IteratorT>
|
||||
struct FinderConcept
|
||||
{
|
||||
private:
|
||||
typedef iterator_range<IteratorT> range;
|
||||
public:
|
||||
void constraints()
|
||||
{
|
||||
// Operation
|
||||
r=(*pF)(i,i);
|
||||
}
|
||||
private:
|
||||
range r;
|
||||
IteratorT i;
|
||||
FinderT* pF;
|
||||
}; // Finder_concept
|
||||
|
||||
|
||||
//! Formatter concept
|
||||
/*!
|
||||
Defines the Formatter concept. Formatter is a functor, which
|
||||
takes a result from a finder operation and transforms it
|
||||
in a specific way.
|
||||
|
||||
Result must be a container supported by container_traits,
|
||||
or a reference to it.
|
||||
*/
|
||||
template<typename FormatterT, typename FinderT, typename IteratorT>
|
||||
struct FormatterConcept
|
||||
{
|
||||
public:
|
||||
void constraints()
|
||||
{
|
||||
// Operation
|
||||
::boost::begin((*pFo)( (*pF)(i,i) ));
|
||||
::boost::end((*pFo)( (*pF)(i,i) ));
|
||||
}
|
||||
private:
|
||||
IteratorT i;
|
||||
FinderT* pF;
|
||||
FormatterT *pFo;
|
||||
}; // FormatterConcept;
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // BOOST_STRING_CONCEPT_HPP
|
28
third_party/boost/boost/algorithm/string/config.hpp
vendored
Normal file
28
third_party/boost/boost/algorithm/string/config.hpp
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
// Boost string_algo library config.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_CONFIG_HPP
|
||||
#define BOOST_STRING_CONFIG_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifdef BOOST_STRING_DEDUCED_TYPENAME
|
||||
# error "macro already defined!"
|
||||
#endif
|
||||
|
||||
#define BOOST_STRING_TYPENAME BOOST_DEDUCED_TYPENAME
|
||||
|
||||
// Metrowerks workaround
|
||||
#if BOOST_WORKAROUND(__MWERKS__, <= 0x3003) // 8.x
|
||||
#pragma parse_func_templ off
|
||||
#endif
|
||||
|
||||
#endif // BOOST_STRING_CONFIG_HPP
|
36
third_party/boost/boost/algorithm/string/constants.hpp
vendored
Normal file
36
third_party/boost/boost/algorithm/string/constants.hpp
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// Boost string_algo library constants.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_CONSTANTS_HPP
|
||||
#define BOOST_STRING_CONSTANTS_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
//! Token compression mode
|
||||
/*!
|
||||
Specifies token compression mode for the token_finder.
|
||||
*/
|
||||
enum token_compress_mode_type
|
||||
{
|
||||
token_compress_on, //!< Compress adjacent tokens
|
||||
token_compress_off //!< Do not compress adjacent tokens
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull the names to the boost namespace
|
||||
using algorithm::token_compress_on;
|
||||
using algorithm::token_compress_off;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_CONSTANTS_HPP
|
||||
|
127
third_party/boost/boost/algorithm/string/detail/case_conv.hpp
vendored
Normal file
127
third_party/boost/boost/algorithm/string/detail/case_conv.hpp
vendored
Normal file
|
@ -0,0 +1,127 @@
|
|||
// Boost string_algo library string_funct.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_CASE_CONV_DETAIL_HPP
|
||||
#define BOOST_STRING_CASE_CONV_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <locale>
|
||||
#include <functional>
|
||||
|
||||
#include <boost/type_traits/make_unsigned.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// case conversion functors -----------------------------------------------//
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
// a tolower functor
|
||||
template<typename CharT>
|
||||
struct to_lowerF
|
||||
{
|
||||
typedef CharT argument_type;
|
||||
typedef CharT result_type;
|
||||
// Constructor
|
||||
to_lowerF( const std::locale& Loc ) : m_Loc( &Loc ) {}
|
||||
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::tolower<CharT>( Ch, *m_Loc );
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
const std::locale* m_Loc;
|
||||
};
|
||||
|
||||
// a toupper functor
|
||||
template<typename CharT>
|
||||
struct to_upperF
|
||||
{
|
||||
typedef CharT argument_type;
|
||||
typedef CharT result_type;
|
||||
// Constructor
|
||||
to_upperF( const std::locale& Loc ) : m_Loc( &Loc ) {}
|
||||
|
||||
// Operation
|
||||
CharT operator ()( CharT Ch ) const
|
||||
{
|
||||
#if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL)
|
||||
return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch ));
|
||||
#else
|
||||
return std::toupper<CharT>( Ch, *m_Loc );
|
||||
#endif
|
||||
}
|
||||
private:
|
||||
const std::locale* m_Loc;
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// algorithm implementation -------------------------------------------------------------------------
|
||||
|
||||
// Transform a range
|
||||
template<typename OutputIteratorT, typename RangeT, typename FunctorT>
|
||||
OutputIteratorT transform_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
FunctorT Functor)
|
||||
{
|
||||
return std::transform(
|
||||
::boost::begin(Input),
|
||||
::boost::end(Input),
|
||||
Output,
|
||||
Functor);
|
||||
}
|
||||
|
||||
// Transform a range (in-place)
|
||||
template<typename RangeT, typename FunctorT>
|
||||
void transform_range(
|
||||
const RangeT& Input,
|
||||
FunctorT Functor)
|
||||
{
|
||||
std::transform(
|
||||
::boost::begin(Input),
|
||||
::boost::end(Input),
|
||||
::boost::begin(Input),
|
||||
Functor);
|
||||
}
|
||||
|
||||
template<typename SequenceT, typename RangeT, typename FunctorT>
|
||||
inline SequenceT transform_range_copy(
|
||||
const RangeT& Input,
|
||||
FunctorT Functor)
|
||||
{
|
||||
return SequenceT(
|
||||
::boost::make_transform_iterator(
|
||||
::boost::begin(Input),
|
||||
Functor),
|
||||
::boost::make_transform_iterator(
|
||||
::boost::end(Input),
|
||||
Functor));
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_CASE_CONV_DETAIL_HPP
|
204
third_party/boost/boost/algorithm/string/detail/find_format.hpp
vendored
Normal file
204
third_party/boost/boost/algorithm/string/detail/find_format.hpp
vendored
Normal file
|
@ -0,0 +1,204 @@
|
|||
// Boost string_algo library find_format.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
||||
#define BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// find_format_copy (iterator variant) implementation -------------------------------//
|
||||
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline OutputIteratorT find_format_copy_impl2(
|
||||
OutputIteratorT Output,
|
||||
const InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult,
|
||||
const FormatResultT& FormatResult )
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Match not found - return original sequence
|
||||
Output = std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
|
||||
return Output;
|
||||
}
|
||||
|
||||
// Copy the beginning of the sequence
|
||||
Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output );
|
||||
// Format find result
|
||||
// Copy formatted result
|
||||
Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
|
||||
// Copy the rest of the sequence
|
||||
Output = std::copy( M.end(), ::boost::end(Input), Output );
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline OutputIteratorT find_format_copy_impl(
|
||||
OutputIteratorT Output,
|
||||
const InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult )
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// find_format_copy implementation --------------------------------------------------//
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline InputT find_format_copy_impl2(
|
||||
const InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult,
|
||||
const FormatResultT& FormatResult)
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Match not found - return original sequence
|
||||
return InputT( Input );
|
||||
}
|
||||
|
||||
InputT Output;
|
||||
// Copy the beginning of the sequence
|
||||
boost::algorithm::detail::insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() );
|
||||
// Copy formatted result
|
||||
boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
|
||||
// Copy the rest of the sequence
|
||||
boost::algorithm::detail::insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) );
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline InputT find_format_copy_impl(
|
||||
const InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_copy_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return Input;
|
||||
}
|
||||
}
|
||||
|
||||
// replace implementation ----------------------------------------------------//
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline void find_format_impl2(
|
||||
InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult,
|
||||
const FormatResultT& FormatResult)
|
||||
{
|
||||
typedef find_format_store<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<InputT>::type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Search not found - return original sequence
|
||||
return;
|
||||
}
|
||||
|
||||
// Replace match
|
||||
::boost::algorithm::detail::replace( Input, M.begin(), M.end(), M.format_result() );
|
||||
}
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline void find_format_impl(
|
||||
InputT& Input,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
::boost::algorithm::detail::find_format_impl2(
|
||||
Input,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_FIND_FORMAT_DETAIL_HPP
|
273
third_party/boost/boost/algorithm/string/detail/find_format_all.hpp
vendored
Normal file
273
third_party/boost/boost/algorithm/string/detail/find_format_all.hpp
vendored
Normal file
|
@ -0,0 +1,273 @@
|
|||
// Boost string_algo library find_format_all.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
||||
#define BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_store.hpp>
|
||||
#include <boost/algorithm/string/detail/replace_storage.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// find_format_all_copy (iterator variant) implementation ---------------------------//
|
||||
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline OutputIteratorT find_format_all_copy_impl2(
|
||||
OutputIteratorT Output,
|
||||
const InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult,
|
||||
const FormatResultT& FormatResult )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
// Initialize last match
|
||||
input_iterator_type LastMatch=::boost::begin(Input);
|
||||
|
||||
// Iterate through all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
Output = std::copy( LastMatch, M.begin(), Output );
|
||||
// Copy formatted result
|
||||
Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
|
||||
|
||||
// Proceed to the next match
|
||||
LastMatch=M.end();
|
||||
M=Finder( LastMatch, ::boost::end(Input) );
|
||||
}
|
||||
|
||||
// Copy the rest of the sequence
|
||||
Output = std::copy( LastMatch, ::boost::end(Input), Output );
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline OutputIteratorT find_format_all_copy_impl(
|
||||
OutputIteratorT Output,
|
||||
const InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult )
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Output,
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return std::copy( ::boost::begin(Input), ::boost::end(Input), Output );
|
||||
}
|
||||
}
|
||||
|
||||
// find_format_all_copy implementation ----------------------------------------------//
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline InputT find_format_all_copy_impl2(
|
||||
const InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult,
|
||||
const FormatResultT& FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
// Initialize last match
|
||||
input_iterator_type LastMatch=::boost::begin(Input);
|
||||
|
||||
// Output temporary
|
||||
InputT Output;
|
||||
|
||||
// Iterate through all matches
|
||||
while( M )
|
||||
{
|
||||
// Copy the beginning of the sequence
|
||||
boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, M.begin() );
|
||||
// Copy formatted result
|
||||
boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
|
||||
|
||||
// Proceed to the next match
|
||||
LastMatch=M.end();
|
||||
M=Finder( LastMatch, ::boost::end(Input) );
|
||||
}
|
||||
|
||||
// Copy the rest of the sequence
|
||||
::boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, ::boost::end(Input) );
|
||||
|
||||
return Output;
|
||||
}
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline InputT find_format_all_copy_impl(
|
||||
const InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
const FindResultT& FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
return ::boost::algorithm::detail::find_format_all_copy_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
} else {
|
||||
return Input;
|
||||
}
|
||||
}
|
||||
|
||||
// find_format_all implementation ------------------------------------------------//
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT,
|
||||
typename FormatResultT >
|
||||
inline void find_format_all_impl2(
|
||||
InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
FindResultT FindResult,
|
||||
FormatResultT FormatResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_iterator<InputT>::type input_iterator_type;
|
||||
typedef find_format_store<
|
||||
input_iterator_type,
|
||||
FormatterT,
|
||||
FormatResultT > store_type;
|
||||
|
||||
// Create store for the find result
|
||||
store_type M( FindResult, FormatResult, Formatter );
|
||||
|
||||
// Instantiate replacement storage
|
||||
std::deque<
|
||||
BOOST_STRING_TYPENAME range_value<InputT>::type> Storage;
|
||||
|
||||
// Initialize replacement iterators
|
||||
input_iterator_type InsertIt=::boost::begin(Input);
|
||||
input_iterator_type SearchIt=::boost::begin(Input);
|
||||
|
||||
while( M )
|
||||
{
|
||||
// process the segment
|
||||
InsertIt=process_segment(
|
||||
Storage,
|
||||
Input,
|
||||
InsertIt,
|
||||
SearchIt,
|
||||
M.begin() );
|
||||
|
||||
// Adjust search iterator
|
||||
SearchIt=M.end();
|
||||
|
||||
// Copy formatted replace to the storage
|
||||
::boost::algorithm::detail::copy_to_storage( Storage, M.format_result() );
|
||||
|
||||
// Find range for a next match
|
||||
M=Finder( SearchIt, ::boost::end(Input) );
|
||||
}
|
||||
|
||||
// process the last segment
|
||||
InsertIt=::boost::algorithm::detail::process_segment(
|
||||
Storage,
|
||||
Input,
|
||||
InsertIt,
|
||||
SearchIt,
|
||||
::boost::end(Input) );
|
||||
|
||||
if ( Storage.empty() )
|
||||
{
|
||||
// Truncate input
|
||||
::boost::algorithm::detail::erase( Input, InsertIt, ::boost::end(Input) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Copy remaining data to the end of input
|
||||
::boost::algorithm::detail::insert( Input, ::boost::end(Input), Storage.begin(), Storage.end() );
|
||||
}
|
||||
}
|
||||
|
||||
template<
|
||||
typename InputT,
|
||||
typename FinderT,
|
||||
typename FormatterT,
|
||||
typename FindResultT >
|
||||
inline void find_format_all_impl(
|
||||
InputT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter,
|
||||
FindResultT FindResult)
|
||||
{
|
||||
if( ::boost::algorithm::detail::check_find_result(Input, FindResult) ) {
|
||||
::boost::algorithm::detail::find_format_all_impl2(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
FindResult,
|
||||
Formatter(FindResult) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_FIND_FORMAT_ALL_DETAIL_HPP
|
89
third_party/boost/boost/algorithm/string/detail/find_format_store.hpp
vendored
Normal file
89
third_party/boost/boost/algorithm/string/detail/find_format_store.hpp
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
// Boost string_algo library find_format_store.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
||||
#define BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// temporary format and find result storage --------------------------------//
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
template<
|
||||
typename ForwardIteratorT,
|
||||
typename FormatterT,
|
||||
typename FormatResultT >
|
||||
class find_format_store :
|
||||
public iterator_range<ForwardIteratorT>
|
||||
{
|
||||
public:
|
||||
// typedefs
|
||||
typedef iterator_range<ForwardIteratorT> base_type;
|
||||
typedef FormatterT formatter_type;
|
||||
typedef FormatResultT format_result_type;
|
||||
|
||||
public:
|
||||
// Construction
|
||||
find_format_store(
|
||||
const base_type& FindResult,
|
||||
const format_result_type& FormatResult,
|
||||
const formatter_type& Formatter ) :
|
||||
base_type(FindResult),
|
||||
m_FormatResult(FormatResult),
|
||||
m_Formatter(Formatter) {}
|
||||
|
||||
// Assignment
|
||||
template< typename FindResultT >
|
||||
find_format_store& operator=( FindResultT FindResult )
|
||||
{
|
||||
iterator_range<ForwardIteratorT>::operator=(FindResult);
|
||||
if( !this->empty() ) {
|
||||
m_FormatResult=m_Formatter(FindResult);
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Retrieve format result
|
||||
const format_result_type& format_result()
|
||||
{
|
||||
return m_FormatResult;
|
||||
}
|
||||
|
||||
private:
|
||||
format_result_type m_FormatResult;
|
||||
const formatter_type& m_Formatter;
|
||||
};
|
||||
|
||||
template<typename InputT, typename FindResultT>
|
||||
bool check_find_result(InputT&, FindResultT& FindResult)
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<InputT>::type input_iterator_type;
|
||||
iterator_range<input_iterator_type> ResultRange(FindResult);
|
||||
return !ResultRange.empty();
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_FIND_FORMAT_STORE_DETAIL_HPP
|
639
third_party/boost/boost/algorithm/string/detail/finder.hpp
vendored
Normal file
639
third_party/boost/boost/algorithm/string/detail/finder.hpp
vendored
Normal file
|
@ -0,0 +1,639 @@
|
|||
// Boost string_algo library finder.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2006.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FINDER_DETAIL_HPP
|
||||
#define BOOST_STRING_FINDER_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/empty.hpp>
|
||||
#include <boost/range/as_literal.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
|
||||
// find first functor -----------------------------------------------//
|
||||
|
||||
// find a subsequence in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, functor returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT,typename PredicateT>
|
||||
struct first_finderF
|
||||
{
|
||||
typedef SearchIteratorT search_iterator_type;
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
first_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {}
|
||||
first_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
PredicateT Comp ) :
|
||||
m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
|
||||
// Outer loop
|
||||
for(input_iterator_type OuterIt=Begin;
|
||||
OuterIt!=End;
|
||||
++OuterIt)
|
||||
{
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
input_iterator_type InnerIt=OuterIt;
|
||||
search_iterator_type SubstrIt=m_Search.begin();
|
||||
for(;
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
// Substring matching succeeded
|
||||
if ( SubstrIt==m_Search.end() )
|
||||
return result_type( OuterIt, InnerIt );
|
||||
}
|
||||
|
||||
return result_type( End, End );
|
||||
}
|
||||
|
||||
private:
|
||||
iterator_range<search_iterator_type> m_Search;
|
||||
PredicateT m_Comp;
|
||||
};
|
||||
|
||||
// find last functor -----------------------------------------------//
|
||||
|
||||
// find the last match a subsequence in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT, typename PredicateT>
|
||||
struct last_finderF
|
||||
{
|
||||
typedef SearchIteratorT search_iterator_type;
|
||||
typedef first_finderF<
|
||||
search_iterator_type,
|
||||
PredicateT> first_finder_type;
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
last_finderF( const SearchT& Search, PredicateT Comp ) :
|
||||
m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {}
|
||||
last_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
PredicateT Comp ) :
|
||||
m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return findit( Begin, End, category() );
|
||||
}
|
||||
|
||||
private:
|
||||
// forward iterator
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::forward_iterator_tag ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
first_finder_type first_finder(
|
||||
m_Search.begin(), m_Search.end(), m_Comp );
|
||||
|
||||
result_type M=first_finder( Begin, End );
|
||||
result_type Last=M;
|
||||
|
||||
while( M )
|
||||
{
|
||||
Last=M;
|
||||
M=first_finder( ::boost::end(M), End );
|
||||
}
|
||||
|
||||
return Last;
|
||||
}
|
||||
|
||||
// bidirectional iterator
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
findit(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
std::bidirectional_iterator_tag ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
|
||||
// Outer loop
|
||||
for(input_iterator_type OuterIt=End;
|
||||
OuterIt!=Begin; )
|
||||
{
|
||||
input_iterator_type OuterIt2=--OuterIt;
|
||||
|
||||
input_iterator_type InnerIt=OuterIt2;
|
||||
search_iterator_type SubstrIt=m_Search.begin();
|
||||
for(;
|
||||
InnerIt!=End && SubstrIt!=m_Search.end();
|
||||
++InnerIt,++SubstrIt)
|
||||
{
|
||||
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
|
||||
break;
|
||||
}
|
||||
|
||||
// Substring matching succeeded
|
||||
if( SubstrIt==m_Search.end() )
|
||||
return result_type( OuterIt2, InnerIt );
|
||||
}
|
||||
|
||||
return result_type( End, End );
|
||||
}
|
||||
|
||||
private:
|
||||
iterator_range<search_iterator_type> m_Search;
|
||||
PredicateT m_Comp;
|
||||
};
|
||||
|
||||
// find n-th functor -----------------------------------------------//
|
||||
|
||||
// find the n-th match of a subsequence in the sequence ( functor )
|
||||
/*
|
||||
Returns a pair <begin,end> marking the subsequence in the sequence.
|
||||
If the find fails, returns <End,End>
|
||||
*/
|
||||
template<typename SearchIteratorT, typename PredicateT>
|
||||
struct nth_finderF
|
||||
{
|
||||
typedef SearchIteratorT search_iterator_type;
|
||||
typedef first_finderF<
|
||||
search_iterator_type,
|
||||
PredicateT> first_finder_type;
|
||||
typedef last_finderF<
|
||||
search_iterator_type,
|
||||
PredicateT> last_finder_type;
|
||||
|
||||
// Construction
|
||||
template< typename SearchT >
|
||||
nth_finderF(
|
||||
const SearchT& Search,
|
||||
int Nth,
|
||||
PredicateT Comp) :
|
||||
m_Search(::boost::begin(Search), ::boost::end(Search)),
|
||||
m_Nth(Nth),
|
||||
m_Comp(Comp) {}
|
||||
nth_finderF(
|
||||
search_iterator_type SearchBegin,
|
||||
search_iterator_type SearchEnd,
|
||||
int Nth,
|
||||
PredicateT Comp) :
|
||||
m_Search(SearchBegin, SearchEnd),
|
||||
m_Nth(Nth),
|
||||
m_Comp(Comp) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
if(m_Nth>=0)
|
||||
{
|
||||
return find_forward(Begin, End, m_Nth);
|
||||
}
|
||||
else
|
||||
{
|
||||
return find_backward(Begin, End, -m_Nth);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
// Implementation helpers
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_forward(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
// Instantiate find functor
|
||||
first_finder_type first_finder(
|
||||
m_Search.begin(), m_Search.end(), m_Comp );
|
||||
|
||||
result_type M( Begin, Begin );
|
||||
|
||||
for( unsigned int n=0; n<=N; ++n )
|
||||
{
|
||||
// find next match
|
||||
M=first_finder( ::boost::end(M), End );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Subsequence not found, return
|
||||
return M;
|
||||
}
|
||||
}
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_backward(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
// Sanity check
|
||||
if( boost::empty(m_Search) )
|
||||
return result_type( End, End );
|
||||
|
||||
// Instantiate find functor
|
||||
last_finder_type last_finder(
|
||||
m_Search.begin(), m_Search.end(), m_Comp );
|
||||
|
||||
result_type M( End, End );
|
||||
|
||||
for( unsigned int n=1; n<=N; ++n )
|
||||
{
|
||||
// find next match
|
||||
M=last_finder( Begin, ::boost::begin(M) );
|
||||
|
||||
if ( !M )
|
||||
{
|
||||
// Subsequence not found, return
|
||||
return M;
|
||||
}
|
||||
}
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
iterator_range<search_iterator_type> m_Search;
|
||||
int m_Nth;
|
||||
PredicateT m_Comp;
|
||||
};
|
||||
|
||||
// find head/tail implementation helpers ---------------------------//
|
||||
|
||||
template<typename ForwardIteratorT>
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_head_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N,
|
||||
std::forward_iterator_tag )
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
input_iterator_type It=Begin;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
Index<N && It!=End; ++Index,++It ) {};
|
||||
|
||||
return result_type( Begin, It );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_head_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N,
|
||||
std::random_access_iterator_tag )
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
|
||||
return result_type( Begin, End );
|
||||
|
||||
return result_type(Begin,Begin+N);
|
||||
}
|
||||
|
||||
// Find head implementation
|
||||
template<typename ForwardIteratorT>
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_head_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_tail_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N,
|
||||
std::forward_iterator_tag )
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
unsigned int Index=0;
|
||||
input_iterator_type It=Begin;
|
||||
input_iterator_type It2=Begin;
|
||||
|
||||
// Advance It2 by N increments
|
||||
for( Index=0; Index<N && It2!=End; ++Index,++It2 ) {};
|
||||
|
||||
// Advance It, It2 to the end
|
||||
for(; It2!=End; ++It,++It2 ) {};
|
||||
|
||||
return result_type( It, It2 );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_tail_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N,
|
||||
std::bidirectional_iterator_tag )
|
||||
{
|
||||
typedef ForwardIteratorT input_iterator_type;
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
input_iterator_type It=End;
|
||||
for(
|
||||
unsigned int Index=0;
|
||||
Index<N && It!=Begin; ++Index,--It ) {};
|
||||
|
||||
return result_type( It, End );
|
||||
}
|
||||
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_tail_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N,
|
||||
std::random_access_iterator_tag )
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
|
||||
return result_type( Begin, End );
|
||||
|
||||
return result_type( End-N, End );
|
||||
}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
find_tail_impl(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End,
|
||||
unsigned int N )
|
||||
{
|
||||
typedef BOOST_STRING_TYPENAME boost::detail::
|
||||
iterator_traits<ForwardIteratorT>::iterator_category category;
|
||||
|
||||
return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
// find head functor -----------------------------------------------//
|
||||
|
||||
|
||||
// find a head in the sequence ( functor )
|
||||
/*
|
||||
This functor find a head of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
elements of the range.
|
||||
*/
|
||||
struct head_finderF
|
||||
{
|
||||
// Construction
|
||||
head_finderF( int N ) : m_N(N) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
if(m_N>=0)
|
||||
{
|
||||
return ::boost::algorithm::detail::find_head_impl( Begin, End, m_N );
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator_range<ForwardIteratorT> Res=
|
||||
::boost::algorithm::detail::find_tail_impl( Begin, End, -m_N );
|
||||
|
||||
return ::boost::make_iterator_range(Begin, Res.begin());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int m_N;
|
||||
};
|
||||
|
||||
// find tail functor -----------------------------------------------//
|
||||
|
||||
|
||||
// find a tail in the sequence ( functor )
|
||||
/*
|
||||
This functor find a tail of the specified range. For
|
||||
a specified N, the head is a subsequence of N starting
|
||||
elements of the range.
|
||||
*/
|
||||
struct tail_finderF
|
||||
{
|
||||
// Construction
|
||||
tail_finderF( int N ) : m_N(N) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
if(m_N>=0)
|
||||
{
|
||||
return ::boost::algorithm::detail::find_tail_impl( Begin, End, m_N );
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator_range<ForwardIteratorT> Res=
|
||||
::boost::algorithm::detail::find_head_impl( Begin, End, -m_N );
|
||||
|
||||
return ::boost::make_iterator_range(Res.end(), End);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
int m_N;
|
||||
};
|
||||
|
||||
// find token functor -----------------------------------------------//
|
||||
|
||||
// find a token in a sequence ( functor )
|
||||
/*
|
||||
This find functor finds a token specified be a predicate
|
||||
in a sequence. It is equivalent of std::find algorithm,
|
||||
with an exception that it return range instead of a single
|
||||
iterator.
|
||||
|
||||
If bCompress is set to true, adjacent matching tokens are
|
||||
concatenated into one match.
|
||||
*/
|
||||
template< typename PredicateT >
|
||||
struct token_finderF
|
||||
{
|
||||
// Construction
|
||||
token_finderF(
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off ) :
|
||||
m_Pred(Pred), m_eCompress(eCompress) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIteratorT >
|
||||
iterator_range<ForwardIteratorT>
|
||||
operator()(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End ) const
|
||||
{
|
||||
typedef iterator_range<ForwardIteratorT> result_type;
|
||||
|
||||
ForwardIteratorT It=std::find_if( Begin, End, m_Pred );
|
||||
|
||||
if( It==End )
|
||||
{
|
||||
return result_type( End, End );
|
||||
}
|
||||
else
|
||||
{
|
||||
ForwardIteratorT It2=It;
|
||||
|
||||
if( m_eCompress==token_compress_on )
|
||||
{
|
||||
// Find first non-matching character
|
||||
while( It2!=End && m_Pred(*It2) ) ++It2;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Advance by one position
|
||||
++It2;
|
||||
}
|
||||
|
||||
return result_type( It, It2 );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
PredicateT m_Pred;
|
||||
token_compress_mode_type m_eCompress;
|
||||
};
|
||||
|
||||
// find range functor -----------------------------------------------//
|
||||
|
||||
// find a range in the sequence ( functor )
|
||||
/*
|
||||
This functor actually does not perform any find operation.
|
||||
It always returns given iterator range as a result.
|
||||
*/
|
||||
template<typename ForwardIterator1T>
|
||||
struct range_finderF
|
||||
{
|
||||
typedef ForwardIterator1T input_iterator_type;
|
||||
typedef iterator_range<input_iterator_type> result_type;
|
||||
|
||||
// Construction
|
||||
range_finderF(
|
||||
input_iterator_type Begin,
|
||||
input_iterator_type End ) : m_Range(Begin, End) {}
|
||||
|
||||
range_finderF(const iterator_range<input_iterator_type>& Range) :
|
||||
m_Range(Range) {}
|
||||
|
||||
// Operation
|
||||
template< typename ForwardIterator2T >
|
||||
iterator_range<ForwardIterator2T>
|
||||
operator()(
|
||||
ForwardIterator2T,
|
||||
ForwardIterator2T ) const
|
||||
{
|
||||
#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 )
|
||||
return iterator_range<const ForwardIterator2T>(this->m_Range);
|
||||
#else
|
||||
return m_Range;
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
iterator_range<input_iterator_type> m_Range;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_FINDER_DETAIL_HPP
|
119
third_party/boost/boost/algorithm/string/detail/formatter.hpp
vendored
Normal file
119
third_party/boost/boost/algorithm/string/detail/formatter.hpp
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
// Boost string_algo library formatter.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FORMATTER_DETAIL_HPP
|
||||
#define BOOST_STRING_FORMATTER_DETAIL_HPP
|
||||
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/detail/util.hpp>
|
||||
|
||||
// generic replace functors -----------------------------------------------//
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// const format functor ----------------------------------------------------//
|
||||
|
||||
// constant format functor
|
||||
template<typename RangeT>
|
||||
struct const_formatF
|
||||
{
|
||||
private:
|
||||
typedef BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type format_iterator;
|
||||
typedef iterator_range<format_iterator> result_type;
|
||||
|
||||
public:
|
||||
// Construction
|
||||
const_formatF(const RangeT& Format) :
|
||||
m_Format(::boost::begin(Format), ::boost::end(Format)) {}
|
||||
|
||||
// Operation
|
||||
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
template<typename Range2T>
|
||||
result_type& operator()(const Range2T&)
|
||||
{
|
||||
return m_Format;
|
||||
}
|
||||
#endif
|
||||
|
||||
template<typename Range2T>
|
||||
const result_type& operator()(const Range2T&) const
|
||||
{
|
||||
return m_Format;
|
||||
}
|
||||
|
||||
private:
|
||||
result_type m_Format;
|
||||
};
|
||||
|
||||
// identity format functor ----------------------------------------------------//
|
||||
|
||||
// identity format functor
|
||||
template<typename RangeT>
|
||||
struct identity_formatF
|
||||
{
|
||||
// Operation
|
||||
template< typename Range2T >
|
||||
const RangeT& operator()(const Range2T& Replace) const
|
||||
{
|
||||
return RangeT(::boost::begin(Replace), ::boost::end(Replace));
|
||||
}
|
||||
};
|
||||
|
||||
// empty format functor ( used by erase ) ------------------------------------//
|
||||
|
||||
// empty format functor
|
||||
template< typename CharT >
|
||||
struct empty_formatF
|
||||
{
|
||||
template< typename ReplaceT >
|
||||
empty_container<CharT> operator()(const ReplaceT&) const
|
||||
{
|
||||
return empty_container<CharT>();
|
||||
}
|
||||
};
|
||||
|
||||
// dissect format functor ----------------------------------------------------//
|
||||
|
||||
// dissect format functor
|
||||
template<typename FinderT>
|
||||
struct dissect_formatF
|
||||
{
|
||||
public:
|
||||
// Construction
|
||||
dissect_formatF(FinderT Finder) :
|
||||
m_Finder(Finder) {}
|
||||
|
||||
// Operation
|
||||
template<typename RangeT>
|
||||
inline iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
operator()(const RangeT& Replace) const
|
||||
{
|
||||
return m_Finder(::boost::begin(Replace), ::boost::end(Replace));
|
||||
}
|
||||
|
||||
private:
|
||||
FinderT m_Finder;
|
||||
};
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_FORMATTER_DETAIL_HPP
|
159
third_party/boost/boost/algorithm/string/detail/replace_storage.hpp
vendored
Normal file
159
third_party/boost/boost/algorithm/string/detail/replace_storage.hpp
vendored
Normal file
|
@ -0,0 +1,159 @@
|
|||
// Boost string_algo library replace_storage.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
|
||||
#define BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
#include <boost/algorithm/string/detail/sequence.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// storage handling routines -----------------------------------------------//
|
||||
|
||||
template< typename StorageT, typename OutputIteratorT >
|
||||
inline OutputIteratorT move_from_storage(
|
||||
StorageT& Storage,
|
||||
OutputIteratorT DestBegin,
|
||||
OutputIteratorT DestEnd )
|
||||
{
|
||||
OutputIteratorT OutputIt=DestBegin;
|
||||
|
||||
while( !Storage.empty() && OutputIt!=DestEnd )
|
||||
{
|
||||
*OutputIt=Storage.front();
|
||||
Storage.pop_front();
|
||||
++OutputIt;
|
||||
}
|
||||
|
||||
return OutputIt;
|
||||
}
|
||||
|
||||
template< typename StorageT, typename WhatT >
|
||||
inline void copy_to_storage(
|
||||
StorageT& Storage,
|
||||
const WhatT& What )
|
||||
{
|
||||
Storage.insert( Storage.end(), ::boost::begin(What), ::boost::end(What) );
|
||||
}
|
||||
|
||||
|
||||
// process segment routine -----------------------------------------------//
|
||||
|
||||
template< bool HasStableIterators >
|
||||
struct process_segment_helper
|
||||
{
|
||||
// Optimized version of process_segment for generic sequence
|
||||
template<
|
||||
typename StorageT,
|
||||
typename InputT,
|
||||
typename ForwardIteratorT >
|
||||
ForwardIteratorT operator()(
|
||||
StorageT& Storage,
|
||||
InputT& /*Input*/,
|
||||
ForwardIteratorT InsertIt,
|
||||
ForwardIteratorT SegmentBegin,
|
||||
ForwardIteratorT SegmentEnd )
|
||||
{
|
||||
// Copy data from the storage until the beginning of the segment
|
||||
ForwardIteratorT It=::boost::algorithm::detail::move_from_storage( Storage, InsertIt, SegmentBegin );
|
||||
|
||||
// 3 cases are possible :
|
||||
// a) Storage is empty, It==SegmentBegin
|
||||
// b) Storage is empty, It!=SegmentBegin
|
||||
// c) Storage is not empty
|
||||
|
||||
if( Storage.empty() )
|
||||
{
|
||||
if( It==SegmentBegin )
|
||||
{
|
||||
// Case a) everything is grand, just return end of segment
|
||||
return SegmentEnd;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case b) move the segment backwards
|
||||
return std::copy( SegmentBegin, SegmentEnd, It );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Case c) -> shift the segment to the left and keep the overlap in the storage
|
||||
while( It!=SegmentEnd )
|
||||
{
|
||||
// Store value into storage
|
||||
Storage.push_back( *It );
|
||||
// Get the top from the storage and put it here
|
||||
*It=Storage.front();
|
||||
Storage.pop_front();
|
||||
|
||||
// Advance
|
||||
++It;
|
||||
}
|
||||
|
||||
return It;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct process_segment_helper< true >
|
||||
{
|
||||
// Optimized version of process_segment for list-like sequence
|
||||
template<
|
||||
typename StorageT,
|
||||
typename InputT,
|
||||
typename ForwardIteratorT >
|
||||
ForwardIteratorT operator()(
|
||||
StorageT& Storage,
|
||||
InputT& Input,
|
||||
ForwardIteratorT InsertIt,
|
||||
ForwardIteratorT SegmentBegin,
|
||||
ForwardIteratorT SegmentEnd )
|
||||
|
||||
{
|
||||
// Call replace to do the job
|
||||
::boost::algorithm::detail::replace( Input, InsertIt, SegmentBegin, Storage );
|
||||
// Empty the storage
|
||||
Storage.clear();
|
||||
// Iterators were not changed, simply return the end of segment
|
||||
return SegmentEnd;
|
||||
}
|
||||
};
|
||||
|
||||
// Process one segment in the replace_all algorithm
|
||||
template<
|
||||
typename StorageT,
|
||||
typename InputT,
|
||||
typename ForwardIteratorT >
|
||||
inline ForwardIteratorT process_segment(
|
||||
StorageT& Storage,
|
||||
InputT& Input,
|
||||
ForwardIteratorT InsertIt,
|
||||
ForwardIteratorT SegmentBegin,
|
||||
ForwardIteratorT SegmentEnd )
|
||||
{
|
||||
return
|
||||
process_segment_helper<
|
||||
has_stable_iterators<InputT>::value>()(
|
||||
Storage, Input, InsertIt, SegmentBegin, SegmentEnd );
|
||||
}
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_STRING_REPLACE_STORAGE_DETAIL_HPP
|
200
third_party/boost/boost/algorithm/string/detail/sequence.hpp
vendored
Normal file
200
third_party/boost/boost/algorithm/string/detail/sequence.hpp
vendored
Normal file
|
@ -0,0 +1,200 @@
|
|||
// Boost string_algo library sequence.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_DETAIL_SEQUENCE_HPP
|
||||
#define BOOST_STRING_DETAIL_SEQUENCE_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/mpl/logical.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
#include <boost/algorithm/string/sequence_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// insert helpers -------------------------------------------------//
|
||||
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
inline void insert(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator At,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
Input.insert( At, Begin, End );
|
||||
}
|
||||
|
||||
template< typename InputT, typename InsertT >
|
||||
inline void insert(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator At,
|
||||
const InsertT& Insert )
|
||||
{
|
||||
::boost::algorithm::detail::insert( Input, At, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
|
||||
// erase helper ---------------------------------------------------//
|
||||
|
||||
// Erase a range in the sequence
|
||||
/*
|
||||
Returns the iterator pointing just after the erase subrange
|
||||
*/
|
||||
template< typename InputT >
|
||||
inline typename InputT::iterator erase(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To )
|
||||
{
|
||||
return Input.erase( From, To );
|
||||
}
|
||||
|
||||
// replace helper implementation ----------------------------------//
|
||||
|
||||
// Optimized version of replace for generic sequence containers
|
||||
// Assumption: insert and erase are expensive
|
||||
template< bool HasConstTimeOperations >
|
||||
struct replace_const_time_helper
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
// Copy data to the container ( as much as possible )
|
||||
ForwardIteratorT InsertIt=Begin;
|
||||
BOOST_STRING_TYPENAME InputT::iterator InputIt=From;
|
||||
for(; InsertIt!=End && InputIt!=To; InsertIt++, InputIt++ )
|
||||
{
|
||||
*InputIt=*InsertIt;
|
||||
}
|
||||
|
||||
if ( InsertIt!=End )
|
||||
{
|
||||
// Replace sequence is longer, insert it
|
||||
Input.insert( InputIt, InsertIt, End );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( InputIt!=To )
|
||||
{
|
||||
// Replace sequence is shorter, erase the rest
|
||||
Input.erase( InputIt, To );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct replace_const_time_helper< true >
|
||||
{
|
||||
// Const-time erase and insert methods -> use them
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
BOOST_STRING_TYPENAME InputT::iterator At=Input.erase( From, To );
|
||||
if ( Begin!=End )
|
||||
{
|
||||
if(!Input.empty())
|
||||
{
|
||||
Input.insert( At, Begin, End );
|
||||
}
|
||||
else
|
||||
{
|
||||
Input.insert( Input.begin(), Begin, End );
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// No native replace method
|
||||
template< bool HasNative >
|
||||
struct replace_native_helper
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
replace_const_time_helper<
|
||||
boost::mpl::and_<
|
||||
has_const_time_insert<InputT>,
|
||||
has_const_time_erase<InputT> >::value >()(
|
||||
Input, From, To, Begin, End );
|
||||
}
|
||||
};
|
||||
|
||||
// Container has native replace method
|
||||
template<>
|
||||
struct replace_native_helper< true >
|
||||
{
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
void operator()(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
Input.replace( From, To, Begin, End );
|
||||
}
|
||||
};
|
||||
|
||||
// replace helper -------------------------------------------------//
|
||||
|
||||
template< typename InputT, typename ForwardIteratorT >
|
||||
inline void replace(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
replace_native_helper< has_native_replace<InputT>::value >()(
|
||||
Input, From, To, Begin, End );
|
||||
}
|
||||
|
||||
template< typename InputT, typename InsertT >
|
||||
inline void replace(
|
||||
InputT& Input,
|
||||
BOOST_STRING_TYPENAME InputT::iterator From,
|
||||
BOOST_STRING_TYPENAME InputT::iterator To,
|
||||
const InsertT& Insert )
|
||||
{
|
||||
if(From!=To)
|
||||
{
|
||||
::boost::algorithm::detail::replace( Input, From, To, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
else
|
||||
{
|
||||
::boost::algorithm::detail::insert( Input, From, ::boost::begin(Insert), ::boost::end(Insert) );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_DETAIL_SEQUENCE_HPP
|
107
third_party/boost/boost/algorithm/string/detail/util.hpp
vendored
Normal file
107
third_party/boost/boost/algorithm/string/detail/util.hpp
vendored
Normal file
|
@ -0,0 +1,107 @@
|
|||
// Boost string_algo library util.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_UTIL_DETAIL_HPP
|
||||
#define BOOST_STRING_UTIL_DETAIL_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
#include <functional>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
namespace detail {
|
||||
|
||||
// empty container -----------------------------------------------//
|
||||
|
||||
// empty_container
|
||||
/*
|
||||
This class represents always empty container,
|
||||
containing elements of type CharT.
|
||||
|
||||
It is supposed to be used in a const version only
|
||||
*/
|
||||
template< typename CharT >
|
||||
struct empty_container
|
||||
{
|
||||
typedef empty_container<CharT> type;
|
||||
typedef CharT value_type;
|
||||
typedef std::size_t size_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef const value_type& reference;
|
||||
typedef const value_type& const_reference;
|
||||
typedef const value_type* iterator;
|
||||
typedef const value_type* const_iterator;
|
||||
|
||||
|
||||
// Operations
|
||||
const_iterator begin() const
|
||||
{
|
||||
return reinterpret_cast<const_iterator>(0);
|
||||
}
|
||||
|
||||
const_iterator end() const
|
||||
{
|
||||
return reinterpret_cast<const_iterator>(0);
|
||||
}
|
||||
|
||||
bool empty() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
size_type size() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
// bounded copy algorithm -----------------------------------------------//
|
||||
|
||||
// Bounded version of the std::copy algorithm
|
||||
template<typename InputIteratorT, typename OutputIteratorT>
|
||||
inline OutputIteratorT bounded_copy(
|
||||
InputIteratorT First,
|
||||
InputIteratorT Last,
|
||||
OutputIteratorT DestFirst,
|
||||
OutputIteratorT DestLast )
|
||||
{
|
||||
InputIteratorT InputIt=First;
|
||||
OutputIteratorT OutputIt=DestFirst;
|
||||
for(; InputIt!=Last && OutputIt!=DestLast; InputIt++, OutputIt++ )
|
||||
{
|
||||
*OutputIt=*InputIt;
|
||||
}
|
||||
|
||||
return OutputIt;
|
||||
}
|
||||
|
||||
// iterator range utilities -----------------------------------------//
|
||||
|
||||
// copy range functor
|
||||
template<
|
||||
typename SeqT,
|
||||
typename IteratorT=BOOST_STRING_TYPENAME SeqT::const_iterator >
|
||||
struct copy_iterator_rangeF
|
||||
{
|
||||
typedef iterator_range<IteratorT> argument_type;
|
||||
typedef SeqT result_type;
|
||||
SeqT operator()( const iterator_range<IteratorT>& Range ) const
|
||||
{
|
||||
return copy_range<SeqT>(Range);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_UTIL_DETAIL_HPP
|
844
third_party/boost/boost/algorithm/string/erase.hpp
vendored
Normal file
844
third_party/boost/boost/algorithm/string/erase.hpp
vendored
Normal file
|
@ -0,0 +1,844 @@
|
|||
// Boost string_algo library erase.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2006.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_ERASE_HPP
|
||||
#define BOOST_STRING_ERASE_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines various erase algorithms. Each algorithm removes
|
||||
part(s) of the input according to a searching criteria.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// erase_range -------------------------------------------------------//
|
||||
|
||||
//! Erase range algorithm
|
||||
/*!
|
||||
Remove the given range from the input. The result is a modified copy of
|
||||
the input. It is returned as a sequence or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input sequence
|
||||
\param SearchRange A range in the input to be removed
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<typename OutputIteratorT, typename RangeT>
|
||||
inline OutputIteratorT erase_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type>& SearchRange )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase range algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT erase_range_copy(
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase range algorithm
|
||||
/*!
|
||||
Remove the given range from the input.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param SearchRange A range in the input to be removed
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline void erase_range(
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<SequenceT>::type>& SearchRange )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_first --------------------------------------------------------//
|
||||
|
||||
//! Erase first algorithm
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase first algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase first algorithm
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_first(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_first ( case insensitive ) ------------------------------------//
|
||||
|
||||
//! Erase first algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase first algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_first_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase first algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the first occurrence of the substring from the input.
|
||||
The input sequence is modified in-place. Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_first(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_last --------------------------------------------------------//
|
||||
|
||||
//! Erase last algorithm
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase last algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase last algorithm
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_last(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_last ( case insensitive ) ------------------------------------//
|
||||
|
||||
//! Erase last algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase last algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_last_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase last algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the last occurrence of the substring from the input.
|
||||
The input sequence is modified in-place. Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_last(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_nth --------------------------------------------------------------------//
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
int Nth )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
int Nth )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_nth(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
int Nth )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_nth ( case insensitive ) ---------------------------------------------//
|
||||
|
||||
//! Erase nth algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
|
||||
empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase nth algorithm
|
||||
/*!
|
||||
Remove the Nth occurrence of the substring in the input.
|
||||
The input sequence is modified in-place. Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_nth(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
int Nth,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
|
||||
// erase_all --------------------------------------------------------//
|
||||
|
||||
//! Erase all algorithm
|
||||
/*!
|
||||
Remove all the occurrences of the string from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input sequence
|
||||
\param Search A substring to be searched for.
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT erase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase all algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT erase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase all algorithm
|
||||
/*!
|
||||
Remove all the occurrences of the string from the input.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void erase_all(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search )
|
||||
{
|
||||
::boost::algorithm::find_format_all(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_all ( case insensitive ) ------------------------------------//
|
||||
|
||||
//! Erase all algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove all the occurrences of the string from the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT ierase_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase all algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT ierase_all_copy(
|
||||
const SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
//! Erase all algorithm ( case insensitive )
|
||||
/*!
|
||||
Remove all the occurrences of the string from the input.
|
||||
The input sequence is modified in-place. Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for.
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void ierase_all(
|
||||
SequenceT& Input,
|
||||
const RangeT& Search,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format_all(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::empty_formatter(Input) );
|
||||
}
|
||||
|
||||
// erase_head --------------------------------------------------------------------//
|
||||
|
||||
//! Erase head algorithm
|
||||
/*!
|
||||
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the head. The result is a modified copy of the input.
|
||||
It is returned as a sequence or copied to the output iterator.
|
||||
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param N Length of the head.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT>
|
||||
inline OutputIteratorT erase_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
int N )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
//! Erase head algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT erase_head_copy(
|
||||
const SequenceT& Input,
|
||||
int N )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
//! Erase head algorithm
|
||||
/*!
|
||||
Remove the head from the input. The head is a prefix of a sequence of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the head. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param N Length of the head
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline void erase_head(
|
||||
SequenceT& Input,
|
||||
int N )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
// erase_tail --------------------------------------------------------------------//
|
||||
|
||||
//! Erase tail algorithm
|
||||
/*!
|
||||
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the tail.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param N Length of the tail.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT>
|
||||
inline OutputIteratorT erase_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
int N )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
//! Erase tail algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline SequenceT erase_tail_copy(
|
||||
const SequenceT& Input,
|
||||
int N )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
//! Erase tail algorithm
|
||||
/*!
|
||||
Remove the tail from the input. The tail is a suffix of a sequence of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the tail. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param N Length of the tail
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
*/
|
||||
template<typename SequenceT>
|
||||
inline void erase_tail(
|
||||
SequenceT& Input,
|
||||
int N )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::empty_formatter( Input ) );
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names into the boost namespace
|
||||
using algorithm::erase_range_copy;
|
||||
using algorithm::erase_range;
|
||||
using algorithm::erase_first_copy;
|
||||
using algorithm::erase_first;
|
||||
using algorithm::ierase_first_copy;
|
||||
using algorithm::ierase_first;
|
||||
using algorithm::erase_last_copy;
|
||||
using algorithm::erase_last;
|
||||
using algorithm::ierase_last_copy;
|
||||
using algorithm::ierase_last;
|
||||
using algorithm::erase_nth_copy;
|
||||
using algorithm::erase_nth;
|
||||
using algorithm::ierase_nth_copy;
|
||||
using algorithm::ierase_nth;
|
||||
using algorithm::erase_all_copy;
|
||||
using algorithm::erase_all;
|
||||
using algorithm::ierase_all_copy;
|
||||
using algorithm::ierase_all;
|
||||
using algorithm::erase_head_copy;
|
||||
using algorithm::erase_head;
|
||||
using algorithm::erase_tail_copy;
|
||||
using algorithm::erase_tail;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_ERASE_HPP
|
287
third_party/boost/boost/algorithm/string/find_format.hpp
vendored
Normal file
287
third_party/boost/boost/algorithm/string/find_format.hpp
vendored
Normal file
|
@ -0,0 +1,287 @@
|
|||
// Boost string_algo library find_format.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FIND_FORMAT_HPP
|
||||
#define BOOST_STRING_FIND_FORMAT_HPP
|
||||
|
||||
#include <deque>
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/as_literal.hpp>
|
||||
|
||||
#include <boost/algorithm/string/concept.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format.hpp>
|
||||
#include <boost/algorithm/string/detail/find_format_all.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines generic replace algorithms. Each algorithm replaces
|
||||
part(s) of the input. The part to be replaced is looked up using a Finder object.
|
||||
Result of finding is then used by a Formatter object to generate the replacement.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// generic replace -----------------------------------------------------------------//
|
||||
|
||||
//! Generic replace algorithm
|
||||
/*!
|
||||
Use the Finder to search for a substring. Use the Formatter to format
|
||||
this substring and replace it in the input.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input sequence
|
||||
\param Finder A Finder object used to search for a match to be replaced
|
||||
\param Formatter A Formatter object used to format a match
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
));
|
||||
|
||||
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
|
||||
|
||||
return detail::find_format_copy_impl(
|
||||
Output,
|
||||
lit_input,
|
||||
Formatter,
|
||||
Finder( ::boost::begin(lit_input), ::boost::end(lit_input) ) );
|
||||
}
|
||||
|
||||
//! Generic replace algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline SequenceT find_format_copy(
|
||||
const SequenceT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
|
||||
return detail::find_format_copy_impl(
|
||||
Input,
|
||||
Formatter,
|
||||
Finder(::boost::begin(Input), ::boost::end(Input)));
|
||||
}
|
||||
|
||||
//! Generic replace algorithm
|
||||
/*!
|
||||
Use the Finder to search for a substring. Use the Formatter to format
|
||||
this substring and replace it in the input. The input is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param Finder A Finder object used to search for a match to be replaced
|
||||
\param Formatter A Formatter object used to format a match
|
||||
*/
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline void find_format(
|
||||
SequenceT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter)
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
|
||||
detail::find_format_impl(
|
||||
Input,
|
||||
Formatter,
|
||||
Finder(::boost::begin(Input), ::boost::end(Input)));
|
||||
}
|
||||
|
||||
|
||||
// find_format_all generic ----------------------------------------------------------------//
|
||||
|
||||
//! Generic replace all algorithm
|
||||
/*!
|
||||
Use the Finder to search for a substring. Use the Formatter to format
|
||||
this substring and replace it in the input. Repeat this for all matching
|
||||
substrings.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input sequence
|
||||
\param Finder A Finder object used to search for a match to be replaced
|
||||
\param Formatter A Formatter object used to format a match
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename RangeT,
|
||||
typename FinderT,
|
||||
typename FormatterT>
|
||||
inline OutputIteratorT find_format_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const RangeT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter)
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type>
|
||||
));
|
||||
|
||||
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(::boost::as_literal(Input));
|
||||
|
||||
return detail::find_format_all_copy_impl(
|
||||
Output,
|
||||
lit_input,
|
||||
Finder,
|
||||
Formatter,
|
||||
Finder(::boost::begin(lit_input), ::boost::end(lit_input)));
|
||||
}
|
||||
|
||||
//! Generic replace all algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename FinderT,
|
||||
typename FormatterT >
|
||||
inline SequenceT find_format_all_copy(
|
||||
const SequenceT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
|
||||
return detail::find_format_all_copy_impl(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
Finder( ::boost::begin(Input), ::boost::end(Input) ) );
|
||||
}
|
||||
|
||||
//! Generic replace all algorithm
|
||||
/*!
|
||||
Use the Finder to search for a substring. Use the Formatter to format
|
||||
this substring and replace it in the input. Repeat this for all matching
|
||||
substrings.The input is modified in-place.
|
||||
|
||||
\param Input An input sequence
|
||||
\param Finder A Finder object used to search for a match to be replaced
|
||||
\param Formatter A Formatter object used to format a match
|
||||
*/
|
||||
template<
|
||||
typename SequenceT,
|
||||
typename FinderT,
|
||||
typename FormatterT >
|
||||
inline void find_format_all(
|
||||
SequenceT& Input,
|
||||
FinderT Finder,
|
||||
FormatterT Formatter )
|
||||
{
|
||||
// Concept check
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FinderConcept<
|
||||
FinderT,
|
||||
BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
BOOST_CONCEPT_ASSERT((
|
||||
FormatterConcept<
|
||||
FormatterT,
|
||||
FinderT,BOOST_STRING_TYPENAME range_const_iterator<SequenceT>::type>
|
||||
));
|
||||
|
||||
detail::find_format_all_impl(
|
||||
Input,
|
||||
Finder,
|
||||
Formatter,
|
||||
Finder(::boost::begin(Input), ::boost::end(Input)));
|
||||
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull the names to the boost namespace
|
||||
using algorithm::find_format_copy;
|
||||
using algorithm::find_format;
|
||||
using algorithm::find_format_all_copy;
|
||||
using algorithm::find_format_all;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_FIND_FORMAT_HPP
|
266
third_party/boost/boost/algorithm/string/finder.hpp
vendored
Normal file
266
third_party/boost/boost/algorithm/string/finder.hpp
vendored
Normal file
|
@ -0,0 +1,266 @@
|
|||
// Boost string_algo library finder.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2006.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FINDER_HPP
|
||||
#define BOOST_STRING_FINDER_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/constants.hpp>
|
||||
#include <boost/algorithm/string/detail/finder.hpp>
|
||||
#include <boost/algorithm/string/compare.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines Finder generators. Finder object is a functor which is able to
|
||||
find a substring matching a specific criteria in the input.
|
||||
Finders are used as a pluggable components for replace, find
|
||||
and split facilities. This header contains generator functions
|
||||
for finders provided in this library.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// Finder generators ------------------------------------------//
|
||||
|
||||
//! "First" finder
|
||||
/*!
|
||||
Construct the \c first_finder. The finder searches for the first
|
||||
occurrence of the string in a given input.
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param Search A substring to be searched for.
|
||||
\return An instance of the \c first_finder object
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
is_equal>
|
||||
first_finder( const RangeT& Search )
|
||||
{
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
is_equal>( ::boost::as_literal(Search), is_equal() ) ;
|
||||
}
|
||||
|
||||
//! "First" finder
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename RangeT,typename PredicateT>
|
||||
inline detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
PredicateT>
|
||||
first_finder(
|
||||
const RangeT& Search, PredicateT Comp )
|
||||
{
|
||||
return
|
||||
detail::first_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
PredicateT>( ::boost::as_literal(Search), Comp );
|
||||
}
|
||||
|
||||
//! "Last" finder
|
||||
/*!
|
||||
Construct the \c last_finder. The finder searches for the last
|
||||
occurrence of the string in a given input.
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param Search A substring to be searched for.
|
||||
\return An instance of the \c last_finder object
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
is_equal>
|
||||
last_finder( const RangeT& Search )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
is_equal>( ::boost::as_literal(Search), is_equal() );
|
||||
}
|
||||
//! "Last" finder
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename RangeT, typename PredicateT>
|
||||
inline detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
PredicateT>
|
||||
last_finder( const RangeT& Search, PredicateT Comp )
|
||||
{
|
||||
return
|
||||
detail::last_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
PredicateT>( ::boost::as_literal(Search), Comp ) ;
|
||||
}
|
||||
|
||||
//! "Nth" finder
|
||||
/*!
|
||||
Construct the \c nth_finder. The finder searches for the n-th (zero-indexed)
|
||||
occurrence of the string in a given input.
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param Search A substring to be searched for.
|
||||
\param Nth An index of the match to be find
|
||||
\return An instance of the \c nth_finder object
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
is_equal>
|
||||
nth_finder(
|
||||
const RangeT& Search,
|
||||
int Nth)
|
||||
{
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
is_equal>( ::boost::as_literal(Search), Nth, is_equal() ) ;
|
||||
}
|
||||
//! "Nth" finder
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename RangeT, typename PredicateT>
|
||||
inline detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
|
||||
PredicateT>
|
||||
nth_finder(
|
||||
const RangeT& Search,
|
||||
int Nth,
|
||||
PredicateT Comp )
|
||||
{
|
||||
return
|
||||
detail::nth_finderF<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<RangeT>::type,
|
||||
PredicateT>( ::boost::as_literal(Search), Nth, Comp );
|
||||
}
|
||||
|
||||
//! "Head" finder
|
||||
/*!
|
||||
Construct the \c head_finder. The finder returns a head of a given
|
||||
input. The head is a prefix of a string up to n elements in
|
||||
size. If an input has less then n elements, whole input is
|
||||
considered a head.
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param N The size of the head
|
||||
\return An instance of the \c head_finder object
|
||||
*/
|
||||
inline detail::head_finderF
|
||||
head_finder( int N )
|
||||
{
|
||||
return detail::head_finderF(N);
|
||||
}
|
||||
|
||||
//! "Tail" finder
|
||||
/*!
|
||||
Construct the \c tail_finder. The finder returns a tail of a given
|
||||
input. The tail is a suffix of a string up to n elements in
|
||||
size. If an input has less then n elements, whole input is
|
||||
considered a head.
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param N The size of the head
|
||||
\return An instance of the \c tail_finder object
|
||||
*/
|
||||
inline detail::tail_finderF
|
||||
tail_finder( int N )
|
||||
{
|
||||
return detail::tail_finderF(N);
|
||||
}
|
||||
|
||||
//! "Token" finder
|
||||
/*!
|
||||
Construct the \c token_finder. The finder searches for a token
|
||||
specified by a predicate. It is similar to std::find_if
|
||||
algorithm, with an exception that it return a range of
|
||||
instead of a single iterator.
|
||||
|
||||
If "compress token mode" is enabled, adjacent matching tokens are
|
||||
concatenated into one match. Thus the finder can be used to
|
||||
search for continuous segments of characters satisfying the
|
||||
given predicate.
|
||||
|
||||
The result is given as an \c iterator_range delimiting the match.
|
||||
|
||||
\param Pred An element selection predicate
|
||||
\param eCompress Compress flag
|
||||
\return An instance of the \c token_finder object
|
||||
*/
|
||||
template< typename PredicateT >
|
||||
inline detail::token_finderF<PredicateT>
|
||||
token_finder(
|
||||
PredicateT Pred,
|
||||
token_compress_mode_type eCompress=token_compress_off )
|
||||
{
|
||||
return detail::token_finderF<PredicateT>( Pred, eCompress );
|
||||
}
|
||||
|
||||
//! "Range" finder
|
||||
/*!
|
||||
Construct the \c range_finder. The finder does not perform
|
||||
any operation. It simply returns the given range for
|
||||
any input.
|
||||
|
||||
\param Begin Beginning of the range
|
||||
\param End End of the range
|
||||
\return An instance of the \c range_finger object
|
||||
*/
|
||||
template< typename ForwardIteratorT >
|
||||
inline detail::range_finderF<ForwardIteratorT>
|
||||
range_finder(
|
||||
ForwardIteratorT Begin,
|
||||
ForwardIteratorT End )
|
||||
{
|
||||
return detail::range_finderF<ForwardIteratorT>( Begin, End );
|
||||
}
|
||||
|
||||
//! "Range" finder
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template< typename ForwardIteratorT >
|
||||
inline detail::range_finderF<ForwardIteratorT>
|
||||
range_finder( iterator_range<ForwardIteratorT> Range )
|
||||
{
|
||||
return detail::range_finderF<ForwardIteratorT>( Range );
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull the names to the boost namespace
|
||||
using algorithm::first_finder;
|
||||
using algorithm::last_finder;
|
||||
using algorithm::nth_finder;
|
||||
using algorithm::head_finder;
|
||||
using algorithm::tail_finder;
|
||||
using algorithm::token_finder;
|
||||
using algorithm::range_finder;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_FINDER_HPP
|
120
third_party/boost/boost/algorithm/string/formatter.hpp
vendored
Normal file
120
third_party/boost/boost/algorithm/string/formatter.hpp
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Boost string_algo library formatter.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_FORMATTER_HPP
|
||||
#define BOOST_STRING_FORMATTER_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/as_literal.hpp>
|
||||
|
||||
#include <boost/algorithm/string/detail/formatter.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines Formatter generators. Formatter is a functor which formats
|
||||
a string according to given parameters. A Formatter works
|
||||
in conjunction with a Finder. A Finder can provide additional information
|
||||
for a specific Formatter. An example of such a cooperation is regex_finder
|
||||
and regex_formatter.
|
||||
|
||||
Formatters are used as pluggable components for replace facilities.
|
||||
This header contains generator functions for the Formatters provided in this library.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// generic formatters ---------------------------------------------------------------//
|
||||
|
||||
//! Constant formatter
|
||||
/*!
|
||||
Constructs a \c const_formatter. Const formatter always returns
|
||||
the same value, regardless of the parameter.
|
||||
|
||||
\param Format A predefined value used as a result for formatting
|
||||
\return An instance of the \c const_formatter object.
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::const_formatF<
|
||||
iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
|
||||
const_formatter(const RangeT& Format)
|
||||
{
|
||||
return detail::const_formatF<
|
||||
iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >(::boost::as_literal(Format));
|
||||
}
|
||||
|
||||
//! Identity formatter
|
||||
/*!
|
||||
Constructs an \c identity_formatter. Identity formatter always returns
|
||||
the parameter.
|
||||
|
||||
\return An instance of the \c identity_formatter object.
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::identity_formatF<
|
||||
iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
|
||||
identity_formatter()
|
||||
{
|
||||
return detail::identity_formatF<
|
||||
iterator_range<
|
||||
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
|
||||
}
|
||||
|
||||
//! Empty formatter
|
||||
/*!
|
||||
Constructs an \c empty_formatter. Empty formatter always returns an empty
|
||||
sequence.
|
||||
|
||||
\param Input container used to select a correct value_type for the
|
||||
resulting empty_container<>.
|
||||
\return An instance of the \c empty_formatter object.
|
||||
*/
|
||||
template<typename RangeT>
|
||||
inline detail::empty_formatF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>
|
||||
empty_formatter(const RangeT&)
|
||||
{
|
||||
return detail::empty_formatF<
|
||||
BOOST_STRING_TYPENAME range_value<RangeT>::type>();
|
||||
}
|
||||
|
||||
//! Empty formatter
|
||||
/*!
|
||||
Constructs a \c dissect_formatter. Dissect formatter uses a specified finder
|
||||
to extract a portion of the formatted sequence. The first finder's match is returned
|
||||
as a result
|
||||
|
||||
\param Finder a finder used to select a portion of the formatted sequence
|
||||
\return An instance of the \c dissect_formatter object.
|
||||
*/
|
||||
template<typename FinderT>
|
||||
inline detail::dissect_formatF< FinderT >
|
||||
dissect_formatter(const FinderT& Finder)
|
||||
{
|
||||
return detail::dissect_formatF<FinderT>(Finder);
|
||||
}
|
||||
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull the names to the boost namespace
|
||||
using algorithm::const_formatter;
|
||||
using algorithm::identity_formatter;
|
||||
using algorithm::empty_formatter;
|
||||
using algorithm::dissect_formatter;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_FORMATTER_HPP
|
926
third_party/boost/boost/algorithm/string/replace.hpp
vendored
Normal file
926
third_party/boost/boost/algorithm/string/replace.hpp
vendored
Normal file
|
@ -0,0 +1,926 @@
|
|||
// Boost string_algo library replace.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2006.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_REPLACE_HPP
|
||||
#define BOOST_STRING_REPLACE_HPP
|
||||
|
||||
#include <boost/algorithm/string/config.hpp>
|
||||
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/iterator.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
|
||||
#include <boost/algorithm/string/find_format.hpp>
|
||||
#include <boost/algorithm/string/finder.hpp>
|
||||
#include <boost/algorithm/string/formatter.hpp>
|
||||
#include <boost/algorithm/string/compare.hpp>
|
||||
|
||||
/*! \file
|
||||
Defines various replace algorithms. Each algorithm replaces
|
||||
part(s) of the input according to set of searching and replace criteria.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// replace_range --------------------------------------------------------------------//
|
||||
|
||||
//! Replace range algorithm
|
||||
/*!
|
||||
Replace the given range in the input string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param SearchRange A range in the input to be substituted
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_range_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<Range1T>::type>& SearchRange,
|
||||
const Range2T& Format)
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::const_formatter(Format));
|
||||
}
|
||||
|
||||
//! Replace range algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_range_copy(
|
||||
const SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_const_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::const_formatter(Format));
|
||||
}
|
||||
|
||||
//! Replace range algorithm
|
||||
/*!
|
||||
Replace the given range in the input string.
|
||||
The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param SearchRange A range in the input to be substituted
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_range(
|
||||
SequenceT& Input,
|
||||
const iterator_range<
|
||||
BOOST_STRING_TYPENAME
|
||||
range_iterator<SequenceT>::type>& SearchRange,
|
||||
const RangeT& Format)
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::range_finder(SearchRange),
|
||||
::boost::algorithm::const_formatter(Format));
|
||||
}
|
||||
|
||||
// replace_first --------------------------------------------------------------------//
|
||||
|
||||
//! Replace first algorithm
|
||||
/*!
|
||||
Replace the first match of the search substring in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format)
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace first algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace first algorithm
|
||||
/*!
|
||||
replace the first match of the search substring in the input
|
||||
with the format string. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_first(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_first ( case insensitive ) ---------------------------------------------//
|
||||
|
||||
//! Replace first algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace the first match of the search substring in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_first_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace first algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range2T, typename Range1T>
|
||||
inline SequenceT ireplace_first_copy(
|
||||
const SequenceT& Input,
|
||||
const Range2T& Search,
|
||||
const Range1T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace first algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace the first match of the search substring in the input
|
||||
with the format string. Input sequence is modified in-place.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void ireplace_first(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_last --------------------------------------------------------------------//
|
||||
|
||||
//! Replace last algorithm
|
||||
/*!
|
||||
Replace the last match of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace last algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace last algorithm
|
||||
/*!
|
||||
Replace the last match of the search string in the input
|
||||
with the format string. Input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_last(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_last ( case insensitive ) -----------------------------------------------//
|
||||
|
||||
//! Replace last algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace the last match of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_last_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace last algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_last_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace last algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace the last match of the search string in the input
|
||||
with the format string.The input sequence is modified in-place.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void ireplace_last(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::last_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_nth --------------------------------------------------------------------//
|
||||
|
||||
//! Replace nth algorithm
|
||||
/*!
|
||||
Replace an Nth (zero-indexed) match of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
int Nth,
|
||||
const Range3T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace nth algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
int Nth,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace nth algorithm
|
||||
/*!
|
||||
Replace an Nth (zero-indexed) match of the search string in the input
|
||||
with the format string. Input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_nth(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
int Nth,
|
||||
const Range2T& Format )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_nth ( case insensitive ) -----------------------------------------------//
|
||||
|
||||
//! Replace nth algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace an Nth (zero-indexed) match of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_nth_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
int Nth,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc) ),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace nth algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_nth_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
int Nth,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace nth algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace an Nth (zero-indexed) match of the search string in the input
|
||||
with the format string. Input sequence is modified in-place.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Nth An index of the match to be replaced. The index is 0-based.
|
||||
For negative N, matches are counted from the end of string.
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void ireplace_nth(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
int Nth,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::nth_finder(Search, Nth, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_all --------------------------------------------------------------------//
|
||||
|
||||
//! Replace all algorithm
|
||||
/*!
|
||||
Replace all occurrences of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT replace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace all algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT replace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace all algorithm
|
||||
/*!
|
||||
Replace all occurrences of the search string in the input
|
||||
with the format string. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void replace_all(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format )
|
||||
{
|
||||
::boost::algorithm::find_format_all(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_all ( case insensitive ) -----------------------------------------------//
|
||||
|
||||
//! Replace all algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace all occurrences of the search string in the input
|
||||
with the format string.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T,
|
||||
typename Range3T>
|
||||
inline OutputIteratorT ireplace_all_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
const Range2T& Search,
|
||||
const Range3T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace all algorithm ( case insensitive )
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline SequenceT ireplace_all_copy(
|
||||
const SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
return ::boost::algorithm::find_format_all_copy(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace all algorithm ( case insensitive )
|
||||
/*!
|
||||
Replace all occurrences of the search string in the input
|
||||
with the format string.The input sequence is modified in-place.
|
||||
Searching is case insensitive.
|
||||
|
||||
\param Input An input string
|
||||
\param Search A substring to be searched for
|
||||
\param Format A substitute string
|
||||
\param Loc A locale used for case insensitive comparison
|
||||
*/
|
||||
template<typename SequenceT, typename Range1T, typename Range2T>
|
||||
inline void ireplace_all(
|
||||
SequenceT& Input,
|
||||
const Range1T& Search,
|
||||
const Range2T& Format,
|
||||
const std::locale& Loc=std::locale() )
|
||||
{
|
||||
::boost::algorithm::find_format_all(
|
||||
Input,
|
||||
::boost::algorithm::first_finder(Search, is_iequal(Loc)),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_head --------------------------------------------------------------------//
|
||||
|
||||
//! Replace head algorithm
|
||||
/*!
|
||||
Replace the head of the input with the given format string.
|
||||
The head is a prefix of a string of given size.
|
||||
If the sequence is shorter then required, whole string if
|
||||
considered to be the head.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param N Length of the head.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_head_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
int N,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace head algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_head_copy(
|
||||
const SequenceT& Input,
|
||||
int N,
|
||||
const RangeT& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace head algorithm
|
||||
/*!
|
||||
Replace the head of the input with the given format string.
|
||||
The head is a prefix of a string of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the head. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param N Length of the head.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_head(
|
||||
SequenceT& Input,
|
||||
int N,
|
||||
const RangeT& Format )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::head_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
// replace_tail --------------------------------------------------------------------//
|
||||
|
||||
//! Replace tail algorithm
|
||||
/*!
|
||||
Replace the tail of the input with the given format string.
|
||||
The tail is a suffix of a string of given size.
|
||||
If the sequence is shorter then required, whole string is
|
||||
considered to be the tail.
|
||||
The result is a modified copy of the input. It is returned as a sequence
|
||||
or copied to the output iterator.
|
||||
|
||||
\param Output An output iterator to which the result will be copied
|
||||
\param Input An input string
|
||||
\param N Length of the tail.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\param Format A substitute string
|
||||
\return An output iterator pointing just after the last inserted character or
|
||||
a modified copy of the input
|
||||
|
||||
\note The second variant of this function provides the strong exception-safety guarantee
|
||||
*/
|
||||
template<
|
||||
typename OutputIteratorT,
|
||||
typename Range1T,
|
||||
typename Range2T>
|
||||
inline OutputIteratorT replace_tail_copy(
|
||||
OutputIteratorT Output,
|
||||
const Range1T& Input,
|
||||
int N,
|
||||
const Range2T& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Output,
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace tail algorithm
|
||||
/*!
|
||||
\overload
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline SequenceT replace_tail_copy(
|
||||
const SequenceT& Input,
|
||||
int N,
|
||||
const RangeT& Format )
|
||||
{
|
||||
return ::boost::algorithm::find_format_copy(
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
//! Replace tail algorithm
|
||||
/*!
|
||||
Replace the tail of the input with the given format sequence.
|
||||
The tail is a suffix of a string of given size.
|
||||
If the sequence is shorter then required, the whole string is
|
||||
considered to be the tail. The input sequence is modified in-place.
|
||||
|
||||
\param Input An input string
|
||||
\param N Length of the tail.
|
||||
For N>=0, at most N characters are extracted.
|
||||
For N<0, size(Input)-|N| characters are extracted.
|
||||
\param Format A substitute string
|
||||
*/
|
||||
template<typename SequenceT, typename RangeT>
|
||||
inline void replace_tail(
|
||||
SequenceT& Input,
|
||||
int N,
|
||||
const RangeT& Format )
|
||||
{
|
||||
::boost::algorithm::find_format(
|
||||
Input,
|
||||
::boost::algorithm::tail_finder(N),
|
||||
::boost::algorithm::const_formatter(Format) );
|
||||
}
|
||||
|
||||
} // namespace algorithm
|
||||
|
||||
// pull names to the boost namespace
|
||||
using algorithm::replace_range_copy;
|
||||
using algorithm::replace_range;
|
||||
using algorithm::replace_first_copy;
|
||||
using algorithm::replace_first;
|
||||
using algorithm::ireplace_first_copy;
|
||||
using algorithm::ireplace_first;
|
||||
using algorithm::replace_last_copy;
|
||||
using algorithm::replace_last;
|
||||
using algorithm::ireplace_last_copy;
|
||||
using algorithm::ireplace_last;
|
||||
using algorithm::replace_nth_copy;
|
||||
using algorithm::replace_nth;
|
||||
using algorithm::ireplace_nth_copy;
|
||||
using algorithm::ireplace_nth;
|
||||
using algorithm::replace_all_copy;
|
||||
using algorithm::replace_all;
|
||||
using algorithm::ireplace_all_copy;
|
||||
using algorithm::ireplace_all;
|
||||
using algorithm::replace_head_copy;
|
||||
using algorithm::replace_head;
|
||||
using algorithm::replace_tail_copy;
|
||||
using algorithm::replace_tail;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_REPLACE_HPP
|
120
third_party/boost/boost/algorithm/string/sequence_traits.hpp
vendored
Normal file
120
third_party/boost/boost/algorithm/string/sequence_traits.hpp
vendored
Normal file
|
@ -0,0 +1,120 @@
|
|||
// Boost string_algo library sequence_traits.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP
|
||||
#define BOOST_STRING_SEQUENCE_TRAITS_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/algorithm/string/yes_no_type.hpp>
|
||||
|
||||
/*! \file
|
||||
Traits defined in this header are used by various algorithms to achieve
|
||||
better performance for specific containers.
|
||||
Traits provide fail-safe defaults. If a container supports some of these
|
||||
features, it is possible to specialize the specific trait for this container.
|
||||
For lacking compilers, it is possible of define an override for a specific tester
|
||||
function.
|
||||
|
||||
Due to a language restriction, it is not currently possible to define specializations for
|
||||
stl containers without including the corresponding header. To decrease the overhead
|
||||
needed by this inclusion, user can selectively include a specialization
|
||||
header for a specific container. They are located in boost/algorithm/string/stl
|
||||
directory. Alternatively she can include boost/algorithm/string/std_collection_traits.hpp
|
||||
header which contains specializations for all stl containers.
|
||||
*/
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// sequence traits -----------------------------------------------//
|
||||
|
||||
|
||||
//! Native replace trait
|
||||
/*!
|
||||
This trait specifies that the sequence has \c std::string like replace method
|
||||
*/
|
||||
template< typename T >
|
||||
class has_native_replace
|
||||
{
|
||||
|
||||
public:
|
||||
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
enum { value = false };
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
|
||||
|
||||
typedef mpl::bool_<has_native_replace<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
//! Stable iterators trait
|
||||
/*!
|
||||
This trait specifies that the sequence has stable iterators. It means
|
||||
that operations like insert/erase/replace do not invalidate iterators.
|
||||
*/
|
||||
template< typename T >
|
||||
class has_stable_iterators
|
||||
{
|
||||
public:
|
||||
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
enum { value = false };
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
|
||||
typedef mpl::bool_<has_stable_iterators<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
//! Const time insert trait
|
||||
/*!
|
||||
This trait specifies that the sequence's insert method has
|
||||
constant time complexity.
|
||||
*/
|
||||
template< typename T >
|
||||
class has_const_time_insert
|
||||
{
|
||||
public:
|
||||
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
enum { value = false };
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
|
||||
typedef mpl::bool_<has_const_time_insert<T>::value> type;
|
||||
};
|
||||
|
||||
|
||||
//! Const time erase trait
|
||||
/*!
|
||||
This trait specifies that the sequence's erase method has
|
||||
constant time complexity.
|
||||
*/
|
||||
template< typename T >
|
||||
class has_const_time_erase
|
||||
{
|
||||
public:
|
||||
# if BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
enum { value = false };
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value=false);
|
||||
# endif // BOOST_WORKAROUND( __IBMCPP__, <= 600 )
|
||||
|
||||
typedef mpl::bool_<has_const_time_erase<T>::value> type;
|
||||
};
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_SEQUENCE_TRAITS_HPP
|
33
third_party/boost/boost/algorithm/string/yes_no_type.hpp
vendored
Normal file
33
third_party/boost/boost/algorithm/string/yes_no_type.hpp
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
// Boost string_algo library yes_no_type.hpp header file ---------------------------//
|
||||
|
||||
// Copyright Pavol Droba 2002-2003.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/ for updates, documentation, and revision history.
|
||||
|
||||
#ifndef BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
|
||||
#define BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
|
||||
|
||||
namespace boost {
|
||||
namespace algorithm {
|
||||
|
||||
// taken from boost mailing-list
|
||||
// when yes_no_type will become officially
|
||||
// a part of boost distribution, this header
|
||||
// will be deprecated
|
||||
template<int I> struct size_descriptor
|
||||
{
|
||||
typedef char (& type)[I];
|
||||
};
|
||||
|
||||
typedef size_descriptor<1>::type yes_type;
|
||||
typedef size_descriptor<2>::type no_type;
|
||||
|
||||
} // namespace algorithm
|
||||
} // namespace boost
|
||||
|
||||
|
||||
#endif // BOOST_STRING_YES_NO_TYPE_DETAIL_HPP
|
18
third_party/boost/boost/aligned_storage.hpp
vendored
Normal file
18
third_party/boost/boost/aligned_storage.hpp
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// boost aligned_storage.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2002-2003
|
||||
// Eric Friedman, Itay Maman
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_ALIGNED_STORAGE_HPP
|
||||
#define BOOST_ALIGNED_STORAGE_HPP
|
||||
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
|
||||
#endif // BOOST_ALIGNED_STORAGE_HPP
|
100
third_party/boost/boost/archive/archive_exception.hpp
vendored
Normal file
100
third_party/boost/boost/archive/archive_exception.hpp
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
#ifndef BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
||||
#define BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// archive/archive_exception.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <exception>
|
||||
#include <boost/assert.hpp>
|
||||
#include <string>
|
||||
|
||||
#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
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// exceptions thrown by archives
|
||||
//
|
||||
class BOOST_SYMBOL_VISIBLE archive_exception :
|
||||
public virtual std::exception
|
||||
{
|
||||
private:
|
||||
char m_buffer[128];
|
||||
protected:
|
||||
BOOST_ARCHIVE_DECL unsigned int
|
||||
append(unsigned int l, const char * a);
|
||||
BOOST_ARCHIVE_DECL
|
||||
archive_exception() BOOST_NOEXCEPT;
|
||||
public:
|
||||
typedef enum {
|
||||
no_exception, // initialized without code
|
||||
other_exception, // any excepton not listed below
|
||||
unregistered_class, // attempt to serialize a pointer of
|
||||
// an unregistered class
|
||||
invalid_signature, // first line of archive does not contain
|
||||
// expected string
|
||||
unsupported_version,// archive created with library version
|
||||
// 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
|
||||
// in the creation of an extra copy of the obect.
|
||||
incompatible_native_format, // attempt to read native binary format
|
||||
// on incompatible platform
|
||||
array_size_too_short,// array being loaded doesn't fit in array allocated
|
||||
input_stream_error, // error on input stream
|
||||
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
|
||||
// void_cast_register
|
||||
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
|
||||
// type has been instantiated in more than one module.
|
||||
output_stream_error // error on input stream
|
||||
} exception_code;
|
||||
exception_code code;
|
||||
|
||||
BOOST_ARCHIVE_DECL archive_exception(
|
||||
exception_code c,
|
||||
const char * e1 = NULL,
|
||||
const char * e2 = NULL
|
||||
) BOOST_NOEXCEPT;
|
||||
BOOST_ARCHIVE_DECL archive_exception(archive_exception const &) BOOST_NOEXCEPT ;
|
||||
virtual BOOST_ARCHIVE_DECL ~archive_exception() BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
virtual BOOST_ARCHIVE_DECL const char * what() const BOOST_NOEXCEPT_OR_NOTHROW ;
|
||||
};
|
||||
|
||||
}// namespace archive
|
||||
}// namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_ARCHIVE_EXCEPTION_HPP
|
307
third_party/boost/boost/archive/basic_archive.hpp
vendored
Normal file
307
third_party/boost/boost/archive/basic_archive.hpp
vendored
Normal file
|
@ -0,0 +1,307 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_archive.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <cstring> // count
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp> // size_t
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4244 4267 )
|
||||
#endif
|
||||
|
||||
/* NOTE : Warning : Warning : Warning : Warning : Warning
|
||||
* Don't ever changes this. If you do, they previously created
|
||||
* binary archives won't be readable !!!
|
||||
*/
|
||||
class library_version_type {
|
||||
private:
|
||||
typedef uint_least16_t base_type;
|
||||
base_type t;
|
||||
public:
|
||||
library_version_type(): t(0) {};
|
||||
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_) :
|
||||
t(t_.t)
|
||||
{}
|
||||
library_version_type & operator=(const library_version_type & rhs){
|
||||
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
|
||||
BOOST_ARCHIVE_VERSION();
|
||||
|
||||
class version_type {
|
||||
private:
|
||||
typedef uint_least32_t base_type;
|
||||
base_type t;
|
||||
public:
|
||||
// should be private - but MPI fails if it's not!!!
|
||||
version_type(): t(0) {};
|
||||
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_) :
|
||||
t(t_.t)
|
||||
{}
|
||||
version_type & operator=(const version_type & rhs){
|
||||
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 {
|
||||
private:
|
||||
typedef int_least16_t base_type;
|
||||
base_type t;
|
||||
public:
|
||||
// should be private - but then can't use BOOST_STRONG_TYPE below
|
||||
class_id_type() : t(0) {};
|
||||
explicit class_id_type(const int t_) : t(t_){
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
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_) :
|
||||
t(t_.t)
|
||||
{}
|
||||
class_id_type & operator=(const class_id_type & rhs){
|
||||
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 class_id_type & rhs) const {
|
||||
return t == rhs.t;
|
||||
}
|
||||
bool operator<(const class_id_type & rhs) const {
|
||||
return t < rhs.t;
|
||||
}
|
||||
};
|
||||
|
||||
#define NULL_POINTER_TAG boost::archive::class_id_type(-1)
|
||||
|
||||
class object_id_type {
|
||||
private:
|
||||
typedef uint_least32_t base_type;
|
||||
base_type t;
|
||||
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
|
||||
BOOST_ASSERT(t_ <= boost::integer_traits<base_type>::const_max);
|
||||
}
|
||||
object_id_type(const object_id_type & t_) :
|
||||
t(t_.t)
|
||||
{}
|
||||
object_id_type & operator=(const object_id_type & rhs){
|
||||
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 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)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
struct tracking_type {
|
||||
bool t;
|
||||
explicit tracking_type(const bool t_ = false)
|
||||
: t(t_)
|
||||
{};
|
||||
tracking_type(const tracking_type & t_)
|
||||
: t(t_.t)
|
||||
{}
|
||||
operator bool () const {
|
||||
return t;
|
||||
};
|
||||
operator bool & () {
|
||||
return t;
|
||||
};
|
||||
tracking_type & operator=(const bool t_){
|
||||
t = t_;
|
||||
return *this;
|
||||
}
|
||||
bool operator==(const tracking_type & rhs) const {
|
||||
return t == rhs.t;
|
||||
}
|
||||
bool operator==(const bool & rhs) const {
|
||||
return t == rhs;
|
||||
}
|
||||
tracking_type & operator=(const tracking_type & rhs){
|
||||
t = rhs.t;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct class_name_type :
|
||||
private boost::noncopyable
|
||||
{
|
||||
char *t;
|
||||
operator const char * & () const {
|
||||
return const_cast<const char * &>(t);
|
||||
}
|
||||
operator char * () {
|
||||
return t;
|
||||
}
|
||||
std::size_t size() const {
|
||||
return std::strlen(t);
|
||||
}
|
||||
explicit class_name_type(const char *key_)
|
||||
: t(const_cast<char *>(key_)){}
|
||||
explicit class_name_type(char *key_)
|
||||
: t(key_){}
|
||||
class_name_type & operator=(const class_name_type & rhs){
|
||||
t = rhs.t;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
enum archive_flags {
|
||||
no_header = 1, // suppress archive header info
|
||||
no_codecvt = 2, // suppress alteration of codecvt facet
|
||||
no_xml_tag_checking = 4, // suppress checking of xml tags
|
||||
no_tracking = 8, // suppress ALL tracking
|
||||
flags_last = 8
|
||||
};
|
||||
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_SIGNATURE();
|
||||
|
||||
/* NOTE : Warning : Warning : Warning : Warning : Warning
|
||||
* 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
|
||||
* inherently wrong in doing this - but you have to be super
|
||||
* careful because it's easy to get wrong and start breaking
|
||||
* old archives !!!
|
||||
*/
|
||||
|
||||
#define BOOST_ARCHIVE_STRONG_TYPEDEF(T, D) \
|
||||
class D : public T { \
|
||||
public: \
|
||||
explicit D(const T tt) : T(tt){} \
|
||||
}; \
|
||||
/**/
|
||||
|
||||
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_reference_type)
|
||||
BOOST_ARCHIVE_STRONG_TYPEDEF(class_id_type, class_id_optional_type)
|
||||
BOOST_ARCHIVE_STRONG_TYPEDEF(object_id_type, object_reference_type)
|
||||
|
||||
}// namespace archive
|
||||
}// namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#include <boost/serialization/level.hpp>
|
||||
|
||||
// set implementation level to primitive for all types
|
||||
// used internally by the serialization library
|
||||
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::library_version_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::version_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_reference_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_id_optional_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::class_name_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_id_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::object_reference_type, primitive_type)
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::archive::tracking_type, primitive_type)
|
||||
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
|
||||
// set types used internally by the serialization library
|
||||
// to be bitwise serializable
|
||||
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::library_version_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::version_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_reference_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_id_optional_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::class_name_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_id_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::object_reference_type)
|
||||
BOOST_IS_BITWISE_SERIALIZABLE(boost::archive::tracking_type)
|
||||
|
||||
#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP
|
216
third_party/boost/boost/archive/basic_binary_iarchive.hpp
vendored
Normal file
216
third_party/boost/boost/archive/basic_binary_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,216 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iarchive.hpp
|
||||
//
|
||||
// archives stored as native binary - this should be the fastest way
|
||||
// to archive the state of a group of obects. It makes no attempt to
|
||||
// convert to any canonical form.
|
||||
|
||||
// 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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// intermediate level to support override of operators
|
||||
// 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;
|
||||
template<class T>
|
||||
void load_override(T & t){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
|
||||
// include these to trap a change in binary format which
|
||||
// isn't specifically handled
|
||||
// upto 32K classes
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
|
||||
// upto 2G objects
|
||||
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
|
||||
void load_override(class_id_optional_type & /* t */){}
|
||||
|
||||
void load_override(tracking_type & t, int /*version*/){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
int_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
else{
|
||||
bool x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::tracking_type(x);
|
||||
}
|
||||
}
|
||||
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{
|
||||
int_least16_t 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));
|
||||
}
|
||||
|
||||
void load_override(version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
uint_least8_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(5) < lvt){
|
||||
uint_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(2) < lvt){
|
||||
// upto 255 versions
|
||||
unsigned char x=0;
|
||||
* this->This() >> x;
|
||||
t = version_type(x);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::archive::version_type(x);
|
||||
}
|
||||
}
|
||||
|
||||
void load_override(boost::serialization::item_version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
// if(boost::archive::library_version_type(7) < lvt){
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
uint_least16_t x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::serialization::item_version_type(x);
|
||||
}
|
||||
else{
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = boost::serialization::item_version_type(x);
|
||||
}
|
||||
}
|
||||
|
||||
void load_override(serialization::collection_size_type & t){
|
||||
if(boost::archive::library_version_type(5) < this->get_library_version()){
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
else{
|
||||
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)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_BINARY_IARCHIVE_HPP
|
198
third_party/boost/boost/archive/basic_binary_iprimitive.hpp
vendored
Normal file
198
third_party/boost/boost/archive/basic_binary_iprimitive.hpp
vendored
Normal file
|
@ -0,0 +1,198 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4800 )
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iprimitive.hpp
|
||||
//
|
||||
// archives stored as native binary - this should be the fastest way
|
||||
// to archive the state of a group of obects. It makes no attempt to
|
||||
// convert to any canonical form.
|
||||
|
||||
// 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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <iosfwd>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <cstring> // std::memcpy
|
||||
#include <cstddef> // std::size_t
|
||||
#include <streambuf> // basic_streambuf
|
||||
#include <string>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// class binary_iarchive - read serialized objects from a input binary stream
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_iprimitive {
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
friend class load_access;
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
std::basic_streambuf<Elem, Tr> & m_sb;
|
||||
// return a pointer to the most derived class
|
||||
Archive * This(){
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
|
||||
// main template for serilization of primitive types
|
||||
template<class T>
|
||||
void load(T & t){
|
||||
load_binary(& t, sizeof(T));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// fundamental types that need special treatment
|
||||
|
||||
// trap usage of invalid uninitialized boolean
|
||||
void load(bool & t){
|
||||
load_binary(& t, sizeof(t));
|
||||
int i = t;
|
||||
BOOST_ASSERT(0 == i || 1 == i);
|
||||
(void)i; // warning suppression for release builds.
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load(std::string &s);
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load(std::wstring &ws);
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load(char * t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load(wchar_t * t);
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_iprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
);
|
||||
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>
|
||||
// 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;
|
||||
};
|
||||
#else
|
||||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
#endif
|
||||
};
|
||||
|
||||
// the optimized load_array dispatches to load_binary
|
||||
template <class ValueType>
|
||||
void load_array(serialization::array_wrapper<ValueType>& a, unsigned int)
|
||||
{
|
||||
load_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
|
||||
void
|
||||
load_binary(void *address, std::size_t count);
|
||||
};
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
inline void
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
|
||||
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))
|
||||
<= 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),
|
||||
s
|
||||
);
|
||||
if(scount != s)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
// note: an optimizer should eliminate the following for char files
|
||||
BOOST_ASSERT(count % sizeof(Elem) <= boost::integer_traits<std::streamsize>::const_max);
|
||||
s = static_cast<std::streamsize>(count % sizeof(Elem));
|
||||
if(0 < s){
|
||||
// if(is.fail())
|
||||
// boost::serialization::throw_exception(
|
||||
// archive_exception(archive_exception::stream_error)
|
||||
// );
|
||||
Elem t;
|
||||
scount = m_sb.sgetn(& t, 1);
|
||||
if(scount != 1)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
std::memcpy(static_cast<char*>(address) + (count - s), &t, static_cast<std::size_t>(s));
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BINARY_IPRIMITIVE_HPP
|
185
third_party/boost/boost/archive/basic_binary_oarchive.hpp
vendored
Normal file
185
third_party/boost/boost/archive/basic_binary_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,185 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as native binary - this should be the fastest way
|
||||
// to archive the state of a group of obects. It makes no attempt to
|
||||
// convert to any canonical form.
|
||||
|
||||
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
|
||||
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/item_version_type.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oarchive - write serialized objects to a binary output stream
|
||||
// note: this archive has no pretensions to portability. Archive format
|
||||
// may vary across machine architectures and compilers. About the only
|
||||
// guarentee is that an archive created with this code will be readable
|
||||
// by a program built with the same tools for the same machne. This class
|
||||
// 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 :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// any datatype not specifed below will be handled by base class
|
||||
typedef detail::common_oarchive<Archive> detail_common_oarchive;
|
||||
template<class T>
|
||||
void save_override(const T & t){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// include these to trap a change in binary format which
|
||||
// isn't specifically handled
|
||||
BOOST_STATIC_ASSERT(sizeof(tracking_type) == sizeof(bool));
|
||||
// upto 32K classes
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_type) == sizeof(int_least16_t));
|
||||
BOOST_STATIC_ASSERT(sizeof(class_id_reference_type) == sizeof(int_least16_t));
|
||||
// upto 2G objects
|
||||
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
|
||||
void save_override(const class_id_optional_type & /* t */){}
|
||||
|
||||
// enable this if we decide to support generation of previous versions
|
||||
#if 0
|
||||
void save_override(const boost::archive::version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
const boost::uint_least16_t x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
else{
|
||||
const unsigned int x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
}
|
||||
void save_override(const boost::serialization::item_version_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
const boost::uint_least16_t x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
else{
|
||||
const unsigned int x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
}
|
||||
|
||||
void save_override(class_id_type & t){
|
||||
library_version_type lvt = this->get_library_version();
|
||||
if(boost::archive::library_version_type(7) < lvt){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
else
|
||||
if(boost::archive::library_version_type(6) < lvt){
|
||||
const boost::int_least16_t x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
else{
|
||||
const int x = t;
|
||||
* this->This() << x;
|
||||
}
|
||||
}
|
||||
void save_override(class_id_reference_type & t){
|
||||
save_override(static_cast<class_id_type &>(t));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// explicitly convert to char * to avoid compile ambiguities
|
||||
void save_override(const class_name_type & t){
|
||||
const std::string s(t);
|
||||
* this->This() << s;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void save_override(const serialization::collection_size_type & t){
|
||||
if (get_library_version() < boost::archive::library_version_type(6)){
|
||||
unsigned int x=0;
|
||||
* this->This() >> x;
|
||||
t = serialization::collection_size_type(x);
|
||||
}
|
||||
else{
|
||||
* this->This() >> t;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
basic_binary_oarchive(unsigned int flags) :
|
||||
detail::common_oarchive<Archive>(flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_BINARY_OARCHIVE_HPP
|
188
third_party/boost/boost/archive/basic_binary_oprimitive.hpp
vendored
Normal file
188
third_party/boost/boost/archive/basic_binary_oprimitive.hpp
vendored
Normal file
|
@ -0,0 +1,188 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_oprimitive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as native binary - this should be the fastest way
|
||||
// to archive the state of a group of obects. It makes no attempt to
|
||||
// convert to any canonical form.
|
||||
|
||||
// IN GENERAL, ARCHIVES CREATED WITH THIS CLASS WILL NOT BE READABLE
|
||||
// ON PLATFORM APART FROM THE ONE THEY ARE CREATE ON
|
||||
|
||||
#include <iosfwd>
|
||||
#include <boost/assert.hpp>
|
||||
#include <locale>
|
||||
#include <streambuf> // basic_streambuf
|
||||
#include <string>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
//#include <boost/mpl/placeholders.hpp>
|
||||
#include <boost/serialization/is_bitwise_serializable.hpp>
|
||||
#include <boost/serialization/array_wrapper.hpp>
|
||||
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_binary_oprimitive - binary output of prmitives
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class BOOST_SYMBOL_VISIBLE basic_binary_oprimitive {
|
||||
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
friend class save_access;
|
||||
protected:
|
||||
#else
|
||||
public:
|
||||
#endif
|
||||
std::basic_streambuf<Elem, Tr> & m_sb;
|
||||
// return a pointer to the most derived class
|
||||
Archive * This(){
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<Elem> codecvt_null_facet;
|
||||
basic_streambuf_locale_saver<Elem, Tr> locale_saver;
|
||||
std::locale archive_locale;
|
||||
#endif
|
||||
// default saving of primitives.
|
||||
template<class T>
|
||||
void save(const T & t)
|
||||
{
|
||||
save_binary(& t, sizeof(T));
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// fundamental types that need special treatment
|
||||
|
||||
// trap usage of invalid uninitialized boolean which would
|
||||
// otherwise crash on load.
|
||||
void save(const bool t){
|
||||
BOOST_ASSERT(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
save_binary(& t, sizeof(t));
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save(const std::string &s);
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save(const std::wstring &ws);
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save(const char * t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save(const wchar_t * t);
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_oprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
);
|
||||
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>
|
||||
// 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;
|
||||
};
|
||||
#else
|
||||
struct apply : public boost::serialization::is_bitwise_serializable< T > {};
|
||||
#endif
|
||||
};
|
||||
|
||||
// the optimized save_array dispatches to save_binary
|
||||
template <class ValueType>
|
||||
void save_array(boost::serialization::array_wrapper<ValueType> const& a, unsigned int)
|
||||
{
|
||||
save_binary(a.address(),a.count()*sizeof(ValueType));
|
||||
}
|
||||
|
||||
void save_binary(const void *address, std::size_t count);
|
||||
};
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
inline void
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
// BOOST_ASSERT(count <= std::size_t(boost::integer_traits<std::streamsize>::const_max));
|
||||
// note: if the following assertions fail
|
||||
// a likely cause is that the output stream is set to "text"
|
||||
// mode where by cr characters recieve special treatment.
|
||||
// be sure that the output stream is opened with ios::binary
|
||||
//if(os.fail())
|
||||
// boost::serialization::throw_exception(
|
||||
// archive_exception(archive_exception::output_stream_error)
|
||||
// );
|
||||
// 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<std::streamsize>(count)
|
||||
);
|
||||
if(count != static_cast<std::size_t>(scount))
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
//os.write(
|
||||
// static_cast<const typename OStream::char_type *>(address),
|
||||
// count
|
||||
//);
|
||||
//BOOST_ASSERT(os.good());
|
||||
}
|
||||
|
||||
} //namespace boost
|
||||
} //namespace archive
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_BINARY_OPRIMITIVE_HPP
|
108
third_party/boost/boost/archive/basic_streambuf_locale_saver.hpp
vendored
Normal file
108
third_party/boost/boost/archive/basic_streambuf_locale_saver.hpp
vendored
Normal file
|
@ -0,0 +1,108 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_streambuf_locale_saver.hpp
|
||||
|
||||
// (C) Copyright 2005 Robert Ramey - http://www.rrsd.com
|
||||
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// note derived from boost/io/ios_state.hpp
|
||||
// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution
|
||||
// are subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
|
||||
|
||||
// See <http://www.boost.org/libs/io/> for the library's home page.
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
|
||||
#include <locale> // for std::locale
|
||||
#include <ios>
|
||||
#include <streambuf> // for std::basic_streambuf
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
namespace archive{
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_streambuf_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_streambuf_locale_saver(std::basic_streambuf<Ch, Tr> &s) :
|
||||
m_streambuf(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_streambuf_locale_saver(){
|
||||
m_streambuf.pubsync();
|
||||
m_streambuf.pubimbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_streambuf<Ch, Tr> & m_streambuf;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_istream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_istream_locale_saver(std::basic_istream<Ch, Tr> &s) :
|
||||
m_istream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_istream_locale_saver(){
|
||||
// libstdc++ crashes without this
|
||||
m_istream.sync();
|
||||
m_istream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_istream<Ch, Tr> & m_istream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
template < typename Ch, class Tr >
|
||||
class basic_ostream_locale_saver :
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
explicit basic_ostream_locale_saver(std::basic_ostream<Ch, Tr> &s) :
|
||||
m_ostream(s),
|
||||
m_locale(s.getloc())
|
||||
{}
|
||||
~basic_ostream_locale_saver(){
|
||||
m_ostream.flush();
|
||||
m_ostream.imbue(m_locale);
|
||||
}
|
||||
private:
|
||||
std::basic_ostream<Ch, Tr> & m_ostream;
|
||||
std::locale const m_locale;
|
||||
};
|
||||
|
||||
|
||||
} // archive
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_STD_LOCALE
|
||||
#endif // BOOST_ARCHIVE_BASIC_STREAMBUF_LOCALE_SAVER_HPP
|
96
third_party/boost/boost/archive/basic_text_iarchive.hpp
vendored
Normal file
96
third_party/boost/boost/archive/basic_text_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,96 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_iarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// 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
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
// intermediate level to support override of operators
|
||||
// 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
|
||||
void load_override(class_id_optional_type & /*t*/){}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(class_name_type & t);
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init(void);
|
||||
|
||||
basic_text_iarchive(unsigned int flags) :
|
||||
detail::common_iarchive<Archive>(flags)
|
||||
{}
|
||||
~basic_text_iarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_IARCHIVE_HPP
|
142
third_party/boost/boost/archive/basic_text_iprimitive.hpp
vendored
Normal file
142
third_party/boost/boost/archive/basic_text_iprimitive.hpp
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_iprimitive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these are templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// Note the fact that on libraries without wide characters, ostream is
|
||||
// not a specialization of basic_ostream which in fact is not defined
|
||||
// in such cases. So we can't use basic_ostream<IStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
#if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
|
||||
using ::locale;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_iarchive - load serialized objects from a input text stream
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4244 4267 )
|
||||
#endif
|
||||
|
||||
template<class IStream>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_iprimitive {
|
||||
protected:
|
||||
IStream &is;
|
||||
io::ios_flags_saver flags_saver;
|
||||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename IStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_istream_locale_saver<
|
||||
typename IStream::char_type,
|
||||
typename IStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
void load(T & t)
|
||||
{
|
||||
if(is >> t)
|
||||
return;
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
}
|
||||
|
||||
void load(char & t)
|
||||
{
|
||||
short int i;
|
||||
load(i);
|
||||
t = i;
|
||||
}
|
||||
void load(signed char & t)
|
||||
{
|
||||
short int i;
|
||||
load(i);
|
||||
t = i;
|
||||
}
|
||||
void load(unsigned char & t)
|
||||
{
|
||||
unsigned short int i;
|
||||
load(i);
|
||||
t = i;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
void load(wchar_t & t)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
|
||||
int i;
|
||||
load(i);
|
||||
t = i;
|
||||
}
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_iprimitive(IStream &is, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_text_iprimitive();
|
||||
public:
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_binary(void *address, std::size_t count);
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_IPRIMITIVE_HPP
|
119
third_party/boost/boost/archive/basic_text_oarchive.hpp
vendored
Normal file
119
third_party/boost/boost/archive/basic_text_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// 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_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oarchive
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum {
|
||||
none,
|
||||
eol,
|
||||
space
|
||||
} delimiter;
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
newtoken();
|
||||
|
||||
void newline(){
|
||||
delimiter = eol;
|
||||
}
|
||||
|
||||
// default processing - kick back to base class. Note the
|
||||
// extra stuff to get it passed borland compilers
|
||||
typedef detail::common_oarchive<Archive> detail_common_oarchive;
|
||||
template<class T>
|
||||
void save_override(T & t){
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// start new objects on a new line
|
||||
void save_override(const object_id_type & t){
|
||||
this->This()->newline();
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// 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){
|
||||
const std::string s(t);
|
||||
* this->This() << s;
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
|
||||
basic_text_oarchive(unsigned int flags) :
|
||||
detail::common_oarchive<Archive>(flags),
|
||||
delimiter(none)
|
||||
{}
|
||||
~basic_text_oarchive(){}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_OARCHIVE_HPP
|
209
third_party/boost/boost/archive/basic_text_oprimitive.hpp
vendored
Normal file
209
third_party/boost/boost/archive/basic_text_oprimitive.hpp
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oprimitive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// 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_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
|
||||
#include <iomanip>
|
||||
#include <locale>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
#if ! defined(BOOST_DINKUMWARE_STDLIB) && ! defined(__SGI_STL_PORT)
|
||||
using ::locale;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/type_traits/is_floating_point.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
#include <boost/integer.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/basic_streambuf_locale_saver.hpp>
|
||||
#include <boost/archive/codecvt_null.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_text_oprimitive - output of prmitives to stream
|
||||
template<class OStream>
|
||||
class BOOST_SYMBOL_VISIBLE basic_text_oprimitive
|
||||
{
|
||||
protected:
|
||||
OStream &os;
|
||||
io::ios_flags_saver flags_saver;
|
||||
io::ios_precision_saver precision_saver;
|
||||
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
// note order! - if you change this, libstd++ will fail!
|
||||
// a) create new locale with new codecvt facet
|
||||
// b) save current locale
|
||||
// c) change locale to new one
|
||||
// d) use stream buffer
|
||||
// e) change locale back to original
|
||||
// f) destroy new codecvt facet
|
||||
boost::archive::codecvt_null<typename OStream::char_type> codecvt_null_facet;
|
||||
std::locale archive_locale;
|
||||
basic_ostream_locale_saver<
|
||||
typename OStream::char_type,
|
||||
typename OStream::traits_type
|
||||
> locale_saver;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// fundamental types that need special treatment
|
||||
void save(const bool t){
|
||||
// trap usage of invalid uninitialized boolean which would
|
||||
// otherwise crash on load.
|
||||
BOOST_ASSERT(0 == static_cast<int>(t) || 1 == static_cast<int>(t));
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
void save(const signed char t)
|
||||
{
|
||||
save(static_cast<short int>(t));
|
||||
}
|
||||
void save(const unsigned char t)
|
||||
{
|
||||
save(static_cast<short unsigned int>(t));
|
||||
}
|
||||
void save(const char t)
|
||||
{
|
||||
save(static_cast<short int>(t));
|
||||
}
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
void save(const wchar_t t)
|
||||
{
|
||||
BOOST_STATIC_ASSERT(sizeof(wchar_t) <= sizeof(int));
|
||||
save(static_cast<int>(t));
|
||||
}
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// saving of any types not listed above
|
||||
|
||||
template<class T>
|
||||
void save_impl(const T &t, boost::mpl::bool_<false> &){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os << t;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// floating point types need even more special treatment
|
||||
// the following determines whether the type T is some sort
|
||||
// of floating point type. Note that we then assume that
|
||||
// the stream << operator is defined on that type - if not
|
||||
// we'll get a compile time error. This is meant to automatically
|
||||
// support synthesized types which support floating point
|
||||
// operations. Also it should handle compiler dependent types
|
||||
// such long double. Due to John Maddock.
|
||||
|
||||
template<class T>
|
||||
struct is_float {
|
||||
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)
|
||||
>::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())
|
||||
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:
|
||||
// www.eecs.berkeley.edu/~wkahan/ieee754status/ieee754.ps
|
||||
// const unsigned int digits = (std::numeric_limits<T>::digits * 3010) / 10000;
|
||||
// note: I've commented out the above because I didn't get good results. e.g.
|
||||
// in one case I got a difference of 19 units.
|
||||
#ifndef BOOST_NO_CXX11_NUMERIC_LIMITS
|
||||
const unsigned int digits = std::numeric_limits<T>::max_digits10;
|
||||
#else
|
||||
const unsigned int digits = std::numeric_limits<T>::digits10 + 2;
|
||||
#endif
|
||||
os << std::setprecision(digits) << std::scientific << t;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void save(const T & t){
|
||||
typename is_float<T>::type tf;
|
||||
save_impl(t, tf);
|
||||
}
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive(OStream & os, bool no_codecvt);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_text_oprimitive();
|
||||
public:
|
||||
// unformatted append of one character
|
||||
void put(typename OStream::char_type c){
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
os.put(c);
|
||||
}
|
||||
// unformatted append of null terminated string
|
||||
void put(const char * s){
|
||||
while('\0' != *s)
|
||||
os.put(*s++);
|
||||
}
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_binary(const void *address, std::size_t count);
|
||||
};
|
||||
|
||||
} //namespace boost
|
||||
} //namespace archive
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_TEXT_OPRIMITIVE_HPP
|
67
third_party/boost/boost/archive/basic_xml_archive.hpp
vendored
Normal file
67
third_party/boost/boost/archive/basic_xml_archive.hpp
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_archive.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// constant strings used in xml i/o
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_OBJECT_ID();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_OBJECT_REFERENCE();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_CLASS_ID();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_CLASS_NAME();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_TRACKING();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_VERSION();
|
||||
|
||||
extern
|
||||
BOOST_ARCHIVE_DECL const char *
|
||||
BOOST_ARCHIVE_XML_SIGNATURE();
|
||||
|
||||
}// namespace archive
|
||||
}// namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_XML_TEXT_ARCHIVE_HPP
|
||||
|
119
third_party/boost/boost/archive/basic_xml_iarchive.hpp
vendored
Normal file
119
third_party/boost/boost/archive/basic_xml_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,119 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_iarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_iarchive.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// class basic_xml_iarchive - read serialized objects from a input text stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_xml_iarchive :
|
||||
public detail::common_iarchive<Archive>
|
||||
{
|
||||
unsigned int depth;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
#endif
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_start(const char *name);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_end(const char *name);
|
||||
|
||||
// Anything not an attribute and not a name-value pair is an
|
||||
// should be trapped here.
|
||||
template<class T>
|
||||
void load_override(T & t)
|
||||
{
|
||||
// If your program fails to compile here, its most likely due to
|
||||
// not specifying an nvp wrapper around the variable to
|
||||
// be serialized.
|
||||
BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
|
||||
this->detail_common_iarchive::load_override(t);
|
||||
}
|
||||
|
||||
// Anything not an attribute - see below - should be a name value
|
||||
// pair and be processed here
|
||||
typedef detail::common_iarchive<Archive> detail_common_iarchive;
|
||||
template<class T>
|
||||
void load_override(
|
||||
const boost::serialization::nvp< T > & t
|
||||
){
|
||||
this->This()->load_start(t.name());
|
||||
this->detail_common_iarchive::load_override(t.value());
|
||||
this->This()->load_end(t.name());
|
||||
}
|
||||
|
||||
// specific overrides for attributes - handle as
|
||||
// primitives. These are not name-value pairs
|
||||
// so they have to be intercepted here and passed on to load.
|
||||
// although the class_id is included in the xml text file in order
|
||||
// to make the file self describing, it isn't used when loading
|
||||
// an xml archive. So we can skip it here. Note: we MUST override
|
||||
// it otherwise it will be loaded as a normal primitive w/o tag and
|
||||
// leaving the archive in an undetermined state
|
||||
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(object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
load_override(tracking_type & t);
|
||||
// class_name_type can't be handled here as it depends upon the
|
||||
// char type used by the stream. So require the derived implementation
|
||||
// handle this.
|
||||
// void load_override(class_name_type & t);
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_iarchive(unsigned int flags);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_xml_iarchive();
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_XML_IARCHIVE_HPP
|
138
third_party/boost/boost/archive/basic_xml_oarchive.hpp
vendored
Normal file
138
third_party/boost/boost/archive/basic_xml_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,138 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/archive/detail/common_oarchive.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_xml_oarchive - write serialized objects to a xml output stream
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE basic_xml_oarchive :
|
||||
public detail::common_oarchive<Archive>
|
||||
{
|
||||
// special stuff for xml output
|
||||
unsigned int depth;
|
||||
bool pending_preamble;
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
#endif
|
||||
bool indent_next;
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
indent();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
init();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
windup();
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
write_attribute(
|
||||
const char *attribute_name,
|
||||
int t,
|
||||
const char *conjunction = "=\""
|
||||
);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
write_attribute(
|
||||
const char *attribute_name,
|
||||
const char *key
|
||||
);
|
||||
// helpers used below
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_start(const char *name);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_end(const char *name);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
end_preamble();
|
||||
|
||||
// Anything not an attribute and not a name-value pair is an
|
||||
// error and should be trapped here.
|
||||
template<class T>
|
||||
void save_override(T & t)
|
||||
{
|
||||
// If your program fails to compile here, its most likely due to
|
||||
// not specifying an nvp wrapper around the variable to
|
||||
// be serialized.
|
||||
BOOST_MPL_ASSERT((serialization::is_wrapper< T >));
|
||||
this->detail_common_oarchive::save_override(t);
|
||||
}
|
||||
|
||||
// special treatment for name-value pairs.
|
||||
typedef detail::common_oarchive<Archive> detail_common_oarchive;
|
||||
template<class T>
|
||||
void save_override(
|
||||
const ::boost::serialization::nvp< T > & t
|
||||
){
|
||||
this->This()->save_start(t.name());
|
||||
this->detail_common_oarchive::save_override(t.const_value());
|
||||
this->This()->save_end(t.name());
|
||||
}
|
||||
|
||||
// specific overrides for attributes - not name value pairs so we
|
||||
// want to trap them before the above "fall through"
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_optional_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_id_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_id_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const object_reference_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const version_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const class_name_type & t);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
save_override(const tracking_type & t);
|
||||
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_oarchive(unsigned int flags);
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
~basic_xml_oarchive();
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_XML_OARCHIVE_HPP
|
64
third_party/boost/boost/archive/binary_iarchive.hpp
vendored
Normal file
64
third_party/boost/boost/archive/binary_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_iarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <istream>
|
||||
#include <boost/archive/binary_iarchive_impl.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// do not derive from this class. If you want to extend this functionality
|
||||
// via inhertance, derived from binary_iarchive_impl instead. This will
|
||||
// preserve correct static polymorphism.
|
||||
class BOOST_SYMBOL_VISIBLE binary_iarchive :
|
||||
public binary_iarchive_impl<
|
||||
boost::archive::binary_iarchive,
|
||||
std::istream::char_type,
|
||||
std::istream::traits_type
|
||||
>{
|
||||
public:
|
||||
binary_iarchive(std::istream & is, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
binary_iarchive, std::istream::char_type, std::istream::traits_type
|
||||
>(is, 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)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive)
|
||||
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_iarchive)
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP
|
105
third_party/boost/boost/archive/binary_iarchive_impl.hpp
vendored
Normal file
105
third_party/boost/boost/archive/binary_iarchive_impl.hpp
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_iarchive_impl.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <istream>
|
||||
#include <boost/archive/basic_binary_iprimitive.hpp>
|
||||
#include <boost/archive/basic_binary_iarchive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_iarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class BOOST_SYMBOL_VISIBLE binary_iarchive_impl :
|
||||
public basic_binary_iprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_iarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_iarchive<Archive>;
|
||||
friend basic_binary_iarchive<Archive>;
|
||||
friend load_access;
|
||||
#else
|
||||
friend class detail::interface_iarchive<Archive>;
|
||||
friend class basic_binary_iarchive<Archive>;
|
||||
friend class load_access;
|
||||
#endif
|
||||
#endif
|
||||
template<class T>
|
||||
void load_override(T & t){
|
||||
this->basic_binary_iarchive<Archive>::load_override(t);
|
||||
}
|
||||
void init(unsigned int flags){
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_iarchive<Archive>::init();
|
||||
this->basic_binary_iprimitive<Archive, Elem, Tr>::init();
|
||||
#else
|
||||
basic_binary_iarchive<Archive>::init();
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::init();
|
||||
#endif
|
||||
}
|
||||
binary_iarchive_impl(
|
||||
std::basic_streambuf<Elem, Tr> & bsb,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>(
|
||||
bsb,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_binary_iarchive<Archive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
binary_iarchive_impl(
|
||||
std::basic_istream<Elem, Tr> & is,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>(
|
||||
* is.rdbuf(),
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_binary_iarchive<Archive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_IMPL_HPP
|
64
third_party/boost/boost/archive/binary_oarchive.hpp
vendored
Normal file
64
third_party/boost/boost/archive/binary_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,64 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <ostream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/archive/binary_oarchive_impl.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
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 :
|
||||
public binary_oarchive_impl<
|
||||
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
|
||||
>
|
||||
{
|
||||
public:
|
||||
binary_oarchive(std::ostream & os, unsigned int flags = 0) :
|
||||
binary_oarchive_impl<
|
||||
binary_oarchive, std::ostream::char_type, std::ostream::traits_type
|
||||
>(os, 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)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive)
|
||||
BOOST_SERIALIZATION_USE_ARRAY_OPTIMIZATION(boost::archive::binary_oarchive)
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP
|
106
third_party/boost/boost/archive/binary_oarchive_impl.hpp
vendored
Normal file
106
third_party/boost/boost/archive/binary_oarchive_impl.hpp
vendored
Normal file
|
@ -0,0 +1,106 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_oarchive_impl.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <ostream>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/archive/basic_binary_oprimitive.hpp>
|
||||
#include <boost/archive/basic_binary_oarchive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class Archive> class interface_oarchive;
|
||||
} // namespace detail
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
class BOOST_SYMBOL_VISIBLE binary_oarchive_impl :
|
||||
public basic_binary_oprimitive<Archive, Elem, Tr>,
|
||||
public basic_binary_oarchive<Archive>
|
||||
{
|
||||
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
|
||||
public:
|
||||
#else
|
||||
protected:
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, < 1500)
|
||||
// for some inexplicable reason insertion of "class" generates compile erro
|
||||
// on msvc 7.1
|
||||
friend detail::interface_oarchive<Archive>;
|
||||
friend basic_binary_oarchive<Archive>;
|
||||
friend save_access;
|
||||
#else
|
||||
friend class detail::interface_oarchive<Archive>;
|
||||
friend class basic_binary_oarchive<Archive>;
|
||||
friend class save_access;
|
||||
#endif
|
||||
#endif
|
||||
template<class T>
|
||||
void save_override(T & t){
|
||||
this->basic_binary_oarchive<Archive>::save_override(t);
|
||||
}
|
||||
void init(unsigned int flags) {
|
||||
if(0 != (flags & no_header)){
|
||||
return;
|
||||
}
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_binary_oarchive<Archive>::init();
|
||||
this->basic_binary_oprimitive<Archive, Elem, Tr>::init();
|
||||
#else
|
||||
basic_binary_oarchive<Archive>::init();
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::init();
|
||||
#endif
|
||||
}
|
||||
binary_oarchive_impl(
|
||||
std::basic_streambuf<Elem, Tr> & bsb,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>(
|
||||
bsb,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_binary_oarchive<Archive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
binary_oarchive_impl(
|
||||
std::basic_ostream<Elem, Tr> & os,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>(
|
||||
* os.rdbuf(),
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_binary_oarchive<Archive>(flags)
|
||||
{
|
||||
init(flags);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_IMPL_HPP
|
56
third_party/boost/boost/archive/binary_wiarchive.hpp
vendored
Normal file
56
third_party/boost/boost/archive/binary_wiarchive.hpp
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_wiarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#else
|
||||
|
||||
#include <istream> // wistream
|
||||
#include <boost/archive/binary_iarchive_impl.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
class binary_wiarchive :
|
||||
public binary_iarchive_impl<
|
||||
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
|
||||
>
|
||||
{
|
||||
public:
|
||||
binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
|
||||
>(is, flags)
|
||||
{}
|
||||
binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
|
||||
binary_iarchive_impl<
|
||||
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
|
||||
>(bsb, flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive)
|
||||
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
||||
#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP
|
59
third_party/boost/boost/archive/binary_woarchive.hpp
vendored
Normal file
59
third_party/boost/boost/archive/binary_woarchive.hpp
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
#ifndef BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_woarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#else
|
||||
|
||||
#include <ostream>
|
||||
#include <boost/archive/binary_oarchive_impl.hpp>
|
||||
#include <boost/archive/detail/register_archive.hpp>
|
||||
|
||||
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 :
|
||||
public binary_oarchive_impl<
|
||||
binary_woarchive, std::wostream::char_type, std::wostream::traits_type
|
||||
>
|
||||
{
|
||||
public:
|
||||
binary_woarchive(std::wostream & os, unsigned int flags = 0) :
|
||||
binary_oarchive_impl<
|
||||
binary_woarchive, std::wostream::char_type, std::wostream::traits_type
|
||||
>(os, flags)
|
||||
{}
|
||||
binary_woarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
|
||||
binary_oarchive_impl<
|
||||
binary_woarchive, std::wostream::char_type, std::wostream::traits_type
|
||||
>(bsb, flags)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
// required by export
|
||||
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive)
|
||||
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
||||
#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP
|
110
third_party/boost/boost/archive/codecvt_null.hpp
vendored
Normal file
110
third_party/boost/boost/archive/codecvt_null.hpp
vendored
Normal file
|
@ -0,0 +1,110 @@
|
|||
#ifndef BOOST_ARCHIVE_CODECVT_NULL_HPP
|
||||
#define BOOST_ARCHIVE_CODECVT_NULL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// codecvt_null.hpp:
|
||||
|
||||
// (C) Copyright 2004 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <locale>
|
||||
#include <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
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std {
|
||||
// For STLport on WinCE, BOOST_NO_STDC_NAMESPACE can get defined if STLport is putting symbols in its own namespace.
|
||||
// In the case of codecvt, however, this does not mean that codecvt is in the global namespace (it will be in STLport's namespace)
|
||||
# if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
using ::codecvt;
|
||||
# endif
|
||||
using ::mbstate_t;
|
||||
using ::size_t;
|
||||
} // namespace
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Ch>
|
||||
class codecvt_null;
|
||||
|
||||
template<>
|
||||
class codecvt_null<char> : public std::codecvt<char, char, std::mbstate_t>
|
||||
{
|
||||
virtual bool do_always_noconv() const throw() {
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<char, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
virtual ~codecvt_null(){};
|
||||
};
|
||||
|
||||
template<>
|
||||
class BOOST_WARCHIVE_DECL codecvt_null<wchar_t> :
|
||||
public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
{
|
||||
virtual std::codecvt_base::result
|
||||
do_out(
|
||||
std::mbstate_t & state,
|
||||
const wchar_t * first1,
|
||||
const wchar_t * last1,
|
||||
const wchar_t * & next1,
|
||||
char * first2,
|
||||
char * last2,
|
||||
char * & next2
|
||||
) const;
|
||||
virtual std::codecvt_base::result
|
||||
do_in(
|
||||
std::mbstate_t & state,
|
||||
const char * first1,
|
||||
const char * last1,
|
||||
const char * & next1,
|
||||
wchar_t * first2,
|
||||
wchar_t * last2,
|
||||
wchar_t * & next2
|
||||
) const;
|
||||
virtual int do_encoding( ) const throw( ){
|
||||
return sizeof(wchar_t) / sizeof(char);
|
||||
}
|
||||
virtual int do_max_length( ) const throw( ){
|
||||
return do_encoding();
|
||||
}
|
||||
public:
|
||||
explicit codecvt_null(std::size_t no_locale_manage = 0) :
|
||||
std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
//virtual ~codecvt_null(){};
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pop pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_CODECVT_NULL_HPP
|
16
third_party/boost/boost/archive/detail/abi_prefix.hpp
vendored
Normal file
16
third_party/boost/boost/archive/detail/abi_prefix.hpp
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// abi_prefix.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config/abi_prefix.hpp> // must be the last header
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4251 4231 4660 4275)
|
||||
#endif
|
||||
|
15
third_party/boost/boost/archive/detail/abi_suffix.hpp
vendored
Normal file
15
third_party/boost/boost/archive/detail/abi_suffix.hpp
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// abi_suffix.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
54
third_party/boost/boost/archive/detail/archive_serializer_map.hpp
vendored
Normal file
54
third_party/boost/boost/archive/detail/archive_serializer_map.hpp
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
#ifndef BOOST_ARCHIVE_SERIALIZER_MAP_HPP
|
||||
#define BOOST_ARCHIVE_SERIALIZER_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// archive_serializer_map.hpp: extenstion of type_info required for
|
||||
// serialization.
|
||||
|
||||
// (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)
|
||||
|
||||
// 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.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_serializer;
|
||||
|
||||
template<class Archive>
|
||||
class BOOST_SYMBOL_VISIBLE archive_serializer_map {
|
||||
public:
|
||||
static BOOST_ARCHIVE_OR_WARCHIVE_DECL bool insert(const basic_serializer * bs);
|
||||
static BOOST_ARCHIVE_OR_WARCHIVE_DECL void erase(const basic_serializer * bs);
|
||||
static BOOST_ARCHIVE_OR_WARCHIVE_DECL const basic_serializer * find(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // must be the last header
|
||||
|
||||
#endif //BOOST_ARCHIVE_SERIALIZER_MAP_HPP
|
48
third_party/boost/boost/archive/detail/auto_link_archive.hpp
vendored
Normal file
48
third_party/boost/boost/archive/detail/auto_link_archive.hpp
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// auto_link_archive.hpp
|
||||
//
|
||||
// (c) Copyright Robert Ramey 2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See 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 ------------------------------//
|
||||
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
#if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB) \
|
||||
&& !defined(BOOST_ARCHIVE_SOURCE) && !defined(BOOST_WARCHIVE_SOURCE) \
|
||||
&& !defined(BOOST_SERIALIZATION_SOURCE)
|
||||
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_serialization
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
#endif
|
||||
//
|
||||
// And include the header that does the work:
|
||||
//
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
47
third_party/boost/boost/archive/detail/auto_link_warchive.hpp
vendored
Normal file
47
third_party/boost/boost/archive/detail/auto_link_warchive.hpp
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_AUTO_LINK_WARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// auto_link_warchive.hpp
|
||||
//
|
||||
// (c) Copyright Robert Ramey 2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See 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 ------------------------------//
|
||||
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
|
||||
#if !defined(BOOST_WARCHIVE_SOURCE) \
|
||||
&& !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_SERIALIZATION_NO_LIB)
|
||||
|
||||
// Set the name of our library, this will get undef'ed by auto_link.hpp
|
||||
// once it's done with it:
|
||||
//
|
||||
#define BOOST_LIB_NAME boost_wserialization
|
||||
//
|
||||
// If we're importing code from a dll, then tell auto_link.hpp about it:
|
||||
//
|
||||
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK)
|
||||
# define BOOST_DYN_LINK
|
||||
#endif
|
||||
//
|
||||
// And include the header that does the work:
|
||||
//
|
||||
#include <boost/config/auto_link.hpp>
|
||||
#endif // auto-linking disabled
|
||||
|
||||
#endif // ARCHIVE_DETAIL_AUTO_LINK_ARCHIVE_HPP
|
105
third_party/boost/boost/archive/detail/basic_iarchive.hpp
vendored
Normal file
105
third_party/boost/boost/archive/detail/basic_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,105 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_iarchive.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// can't use this - much as I'd like to as borland doesn't support it
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/serialization/tracking_enum.hpp>
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#include <boost/archive/detail/helper_collection.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_iarchive_impl;
|
||||
class basic_iserializer;
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_iarchive - read serialized objects from a input stream
|
||||
class BOOST_SYMBOL_VISIBLE basic_iarchive :
|
||||
private boost::noncopyable,
|
||||
public boost::archive::detail::helper_collection
|
||||
{
|
||||
friend class basic_iarchive_impl;
|
||||
// hide implementation of this class to minimize header conclusion
|
||||
boost::scoped_ptr<basic_iarchive_impl> pimpl;
|
||||
|
||||
virtual void vload(version_type &t) = 0;
|
||||
virtual void vload(object_id_type &t) = 0;
|
||||
virtual void vload(class_id_type &t) = 0;
|
||||
virtual void vload(class_id_optional_type &t) = 0;
|
||||
virtual void vload(class_name_type &t) = 0;
|
||||
virtual void vload(tracking_type &t) = 0;
|
||||
protected:
|
||||
BOOST_ARCHIVE_DECL basic_iarchive(unsigned int flags);
|
||||
boost::archive::detail::helper_collection &
|
||||
get_helper_collection(){
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
// some msvc versions require that the following function be public
|
||||
// otherwise it should really protected.
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iarchive();
|
||||
// note: NOT part of the public API.
|
||||
BOOST_ARCHIVE_DECL void next_object_pointer(void *t);
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
const basic_iserializer & bis
|
||||
);
|
||||
BOOST_ARCHIVE_DECL void load_object(
|
||||
void *t,
|
||||
const basic_iserializer & bis
|
||||
);
|
||||
BOOST_ARCHIVE_DECL const basic_pointer_iserializer *
|
||||
load_pointer(
|
||||
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
|
||||
set_library_version(library_version_type archive_library_version);
|
||||
BOOST_ARCHIVE_DECL library_version_type
|
||||
get_library_version() const;
|
||||
BOOST_ARCHIVE_DECL unsigned int
|
||||
get_flags() const;
|
||||
BOOST_ARCHIVE_DECL void
|
||||
reset_object_address(const void * new_address, const void * old_address);
|
||||
BOOST_ARCHIVE_DECL void
|
||||
delete_created_pointers();
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_DETAIL_BASIC_IARCHIVE_HPP
|
91
third_party/boost/boost/archive/detail/basic_iserializer.hpp
vendored
Normal file
91
third_party/boost/boost/archive/detail/basic_iserializer.hpp
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstdlib> // NULL
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/decl.hpp>
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
// forward declarations
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_iarchive;
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_iserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
private:
|
||||
basic_pointer_iserializer *m_bpis;
|
||||
protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_iserializer(
|
||||
const boost::serialization::extended_type_info & type
|
||||
);
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_iserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpis != NULL;
|
||||
}
|
||||
void set_bpis(basic_pointer_iserializer *bpis){
|
||||
m_bpis = bpis;
|
||||
}
|
||||
const basic_pointer_iserializer * get_bpis_ptr() const {
|
||||
return m_bpis;
|
||||
}
|
||||
virtual void load_object_data(
|
||||
basic_iarchive & ar,
|
||||
void *x,
|
||||
const unsigned int file_version
|
||||
) const = 0;
|
||||
// returns true if class_info should be saved
|
||||
virtual bool class_info() const = 0 ;
|
||||
// returns true if objects should be tracked
|
||||
virtual bool tracking(const unsigned int) const = 0 ;
|
||||
// returns class version
|
||||
virtual version_type version() const = 0 ;
|
||||
// returns true if this class is polymorphic
|
||||
virtual bool is_polymorphic() const = 0;
|
||||
virtual void destroy(/*const*/ void *address) const = 0 ;
|
||||
};
|
||||
|
||||
} // namespae detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_BASIC_ISERIALIZER_HPP
|
94
third_party/boost/boost/archive/detail/basic_oarchive.hpp
vendored
Normal file
94
third_party/boost/boost/archive/detail/basic_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,94 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_oarchive.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/serialization/tracking_enum.hpp>
|
||||
#include <boost/archive/detail/helper_collection.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_oarchive_impl;
|
||||
class basic_oserializer;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// class basic_oarchive - write serialized objects to an output stream
|
||||
class BOOST_SYMBOL_VISIBLE basic_oarchive :
|
||||
private boost::noncopyable,
|
||||
public boost::archive::detail::helper_collection
|
||||
{
|
||||
friend class basic_oarchive_impl;
|
||||
// hide implementation of this class to minimize header conclusion
|
||||
boost::scoped_ptr<basic_oarchive_impl> pimpl;
|
||||
|
||||
// overload these to bracket object attributes. Used to implement
|
||||
// xml archives
|
||||
virtual void vsave(const version_type t) = 0;
|
||||
virtual void vsave(const object_id_type t) = 0;
|
||||
virtual void vsave(const object_reference_type t) = 0;
|
||||
virtual void vsave(const class_id_type t) = 0;
|
||||
virtual void vsave(const class_id_optional_type t) = 0;
|
||||
virtual void vsave(const class_id_reference_type t) = 0;
|
||||
virtual void vsave(const class_name_type & t) = 0;
|
||||
virtual void vsave(const tracking_type t) = 0;
|
||||
protected:
|
||||
BOOST_ARCHIVE_DECL basic_oarchive(unsigned int flags = 0);
|
||||
BOOST_ARCHIVE_DECL boost::archive::detail::helper_collection &
|
||||
get_helper_collection();
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oarchive();
|
||||
public:
|
||||
// note: NOT part of the public interface
|
||||
BOOST_ARCHIVE_DECL void register_basic_serializer(
|
||||
const basic_oserializer & bos
|
||||
);
|
||||
BOOST_ARCHIVE_DECL void save_object(
|
||||
const void *x,
|
||||
const basic_oserializer & bos
|
||||
);
|
||||
BOOST_ARCHIVE_DECL void save_pointer(
|
||||
const void * t,
|
||||
const basic_pointer_oserializer * bpos_ptr
|
||||
);
|
||||
void save_null_pointer(){
|
||||
vsave(NULL_POINTER_TAG);
|
||||
}
|
||||
// real public interface starts here
|
||||
BOOST_ARCHIVE_DECL void end_preamble(); // default implementation does nothing
|
||||
BOOST_ARCHIVE_DECL library_version_type get_library_version() const;
|
||||
BOOST_ARCHIVE_DECL unsigned int get_flags() const;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif //BOOST_ARCHIVE_BASIC_OARCHIVE_HPP
|
89
third_party/boost/boost/archive/detail/basic_oserializer.hpp
vendored
Normal file
89
third_party/boost/boost/archive/detail/basic_oserializer.hpp
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
#ifndef BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
#define BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
// forward declarations
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_oarchive;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_oserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
private:
|
||||
basic_pointer_oserializer *m_bpos;
|
||||
protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_oserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_oserializer();
|
||||
public:
|
||||
bool serialized_as_pointer() const {
|
||||
return m_bpos != NULL;
|
||||
}
|
||||
void set_bpos(basic_pointer_oserializer *bpos){
|
||||
m_bpos = bpos;
|
||||
}
|
||||
const basic_pointer_oserializer * get_bpos() const {
|
||||
return m_bpos;
|
||||
}
|
||||
virtual void save_object_data(
|
||||
basic_oarchive & ar, const void * x
|
||||
) const = 0;
|
||||
// returns true if class_info should be saved
|
||||
virtual bool class_info() const = 0;
|
||||
// returns true if objects should be tracked
|
||||
virtual bool tracking(const unsigned int flags) const = 0;
|
||||
// returns class version
|
||||
virtual version_type version() const = 0;
|
||||
// returns true if this class is polymorphic
|
||||
virtual bool is_polymorphic() const = 0;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_SERIALIZATION_BASIC_OSERIALIZER_HPP
|
70
third_party/boost/boost/archive/detail/basic_pointer_iserializer.hpp
vendored
Normal file
70
third_party/boost/boost/archive/detail/basic_pointer_iserializer.hpp
vendored
Normal file
|
@ -0,0 +1,70 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_pointer_oserializer.hpp: extenstion of type_info required for
|
||||
// serialization.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
// forward declarations
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_iarchive;
|
||||
class basic_iserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_pointer_iserializer
|
||||
: public basic_serializer {
|
||||
protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_pointer_iserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_iserializer();
|
||||
public:
|
||||
virtual void * heap_allocation() const = 0;
|
||||
virtual const basic_iserializer & get_basic_serializer() const = 0;
|
||||
virtual void load_object_ptr(
|
||||
basic_iarchive & ar,
|
||||
void * x,
|
||||
const unsigned int file_version
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_POINTER_ISERIALIZER_HPP
|
68
third_party/boost/boost/archive/detail/basic_pointer_oserializer.hpp
vendored
Normal file
68
third_party/boost/boost/archive/detail/basic_pointer_oserializer.hpp
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_pointer_oserializer.hpp: extenstion of type_info required for
|
||||
// serialization.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/basic_serializer.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_oarchive;
|
||||
class basic_oserializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE basic_pointer_oserializer :
|
||||
public basic_serializer
|
||||
{
|
||||
protected:
|
||||
explicit BOOST_ARCHIVE_DECL basic_pointer_oserializer(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
);
|
||||
public:
|
||||
virtual BOOST_ARCHIVE_DECL ~basic_pointer_oserializer();
|
||||
virtual const basic_oserializer & get_basic_serializer() const = 0;
|
||||
virtual void save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
const void * x
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_POINTER_OSERIALIZER_HPP
|
77
third_party/boost/boost/archive/detail/basic_serializer.hpp
vendored
Normal file
77
third_party/boost/boost/archive/detail/basic_serializer.hpp
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/serialization/extended_type_info.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
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
|
||||
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)
|
||||
// leave this here as a reminder not to do this!
|
||||
// return & lhs.get_eti() < & rhs.get_eti();
|
||||
return get_eti() < rhs.get_eti();
|
||||
}
|
||||
const char * get_debug_info() const {
|
||||
return m_eti->get_debug_info();
|
||||
}
|
||||
const boost::serialization::extended_type_info & get_eti() const {
|
||||
return * m_eti;
|
||||
}
|
||||
};
|
||||
|
||||
class basic_serializer_arg : public basic_serializer {
|
||||
public:
|
||||
basic_serializer_arg(const serialization::extended_type_info & eti) :
|
||||
basic_serializer(eti)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_SERIALIZER_HPP
|
69
third_party/boost/boost/archive/detail/basic_serializer_map.hpp
vendored
Normal file
69
third_party/boost/boost/archive/detail/basic_serializer_map.hpp
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
#ifndef BOOST_SERIALIZER_MAP_HPP
|
||||
#define BOOST_SERIALIZER_MAP_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////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 .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
}
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_serializer;
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE
|
||||
basic_serializer_map : public
|
||||
boost::noncopyable
|
||||
{
|
||||
struct type_info_pointer_compare
|
||||
{
|
||||
bool operator()(
|
||||
const basic_serializer * lhs, const basic_serializer * rhs
|
||||
) const ;
|
||||
};
|
||||
typedef std::set<
|
||||
const basic_serializer *,
|
||||
type_info_pointer_compare
|
||||
> map_type;
|
||||
map_type m_map;
|
||||
public:
|
||||
BOOST_ARCHIVE_DECL bool insert(const basic_serializer * bs);
|
||||
BOOST_ARCHIVE_DECL void erase(const basic_serializer * bs);
|
||||
BOOST_ARCHIVE_DECL const basic_serializer * find(
|
||||
const boost::serialization::extended_type_info & type_
|
||||
) const;
|
||||
private:
|
||||
// cw 8.3 requires this
|
||||
basic_serializer_map& operator=(basic_serializer_map const&);
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // must be the last header
|
||||
|
||||
#endif // BOOST_SERIALIZER_MAP_HPP
|
169
third_party/boost/boost/archive/detail/check.hpp
vendored
Normal file
169
third_party/boost/boost/archive/detail/check.hpp
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_CHECK_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_CHECK_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#pragma inline_depth(511)
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// check.hpp: interface for serialization system.
|
||||
|
||||
// (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)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/int.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/mpl/greater.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
|
||||
#include <boost/serialization/static_warning.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/wrapper.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
// checks for objects
|
||||
|
||||
template<class T>
|
||||
inline void check_object_level(){
|
||||
typedef
|
||||
typename mpl::greater_equal<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::primitive_type>
|
||||
>::type typex;
|
||||
|
||||
// trap attempts to serialize objects marked
|
||||
// not_serializable
|
||||
BOOST_STATIC_ASSERT(typex::value);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void check_object_versioning(){
|
||||
typedef
|
||||
typename mpl::or_<
|
||||
typename mpl::greater<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::object_serializable>
|
||||
>,
|
||||
typename mpl::equal_to<
|
||||
serialization::version< T >,
|
||||
mpl::int_<0>
|
||||
>
|
||||
> typex;
|
||||
// trap attempts to serialize with objects that don't
|
||||
// save class information in the archive with versioning.
|
||||
BOOST_STATIC_ASSERT(typex::value);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void check_object_tracking(){
|
||||
// presume it has already been determined that
|
||||
// T is not a const
|
||||
BOOST_STATIC_ASSERT(! boost::is_const< T >::value);
|
||||
typedef typename mpl::equal_to<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_never>
|
||||
>::type typex;
|
||||
// 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
|
||||
// "rationale" section of the documenation
|
||||
// for motivation for this checking.
|
||||
|
||||
BOOST_STATIC_WARNING(typex::value);
|
||||
}
|
||||
|
||||
// checks for pointers
|
||||
|
||||
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
|
||||
typename mpl::or_<
|
||||
typename mpl::greater<
|
||||
serialization::implementation_level< T >,
|
||||
mpl::int_<serialization::object_serializable>
|
||||
>,
|
||||
typename mpl::not_<
|
||||
typename mpl::equal_to<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_selectively>
|
||||
>
|
||||
>
|
||||
> typex;
|
||||
// Address the following when serializing to a pointer:
|
||||
|
||||
// a) This type doesn't save class information in the
|
||||
// archive. That is, the serialization trait implementation
|
||||
// level <= object_serializable.
|
||||
// b) Tracking for this type is set to "track selectively"
|
||||
|
||||
// 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
|
||||
// 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
|
||||
// tracking or implementation level traits - or not
|
||||
// serializing via a pointer.
|
||||
BOOST_STATIC_WARNING(typex::value);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
void inline check_pointer_tracking(){
|
||||
typedef typename mpl::greater<
|
||||
serialization::tracking_level< T >,
|
||||
mpl::int_<serialization::track_never>
|
||||
>::type typex;
|
||||
// serializing an object of a type marked "track_never" through a pointer
|
||||
// could result in creating more objects than were saved!
|
||||
BOOST_STATIC_WARNING(typex::value);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void check_const_loading(){
|
||||
typedef
|
||||
typename mpl::or_<
|
||||
typename boost::serialization::is_wrapper< T >,
|
||||
typename mpl::not_<
|
||||
typename boost::is_const< T >
|
||||
>
|
||||
>::type typex;
|
||||
// cannot load data into a "const" object unless it's a
|
||||
// wrapper around some other non-const object.
|
||||
BOOST_STATIC_ASSERT(typex::value);
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // archive
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_CHECK_HPP
|
89
third_party/boost/boost/archive/detail/common_iarchive.hpp
vendored
Normal file
89
third_party/boost/boost/archive/detail/common_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// common_iarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/archive/detail/basic_iarchive.hpp>
|
||||
#include <boost/archive/detail/basic_pointer_iserializer.hpp>
|
||||
#include <boost/archive/detail/interface_iarchive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class extended_type_info;
|
||||
|
||||
// note: referred to as Curiously Recurring Template Patter (CRTP)
|
||||
template<class Archive>
|
||||
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;
|
||||
}
|
||||
virtual void vload(object_id_type & t){
|
||||
* this->This() >> t;
|
||||
}
|
||||
virtual void vload(class_id_type & t){
|
||||
* this->This() >> t;
|
||||
}
|
||||
virtual void vload(class_id_optional_type & t){
|
||||
* this->This() >> t;
|
||||
}
|
||||
virtual void vload(tracking_type & t){
|
||||
* this->This() >> t;
|
||||
}
|
||||
virtual void vload(class_name_type &s){
|
||||
* this->This() >> s;
|
||||
}
|
||||
protected:
|
||||
// default processing - invoke serialization library
|
||||
template<class T>
|
||||
void load_override(T & t){
|
||||
archive::load(* this->This(), t);
|
||||
}
|
||||
// default implementations of functions which emit start/end tags for
|
||||
// archive types that require them.
|
||||
void load_start(const char * /*name*/){}
|
||||
void load_end(const char * /*name*/){}
|
||||
// default archive initialization
|
||||
common_iarchive(unsigned int flags = 0) :
|
||||
basic_iarchive(flags),
|
||||
interface_iarchive<Archive>()
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_COMMON_IARCHIVE_HPP
|
||||
|
89
third_party/boost/boost/archive/detail/common_oarchive.hpp
vendored
Normal file
89
third_party/boost/boost/archive/detail/common_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,89 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// common_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/archive/detail/basic_oarchive.hpp>
|
||||
#include <boost/archive/detail/interface_oarchive.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
// note: referred to as Curiously Recurring Template Patter (CRTP)
|
||||
template<class Archive>
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE common_oarchive :
|
||||
public basic_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;
|
||||
}
|
||||
virtual void vsave(const object_id_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const object_reference_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const class_id_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const class_id_reference_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const class_id_optional_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const class_name_type & t){
|
||||
* this->This() << t;
|
||||
}
|
||||
virtual void vsave(const tracking_type t){
|
||||
* this->This() << t;
|
||||
}
|
||||
protected:
|
||||
// default processing - invoke serialization library
|
||||
template<class T>
|
||||
void save_override(T & t){
|
||||
archive::save(* this->This(), t);
|
||||
}
|
||||
void save_start(const char * /*name*/){}
|
||||
void save_end(const char * /*name*/){}
|
||||
common_oarchive(unsigned int flags = 0) :
|
||||
basic_oarchive(flags),
|
||||
interface_oarchive<Archive>()
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_COMMON_OARCHIVE_HPP
|
57
third_party/boost/boost/archive/detail/decl.hpp
vendored
Normal file
57
third_party/boost/boost/archive/detail/decl.hpp
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_DECL_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_DECL_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8
|
||||
// decl.hpp
|
||||
//
|
||||
// (c) Copyright Robert Ramey 2004
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See 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
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SERIALIZATION_DYN_LINK))
|
||||
#if defined(BOOST_ARCHIVE_SOURCE)
|
||||
#define BOOST_ARCHIVE_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
#define BOOST_ARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_WARCHIVE_SOURCE)
|
||||
#define BOOST_WARCHIVE_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
#define BOOST_WARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_WARCHIVE_SOURCE) || defined(BOOST_ARCHIVE_SOURCE)
|
||||
#define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_EXPORT
|
||||
#else
|
||||
#define BOOST_ARCHIVE_OR_WARCHIVE_DECL BOOST_SYMBOL_IMPORT
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if ! defined(BOOST_ARCHIVE_DECL)
|
||||
#define BOOST_ARCHIVE_DECL
|
||||
#endif
|
||||
#if ! defined(BOOST_WARCHIVE_DECL)
|
||||
#define BOOST_WARCHIVE_DECL
|
||||
#endif
|
||||
#if ! defined(BOOST_ARCHIVE_OR_WARCHIVE_DECL)
|
||||
#define BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
#endif
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_DECL_HPP
|
99
third_party/boost/boost/archive/detail/helper_collection.hpp
vendored
Normal file
99
third_party/boost/boost/archive/detail/helper_collection.hpp
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// helper_collection.hpp: archive support for run-time helpers
|
||||
|
||||
// (C) Copyright 2002-2008 Robert Ramey and Joaquin M Lopez Munoz
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/smart_ptr/shared_ptr.hpp>
|
||||
#include <boost/smart_ptr/make_shared.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class helper_collection
|
||||
{
|
||||
helper_collection(const helper_collection&); // non-copyable
|
||||
helper_collection& operator = (const helper_collection&); // non-copyable
|
||||
|
||||
// note: we dont' actually "share" the function object pointer
|
||||
// we only use shared_ptr to make sure that it get's deleted
|
||||
|
||||
typedef std::pair<
|
||||
const void *,
|
||||
boost::shared_ptr<void>
|
||||
> helper_value_type;
|
||||
template<class T>
|
||||
boost::shared_ptr<void> make_helper_ptr(){
|
||||
// use boost::shared_ptr rather than std::shared_ptr to maintain
|
||||
// c++03 compatibility
|
||||
return boost::make_shared<T>();
|
||||
}
|
||||
|
||||
typedef std::vector<helper_value_type> collection;
|
||||
collection m_collection;
|
||||
|
||||
struct predicate {
|
||||
BOOST_DELETED_FUNCTION(predicate & operator=(const predicate & rhs))
|
||||
public:
|
||||
const void * const m_ti;
|
||||
bool operator()(helper_value_type const &rhs) const {
|
||||
return m_ti == rhs.first;
|
||||
}
|
||||
predicate(const void * ti) :
|
||||
m_ti(ti)
|
||||
{}
|
||||
};
|
||||
protected:
|
||||
helper_collection(){}
|
||||
~helper_collection(){}
|
||||
public:
|
||||
template<typename Helper>
|
||||
Helper& find_helper(void * const id = 0) {
|
||||
collection::const_iterator it =
|
||||
std::find_if(
|
||||
m_collection.begin(),
|
||||
m_collection.end(),
|
||||
predicate(id)
|
||||
);
|
||||
|
||||
void * rval = 0;
|
||||
if(it == m_collection.end()){
|
||||
m_collection.push_back(
|
||||
std::make_pair(id, make_helper_ptr<Helper>())
|
||||
);
|
||||
rval = m_collection.back().second.get();
|
||||
}
|
||||
else{
|
||||
rval = it->second.get();
|
||||
}
|
||||
return *static_cast<Helper *>(rval);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_HELPER_COLLECTION_HPP
|
85
third_party/boost/boost/archive/detail/interface_iarchive.hpp
vendored
Normal file
85
third_party/boost/boost/archive/detail/interface_iarchive.hpp
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// interface_iarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/iserializer.hpp>
|
||||
#include <boost/archive/detail/helper_collection.hpp>
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
template<class Archive>
|
||||
class interface_iarchive
|
||||
{
|
||||
protected:
|
||||
interface_iarchive(){};
|
||||
public:
|
||||
/////////////////////////////////////////////////////////
|
||||
// archive public interface
|
||||
typedef mpl::bool_<true> is_loading;
|
||||
typedef mpl::bool_<false> is_saving;
|
||||
|
||||
// return a pointer to the most derived class
|
||||
Archive * This(){
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const basic_pointer_iserializer *
|
||||
register_type(T * = NULL){
|
||||
const basic_pointer_iserializer & bpis =
|
||||
boost::serialization::singleton<
|
||||
pointer_iserializer<Archive, T>
|
||||
>::get_const_instance();
|
||||
this->This()->register_basic_serializer(bpis.get_basic_serializer());
|
||||
return & bpis;
|
||||
}
|
||||
template<class Helper>
|
||||
Helper &
|
||||
get_helper(void * const id = 0){
|
||||
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
|
||||
template<class T>
|
||||
Archive & operator&(T & t){
|
||||
return *(this->This()) >> t;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
87
third_party/boost/boost/archive/detail/interface_oarchive.hpp
vendored
Normal file
87
third_party/boost/boost/archive/detail/interface_oarchive.hpp
vendored
Normal file
|
@ -0,0 +1,87 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_INTERFACE_OARCHIVE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// interface_oarchive.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <cstddef> // NULL
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/mpl/bool.hpp>
|
||||
|
||||
#include <boost/archive/detail/auto_link_archive.hpp>
|
||||
#include <boost/archive/detail/oserializer.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
template<class Archive>
|
||||
class interface_oarchive
|
||||
{
|
||||
protected:
|
||||
interface_oarchive(){};
|
||||
public:
|
||||
/////////////////////////////////////////////////////////
|
||||
// archive public interface
|
||||
typedef mpl::bool_<false> is_loading;
|
||||
typedef mpl::bool_<true> is_saving;
|
||||
|
||||
// return a pointer to the most derived class
|
||||
Archive * This(){
|
||||
return static_cast<Archive *>(this);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
const basic_pointer_oserializer *
|
||||
register_type(const T * = NULL){
|
||||
const basic_pointer_oserializer & bpos =
|
||||
boost::serialization::singleton<
|
||||
pointer_oserializer<Archive, T>
|
||||
>::get_const_instance();
|
||||
this->This()->register_basic_serializer(bpos.get_basic_serializer());
|
||||
return & bpos;
|
||||
}
|
||||
|
||||
template<class Helper>
|
||||
Helper &
|
||||
get_helper(void * const id = 0){
|
||||
helper_collection & hc = this->This()->get_helper_collection();
|
||||
return hc.template find_helper<Helper>(id);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Archive & operator<<(const T & t){
|
||||
this->This()->save_override(t);
|
||||
return * this->This();
|
||||
}
|
||||
|
||||
// the & operator
|
||||
template<class T>
|
||||
Archive & operator&(const T & t){
|
||||
return * this ->This() << t;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_INTERFACE_IARCHIVE_HPP
|
630
third_party/boost/boost/archive/detail/iserializer.hpp
vendored
Normal file
630
third_party/boost/boost/archive/detail/iserializer.hpp
vendored
Normal file
|
@ -0,0 +1,630 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#pragma inline_depth(511)
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// iserializer.hpp: interface for serialization system.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <new> // for placement new
|
||||
#include <cstddef> // size_t, NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/greater_equal.hpp>
|
||||
#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>
|
||||
#endif
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/smart_cast.hpp>
|
||||
#include <boost/serialization/static_warning.hpp>
|
||||
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
|
||||
#if !defined(BOOST_MSVC) && \
|
||||
(BOOST_WORKAROUND(__IBMCPP__, < 1210) || \
|
||||
defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x590))
|
||||
#define DONT_USE_HAS_NEW_OPERATOR 1
|
||||
#else
|
||||
#define DONT_USE_HAS_NEW_OPERATOR 0
|
||||
#endif
|
||||
|
||||
#if ! DONT_USE_HAS_NEW_OPERATOR
|
||||
#include <boost/type_traits/has_new_operator.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/void_cast.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>
|
||||
#include <boost/archive/detail/basic_iarchive.hpp>
|
||||
#include <boost/archive/detail/basic_iserializer.hpp>
|
||||
#include <boost/archive/detail/basic_pointer_iserializer.hpp>
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/detail/check.hpp>
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
|
||||
// an accessor to permit friend access to archives. Needed because
|
||||
// some compilers don't handle friend templates completely
|
||||
class load_access {
|
||||
public:
|
||||
template<class Archive, class T>
|
||||
static void load_primitive(Archive &ar, T &t){
|
||||
ar.load(t);
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
class iserializer : public basic_iserializer
|
||||
{
|
||||
private:
|
||||
virtual void destroy(/*const*/ void *address) const {
|
||||
boost::serialization::access::destroy(static_cast<T *>(address));
|
||||
}
|
||||
public:
|
||||
explicit iserializer() :
|
||||
basic_iserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
{}
|
||||
virtual BOOST_DLLEXPORT void load_object_data(
|
||||
basic_iarchive & ar,
|
||||
void *x,
|
||||
const unsigned int file_version
|
||||
) const BOOST_USED;
|
||||
virtual bool class_info() const {
|
||||
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
|
||||
== boost::serialization::track_always
|
||||
|| ( boost::serialization::tracking_level< T >::value
|
||||
== boost::serialization::track_selectively
|
||||
&& serialized_as_pointer());
|
||||
}
|
||||
virtual version_type version() const {
|
||||
return version_type(::boost::serialization::version< T >::value);
|
||||
}
|
||||
virtual bool is_polymorphic() const {
|
||||
return boost::is_polymorphic< T >::value;
|
||||
}
|
||||
virtual ~iserializer(){};
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
|
||||
basic_iarchive & ar,
|
||||
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
|
||||
// code. Perhaps in the future we might re-enable it but
|
||||
// permit its suppression with a runtime switch.
|
||||
#if 0
|
||||
// trap case where the program cannot handle the current version
|
||||
if(file_version > static_cast<const unsigned int>(version()))
|
||||
boost::serialization::throw_exception(
|
||||
archive::archive_exception(
|
||||
boost::archive::archive_exception::unsupported_class_version,
|
||||
get_debug_info()
|
||||
)
|
||||
);
|
||||
#endif
|
||||
// make sure call is routed through the higest interface that might
|
||||
// be specialized by the user.
|
||||
boost::serialization::serialize_adl(
|
||||
boost::serialization::smart_cast_reference<Archive &>(ar),
|
||||
* static_cast<T *>(x),
|
||||
file_version
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
// 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".
|
||||
// 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
|
||||
// operator is also defined for the class T.
|
||||
|
||||
template<class T>
|
||||
struct heap_allocation {
|
||||
// boost::has_new_operator< T > doesn't work on these compilers
|
||||
#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)));
|
||||
}
|
||||
static void invoke_delete(T *t){
|
||||
(operator delete(t));
|
||||
}
|
||||
#else
|
||||
// note: we presume that a true value for has_new_operator
|
||||
// implies the existence of a class specific delete operator as well
|
||||
// as a class specific new operator.
|
||||
struct has_new_operator {
|
||||
static T * invoke_new() {
|
||||
return static_cast<T *>((T::operator new)(sizeof(T)));
|
||||
}
|
||||
static void invoke_delete(T * t) {
|
||||
// if compilation fails here, the likely cause that the class
|
||||
// T has a class specific new operator but no class specific
|
||||
// delete operator which matches the following signature.
|
||||
// note that this solution addresses the issue that two
|
||||
// possible signatures. But it doesn't address the possibility
|
||||
// that the class might have class specific new with NO
|
||||
// class specific delete at all. Patches (compatible with
|
||||
// C++03) welcome!
|
||||
(operator delete)(t);
|
||||
}
|
||||
};
|
||||
struct doesnt_have_new_operator {
|
||||
static T* invoke_new() {
|
||||
return static_cast<T *>(operator new(sizeof(T)));
|
||||
}
|
||||
static void invoke_delete(T * t) {
|
||||
// Note: I'm reliance upon automatic conversion from T * to void * here
|
||||
(operator delete)(t);
|
||||
}
|
||||
};
|
||||
static T * invoke_new() {
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
boost::has_new_operator< T >,
|
||||
mpl::identity<has_new_operator >,
|
||||
mpl::identity<doesnt_have_new_operator >
|
||||
>::type typex;
|
||||
return typex::invoke_new();
|
||||
}
|
||||
static void invoke_delete(T *t) {
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
boost::has_new_operator< T >,
|
||||
mpl::identity<has_new_operator >,
|
||||
mpl::identity<doesnt_have_new_operator >
|
||||
>::type typex;
|
||||
typex::invoke_delete(t);
|
||||
}
|
||||
#endif
|
||||
explicit heap_allocation(){
|
||||
m_p = invoke_new();
|
||||
}
|
||||
~heap_allocation(){
|
||||
if (0 != m_p)
|
||||
invoke_delete(m_p);
|
||||
}
|
||||
T* get() const {
|
||||
return m_p;
|
||||
}
|
||||
|
||||
T* release() {
|
||||
T* p = m_p;
|
||||
m_p = 0;
|
||||
return p;
|
||||
}
|
||||
private:
|
||||
T* m_p;
|
||||
};
|
||||
|
||||
template<class Archive, class T>
|
||||
class pointer_iserializer :
|
||||
public basic_pointer_iserializer
|
||||
{
|
||||
private:
|
||||
virtual void * heap_allocation() const {
|
||||
detail::heap_allocation<T> h;
|
||||
T * t = h.get();
|
||||
h.release();
|
||||
return t;
|
||||
}
|
||||
virtual const basic_iserializer & get_basic_serializer() const {
|
||||
return boost::serialization::singleton<
|
||||
iserializer<Archive, T>
|
||||
>::get_const_instance();
|
||||
}
|
||||
BOOST_DLLEXPORT virtual void load_object_ptr(
|
||||
basic_iarchive & ar,
|
||||
void * x,
|
||||
const unsigned int file_version
|
||||
) const BOOST_USED;
|
||||
public:
|
||||
// this should alway be a singleton so make the constructor protected
|
||||
pointer_iserializer();
|
||||
~pointer_iserializer();
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// note: BOOST_DLLEXPORT is so that code for polymorphic class
|
||||
// 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,
|
||||
void * t,
|
||||
const unsigned int file_version
|
||||
) const
|
||||
{
|
||||
Archive & ar_impl =
|
||||
boost::serialization::smart_cast_reference<Archive &>(ar);
|
||||
|
||||
// note that the above will throw std::bad_alloc if the allocation
|
||||
// fails so we don't have to address this contingency here.
|
||||
|
||||
// catch exception during load_construct_data so that we don't
|
||||
// automatically delete the t which is most likely not fully
|
||||
// constructed
|
||||
BOOST_TRY {
|
||||
// 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>(
|
||||
ar_impl,
|
||||
static_cast<T *>(t),
|
||||
file_version
|
||||
);
|
||||
}
|
||||
BOOST_CATCH(...){
|
||||
// if we get here the load_construct failed. The heap_allocation
|
||||
// will be automatically deleted so we don't have to do anything
|
||||
// special here.
|
||||
BOOST_RETHROW;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
|
||||
ar_impl >> boost::serialization::make_nvp(NULL, * static_cast<T *>(t));
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
pointer_iserializer<Archive, T>::pointer_iserializer() :
|
||||
basic_pointer_iserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
{
|
||||
boost::serialization::singleton<
|
||||
iserializer<Archive, T>
|
||||
>::get_mutable_instance().set_bpis(this);
|
||||
archive_serializer_map<Archive>::insert(this);
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
pointer_iserializer<Archive, T>::~pointer_iserializer(){
|
||||
archive_serializer_map<Archive>::erase(this);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
struct load_non_pointer_type {
|
||||
// note this bounces the call right back to the archive
|
||||
// with no runtime overhead
|
||||
struct load_primitive {
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, T & t){
|
||||
load_access::load_primitive(ar, t);
|
||||
}
|
||||
};
|
||||
// note this bounces the call right back to the archive
|
||||
// with no runtime overhead
|
||||
struct load_only {
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, const T & t){
|
||||
// short cut to user's serializer
|
||||
// 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),
|
||||
boost::serialization::version< T >::value
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
// note this save class information including version
|
||||
// and serialization level to the archive
|
||||
struct load_standard {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, const T & t){
|
||||
void * x = boost::addressof(const_cast<T &>(t));
|
||||
ar.load_object(
|
||||
x,
|
||||
boost::serialization::singleton<
|
||||
iserializer<Archive, T>
|
||||
>::get_const_instance()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
struct load_conditional {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, T &t){
|
||||
//if(0 == (ar.get_flags() & no_tracking))
|
||||
load_standard::invoke(ar, t);
|
||||
//else
|
||||
// load_only::invoke(ar, t);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, T &t){
|
||||
typedef typename mpl::eval_if<
|
||||
// if its primitive
|
||||
mpl::equal_to<
|
||||
boost::serialization::implementation_level< T >,
|
||||
mpl::int_<boost::serialization::primitive_type>
|
||||
>,
|
||||
mpl::identity<load_primitive>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
// class info / version
|
||||
mpl::greater_equal<
|
||||
boost::serialization::implementation_level< T >,
|
||||
mpl::int_<boost::serialization::object_class_info>
|
||||
>,
|
||||
// do standard load
|
||||
mpl::identity<load_standard>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
// no tracking
|
||||
mpl::equal_to<
|
||||
boost::serialization::tracking_level< T >,
|
||||
mpl::int_<boost::serialization::track_never>
|
||||
>,
|
||||
// do a fast load
|
||||
mpl::identity<load_only>,
|
||||
// else
|
||||
// do a fast load only tracking is turned off
|
||||
mpl::identity<load_conditional>
|
||||
> > >::type typex;
|
||||
check_object_versioning< T >();
|
||||
check_object_level< T >();
|
||||
typex::invoke(ar, t);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
struct load_pointer_type {
|
||||
struct abstract
|
||||
{
|
||||
template<class T>
|
||||
static const basic_pointer_iserializer * register_type(Archive & /* ar */){
|
||||
// it has? to be polymorphic
|
||||
BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value);
|
||||
return static_cast<basic_pointer_iserializer *>(NULL);
|
||||
}
|
||||
};
|
||||
|
||||
struct non_abstract
|
||||
{
|
||||
template<class T>
|
||||
static const basic_pointer_iserializer * register_type(Archive & ar){
|
||||
return ar.register_type(static_cast<T *>(NULL));
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
// class pointer. Inhibiting code generation for this
|
||||
// permits abstract base classes to be used - note: exception
|
||||
// virtual serialize functions used for plug-ins
|
||||
typedef typename
|
||||
mpl::eval_if<
|
||||
boost::serialization::is_abstract<const T>,
|
||||
boost::mpl::identity<abstract>,
|
||||
boost::mpl::identity<non_abstract>
|
||||
>::type typex;
|
||||
return typex::template register_type< T >(ar);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static T * pointer_tweak(
|
||||
const boost::serialization::extended_type_info & eti,
|
||||
void const * const t,
|
||||
const T &
|
||||
) {
|
||||
// tweak the pointer back to the base class
|
||||
void * upcast = const_cast<void *>(
|
||||
boost::serialization::void_upcast(
|
||||
eti,
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance(),
|
||||
t
|
||||
)
|
||||
);
|
||||
if(NULL == upcast)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::unregistered_class)
|
||||
);
|
||||
return static_cast<T *>(upcast);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
static void check_load(T * const /* t */){
|
||||
check_pointer_level< T >();
|
||||
check_pointer_tracking< T >();
|
||||
}
|
||||
|
||||
static const basic_pointer_iserializer *
|
||||
find(const boost::serialization::extended_type_info & type){
|
||||
return static_cast<const basic_pointer_iserializer *>(
|
||||
archive_serializer_map<Archive>::find(type)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Tptr>
|
||||
static void invoke(Archive & ar, Tptr & 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
|
||||
// include const) to void * &. This is the only way
|
||||
// I could make it work. RR
|
||||
(void * & )t,
|
||||
bpis_ptr,
|
||||
find
|
||||
);
|
||||
// if the pointer isn't that of the base class
|
||||
if(newbpis_ptr != bpis_ptr){
|
||||
t = pointer_tweak(newbpis_ptr->get_eti(), t, *t);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
struct load_enum_type {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, T &t){
|
||||
// convert integers to correct enum to load
|
||||
int i;
|
||||
ar >> boost::serialization::make_nvp(NULL, i);
|
||||
t = static_cast< T >(i);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
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[0]))
|
||||
);
|
||||
boost::serialization::collection_size_type count;
|
||||
ar >> BOOST_SERIALIZATION_NVP(count);
|
||||
if(static_cast<std::size_t>(count) > current_count)
|
||||
boost::serialization::throw_exception(
|
||||
archive::archive_exception(
|
||||
boost::archive::archive_exception::array_size_too_short
|
||||
)
|
||||
);
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar >> serialization::make_array<
|
||||
value_type,
|
||||
boost::serialization::collection_size_type
|
||||
>(
|
||||
static_cast<value_type *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
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
|
||||
// handled below.
|
||||
detail::check_const_loading< T >();
|
||||
typedef
|
||||
typename mpl::eval_if<is_pointer< T >,
|
||||
mpl::identity<detail::load_pointer_type<Archive> >
|
||||
,//else
|
||||
typename mpl::eval_if<is_array< T >,
|
||||
mpl::identity<detail::load_array_type<Archive> >
|
||||
,//else
|
||||
typename mpl::eval_if<is_enum< T >,
|
||||
mpl::identity<detail::load_enum_type<Archive> >
|
||||
,//else
|
||||
mpl::identity<detail::load_non_pointer_type<Archive> >
|
||||
>
|
||||
>
|
||||
>::type typex;
|
||||
typex::invoke(ar, t);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_ISERIALIZER_HPP
|
545
third_party/boost/boost/archive/detail/oserializer.hpp
vendored
Normal file
545
third_party/boost/boost/archive/detail/oserializer.hpp
vendored
Normal file
|
@ -0,0 +1,545 @@
|
|||
#ifndef BOOST_ARCHIVE_OSERIALIZER_HPP
|
||||
#define BOOST_ARCHIVE_OSERIALIZER_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#pragma inline_depth(511)
|
||||
#pragma inline_recursion(on)
|
||||
#endif
|
||||
|
||||
#if defined(__MWERKS__)
|
||||
#pragma inline_depth(511)
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// oserializer.hpp: interface for serialization system.
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/mpl/equal_to.hpp>
|
||||
#include <boost/mpl/greater_equal.hpp>
|
||||
#include <boost/mpl/identity.hpp>
|
||||
#include <boost/mpl/bool_fwd.hpp>
|
||||
|
||||
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
|
||||
#include <boost/serialization/extended_type_info_typeid.hpp>
|
||||
#endif
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/serialization/smart_cast.hpp>
|
||||
#include <boost/serialization/assume_abstract.hpp>
|
||||
#include <boost/serialization/static_warning.hpp>
|
||||
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_enum.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_polymorphic.hpp>
|
||||
#include <boost/type_traits/remove_extent.hpp>
|
||||
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/type_info_implementation.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/void_cast.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>
|
||||
#include <boost/archive/detail/basic_oarchive.hpp>
|
||||
#include <boost/archive/detail/basic_oserializer.hpp>
|
||||
#include <boost/archive/detail/basic_pointer_oserializer.hpp>
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/detail/check.hpp>
|
||||
|
||||
#include <boost/core/addressof.hpp>
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
|
||||
namespace archive {
|
||||
|
||||
// an accessor to permit friend access to archives. Needed because
|
||||
// some compilers don't handle friend templates completely
|
||||
class save_access {
|
||||
public:
|
||||
template<class Archive>
|
||||
static void end_preamble(Archive & ar){
|
||||
ar.end_preamble();
|
||||
}
|
||||
template<class Archive, class T>
|
||||
static void save_primitive(Archive & ar, const T & t){
|
||||
ar.end_preamble();
|
||||
ar.save(t);
|
||||
}
|
||||
};
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
class oserializer : public basic_oserializer
|
||||
{
|
||||
private:
|
||||
// private constructor to inhibit any existence other than the
|
||||
// static one
|
||||
public:
|
||||
explicit BOOST_DLLEXPORT oserializer() :
|
||||
basic_oserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
{}
|
||||
virtual BOOST_DLLEXPORT void save_object_data(
|
||||
basic_oarchive & ar,
|
||||
const void *x
|
||||
) const BOOST_USED;
|
||||
virtual bool class_info() const {
|
||||
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 == boost::serialization::track_always
|
||||
|| (boost::serialization::tracking_level< T >::value == boost::serialization::track_selectively
|
||||
&& serialized_as_pointer());
|
||||
}
|
||||
virtual version_type version() const {
|
||||
return version_type(::boost::serialization::version< T >::value);
|
||||
}
|
||||
virtual bool is_polymorphic() const {
|
||||
return boost::is_polymorphic< T >::value;
|
||||
}
|
||||
virtual ~oserializer(){}
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data(
|
||||
basic_oarchive & ar,
|
||||
const void *x
|
||||
) const {
|
||||
// make sure call is routed through the highest interface that might
|
||||
// be specialized by the user.
|
||||
BOOST_STATIC_ASSERT(boost::is_const< T >::value == false);
|
||||
boost::serialization::serialize_adl(
|
||||
boost::serialization::smart_cast_reference<Archive &>(ar),
|
||||
* static_cast<T *>(const_cast<void *>(x)),
|
||||
version()
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
class pointer_oserializer :
|
||||
public basic_pointer_oserializer
|
||||
{
|
||||
private:
|
||||
const basic_oserializer &
|
||||
get_basic_serializer() const {
|
||||
return boost::serialization::singleton<
|
||||
oserializer<Archive, T>
|
||||
>::get_const_instance();
|
||||
}
|
||||
virtual BOOST_DLLEXPORT void save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
const void * x
|
||||
) const BOOST_USED;
|
||||
public:
|
||||
pointer_oserializer();
|
||||
~pointer_oserializer();
|
||||
};
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<class Archive, class T>
|
||||
BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
|
||||
basic_oarchive & ar,
|
||||
const void * x
|
||||
) const {
|
||||
BOOST_ASSERT(NULL != x);
|
||||
// make sure call is routed through the highest interface that might
|
||||
// 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
|
||||
= boost::serialization::smart_cast_reference<Archive &>(ar);
|
||||
boost::serialization::save_construct_data_adl<Archive, T>(
|
||||
ar_impl,
|
||||
t,
|
||||
file_version
|
||||
);
|
||||
ar_impl << boost::serialization::make_nvp(NULL, * t);
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
pointer_oserializer<Archive, T>::pointer_oserializer() :
|
||||
basic_pointer_oserializer(
|
||||
boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance()
|
||||
)
|
||||
{
|
||||
// make sure appropriate member function is instantiated
|
||||
boost::serialization::singleton<
|
||||
oserializer<Archive, T>
|
||||
>::get_mutable_instance().set_bpos(this);
|
||||
archive_serializer_map<Archive>::insert(this);
|
||||
}
|
||||
|
||||
template<class Archive, class T>
|
||||
pointer_oserializer<Archive, T>::~pointer_oserializer(){
|
||||
archive_serializer_map<Archive>::erase(this);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
struct save_non_pointer_type {
|
||||
// note this bounces the call right back to the archive
|
||||
// with no runtime overhead
|
||||
struct save_primitive {
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, const T & t){
|
||||
save_access::save_primitive(ar, t);
|
||||
}
|
||||
};
|
||||
// same as above but passes through serialization
|
||||
struct save_only {
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, const T & t){
|
||||
// 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),
|
||||
::boost::serialization::version< T >::value
|
||||
);
|
||||
}
|
||||
};
|
||||
// adds class information to the archive. This includes
|
||||
// serialization level and class version
|
||||
struct save_standard {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, const T & t){
|
||||
ar.save_object(
|
||||
boost::addressof(t),
|
||||
boost::serialization::singleton<
|
||||
oserializer<Archive, T>
|
||||
>::get_const_instance()
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// adds class information to the archive. This includes
|
||||
// serialization level and class version
|
||||
struct save_conditional {
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, const T &t){
|
||||
//if(0 == (ar.get_flags() & no_tracking))
|
||||
save_standard::invoke(ar, t);
|
||||
//else
|
||||
// save_only::invoke(ar, t);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, const T & t){
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
// if its primitive
|
||||
mpl::equal_to<
|
||||
boost::serialization::implementation_level< T >,
|
||||
mpl::int_<boost::serialization::primitive_type>
|
||||
>,
|
||||
mpl::identity<save_primitive>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
// class info / version
|
||||
mpl::greater_equal<
|
||||
boost::serialization::implementation_level< T >,
|
||||
mpl::int_<boost::serialization::object_class_info>
|
||||
>,
|
||||
// do standard save
|
||||
mpl::identity<save_standard>,
|
||||
// else
|
||||
typename mpl::eval_if<
|
||||
// no tracking
|
||||
mpl::equal_to<
|
||||
boost::serialization::tracking_level< T >,
|
||||
mpl::int_<boost::serialization::track_never>
|
||||
>,
|
||||
// do a fast save
|
||||
mpl::identity<save_only>,
|
||||
// else
|
||||
// do a fast save only tracking is turned off
|
||||
mpl::identity<save_conditional>
|
||||
> > >::type typex;
|
||||
check_object_versioning< T >();
|
||||
typex::invoke(ar, t);
|
||||
}
|
||||
template<class T>
|
||||
static void invoke(Archive & ar, T & t){
|
||||
check_object_level< T >();
|
||||
check_object_tracking< T >();
|
||||
invoke(ar, const_cast<const T &>(t));
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
struct save_pointer_type {
|
||||
struct abstract
|
||||
{
|
||||
template<class T>
|
||||
static const basic_pointer_oserializer * register_type(Archive & /* ar */){
|
||||
// it has? to be polymorphic
|
||||
BOOST_STATIC_ASSERT(boost::is_polymorphic< T >::value);
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct non_abstract
|
||||
{
|
||||
template<class T>
|
||||
static const basic_pointer_oserializer * register_type(Archive & ar){
|
||||
return ar.register_type(static_cast<T *>(NULL));
|
||||
}
|
||||
};
|
||||
|
||||
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
|
||||
// class pointer. Inhibiting code generation for this
|
||||
// permits abstract base classes to be used - note: exception
|
||||
// virtual serialize functions used for plug-ins
|
||||
typedef
|
||||
typename mpl::eval_if<
|
||||
boost::serialization::is_abstract< T >,
|
||||
mpl::identity<abstract>,
|
||||
mpl::identity<non_abstract>
|
||||
>::type typex;
|
||||
return typex::template register_type< T >(ar);
|
||||
}
|
||||
|
||||
struct non_polymorphic
|
||||
{
|
||||
template<class T>
|
||||
static void save(
|
||||
Archive &ar,
|
||||
T & t
|
||||
){
|
||||
const basic_pointer_oserializer & bpos =
|
||||
boost::serialization::singleton<
|
||||
pointer_oserializer<Archive, T>
|
||||
>::get_const_instance();
|
||||
// save the requested pointer type
|
||||
ar.save_pointer(& t, & bpos);
|
||||
}
|
||||
};
|
||||
|
||||
struct polymorphic
|
||||
{
|
||||
template<class T>
|
||||
static void save(
|
||||
Archive &ar,
|
||||
T & t
|
||||
){
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type const
|
||||
& i = boost::serialization::singleton<
|
||||
typename
|
||||
boost::serialization::type_info_implementation< T >::type
|
||||
>::get_const_instance();
|
||||
|
||||
boost::serialization::extended_type_info const * const this_type = & i;
|
||||
|
||||
// retrieve the true type of the object pointed to
|
||||
// if this assertion fails its an error in this library
|
||||
BOOST_ASSERT(NULL != this_type);
|
||||
|
||||
const boost::serialization::extended_type_info * true_type =
|
||||
i.get_derived_extended_type_info(t);
|
||||
|
||||
// note:if this exception is thrown, be sure that derived pointer
|
||||
// is either registered or exported.
|
||||
if(NULL == true_type){
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::unregistered_class,
|
||||
"derived class not registered or exported"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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);
|
||||
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,
|
||||
static_cast<const void *>(&t)
|
||||
);
|
||||
if(NULL == vp){
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::unregistered_cast,
|
||||
true_type->get_debug_info(),
|
||||
this_type->get_debug_info()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// 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
|
||||
= static_cast<const basic_pointer_oserializer *>(
|
||||
boost::serialization::singleton<
|
||||
archive_serializer_map<Archive>
|
||||
>::get_const_instance().find(*true_type)
|
||||
);
|
||||
BOOST_ASSERT(NULL != bpos);
|
||||
if(NULL == bpos)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::unregistered_class,
|
||||
"derived class not registered or exported"
|
||||
)
|
||||
);
|
||||
ar.save_pointer(vp, bpos);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
static void save(
|
||||
Archive & ar,
|
||||
const T & t
|
||||
){
|
||||
check_pointer_level< T >();
|
||||
check_pointer_tracking< T >();
|
||||
typedef typename mpl::eval_if<
|
||||
is_polymorphic< T >,
|
||||
mpl::identity<polymorphic>,
|
||||
mpl::identity<non_polymorphic>
|
||||
>::type type;
|
||||
type::save(ar, const_cast<T &>(t));
|
||||
}
|
||||
|
||||
template<class TPtr>
|
||||
static void invoke(Archive &ar, const TPtr t){
|
||||
register_type(ar, t);
|
||||
if(NULL == t){
|
||||
basic_oarchive & boa
|
||||
= boost::serialization::smart_cast_reference<basic_oarchive &>(ar);
|
||||
boa.save_null_pointer();
|
||||
save_access::end_preamble(ar);
|
||||
return;
|
||||
}
|
||||
save(ar, * t);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
struct save_enum_type
|
||||
{
|
||||
template<class T>
|
||||
static void invoke(Archive &ar, const T &t){
|
||||
// convert enum to integers on save
|
||||
const int i = static_cast<int>(t);
|
||||
ar << boost::serialization::make_nvp(NULL, i);
|
||||
}
|
||||
};
|
||||
|
||||
template<class Archive>
|
||||
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[0]))
|
||||
);
|
||||
boost::serialization::collection_size_type count(c);
|
||||
ar << BOOST_SERIALIZATION_NVP(count);
|
||||
// explict template arguments to pass intel C++ compiler
|
||||
ar << serialization::make_array<
|
||||
const value_type,
|
||||
boost::serialization::collection_size_type
|
||||
>(
|
||||
static_cast<const value_type *>(&t[0]),
|
||||
count
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} // detail
|
||||
|
||||
template<class Archive, class T>
|
||||
inline void save(Archive & ar, /*const*/ T &t){
|
||||
typedef
|
||||
typename mpl::eval_if<is_pointer< T >,
|
||||
mpl::identity<detail::save_pointer_type<Archive> >,
|
||||
//else
|
||||
typename mpl::eval_if<is_enum< T >,
|
||||
mpl::identity<detail::save_enum_type<Archive> >,
|
||||
//else
|
||||
typename mpl::eval_if<is_array< T >,
|
||||
mpl::identity<detail::save_array_type<Archive> >,
|
||||
//else
|
||||
mpl::identity<detail::save_non_pointer_type<Archive> >
|
||||
>
|
||||
>
|
||||
>::type typex;
|
||||
typex::invoke(ar, t);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_OSERIALIZER_HPP
|
218
third_party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp
vendored
Normal file
218
third_party/boost/boost/archive/detail/polymorphic_iarchive_route.hpp
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_ROUTE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// polymorphic_iarchive_route.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/archive/polymorphic_iarchive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
namespace archive {
|
||||
namespace detail{
|
||||
|
||||
class basic_iserializer;
|
||||
class basic_pointer_iserializer;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
template<class ArchiveImplementation>
|
||||
class polymorphic_iarchive_route :
|
||||
public polymorphic_iarchive,
|
||||
// note: gcc dynamic cross cast fails if the the derivation below is
|
||||
// not public. I think this is a mistake.
|
||||
public /*protected*/ ArchiveImplementation
|
||||
{
|
||||
private:
|
||||
// these are used by the serialization library.
|
||||
virtual void load_object(
|
||||
void *t,
|
||||
const basic_iserializer & bis
|
||||
){
|
||||
ArchiveImplementation::load_object(t, bis);
|
||||
}
|
||||
virtual const basic_pointer_iserializer * load_pointer(
|
||||
void * & t,
|
||||
const basic_pointer_iserializer * bpis_ptr,
|
||||
const basic_pointer_iserializer * (*finder)(
|
||||
const boost::serialization::extended_type_info & type
|
||||
)
|
||||
){
|
||||
return ArchiveImplementation::load_pointer(t, bpis_ptr, finder);
|
||||
}
|
||||
virtual void set_library_version(library_version_type archive_library_version){
|
||||
ArchiveImplementation::set_library_version(archive_library_version);
|
||||
}
|
||||
virtual library_version_type get_library_version() const{
|
||||
return ArchiveImplementation::get_library_version();
|
||||
}
|
||||
virtual unsigned int get_flags() const {
|
||||
return ArchiveImplementation::get_flags();
|
||||
}
|
||||
virtual void delete_created_pointers(){
|
||||
ArchiveImplementation::delete_created_pointers();
|
||||
}
|
||||
virtual void reset_object_address(
|
||||
const void * new_address,
|
||||
const void * old_address
|
||||
){
|
||||
ArchiveImplementation::reset_object_address(new_address, old_address);
|
||||
}
|
||||
virtual void load_binary(void * t, std::size_t size){
|
||||
ArchiveImplementation::load_binary(t, size);
|
||||
}
|
||||
// primitive types the only ones permitted by polymorphic archives
|
||||
virtual void load(bool & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(char & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(signed char & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(unsigned char & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
virtual void load(wchar_t & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
virtual void load(short & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(unsigned short & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(int & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(unsigned int & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(long & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(unsigned long & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
virtual void load(boost::long_long_type & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(boost::ulong_long_type & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
virtual void load(__int64 & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(unsigned __int64 & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#endif
|
||||
virtual void load(float & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(double & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
virtual void load(std::string & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
virtual void load(std::wstring & t){
|
||||
ArchiveImplementation::load(t);
|
||||
}
|
||||
#endif
|
||||
// used for xml and other tagged formats default does nothing
|
||||
virtual void load_start(const char * name){
|
||||
ArchiveImplementation::load_start(name);
|
||||
}
|
||||
virtual void load_end(const char * name){
|
||||
ArchiveImplementation::load_end(name);
|
||||
}
|
||||
virtual void register_basic_serializer(const basic_iserializer & bis){
|
||||
ArchiveImplementation::register_basic_serializer(bis);
|
||||
}
|
||||
virtual helper_collection &
|
||||
get_helper_collection(){
|
||||
return ArchiveImplementation::get_helper_collection();
|
||||
}
|
||||
public:
|
||||
// this can't be inheriteded because they appear in mulitple
|
||||
// parents
|
||||
typedef mpl::bool_<true> is_loading;
|
||||
typedef mpl::bool_<false> is_saving;
|
||||
// the >> operator
|
||||
template<class T>
|
||||
polymorphic_iarchive & operator>>(T & t){
|
||||
return polymorphic_iarchive::operator>>(t);
|
||||
}
|
||||
// the & operator
|
||||
template<class T>
|
||||
polymorphic_iarchive & operator&(T & t){
|
||||
return polymorphic_iarchive::operator&(t);
|
||||
}
|
||||
// register type function
|
||||
template<class T>
|
||||
const basic_pointer_iserializer *
|
||||
register_type(T * t = NULL){
|
||||
return ArchiveImplementation::register_type(t);
|
||||
}
|
||||
// all current archives take a stream as constructor argument
|
||||
template <class _Elem, class _Tr>
|
||||
polymorphic_iarchive_route(
|
||||
std::basic_istream<_Elem, _Tr> & is,
|
||||
unsigned int flags = 0
|
||||
) :
|
||||
ArchiveImplementation(is, flags)
|
||||
{}
|
||||
virtual ~polymorphic_iarchive_route(){};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_IARCHIVE_DISPATCH_HPP
|
209
third_party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp
vendored
Normal file
209
third_party/boost/boost/archive/detail/polymorphic_oarchive_route.hpp
vendored
Normal file
|
@ -0,0 +1,209 @@
|
|||
#ifndef BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_ROUTE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// polymorphic_oarchive_route.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
#include <boost/archive/polymorphic_oarchive.hpp>
|
||||
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
|
||||
|
||||
namespace boost {
|
||||
namespace serialization {
|
||||
class extended_type_info;
|
||||
} // namespace serialization
|
||||
namespace archive {
|
||||
namespace detail{
|
||||
|
||||
class basic_oserializer;
|
||||
class basic_pointer_oserializer;
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
template<class ArchiveImplementation>
|
||||
class polymorphic_oarchive_route :
|
||||
public polymorphic_oarchive,
|
||||
// note: gcc dynamic cross cast fails if the the derivation below is
|
||||
// not public. I think this is a mistake.
|
||||
public /*protected*/ ArchiveImplementation
|
||||
{
|
||||
private:
|
||||
// these are used by the serialization library.
|
||||
virtual void save_object(
|
||||
const void *x,
|
||||
const detail::basic_oserializer & bos
|
||||
){
|
||||
ArchiveImplementation::save_object(x, bos);
|
||||
}
|
||||
virtual void save_pointer(
|
||||
const void * t,
|
||||
const detail::basic_pointer_oserializer * bpos_ptr
|
||||
){
|
||||
ArchiveImplementation::save_pointer(t, bpos_ptr);
|
||||
}
|
||||
virtual void save_null_pointer(){
|
||||
ArchiveImplementation::save_null_pointer();
|
||||
}
|
||||
// primitive types the only ones permitted by polymorphic archives
|
||||
virtual void save(const bool t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const char t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const signed char t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const unsigned char t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
virtual void save(const wchar_t t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
virtual void save(const short t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const unsigned short t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const int t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const unsigned int t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const long t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const unsigned long t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
virtual void save(const boost::long_long_type t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const boost::ulong_long_type t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#elif defined(BOOST_HAS_MS_INT64)
|
||||
virtual void save(const boost::int64_t t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const boost::uint64_t t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#endif
|
||||
virtual void save(const float t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const double t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
virtual void save(const std::string & t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
virtual void save(const std::wstring & t){
|
||||
ArchiveImplementation::save(t);
|
||||
}
|
||||
#endif
|
||||
virtual library_version_type get_library_version() const{
|
||||
return ArchiveImplementation::get_library_version();
|
||||
}
|
||||
virtual unsigned int get_flags() const {
|
||||
return ArchiveImplementation::get_flags();
|
||||
}
|
||||
virtual void save_binary(const void * t, std::size_t size){
|
||||
ArchiveImplementation::save_binary(t, size);
|
||||
}
|
||||
// used for xml and other tagged formats default does nothing
|
||||
virtual void save_start(const char * name){
|
||||
ArchiveImplementation::save_start(name);
|
||||
}
|
||||
virtual void save_end(const char * name){
|
||||
ArchiveImplementation::save_end(name);
|
||||
}
|
||||
virtual void end_preamble(){
|
||||
ArchiveImplementation::end_preamble();
|
||||
}
|
||||
virtual void register_basic_serializer(const detail::basic_oserializer & bos){
|
||||
ArchiveImplementation::register_basic_serializer(bos);
|
||||
}
|
||||
virtual helper_collection &
|
||||
get_helper_collection(){
|
||||
return ArchiveImplementation::get_helper_collection();
|
||||
}
|
||||
public:
|
||||
// this can't be inheriteded because they appear in mulitple
|
||||
// parents
|
||||
typedef mpl::bool_<false> is_loading;
|
||||
typedef mpl::bool_<true> is_saving;
|
||||
// the << operator
|
||||
template<class T>
|
||||
polymorphic_oarchive & operator<<(T & t){
|
||||
return polymorphic_oarchive::operator<<(t);
|
||||
}
|
||||
// the & operator
|
||||
template<class T>
|
||||
polymorphic_oarchive & operator&(T & t){
|
||||
return polymorphic_oarchive::operator&(t);
|
||||
}
|
||||
// register type function
|
||||
template<class T>
|
||||
const basic_pointer_oserializer *
|
||||
register_type(T * t = NULL){
|
||||
return ArchiveImplementation::register_type(t);
|
||||
}
|
||||
// all current archives take a stream as constructor argument
|
||||
template <class _Elem, class _Tr>
|
||||
polymorphic_oarchive_route(
|
||||
std::basic_ostream<_Elem, _Tr> & os,
|
||||
unsigned int flags = 0
|
||||
) :
|
||||
ArchiveImplementation(os, flags)
|
||||
{}
|
||||
virtual ~polymorphic_oarchive_route(){};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_POLYMORPHIC_OARCHIVE_DISPATCH_HPP
|
91
third_party/boost/boost/archive/detail/register_archive.hpp
vendored
Normal file
91
third_party/boost/boost/archive/detail/register_archive.hpp
vendored
Normal file
|
@ -0,0 +1,91 @@
|
|||
// Copyright David Abrahams 2006. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
|
||||
# define BOOST_ARCHIVE_DETAIL_REGISTER_ARCHIVE_DWA2006521_HPP
|
||||
|
||||
namespace boost { namespace archive { namespace detail {
|
||||
|
||||
// No instantiate_ptr_serialization overloads generated by
|
||||
// BOOST_SERIALIZATION_REGISTER_ARCHIVE that lexically follow the call
|
||||
// will be seen *unless* they are in an associated namespace of one of
|
||||
// the arguments, so we pass one of these along to make sure this
|
||||
// namespace is considered. See temp.dep.candidate (14.6.4.2) in the
|
||||
// standard.
|
||||
struct adl_tag {};
|
||||
|
||||
template <class Archive, class Serializable>
|
||||
struct ptr_serialization_support;
|
||||
|
||||
// We could've just used ptr_serialization_support, above, but using
|
||||
// it with only a forward declaration causes vc6/7 to complain about a
|
||||
// missing instantiate member, even if it has one. This is just a
|
||||
// friendly layer of indirection.
|
||||
template <class Archive, class Serializable>
|
||||
struct _ptr_serialization_support
|
||||
: ptr_serialization_support<Archive,Serializable>
|
||||
{
|
||||
typedef int type;
|
||||
};
|
||||
|
||||
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130)
|
||||
|
||||
template<int N>
|
||||
struct counter : counter<N-1> {};
|
||||
template<>
|
||||
struct counter<0> {};
|
||||
|
||||
template<class Serializable>
|
||||
void instantiate_ptr_serialization(Serializable* s, int, adl_tag) {
|
||||
instantiate_ptr_serialization(s, counter<20>());
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
struct get_counter {
|
||||
static const int value = sizeof(adjust_counter(counter<20>()));
|
||||
typedef counter<value> type;
|
||||
typedef counter<value - 1> prior;
|
||||
typedef char (&next)[value+1];
|
||||
};
|
||||
|
||||
char adjust_counter(counter<0>);
|
||||
template<class Serializable>
|
||||
void instantiate_ptr_serialization(Serializable*, counter<0>) {}
|
||||
|
||||
#define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \
|
||||
namespace boost { namespace archive { namespace detail { \
|
||||
get_counter<Archive >::next adjust_counter(get_counter<Archive >::type);\
|
||||
template<class Serializable> \
|
||||
void instantiate_ptr_serialization(Serializable* s, \
|
||||
get_counter<Archive >::type) { \
|
||||
ptr_serialization_support<Archive, Serializable> x; \
|
||||
instantiate_ptr_serialization(s, get_counter<Archive >::prior()); \
|
||||
}\
|
||||
}}}
|
||||
|
||||
|
||||
#else
|
||||
|
||||
// This function gets called, but its only purpose is to participate
|
||||
// in overload resolution with the functions declared by
|
||||
// BOOST_SERIALIZATION_REGISTER_ARCHIVE, below.
|
||||
template <class Serializable>
|
||||
void instantiate_ptr_serialization(Serializable*, int, adl_tag ) {}
|
||||
|
||||
// The function declaration generated by this macro never actually
|
||||
// gets called, but its return type gets instantiated, and that's
|
||||
// enough to cause registration of serialization functions between
|
||||
// Archive and any exported Serializable type. See also:
|
||||
// boost/serialization/export.hpp
|
||||
# define BOOST_SERIALIZATION_REGISTER_ARCHIVE(Archive) \
|
||||
namespace boost { namespace archive { namespace detail { \
|
||||
\
|
||||
template <class Serializable> \
|
||||
typename _ptr_serialization_support<Archive, Serializable>::type \
|
||||
instantiate_ptr_serialization( Serializable*, Archive*, adl_tag ); \
|
||||
\
|
||||
}}}
|
||||
#endif
|
||||
}}} // namespace boost::archive::detail
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP
|
29
third_party/boost/boost/archive/detail/utf8_codecvt_facet.hpp
vendored
Normal file
29
third_party/boost/boost/archive/detail/utf8_codecvt_facet.hpp
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_NO_STD_WSTREAMBUF
|
||||
#error "wide char i/o not supported on this platform"
|
||||
#endif
|
||||
|
||||
// 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 }}}
|
||||
|
||||
#include <boost/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#undef BOOST_UTF8_END_NAMESPACE
|
||||
#undef BOOST_UTF8_DECL
|
||||
#undef BOOST_UTF8_BEGIN_NAMESPACE
|
||||
|
||||
#endif // BOOST_ARCHIVE_DETAIL_UTF8_CODECVT_FACET_HPP
|
224
third_party/boost/boost/archive/dinkumware.hpp
vendored
Normal file
224
third_party/boost/boost/archive/dinkumware.hpp
vendored
Normal file
|
@ -0,0 +1,224 @@
|
|||
#ifndef BOOST_ARCHIVE_DINKUMWARE_HPP
|
||||
#define BOOST_ARCHIVE_DINKUMWARE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// dinkumware.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// this file adds a couple of things that are missing from the dinkumware
|
||||
// implementation of the standard library.
|
||||
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
namespace std {
|
||||
|
||||
// define i/o operators for 64 bit integers
|
||||
template<class 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];
|
||||
unsigned int radix;
|
||||
|
||||
if(os.flags() & (int)std::ios_base::hex)
|
||||
radix = 16;
|
||||
else
|
||||
if(os.flags() & (int)std::ios_base::oct)
|
||||
radix = 8;
|
||||
else
|
||||
//if(s.flags() & (int)std::ios_base::dec)
|
||||
radix = 10;
|
||||
unsigned int i = 0;
|
||||
do{
|
||||
unsigned int j = t % radix;
|
||||
d[i++] = j + ((j < 10) ? '0' : ('a' - 10));
|
||||
t /= radix;
|
||||
}
|
||||
while(t > 0);
|
||||
d[i--] = '\0';
|
||||
|
||||
// reverse digits
|
||||
unsigned int j = 0;
|
||||
while(j < i){
|
||||
CharType k = d[i];
|
||||
d[i] = d[j];
|
||||
d[j] = k;
|
||||
--i;++j;
|
||||
}
|
||||
os << d;
|
||||
return os;
|
||||
|
||||
}
|
||||
|
||||
template<class CharType>
|
||||
basic_ostream<CharType> &
|
||||
operator<<(basic_ostream<CharType> &os, boost::int64_t t){
|
||||
if(0 <= t){
|
||||
os << static_cast<boost::uint64_t>(t);
|
||||
}
|
||||
else{
|
||||
os.put('-');
|
||||
os << -t;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
|
||||
template<class CharType>
|
||||
basic_istream<CharType> &
|
||||
operator>>(basic_istream<CharType> &is, boost::int64_t & t){
|
||||
CharType d;
|
||||
do{
|
||||
d = is.get();
|
||||
}
|
||||
while(::isspace(d));
|
||||
bool negative = (d == '-');
|
||||
if(negative)
|
||||
d = is.get();
|
||||
unsigned int radix;
|
||||
if(is.flags() & (int)std::ios_base::hex)
|
||||
radix = 16;
|
||||
else
|
||||
if(is.flags() & (int)std::ios_base::oct)
|
||||
radix = 8;
|
||||
else
|
||||
//if(s.flags() & (int)std::ios_base::dec)
|
||||
radix = 10;
|
||||
t = 0;
|
||||
do{
|
||||
if('0' <= d && d <= '9')
|
||||
t = t * radix + (d - '0');
|
||||
else
|
||||
if('a' <= d && d <= 'f')
|
||||
t = t * radix + (d - 'a' + 10);
|
||||
else
|
||||
break;
|
||||
d = is.get();
|
||||
}
|
||||
while(!is.fail());
|
||||
// restore the delimiter
|
||||
is.putback(d);
|
||||
is.clear();
|
||||
if(negative)
|
||||
t = -t;
|
||||
return is;
|
||||
}
|
||||
|
||||
template<class CharType>
|
||||
basic_istream<CharType> &
|
||||
operator>>(basic_istream<CharType> &is, boost::uint64_t & t){
|
||||
boost::int64_t it;
|
||||
is >> it;
|
||||
t = it;
|
||||
return is;
|
||||
}
|
||||
|
||||
//#endif
|
||||
|
||||
template<>
|
||||
class back_insert_iterator<basic_string<char> > : public
|
||||
iterator<output_iterator_tag, char>
|
||||
{
|
||||
public:
|
||||
typedef basic_string<char> container_type;
|
||||
typedef container_type::reference reference;
|
||||
|
||||
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
|
||||
//container->push_back(Val_);
|
||||
*container += Val_;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> & operator*(){
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> & operator++(){
|
||||
// pretend to preincrement
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> operator++(int){
|
||||
// pretend to postincrement
|
||||
return (*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
container_type *container; // pointer to container
|
||||
};
|
||||
|
||||
template<char>
|
||||
inline back_insert_iterator<basic_string<char> > back_inserter(
|
||||
basic_string<char> & s
|
||||
){
|
||||
return (std::back_insert_iterator<basic_string<char> >(s));
|
||||
}
|
||||
|
||||
template<>
|
||||
class back_insert_iterator<basic_string<wchar_t> > : public
|
||||
iterator<output_iterator_tag, wchar_t>
|
||||
{
|
||||
public:
|
||||
typedef basic_string<wchar_t> container_type;
|
||||
typedef container_type::reference reference;
|
||||
|
||||
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
|
||||
//container->push_back(Val_);
|
||||
*container += Val_;
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> & operator*(){
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> & operator++(){
|
||||
// pretend to preincrement
|
||||
return (*this);
|
||||
}
|
||||
|
||||
back_insert_iterator<container_type> operator++(int){
|
||||
// pretend to postincrement
|
||||
return (*this);
|
||||
}
|
||||
|
||||
protected:
|
||||
container_type *container; // pointer to container
|
||||
};
|
||||
|
||||
template<wchar_t>
|
||||
inline back_insert_iterator<basic_string<wchar_t> > back_inserter(
|
||||
basic_string<wchar_t> & s
|
||||
){
|
||||
return (std::back_insert_iterator<basic_string<wchar_t> >(s));
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif //BOOST_ARCHIVE_DINKUMWARE_HPP
|
75
third_party/boost/boost/archive/impl/archive_serializer_map.ipp
vendored
Normal file
75
third_party/boost/boost/archive/impl/archive_serializer_map.ipp
vendored
Normal file
|
@ -0,0 +1,75 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// archive_serializer_map.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of basic_text_iprimitive overrides for the combination
|
||||
// of template parameters used to implement a text_iprimitive
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/archive/detail/archive_serializer_map.hpp>
|
||||
#include <boost/archive/detail/basic_serializer_map.hpp>
|
||||
#include <boost/serialization/singleton.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4511 4512)
|
||||
#endif
|
||||
|
||||
namespace extra_detail { // anon
|
||||
template<class Archive>
|
||||
class map : public basic_serializer_map
|
||||
{};
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL bool
|
||||
archive_serializer_map<Archive>::insert(const basic_serializer * bs){
|
||||
return boost::serialization::singleton<
|
||||
extra_detail::map<Archive>
|
||||
>::get_mutable_instance().insert(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())
|
||||
return;
|
||||
boost::serialization::singleton<
|
||||
extra_detail::map<Archive>
|
||||
>::get_mutable_instance().erase(bs);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL const basic_serializer *
|
||||
archive_serializer_map<Archive>::find(
|
||||
const boost::serialization::extended_type_info & eti
|
||||
) {
|
||||
return boost::serialization::singleton<
|
||||
extra_detail::map<Archive>
|
||||
>::get_const_instance().find(eti);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace archive
|
||||
} // namespace boost
|
134
third_party/boost/boost/archive/impl/basic_binary_iarchive.ipp
vendored
Normal file
134
third_party/boost/boost/archive/impl/basic_binary_iarchive.ipp
vendored
Normal file
|
@ -0,0 +1,134 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
using ::strlen;
|
||||
using ::size_t;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
|
||||
#include <boost/archive/basic_binary_iarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of binary_binary_archive
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iarchive<Archive>::load_override(class_name_type & t){
|
||||
std::string cn;
|
||||
cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
|
||||
load_override(cn);
|
||||
if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_class_name)
|
||||
);
|
||||
std::memcpy(t, cn.data(), cn.size());
|
||||
// borland tweak
|
||||
t.t[cn.size()] = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iarchive<Archive>::init(void){
|
||||
// read signature in an archive version independent manner
|
||||
std::string file_signature;
|
||||
|
||||
#if 0 // commented out since it interfers with derivation
|
||||
BOOST_TRY {
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
if(l == std::strlen(BOOST_ARCHIVE_SIGNATURE())) {
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != file_signature.data())
|
||||
#endif
|
||||
file_signature.resize(l);
|
||||
// note breaking a rule here - could be a problem on some platform
|
||||
if(0 < l)
|
||||
this->This()->load_binary(&(*file_signature.begin()), l);
|
||||
}
|
||||
}
|
||||
BOOST_CATCH(archive_exception const &) { // catch stream_error archive exceptions
|
||||
// will cause invalid_signature archive exception to be thrown below
|
||||
file_signature = "";
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
#else
|
||||
// https://svn.boost.org/trac/boost/ticket/7301
|
||||
* this->This() >> file_signature;
|
||||
#endif
|
||||
|
||||
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_signature)
|
||||
);
|
||||
|
||||
// make sure the version of the reading archive library can
|
||||
// support the format of the archive being read
|
||||
library_version_type input_library_version;
|
||||
//* this->This() >> input_library_version;
|
||||
{
|
||||
int v = 0;
|
||||
v = this->This()->m_sb.sbumpc();
|
||||
#if defined(BOOST_LITTLE_ENDIAN)
|
||||
if(v < 6){
|
||||
;
|
||||
}
|
||||
else
|
||||
if(v < 7){
|
||||
// version 6 - next byte should be zero
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
else
|
||||
if(v < 8){
|
||||
int x1;
|
||||
// version 7 = might be followed by zero or some other byte
|
||||
x1 = this->This()->m_sb.sgetc();
|
||||
// it's =a zero, push it back
|
||||
if(0 == x1)
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
else{
|
||||
// version 8+ followed by a zero
|
||||
this->This()->m_sb.sbumpc();
|
||||
}
|
||||
#elif defined(BOOST_BIG_ENDIAN)
|
||||
if(v == 0)
|
||||
v = this->This()->m_sb.sbumpc();
|
||||
#endif
|
||||
input_library_version = static_cast<library_version_type>(v);
|
||||
}
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
this->set_library_version(input_library_version);
|
||||
#else
|
||||
detail::basic_iarchive::set_library_version(input_library_version);
|
||||
#endif
|
||||
|
||||
if(BOOST_ARCHIVE_VERSION() < input_library_version)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::unsupported_version)
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
173
third_party/boost/boost/archive/impl/basic_binary_iprimitive.ipp
vendored
Normal file
173
third_party/boost/boost/archive/impl/basic_binary_iprimitive.ipp
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_iprimitive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t, NULL
|
||||
#include <cstring> // memcpy
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
using ::memcpy;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/archive/basic_binary_iprimitive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of basic_binary_iprimitive
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::init()
|
||||
{
|
||||
// Detect attempts to pass native binary archives across
|
||||
// incompatible platforms. This is not fool proof but its
|
||||
// better than nothing.
|
||||
unsigned char size;
|
||||
this->This()->load(size);
|
||||
if(sizeof(int) != size)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::incompatible_native_format,
|
||||
"size of int"
|
||||
)
|
||||
);
|
||||
this->This()->load(size);
|
||||
if(sizeof(long) != size)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::incompatible_native_format,
|
||||
"size of long"
|
||||
)
|
||||
);
|
||||
this->This()->load(size);
|
||||
if(sizeof(float) != size)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::incompatible_native_format,
|
||||
"size of float"
|
||||
)
|
||||
);
|
||||
this->This()->load(size);
|
||||
if(sizeof(double) != size)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::incompatible_native_format,
|
||||
"size of double"
|
||||
)
|
||||
);
|
||||
|
||||
// for checking endian
|
||||
int i;
|
||||
this->This()->load(i);
|
||||
if(1 != i)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(
|
||||
archive_exception::incompatible_native_format,
|
||||
"endian setting"
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
std::size_t l; // number of wchar_t !!!
|
||||
this->This()->load(l);
|
||||
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
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::load(std::string & s)
|
||||
{
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != s.data())
|
||||
#endif
|
||||
s.resize(l);
|
||||
// note breaking a rule here - could be a problem on some platform
|
||||
if(0 < l)
|
||||
load_binary(&(*s.begin()), l);
|
||||
}
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::load(char * s)
|
||||
{
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
load_binary(s, l);
|
||||
s[l] = '\0';
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::load(std::wstring & ws)
|
||||
{
|
||||
std::size_t l;
|
||||
this->This()->load(l);
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != ws.data())
|
||||
#endif
|
||||
ws.resize(l);
|
||||
// note breaking a rule here - is could be a problem on some platform
|
||||
load_binary(const_cast<wchar_t *>(ws.data()), l * sizeof(wchar_t) / sizeof(char));
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::basic_binary_iprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
codecvt_null_facet(1),
|
||||
locale_saver(m_sb),
|
||||
archive_locale(sb.getloc(), & codecvt_null_facet)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
m_sb.pubsync();
|
||||
m_sb.pubimbue(archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_sb(sb)
|
||||
{}
|
||||
#endif
|
||||
|
||||
// scoped_ptr requires that g be a complete type at time of
|
||||
// destruction so define destructor here rather than in the header
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_iprimitive<Archive, Elem, Tr>::~basic_binary_iprimitive(){}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
42
third_party/boost/boost/archive/impl/basic_binary_oarchive.ipp
vendored
Normal file
42
third_party/boost/boost/archive/impl/basic_binary_oarchive.ipp
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_oarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_binary_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of binary_binary_oarchive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_oarchive<Archive>::init(){
|
||||
// write signature in an archive version independent manner
|
||||
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
|
||||
* this->This() << file_signature;
|
||||
// write library version
|
||||
const library_version_type v(BOOST_ARCHIVE_VERSION());
|
||||
* this->This() << v;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
126
third_party/boost/boost/archive/impl/basic_binary_oprimitive.ipp
vendored
Normal file
126
third_party/boost/boost/archive/impl/basic_binary_oprimitive.ipp
vendored
Normal file
|
@ -0,0 +1,126 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_binary_oprimitive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <ostream>
|
||||
#include <cstddef> // NULL
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar>
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{ using ::wcslen; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_binary_oprimitive.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of basic_binary_oprimitive
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::init()
|
||||
{
|
||||
// record native sizes of fundamental types
|
||||
// this is to permit detection of attempts to pass
|
||||
// native binary archives accross incompatible machines.
|
||||
// This is not foolproof but its better than nothing.
|
||||
this->This()->save(static_cast<unsigned char>(sizeof(int)));
|
||||
this->This()->save(static_cast<unsigned char>(sizeof(long)));
|
||||
this->This()->save(static_cast<unsigned char>(sizeof(float)));
|
||||
this->This()->save(static_cast<unsigned char>(sizeof(double)));
|
||||
// for checking endianness
|
||||
this->This()->save(int(1));
|
||||
}
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::save(const char * s)
|
||||
{
|
||||
std::size_t l = std::strlen(s);
|
||||
this->This()->save(l);
|
||||
save_binary(s, l);
|
||||
}
|
||||
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::string &s)
|
||||
{
|
||||
std::size_t l = static_cast<std::size_t>(s.size());
|
||||
this->This()->save(l);
|
||||
save_binary(s.data(), l);
|
||||
}
|
||||
|
||||
#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)
|
||||
{
|
||||
std::size_t l = std::wcslen(ws);
|
||||
this->This()->save(l);
|
||||
save_binary(ws, l * sizeof(wchar_t) / sizeof(char));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::save(const std::wstring &ws)
|
||||
{
|
||||
std::size_t l = ws.size();
|
||||
this->This()->save(l);
|
||||
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
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::basic_binary_oprimitive(
|
||||
std::basic_streambuf<Elem, Tr> & sb,
|
||||
bool no_codecvt
|
||||
) :
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
m_sb(sb),
|
||||
codecvt_null_facet(1),
|
||||
locale_saver(m_sb),
|
||||
archive_locale(sb.getloc(), & codecvt_null_facet)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
m_sb.pubsync();
|
||||
m_sb.pubimbue(archive_locale);
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_sb(sb)
|
||||
{}
|
||||
#endif
|
||||
|
||||
// scoped_ptr requires that g be a complete type at time of
|
||||
// destruction so define destructor here rather than in the header
|
||||
template<class Archive, class Elem, class Tr>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_binary_oprimitive<Archive, Elem, Tr>::~basic_binary_oprimitive(){}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
76
third_party/boost/boost/archive/impl/basic_text_iarchive.ipp
vendored
Normal file
76
third_party/boost/boost/archive/impl/basic_text_iarchive.ipp
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_iarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
#include <boost/archive/basic_text_iarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of text_text_archive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_iarchive<Archive>::load_override(class_name_type & t){
|
||||
std::string cn;
|
||||
cn.reserve(BOOST_SERIALIZATION_MAX_KEY_SIZE);
|
||||
load_override(cn);
|
||||
if(cn.size() > (BOOST_SERIALIZATION_MAX_KEY_SIZE - 1))
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_class_name)
|
||||
);
|
||||
std::memcpy(t, cn.data(), cn.size());
|
||||
// borland tweak
|
||||
t.t[cn.size()] = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_iarchive<Archive>::init(void){
|
||||
// read signature in an archive version independent manner
|
||||
std::string file_signature;
|
||||
* this->This() >> file_signature;
|
||||
if(file_signature != BOOST_ARCHIVE_SIGNATURE())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_signature)
|
||||
);
|
||||
|
||||
// make sure the version of the reading archive library can
|
||||
// support the format of the archive being read
|
||||
library_version_type input_library_version;
|
||||
* this->This() >> input_library_version;
|
||||
|
||||
#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3205))
|
||||
this->set_library_version(input_library_version);
|
||||
#else
|
||||
detail::basic_iarchive::set_library_version(input_library_version);
|
||||
#endif
|
||||
|
||||
// extra little .t is to get around borland quirk
|
||||
if(BOOST_ARCHIVE_VERSION() < input_library_version)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::unsupported_version)
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
137
third_party/boost/boost/archive/impl/basic_text_iprimitive.ipp
vendored
Normal file
137
third_party/boost/boost/archive/impl/basic_text_iprimitive.ipp
vendored
Normal file
|
@ -0,0 +1,137 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_iprimitive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // size_t, NULL
|
||||
#include <limits> // NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
|
||||
#include <boost/archive/iterators/remove_whitespace.hpp>
|
||||
#include <boost/archive/iterators/istream_iterator.hpp>
|
||||
#include <boost/archive/iterators/binary_from_base64.hpp>
|
||||
#include <boost/archive/iterators/transform_width.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class CharType>
|
||||
static inline bool is_whitespace(CharType c);
|
||||
|
||||
template<>
|
||||
inline bool is_whitespace(char t){
|
||||
return 0 != std::isspace(t);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
template<>
|
||||
inline bool is_whitespace(wchar_t t){
|
||||
return 0 != std::iswspace(t);
|
||||
}
|
||||
#endif
|
||||
} // detail
|
||||
|
||||
// translate base64 text into binary and copy into buffer
|
||||
// until buffer is full.
|
||||
template<class IStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_iprimitive<IStream>::load_binary(
|
||||
void *address,
|
||||
std::size_t count
|
||||
){
|
||||
typedef typename IStream::char_type CharType;
|
||||
|
||||
if(0 == count)
|
||||
return;
|
||||
|
||||
BOOST_ASSERT(
|
||||
static_cast<std::size_t>((std::numeric_limits<std::streamsize>::max)())
|
||||
> (count + sizeof(CharType) - 1)/sizeof(CharType)
|
||||
);
|
||||
|
||||
if(is.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
// convert from base64 to binary
|
||||
typedef typename
|
||||
iterators::transform_width<
|
||||
iterators::binary_from_base64<
|
||||
iterators::remove_whitespace<
|
||||
iterators::istream_iterator<CharType>
|
||||
>
|
||||
,typename IStream::int_type
|
||||
>
|
||||
,8
|
||||
,6
|
||||
,CharType
|
||||
>
|
||||
binary;
|
||||
|
||||
binary i = binary(iterators::istream_iterator<CharType>(is));
|
||||
|
||||
char * caddr = static_cast<char *>(address);
|
||||
|
||||
// take care that we don't increment anymore than necessary
|
||||
while(count-- > 0){
|
||||
*caddr++ = static_cast<char>(*i++);
|
||||
}
|
||||
|
||||
// skip over any excess input
|
||||
for(;;){
|
||||
typename IStream::int_type r;
|
||||
r = is.get();
|
||||
if(is.eof())
|
||||
break;
|
||||
if(detail::is_whitespace(static_cast<CharType>(r)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<class IStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_iprimitive<IStream>::basic_text_iprimitive(
|
||||
IStream &is_,
|
||||
bool no_codecvt
|
||||
) :
|
||||
is(is_),
|
||||
flags_saver(is_),
|
||||
precision_saver(is_),
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
codecvt_null_facet(1),
|
||||
archive_locale(is.getloc(), & codecvt_null_facet),
|
||||
locale_saver(is)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
is_.sync();
|
||||
is_.imbue(archive_locale);
|
||||
}
|
||||
is_ >> std::noboolalpha;
|
||||
}
|
||||
#else
|
||||
{}
|
||||
#endif
|
||||
|
||||
template<class IStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_iprimitive<IStream>::~basic_text_iprimitive(){
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
62
third_party/boost/boost/archive/impl/basic_text_oarchive.ipp
vendored
Normal file
62
third_party/boost/boost/archive/impl/basic_text_oarchive.ipp
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
#include <string>
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstring>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_text_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of basic_text_oarchive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_oarchive<Archive>::newtoken()
|
||||
{
|
||||
switch(delimiter){
|
||||
default:
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
case eol:
|
||||
this->This()->put('\n');
|
||||
delimiter = space;
|
||||
break;
|
||||
case space:
|
||||
this->This()->put(' ');
|
||||
break;
|
||||
case none:
|
||||
delimiter = space;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_oarchive<Archive>::init(){
|
||||
// write signature in an archive version independent manner
|
||||
const std::string file_signature(BOOST_ARCHIVE_SIGNATURE());
|
||||
* this->This() << file_signature;
|
||||
// write library version
|
||||
const library_version_type v(BOOST_ARCHIVE_VERSION());
|
||||
* this->This() << v;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
115
third_party/boost/boost/archive/impl/basic_text_oprimitive.ipp
vendored
Normal file
115
third_party/boost/boost/archive/impl/basic_text_oprimitive.ipp
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_text_oprimitive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <algorithm> // std::copy
|
||||
#include <exception> // std::uncaught_exception
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_text_oprimitive.hpp>
|
||||
|
||||
#include <boost/archive/iterators/base64_from_binary.hpp>
|
||||
#include <boost/archive/iterators/insert_linebreaks.hpp>
|
||||
#include <boost/archive/iterators/transform_width.hpp>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
// translate to base64 and copy in to buffer.
|
||||
template<class OStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_text_oprimitive<OStream>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
typedef typename OStream::char_type CharType;
|
||||
|
||||
if(0 == count)
|
||||
return;
|
||||
|
||||
if(os.fail())
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::output_stream_error)
|
||||
);
|
||||
|
||||
os.put('\n');
|
||||
|
||||
typedef
|
||||
boost::archive::iterators::insert_linebreaks<
|
||||
boost::archive::iterators::base64_from_binary<
|
||||
boost::archive::iterators::transform_width<
|
||||
const char *,
|
||||
6,
|
||||
8
|
||||
>
|
||||
>
|
||||
,76
|
||||
,const char // cwpro8 needs this
|
||||
>
|
||||
base64_text;
|
||||
|
||||
boost::archive::iterators::ostream_iterator<CharType> oi(os);
|
||||
std::copy(
|
||||
base64_text(static_cast<const char *>(address)),
|
||||
base64_text(
|
||||
static_cast<const char *>(address) + count
|
||||
),
|
||||
oi
|
||||
);
|
||||
|
||||
std::size_t tail = count % 3;
|
||||
if(tail > 0){
|
||||
*oi++ = '=';
|
||||
if(tail < 2)
|
||||
*oi = '=';
|
||||
}
|
||||
}
|
||||
|
||||
template<class OStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive<OStream>::basic_text_oprimitive(
|
||||
OStream & os_,
|
||||
bool no_codecvt
|
||||
) :
|
||||
os(os_),
|
||||
flags_saver(os_),
|
||||
precision_saver(os_),
|
||||
#ifndef BOOST_NO_STD_LOCALE
|
||||
codecvt_null_facet(1),
|
||||
archive_locale(os.getloc(), & codecvt_null_facet),
|
||||
locale_saver(os)
|
||||
{
|
||||
if(! no_codecvt){
|
||||
os_.flush();
|
||||
os_.imbue(archive_locale);
|
||||
}
|
||||
os_ << std::noboolalpha;
|
||||
}
|
||||
#else
|
||||
{}
|
||||
#endif
|
||||
|
||||
|
||||
template<class OStream>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_text_oprimitive<OStream>::~basic_text_oprimitive(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
os << std::endl;
|
||||
}
|
||||
|
||||
} //namespace boost
|
||||
} //namespace archive
|
173
third_party/boost/boost/archive/impl/basic_xml_grammar.hpp
vendored
Normal file
173
third_party/boost/boost/archive/impl/basic_xml_grammar.hpp
vendored
Normal file
|
@ -0,0 +1,173 @@
|
|||
#ifndef BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
|
||||
#define BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_grammar.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// this module is derived from simplexml.cpp - an example shipped as part of
|
||||
// the spirit parser. This example contains the following notice:
|
||||
/*=============================================================================
|
||||
simplexml.cpp
|
||||
|
||||
Spirit V1.3
|
||||
URL: http://spirit.sourceforge.net/
|
||||
|
||||
Copyright (c) 2001, Daniel C. Nuffer
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the copyright holder be held liable for
|
||||
any damages arising from the use of this software.
|
||||
|
||||
Permission is granted to anyone to use this software for any purpose,
|
||||
including commercial applications, and to alter it and redistribute
|
||||
it freely, subject to the following restrictions:
|
||||
|
||||
1. The origin of this software must not be misrepresented; you must
|
||||
not claim that you wrote the original software. If you use this
|
||||
software in a product, an acknowledgment in the product documentation
|
||||
would be appreciated but is not required.
|
||||
|
||||
2. Altered source versions must be plainly marked as such, and must
|
||||
not be misrepresented as being the original software.
|
||||
|
||||
3. This notice may not be removed or altered from any source
|
||||
distribution.
|
||||
=============================================================================*/
|
||||
#include <string>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/spirit/include/classic_rule.hpp>
|
||||
#include <boost/spirit/include/classic_chset.hpp>
|
||||
|
||||
#include <boost/archive/basic_archive.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// XML grammar parsing
|
||||
|
||||
template<class CharType>
|
||||
class BOOST_SYMBOL_VISIBLE 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;
|
||||
typedef typename boost::spirit::classic::chset<CharType> chset_t;
|
||||
typedef typename boost::spirit::classic::chlit<CharType> chlit_t;
|
||||
typedef typename boost::spirit::classic::scanner<
|
||||
typename std::basic_string<CharType>::iterator
|
||||
> scanner_t;
|
||||
typedef typename boost::spirit::classic::rule<scanner_t> rule_t;
|
||||
// Start grammar definition
|
||||
rule_t
|
||||
Reference,
|
||||
Eq,
|
||||
STag,
|
||||
ETag,
|
||||
LetterOrUnderscoreOrColon,
|
||||
AttValue,
|
||||
CharRef1,
|
||||
CharRef2,
|
||||
CharRef,
|
||||
AmpRef,
|
||||
LTRef,
|
||||
GTRef,
|
||||
AposRef,
|
||||
QuoteRef,
|
||||
CharData,
|
||||
CharDataChars,
|
||||
content,
|
||||
AmpName,
|
||||
LTName,
|
||||
GTName,
|
||||
ClassNameChar,
|
||||
ClassName,
|
||||
Name,
|
||||
XMLDecl,
|
||||
XMLDeclChars,
|
||||
DocTypeDecl,
|
||||
DocTypeDeclChars,
|
||||
ClassIDAttribute,
|
||||
ObjectIDAttribute,
|
||||
ClassNameAttribute,
|
||||
TrackingAttribute,
|
||||
VersionAttribute,
|
||||
UnusedAttribute,
|
||||
Attribute,
|
||||
SignatureAttribute,
|
||||
SerializationWrapper,
|
||||
NameHead,
|
||||
NameTail,
|
||||
AttributeList,
|
||||
S;
|
||||
|
||||
// XML Character classes
|
||||
chset_t
|
||||
BaseChar,
|
||||
Ideographic,
|
||||
Char,
|
||||
Letter,
|
||||
Digit,
|
||||
CombiningChar,
|
||||
Extender,
|
||||
Sch,
|
||||
NameChar;
|
||||
|
||||
void init_chset();
|
||||
|
||||
bool my_parse(
|
||||
IStream & is,
|
||||
const rule_t &rule_,
|
||||
const CharType delimiter = L'>'
|
||||
) const ;
|
||||
public:
|
||||
struct return_values {
|
||||
StringType object_name;
|
||||
StringType contents;
|
||||
//class_id_type class_id;
|
||||
int_least16_t class_id;
|
||||
//object_id_type object_id;
|
||||
uint_least32_t object_id;
|
||||
//version_type version;
|
||||
unsigned int version;
|
||||
tracking_type tracking_level;
|
||||
StringType class_name;
|
||||
return_values() :
|
||||
version(0),
|
||||
tracking_level(false)
|
||||
{}
|
||||
} rv;
|
||||
bool parse_start_tag(IStream & is) /*const*/;
|
||||
bool parse_end_tag(IStream & is) const;
|
||||
bool parse_string(IStream & is, StringType & s) /*const*/;
|
||||
void init(IStream & is);
|
||||
bool windup(IStream & is);
|
||||
basic_xml_grammar();
|
||||
};
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_BASIC_XML_GRAMMAR_HPP
|
115
third_party/boost/boost/archive/impl/basic_xml_iarchive.ipp
vendored
Normal file
115
third_party/boost/boost/archive/impl/basic_xml_iarchive.ipp
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_iarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/basic_xml_iarchive.hpp>
|
||||
#include <boost/serialization/tracking.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implementation of xml_text_archive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_start(const char *name){
|
||||
// if there's no name
|
||||
if(NULL == name)
|
||||
return;
|
||||
bool result = this->This()->gimpl->parse_start_tag(this->This()->get_is());
|
||||
if(true != result){
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
}
|
||||
// don't check start tag at highest level
|
||||
++depth;
|
||||
return;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_end(const char *name){
|
||||
// if there's no name
|
||||
if(NULL == name)
|
||||
return;
|
||||
bool result = this->This()->gimpl->parse_end_tag(this->This()->get_is());
|
||||
if(true != result){
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::input_stream_error)
|
||||
);
|
||||
}
|
||||
|
||||
// don't check start tag at highest level
|
||||
if(0 == --depth)
|
||||
return;
|
||||
|
||||
if(0 == (this->get_flags() & no_xml_tag_checking)){
|
||||
// double check that the tag matches what is expected - useful for debug
|
||||
if(0 != name[this->This()->gimpl->rv.object_name.size()]
|
||||
|| ! std::equal(
|
||||
this->This()->gimpl->rv.object_name.begin(),
|
||||
this->This()->gimpl->rv.object_name.end(),
|
||||
name
|
||||
)
|
||||
){
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(
|
||||
xml_archive_exception::xml_archive_tag_mismatch,
|
||||
name
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_override(object_id_type & t){
|
||||
t = object_id_type(this->This()->gimpl->rv.object_id);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_override(version_type & t){
|
||||
t = version_type(this->This()->gimpl->rv.version);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_override(class_id_type & t){
|
||||
t = class_id_type(this->This()->gimpl->rv.class_id);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_iarchive<Archive>::load_override(tracking_type & t){
|
||||
t = this->This()->gimpl->rv.tracking_level;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_iarchive<Archive>::basic_xml_iarchive(unsigned int flags) :
|
||||
detail::common_iarchive<Archive>(flags),
|
||||
depth(0)
|
||||
{}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_iarchive<Archive>::~basic_xml_iarchive(){
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
272
third_party/boost/boost/archive/impl/basic_xml_oarchive.ipp
vendored
Normal file
272
third_party/boost/boost/archive/impl/basic_xml_oarchive.ipp
vendored
Normal file
|
@ -0,0 +1,272 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// basic_xml_oarchive.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef> // NULL
|
||||
#include <cstring>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/basic_xml_oarchive.hpp>
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
namespace detail {
|
||||
template<class CharType>
|
||||
struct XML_name {
|
||||
void operator()(CharType t) const{
|
||||
const unsigned char lookup_table[] = {
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0, // -.
|
||||
1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0, // 0-9
|
||||
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // A-
|
||||
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1, // -Z _
|
||||
0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // a-
|
||||
1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0, // -z
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
|
||||
};
|
||||
if((unsigned)t > 127)
|
||||
return;
|
||||
if(0 == lookup_table[(unsigned)t])
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(
|
||||
xml_archive_exception::xml_archive_tag_name_error
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions common to both types of xml output
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::write_attribute(
|
||||
const char *attribute_name,
|
||||
int t,
|
||||
const char *conjunction
|
||||
){
|
||||
this->This()->put(' ');
|
||||
this->This()->put(attribute_name);
|
||||
this->This()->put(conjunction);
|
||||
this->This()->save(t);
|
||||
this->This()->put('"');
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::write_attribute(
|
||||
const char *attribute_name,
|
||||
const char *key
|
||||
){
|
||||
this->This()->put(' ');
|
||||
this->This()->put(attribute_name);
|
||||
this->This()->put("=\"");
|
||||
this->This()->save(key);
|
||||
this->This()->put('"');
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::indent(){
|
||||
int i;
|
||||
for(i = depth; i-- > 0;)
|
||||
this->This()->put('\t');
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_start(const char *name)
|
||||
{
|
||||
if(NULL == name)
|
||||
return;
|
||||
|
||||
// be sure name has no invalid characters
|
||||
std::for_each(name, name + std::strlen(name), detail::XML_name<const char>());
|
||||
|
||||
end_preamble();
|
||||
if(depth > 0){
|
||||
this->This()->put('\n');
|
||||
indent();
|
||||
}
|
||||
++depth;
|
||||
this->This()->put('<');
|
||||
this->This()->save(name);
|
||||
pending_preamble = true;
|
||||
indent_next = false;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_end(const char *name)
|
||||
{
|
||||
if(NULL == name)
|
||||
return;
|
||||
|
||||
// be sure name has no invalid characters
|
||||
std::for_each(name, name + std::strlen(name), detail::XML_name<const char>());
|
||||
|
||||
end_preamble();
|
||||
--depth;
|
||||
if(indent_next){
|
||||
this->This()->put('\n');
|
||||
indent();
|
||||
}
|
||||
indent_next = true;
|
||||
this->This()->put("</");
|
||||
this->This()->save(name);
|
||||
this->This()->put('>');
|
||||
if(0 == depth)
|
||||
this->This()->put('\n');
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::end_preamble(){
|
||||
if(pending_preamble){
|
||||
this->This()->put('>');
|
||||
pending_preamble = false;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const object_id_type & t)
|
||||
{
|
||||
int i = t.t; // extra .t is for borland
|
||||
write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_");
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(
|
||||
const object_reference_type & t,
|
||||
int
|
||||
){
|
||||
int i = t.t; // extra .t is for borland
|
||||
write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_");
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const version_type & t)
|
||||
{
|
||||
int i = t.t; // extra .t is for borland
|
||||
write_attribute(BOOST_ARCHIVE_XML_VERSION(), i);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const object_id_type & t)
|
||||
{
|
||||
// borland doesn't do conversion of STRONG_TYPEDEFs very well
|
||||
const unsigned int i = t;
|
||||
write_attribute(BOOST_ARCHIVE_XML_OBJECT_ID(), i, "=\"_");
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(
|
||||
const object_reference_type & t
|
||||
){
|
||||
const unsigned int i = t;
|
||||
write_attribute(BOOST_ARCHIVE_XML_OBJECT_REFERENCE(), i, "=\"_");
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const version_type & t)
|
||||
{
|
||||
const unsigned int i = t;
|
||||
write_attribute(BOOST_ARCHIVE_XML_VERSION(), i);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const class_id_type & t)
|
||||
{
|
||||
write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t);
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(
|
||||
const class_id_reference_type & t
|
||||
){
|
||||
write_attribute(BOOST_ARCHIVE_XML_CLASS_ID_REFERENCE(), t);
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(
|
||||
const class_id_optional_type & t
|
||||
){
|
||||
write_attribute(BOOST_ARCHIVE_XML_CLASS_ID(), t);
|
||||
}
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const class_name_type & t)
|
||||
{
|
||||
const char * key = t;
|
||||
if(NULL == key)
|
||||
return;
|
||||
write_attribute(BOOST_ARCHIVE_XML_CLASS_NAME(), key);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::save_override(const tracking_type & t)
|
||||
{
|
||||
write_attribute(BOOST_ARCHIVE_XML_TRACKING(), t.t);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::init(){
|
||||
// xml header
|
||||
this->This()->put("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>\n");
|
||||
this->This()->put("<!DOCTYPE boost_serialization>\n");
|
||||
// xml document wrapper - outer root
|
||||
this->This()->put("<boost_serialization");
|
||||
write_attribute("signature", BOOST_ARCHIVE_SIGNATURE());
|
||||
write_attribute("version", BOOST_ARCHIVE_VERSION());
|
||||
this->This()->put(">\n");
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL void
|
||||
basic_xml_oarchive<Archive>::windup(){
|
||||
// xml_trailer
|
||||
this->This()->put("</boost_serialization>\n");
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_oarchive<Archive>::basic_xml_oarchive(unsigned int flags) :
|
||||
detail::common_oarchive<Archive>(flags),
|
||||
depth(0),
|
||||
pending_preamble(false),
|
||||
indent_next(false)
|
||||
{
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_OR_WARCHIVE_DECL
|
||||
basic_xml_oarchive<Archive>::~basic_xml_oarchive(){
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
128
third_party/boost/boost/archive/impl/text_iarchive_impl.ipp
vendored
Normal file
128
third_party/boost/boost/archive/impl/text_iarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,128 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// text_iarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of basic_text_iprimitive overrides for the combination
|
||||
// of template parameters used to implement a text_iprimitive
|
||||
|
||||
#include <cstddef> // size_t, NULL
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp> // RogueWave
|
||||
|
||||
#include <boost/archive/text_iarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::load(char *s)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
// Works on all tested platforms
|
||||
is.read(s, size);
|
||||
s[size] = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::load(std::string &s)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != s.data())
|
||||
#endif
|
||||
s.resize(size);
|
||||
if(0 < size)
|
||||
is.read(&(*s.begin()), size);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::load(wchar_t *ws)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
is.read((char *)ws, size * sizeof(wchar_t)/sizeof(char));
|
||||
ws[size] = L'\0';
|
||||
}
|
||||
#endif // BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::load(std::wstring &ws)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != ws.data())
|
||||
#endif
|
||||
ws.resize(size);
|
||||
// skip separating space
|
||||
is.get();
|
||||
is.read((char *)ws.data(), size * sizeof(wchar_t)/sizeof(char));
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_STD_WSTRING
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::load_override(class_name_type & t){
|
||||
basic_text_iarchive<Archive>::load_override(t);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_iarchive_impl<Archive>::init(){
|
||||
basic_text_iarchive<Archive>::init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
text_iarchive_impl<Archive>::text_iarchive_impl(
|
||||
std::istream & is,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_iprimitive<std::istream>(
|
||||
is,
|
||||
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
|
122
third_party/boost/boost/archive/impl/text_oarchive_impl.ipp
vendored
Normal file
122
third_party/boost/boost/archive/impl/text_oarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// text_oarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <string>
|
||||
#include <boost/config.hpp>
|
||||
#include <cstddef> // size_t
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar>
|
||||
#ifdef BOOST_NO_STDC_NAMESPACE
|
||||
namespace std{ using ::wcslen; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <boost/archive/text_oarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of basic_text_oprimitive overrides for the combination
|
||||
// of template parameters used to create a text_oprimitive
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_oarchive_impl<Archive>::save(const char * s)
|
||||
{
|
||||
const std::size_t len = std::ostream::traits_type::length(s);
|
||||
*this->This() << len;
|
||||
this->This()->newtoken();
|
||||
os << s;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_oarchive_impl<Archive>::save(const std::string &s)
|
||||
{
|
||||
const std::size_t size = s.size();
|
||||
*this->This() << size;
|
||||
this->This()->newtoken();
|
||||
os << s;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_oarchive_impl<Archive>::save(const wchar_t * ws)
|
||||
{
|
||||
const std::size_t l = std::wcslen(ws);
|
||||
* this->This() << l;
|
||||
this->This()->newtoken();
|
||||
os.write((const char *)ws, l * sizeof(wchar_t)/sizeof(char));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_oarchive_impl<Archive>::save(const std::wstring &ws)
|
||||
{
|
||||
const std::size_t l = ws.size();
|
||||
* this->This() << l;
|
||||
this->This()->newtoken();
|
||||
os.write((const char *)(ws.data()), l * sizeof(wchar_t)/sizeof(char));
|
||||
}
|
||||
#endif
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
text_oarchive_impl<Archive>::text_oarchive_impl(
|
||||
std::ostream & os,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_oprimitive<std::ostream>(
|
||||
os,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
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>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
text_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
|
||||
put('\n');
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::ostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->delimiter = this->eol;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
118
third_party/boost/boost/archive/impl/text_wiarchive_impl.ipp
vendored
Normal file
118
third_party/boost/boost/archive/impl/text_wiarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// text_text_wiarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstddef> // size_t, NULL
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/detail/workaround.hpp> // fixup for RogueWave
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
#include <boost/archive/basic_text_iprimitive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of wiprimtives functions
|
||||
//
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_wiarchive_impl<Archive>::load(char *s)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
while(size-- > 0){
|
||||
*s++ = is.narrow(is.get(), '\0');
|
||||
}
|
||||
*s = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_wiarchive_impl<Archive>::load(std::string &s)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != s.data())
|
||||
#endif
|
||||
s.resize(0);
|
||||
s.reserve(size);
|
||||
while(size-- > 0){
|
||||
char x = is.narrow(is.get(), '\0');
|
||||
s += x;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_wiarchive_impl<Archive>::load(wchar_t *s)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
// Works on all tested platforms
|
||||
is.read(s, size);
|
||||
s[size] = L'\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_wiarchive_impl<Archive>::load(std::wstring &ws)
|
||||
{
|
||||
std::size_t size;
|
||||
* this->This() >> size;
|
||||
// skip separating space
|
||||
is.get();
|
||||
// borland complains about resize
|
||||
// borland de-allocator fixup
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != ws.data())
|
||||
#endif
|
||||
ws.resize(size);
|
||||
// note breaking a rule here - is this a problem on some platform
|
||||
is.read(const_cast<wchar_t *>(ws.data()), size);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
text_wiarchive_impl<Archive>::text_wiarchive_impl(
|
||||
std::wistream & is,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_iprimitive<std::wistream>(
|
||||
is,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_text_iarchive<Archive>(flags)
|
||||
{
|
||||
if(0 == (flags & no_header))
|
||||
basic_text_iarchive<Archive>::init();
|
||||
}
|
||||
|
||||
} // archive
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
85
third_party/boost/boost/archive/impl/text_woarchive_impl.ipp
vendored
Normal file
85
third_party/boost/boost/archive/impl/text_woarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// text_woarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <cstring>
|
||||
#include <cstddef> // size_t
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE) && ! defined(__LIBCOMO__)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include <boost/archive/text_woarchive.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// implementation of woarchive functions
|
||||
//
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_woarchive_impl<Archive>::save(const char *s)
|
||||
{
|
||||
// note: superfluous local variable fixes borland warning
|
||||
const std::size_t size = std::strlen(s);
|
||||
* this->This() << size;
|
||||
this->This()->newtoken();
|
||||
while(*s != '\0')
|
||||
os.put(os.widen(*s++));
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_woarchive_impl<Archive>::save(const std::string &s)
|
||||
{
|
||||
const std::size_t size = s.size();
|
||||
* this->This() << size;
|
||||
this->This()->newtoken();
|
||||
const char * cptr = s.data();
|
||||
for(std::size_t i = size; i-- > 0;)
|
||||
os.put(os.widen(*cptr++));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_woarchive_impl<Archive>::save(const wchar_t *ws)
|
||||
{
|
||||
const std::size_t size = std::wostream::traits_type::length(ws);
|
||||
* this->This() << size;
|
||||
this->This()->newtoken();
|
||||
os.write(ws, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
text_woarchive_impl<Archive>::save(const std::wstring &ws)
|
||||
{
|
||||
const std::size_t size = ws.length();
|
||||
* this->This() << size;
|
||||
this->This()->newtoken();
|
||||
os.write(ws.data(), size);
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
199
third_party/boost/boost/archive/impl/xml_iarchive_impl.ipp
vendored
Normal file
199
third_party/boost/boost/archive/impl/xml_iarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,199 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_iarchive_impl.cpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cstring> // memcpy
|
||||
#include <cstddef> // NULL
|
||||
#include <exception>
|
||||
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar> // mbstate_t and mbrtowc
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::mbstate_t;
|
||||
using ::mbrtowc;
|
||||
} // namespace std
|
||||
#endif
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
#include <boost/detail/workaround.hpp> // RogueWave and Dinkumware
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/xml_iarchive.hpp>
|
||||
|
||||
#include "basic_xml_grammar.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to char archives
|
||||
|
||||
// wide char stuff used by char archives
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::load(std::wstring &ws){
|
||||
std::string s;
|
||||
bool result = gimpl->parse_string(is, s);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != ws.data())
|
||||
#endif
|
||||
ws.resize(0);
|
||||
std::mbstate_t mbs = std::mbstate_t();
|
||||
const char * start = s.data();
|
||||
const char * end = start + s.size();
|
||||
while(start < end){
|
||||
wchar_t wc;
|
||||
std::size_t count = std::mbrtowc(&wc, start, end - start, &mbs);
|
||||
if(count == static_cast<std::size_t>(-1))
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
if(count == static_cast<std::size_t>(-2))
|
||||
continue;
|
||||
start += count;
|
||||
ws += wc;
|
||||
}
|
||||
}
|
||||
#endif // BOOST_NO_STD_WSTRING
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::load(wchar_t * ws){
|
||||
std::string s;
|
||||
bool result = gimpl->parse_string(is, s);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(
|
||||
xml_archive_exception::xml_archive_parsing_error
|
||||
)
|
||||
);
|
||||
|
||||
std::mbstate_t mbs = std::mbstate_t();
|
||||
const char * start = s.data();
|
||||
const char * end = start + s.size();
|
||||
while(start < end){
|
||||
wchar_t wc;
|
||||
std::size_t length = std::mbrtowc(&wc, start, end - start, &mbs);
|
||||
if(static_cast<std::size_t>(-1) == length)
|
||||
boost::serialization::throw_exception(
|
||||
iterators::dataflow_exception(
|
||||
iterators::dataflow_exception::invalid_conversion
|
||||
)
|
||||
);
|
||||
if(static_cast<std::size_t>(-2) == length)
|
||||
continue;
|
||||
|
||||
start += length;
|
||||
*ws++ = wc;
|
||||
}
|
||||
*ws = L'\0';
|
||||
}
|
||||
#endif // BOOST_NO_INTRINSIC_WCHAR_T
|
||||
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::load(std::string &s){
|
||||
bool result = gimpl->parse_string(is, s);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::load(char * s){
|
||||
std::string tstring;
|
||||
bool result = gimpl->parse_string(is, tstring);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
std::memcpy(s, tstring.data(), tstring.size());
|
||||
s[tstring.size()] = 0;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::load_override(class_name_type & t){
|
||||
const std::string & s = gimpl->rv.class_name;
|
||||
if(s.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_class_name)
|
||||
);
|
||||
char * tptr = t;
|
||||
std::memcpy(tptr, s.data(), s.size());
|
||||
tptr[s.size()] = '\0';
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_iarchive_impl<Archive>::init(){
|
||||
gimpl->init(is);
|
||||
this->set_library_version(
|
||||
library_version_type(gimpl->rv.version)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_iarchive_impl<Archive>::xml_iarchive_impl(
|
||||
std::istream &is_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_iprimitive<std::istream>(
|
||||
is_,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
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(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
gimpl->windup(is);
|
||||
}
|
||||
}
|
||||
} // namespace archive
|
||||
} // namespace boost
|
142
third_party/boost/boost/archive/impl/xml_oarchive_impl.ipp
vendored
Normal file
142
third_party/boost/boost/archive/impl/xml_oarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_oarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <ostream>
|
||||
#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
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <boost/archive/wcslen.hpp>
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to char archives
|
||||
|
||||
// wide char stuff used by char archives
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
// copy chars to output escaping to xml and translating wide chars to mb chars
|
||||
template<class InputIterator>
|
||||
void save_iterator(std::ostream &os, InputIterator begin, InputIterator end){
|
||||
typedef boost::archive::iterators::mb_from_wchar<
|
||||
boost::archive::iterators::xml_escape<InputIterator>
|
||||
> translator;
|
||||
std::copy(
|
||||
translator(begin),
|
||||
translator(end),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const std::wstring & ws){
|
||||
// at least one library doesn't typedef value_type for strings
|
||||
// so rather than using string directly make a pointer iterator out of it
|
||||
// save_iterator(os, ws.data(), ws.data() + std::wcslen(ws.data()));
|
||||
save_iterator(os, ws.data(), ws.data() + ws.size());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const wchar_t * ws){
|
||||
save_iterator(os, ws, ws + std::wcslen(ws));
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // BOOST_NO_CWCHAR
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const std::string & s){
|
||||
// at least one library doesn't typedef value_type for strings
|
||||
// so rather than using string directly make a pointer iterator out of it
|
||||
typedef boost::archive::iterators::xml_escape<
|
||||
const char *
|
||||
> xml_escape_translator;
|
||||
std::copy(
|
||||
xml_escape_translator(s.data()),
|
||||
xml_escape_translator(s.data()+ s.size()),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save(const char * s){
|
||||
typedef boost::archive::iterators::xml_escape<
|
||||
const char *
|
||||
> xml_escape_translator;
|
||||
std::copy(
|
||||
xml_escape_translator(s),
|
||||
xml_escape_translator(s + std::strlen(s)),
|
||||
boost::archive::iterators::ostream_iterator<char>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl<Archive>::xml_oarchive_impl(
|
||||
std::ostream & os_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_oprimitive<std::ostream>(
|
||||
os_,
|
||||
0 != (flags & no_codecvt)
|
||||
),
|
||||
basic_xml_oarchive<Archive>(flags)
|
||||
{
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL void
|
||||
xml_oarchive_impl<Archive>::save_binary(const void *address, std::size_t count){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::ostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_ARCHIVE_DECL
|
||||
xml_oarchive_impl<Archive>::~xml_oarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header))
|
||||
this->windup();
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
189
third_party/boost/boost/archive/impl/xml_wiarchive_impl.ipp
vendored
Normal file
189
third_party/boost/boost/archive/impl/xml_wiarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,189 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_wiarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <cstring>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::memcpy;
|
||||
} //std
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp> // msvc 6.0 needs this to suppress warnings
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm> // std::copy
|
||||
#include <exception> // uncaught exception
|
||||
#include <boost/detail/workaround.hpp> // Dinkumware and RogueWave
|
||||
#if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, == 1)
|
||||
#include <boost/archive/dinkumware.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/io/ios_state.hpp>
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/serialization/string.hpp>
|
||||
|
||||
#include <boost/archive/basic_xml_archive.hpp>
|
||||
#include <boost/archive/xml_wiarchive.hpp>
|
||||
|
||||
#include <boost/archive/xml_archive_exception.hpp>
|
||||
#include <boost/archive/iterators/mb_from_wchar.hpp>
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include "basic_xml_grammar.hpp"
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to wide char archives
|
||||
|
||||
namespace { // anonymous
|
||||
|
||||
void copy_to_ptr(char * s, const std::wstring & ws){
|
||||
std::copy(
|
||||
iterators::mb_from_wchar<std::wstring::const_iterator>(
|
||||
ws.begin()
|
||||
),
|
||||
iterators::mb_from_wchar<std::wstring::const_iterator>(
|
||||
ws.end()
|
||||
),
|
||||
s
|
||||
);
|
||||
s[ws.size()] = 0;
|
||||
}
|
||||
|
||||
} // anonymous
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::load(std::string & s){
|
||||
std::wstring ws;
|
||||
bool result = gimpl->parse_string(is, ws);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
#if BOOST_WORKAROUND(_RWSTD_VER, BOOST_TESTED_AT(20101))
|
||||
if(NULL != s.data())
|
||||
#endif
|
||||
s.resize(0);
|
||||
s.reserve(ws.size());
|
||||
std::copy(
|
||||
iterators::mb_from_wchar<std::wstring::iterator>(
|
||||
ws.begin()
|
||||
),
|
||||
iterators::mb_from_wchar<std::wstring::iterator>(
|
||||
ws.end()
|
||||
),
|
||||
std::back_inserter(s)
|
||||
);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::load(std::wstring & ws){
|
||||
bool result = gimpl->parse_string(is, ws);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::load(char * s){
|
||||
std::wstring ws;
|
||||
bool result = gimpl->parse_string(is, ws);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
copy_to_ptr(s, ws);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::load(wchar_t * ws){
|
||||
std::wstring twstring;
|
||||
bool result = gimpl->parse_string(is, twstring);
|
||||
if(! result)
|
||||
boost::serialization::throw_exception(
|
||||
xml_archive_exception(xml_archive_exception::xml_archive_parsing_error)
|
||||
);
|
||||
std::memcpy(ws, twstring.c_str(), twstring.size());
|
||||
ws[twstring.size()] = L'\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::load_override(class_name_type & t){
|
||||
const std::wstring & ws = gimpl->rv.class_name;
|
||||
if(ws.size() > BOOST_SERIALIZATION_MAX_KEY_SIZE - 1)
|
||||
boost::serialization::throw_exception(
|
||||
archive_exception(archive_exception::invalid_class_name)
|
||||
);
|
||||
copy_to_ptr(t, ws);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_wiarchive_impl<Archive>::init(){
|
||||
gimpl->init(is);
|
||||
this->set_library_version(
|
||||
library_version_type(gimpl->rv.version)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_wiarchive_impl<Archive>::xml_wiarchive_impl(
|
||||
std::wistream &is_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_iprimitive<std::wistream>(
|
||||
is_,
|
||||
true // don't change the codecvt - use the one below
|
||||
),
|
||||
basic_xml_iarchive<Archive>(flags),
|
||||
gimpl(new xml_wgrammar())
|
||||
{
|
||||
if(0 == (flags & no_codecvt)){
|
||||
archive_locale = std::locale(
|
||||
is_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
// libstdc++ crashes without this
|
||||
is_.sync();
|
||||
is_.imbue(archive_locale);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_wiarchive_impl<Archive>::~xml_wiarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
gimpl->windup(is);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_NO_STD_WSTREAMBUF
|
170
third_party/boost/boost/archive/impl/xml_woarchive_impl.ipp
vendored
Normal file
170
third_party/boost/boost/archive/impl/xml_woarchive_impl.ipp
vendored
Normal file
|
@ -0,0 +1,170 @@
|
|||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// xml_woarchive_impl.ipp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_STD_WSTREAMBUF
|
||||
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
#include <algorithm> // std::copy
|
||||
#include <locale>
|
||||
#include <exception>
|
||||
|
||||
#include <cstring> // strlen
|
||||
#include <cstdlib> // mbtowc
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar> // wcslen
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::strlen;
|
||||
#if ! defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
using ::mbtowc;
|
||||
using ::wcslen;
|
||||
#endif
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/xml_woarchive.hpp>
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
|
||||
#include <boost/archive/iterators/xml_escape.hpp>
|
||||
#include <boost/archive/iterators/wchar_from_mb.hpp>
|
||||
#include <boost/archive/iterators/ostream_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// implemenations of functions specific to wide char archives
|
||||
|
||||
// copy chars to output escaping to xml and widening characters as we go
|
||||
template<class InputIterator>
|
||||
void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){
|
||||
typedef iterators::wchar_from_mb<
|
||||
iterators::xml_escape<InputIterator>
|
||||
> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(begin),
|
||||
xmbtows(end),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const std::string & s){
|
||||
// note: we don't use s.begin() and s.end() because dinkumware
|
||||
// doesn't have string::value_type defined. So use a wrapper
|
||||
// around these values to implement the definitions.
|
||||
const char * begin = s.data();
|
||||
const char * end = begin + s.size();
|
||||
save_iterator(os, begin, end);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_STD_WSTRING
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const std::wstring & ws){
|
||||
#if 0
|
||||
typedef iterators::xml_escape<std::wstring::const_iterator> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws.begin()),
|
||||
xmbtows(ws.end()),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
#endif
|
||||
typedef iterators::xml_escape<const wchar_t *> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws.data()),
|
||||
xmbtows(ws.data() + ws.size()),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
#endif //BOOST_NO_STD_WSTRING
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const char * s){
|
||||
save_iterator(os, s, s + std::strlen(s));
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save(const wchar_t * ws){
|
||||
typedef iterators::xml_escape<const wchar_t *> xmbtows;
|
||||
std::copy(
|
||||
xmbtows(ws),
|
||||
xmbtows(ws + std::wcslen(ws)),
|
||||
boost::archive::iterators::ostream_iterator<wchar_t>(os)
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl<Archive>::xml_woarchive_impl(
|
||||
std::wostream & os_,
|
||||
unsigned int flags
|
||||
) :
|
||||
basic_text_oprimitive<std::wostream>(
|
||||
os_,
|
||||
true // don't change the codecvt - use the one below
|
||||
),
|
||||
basic_xml_oarchive<Archive>(flags)
|
||||
{
|
||||
if(0 == (flags & no_codecvt)){
|
||||
archive_locale = std::locale(
|
||||
os_.getloc(),
|
||||
new boost::archive::detail::utf8_codecvt_facet
|
||||
);
|
||||
os_.flush();
|
||||
os_.imbue(archive_locale);
|
||||
}
|
||||
if(0 == (flags & no_header))
|
||||
this->init();
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL
|
||||
xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
|
||||
if(std::uncaught_exception())
|
||||
return;
|
||||
if(0 == (this->get_flags() & no_header)){
|
||||
os << L"</boost_serialization>";
|
||||
}
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
BOOST_WARCHIVE_DECL void
|
||||
xml_woarchive_impl<Archive>::save_binary(
|
||||
const void *address,
|
||||
std::size_t count
|
||||
){
|
||||
this->end_preamble();
|
||||
#if ! defined(__MWERKS__)
|
||||
this->basic_text_oprimitive<std::wostream>::save_binary(
|
||||
#else
|
||||
this->basic_text_oprimitive::save_binary(
|
||||
#endif
|
||||
address,
|
||||
count
|
||||
);
|
||||
this->indent_next = true;
|
||||
}
|
||||
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif //BOOST_NO_STD_WSTREAMBUF
|
109
third_party/boost/boost/archive/iterators/base64_from_binary.hpp
vendored
Normal file
109
third_party/boost/boost/archive/iterators/base64_from_binary.hpp
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// base64_from_binary.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef> // size_t
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::size_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// convert binary integers to base64 characters
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class CharType>
|
||||
struct from_6_bit {
|
||||
typedef CharType result_type;
|
||||
CharType operator()(CharType t) const{
|
||||
static const char * lookup_table =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789"
|
||||
"+/";
|
||||
BOOST_ASSERT(t < 64);
|
||||
return lookup_table[static_cast<size_t>(t)];
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// note: what we would like to do is
|
||||
// template<class Base, class CharType = typename Base::value_type>
|
||||
// typedef transform_iterator<
|
||||
// from_6_bit<CharType>,
|
||||
// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType>
|
||||
// > base64_from_binary;
|
||||
// but C++ won't accept this. Rather than using a "type generator" and
|
||||
// using a different syntax, make a derivation which should be equivalent.
|
||||
//
|
||||
// Another issue addressed here is that the transform_iterator doesn't have
|
||||
// a templated constructor. This makes it incompatible with the dataflow
|
||||
// ideal. This is also addressed here.
|
||||
|
||||
//template<class Base, class CharType = typename Base::value_type>
|
||||
template<
|
||||
class Base,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
>
|
||||
class base64_from_binary :
|
||||
public transform_iterator<
|
||||
detail::from_6_bit<CharType>,
|
||||
Base
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef transform_iterator<
|
||||
typename detail::from_6_bit<CharType>,
|
||||
Base
|
||||
> super_t;
|
||||
|
||||
public:
|
||||
// make composible buy using templated constructor
|
||||
template<class T>
|
||||
base64_from_binary(T start) :
|
||||
super_t(
|
||||
Base(static_cast< T >(start)),
|
||||
detail::from_6_bit<CharType>()
|
||||
)
|
||||
{}
|
||||
// intel 7.1 doesn't like default copy constructor
|
||||
base64_from_binary(const base64_from_binary & rhs) :
|
||||
super_t(
|
||||
Base(rhs.base_reference()),
|
||||
detail::from_6_bit<CharType>()
|
||||
)
|
||||
{}
|
||||
// base64_from_binary(){};
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_BASE64_FROM_BINARY_HPP
|
118
third_party/boost/boost/archive/iterators/binary_from_base64.hpp
vendored
Normal file
118
third_party/boost/boost/archive/iterators/binary_from_base64.hpp
vendored
Normal file
|
@ -0,0 +1,118 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// binary_from_base64.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/serialization/throw_exception.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/archive/iterators/dataflow_exception.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// convert base64 characters to binary data
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<class CharType>
|
||||
struct to_6_bit {
|
||||
typedef CharType result_type;
|
||||
CharType operator()(CharType t) const{
|
||||
static const signed char lookup_table[] = {
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
|
||||
52,53,54,55,56,57,58,59,60,61,-1,-1,-1, 0,-1,-1, // render '=' as 0
|
||||
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
|
||||
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
|
||||
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,
|
||||
41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1
|
||||
};
|
||||
// metrowerks trips this assertion - how come?
|
||||
#if ! defined(__MWERKS__)
|
||||
BOOST_STATIC_ASSERT(128 == sizeof(lookup_table));
|
||||
#endif
|
||||
signed char value = -1;
|
||||
if((unsigned)t <= 127)
|
||||
value = lookup_table[(unsigned)t];
|
||||
if(-1 == value)
|
||||
boost::serialization::throw_exception(
|
||||
dataflow_exception(dataflow_exception::invalid_base64_character)
|
||||
);
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// note: what we would like to do is
|
||||
// template<class Base, class CharType = typename Base::value_type>
|
||||
// typedef transform_iterator<
|
||||
// from_6_bit<CharType>,
|
||||
// transform_width<Base, 6, sizeof(Base::value_type) * 8, CharType>
|
||||
// > base64_from_binary;
|
||||
// but C++ won't accept this. Rather than using a "type generator" and
|
||||
// using a different syntax, make a derivation which should be equivalent.
|
||||
//
|
||||
// Another issue addressed here is that the transform_iterator doesn't have
|
||||
// a templated constructor. This makes it incompatible with the dataflow
|
||||
// ideal. This is also addressed here.
|
||||
|
||||
template<
|
||||
class Base,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
>
|
||||
class binary_from_base64 : public
|
||||
transform_iterator<
|
||||
detail::to_6_bit<CharType>,
|
||||
Base
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef transform_iterator<
|
||||
detail::to_6_bit<CharType>,
|
||||
Base
|
||||
> super_t;
|
||||
public:
|
||||
// make composible buy using templated constructor
|
||||
template<class T>
|
||||
binary_from_base64(T start) :
|
||||
super_t(
|
||||
Base(static_cast< T >(start)),
|
||||
detail::to_6_bit<CharType>()
|
||||
)
|
||||
{}
|
||||
// intel 7.1 doesn't like default copy constructor
|
||||
binary_from_base64(const binary_from_base64 & rhs) :
|
||||
super_t(
|
||||
Base(rhs.base_reference()),
|
||||
detail::to_6_bit<CharType>()
|
||||
)
|
||||
{}
|
||||
// binary_from_base64(){};
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_BINARY_FROM_BASE64_HPP
|
80
third_party/boost/boost/archive/iterators/dataflow_exception.hpp
vendored
Normal file
80
third_party/boost/boost/archive/iterators/dataflow_exception.hpp
vendored
Normal file
|
@ -0,0 +1,80 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// dataflow_exception.hpp:
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#include <exception>
|
||||
#endif //BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// exceptions thrown by dataflows
|
||||
//
|
||||
class dataflow_exception : public std::exception
|
||||
{
|
||||
public:
|
||||
typedef enum {
|
||||
invalid_6_bitcode,
|
||||
invalid_base64_character,
|
||||
invalid_xml_escape_sequence,
|
||||
comparison_not_permitted,
|
||||
invalid_conversion,
|
||||
other_exception
|
||||
} exception_code;
|
||||
exception_code code;
|
||||
|
||||
dataflow_exception(exception_code c = other_exception) : code(c)
|
||||
{}
|
||||
|
||||
virtual const char *what( ) const throw( )
|
||||
{
|
||||
const char *msg = "unknown exception code";
|
||||
switch(code){
|
||||
case invalid_6_bitcode:
|
||||
msg = "attempt to encode a value > 6 bits";
|
||||
break;
|
||||
case invalid_base64_character:
|
||||
msg = "attempt to decode a value not in base64 char set";
|
||||
break;
|
||||
case invalid_xml_escape_sequence:
|
||||
msg = "invalid xml escape_sequence";
|
||||
break;
|
||||
case comparison_not_permitted:
|
||||
msg = "cannot invoke iterator comparison now";
|
||||
break;
|
||||
case invalid_conversion:
|
||||
msg = "invalid multbyte/wide char conversion";
|
||||
break;
|
||||
default:
|
||||
BOOST_ASSERT(false);
|
||||
break;
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif //BOOST_ARCHIVE_ITERATORS_DATAFLOW_EXCEPTION_HPP
|
115
third_party/boost/boost/archive/iterators/escape.hpp
vendored
Normal file
115
third_party/boost/boost/archive/iterators/escape.hpp
vendored
Normal file
|
@ -0,0 +1,115 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// escape.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // NULL
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// insert escapes into text
|
||||
|
||||
template<class Derived, class Base>
|
||||
class escape :
|
||||
public boost::iterator_adaptor<
|
||||
Derived,
|
||||
Base,
|
||||
typename boost::iterator_value<Base>::type,
|
||||
single_pass_traversal_tag,
|
||||
typename boost::iterator_value<Base>::type
|
||||
>
|
||||
{
|
||||
typedef typename boost::iterator_value<Base>::type base_value_type;
|
||||
typedef typename boost::iterator_reference<Base>::type reference_type;
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
typedef typename boost::iterator_adaptor<
|
||||
Derived,
|
||||
Base,
|
||||
base_value_type,
|
||||
single_pass_traversal_tag,
|
||||
base_value_type
|
||||
> super_t;
|
||||
|
||||
typedef escape<Derived, Base> this_t;
|
||||
|
||||
void dereference_impl() {
|
||||
m_current_value = static_cast<Derived *>(this)->fill(m_bnext, m_bend);
|
||||
m_full = true;
|
||||
}
|
||||
|
||||
//Access the value referred to
|
||||
reference_type dereference() const {
|
||||
if(!m_full)
|
||||
const_cast<this_t *>(this)->dereference_impl();
|
||||
return m_current_value;
|
||||
}
|
||||
|
||||
bool equal(const this_t & rhs) const {
|
||||
if(m_full){
|
||||
if(! rhs.m_full)
|
||||
const_cast<this_t *>(& rhs)->dereference_impl();
|
||||
}
|
||||
else{
|
||||
if(rhs.m_full)
|
||||
const_cast<this_t *>(this)->dereference_impl();
|
||||
}
|
||||
if(m_bnext != rhs.m_bnext)
|
||||
return false;
|
||||
if(this->base_reference() != rhs.base_reference())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void increment(){
|
||||
if(++m_bnext < m_bend){
|
||||
m_current_value = *m_bnext;
|
||||
return;
|
||||
}
|
||||
++(this->base_reference());
|
||||
m_bnext = NULL;
|
||||
m_bend = NULL;
|
||||
m_full = false;
|
||||
}
|
||||
|
||||
// buffer to handle pending characters
|
||||
const base_value_type *m_bnext;
|
||||
const base_value_type *m_bend;
|
||||
bool m_full;
|
||||
base_value_type m_current_value;
|
||||
public:
|
||||
escape(Base base) :
|
||||
super_t(base),
|
||||
m_bnext(NULL),
|
||||
m_bend(NULL),
|
||||
m_full(false),
|
||||
m_current_value(0)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_ESCAPE_HPP
|
99
third_party/boost/boost/archive/iterators/insert_linebreaks.hpp
vendored
Normal file
99
third_party/boost/boost/archive/iterators/insert_linebreaks.hpp
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// insert_linebreaks.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{ using ::memcpy; }
|
||||
#endif
|
||||
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/iterator_traits.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// insert line break every N characters
|
||||
template<
|
||||
class Base,
|
||||
int N,
|
||||
class CharType = typename boost::iterator_value<Base>::type
|
||||
>
|
||||
class insert_linebreaks :
|
||||
public iterator_adaptor<
|
||||
insert_linebreaks<Base, N, CharType>,
|
||||
Base,
|
||||
CharType,
|
||||
single_pass_traversal_tag,
|
||||
CharType
|
||||
>
|
||||
{
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
typedef iterator_adaptor<
|
||||
insert_linebreaks<Base, N, CharType>,
|
||||
Base,
|
||||
CharType,
|
||||
single_pass_traversal_tag,
|
||||
CharType
|
||||
> super_t;
|
||||
|
||||
bool equal(const insert_linebreaks<Base, N, CharType> & rhs) const {
|
||||
return
|
||||
// m_count == rhs.m_count
|
||||
// && base_reference() == rhs.base_reference()
|
||||
this->base_reference() == rhs.base_reference()
|
||||
;
|
||||
}
|
||||
|
||||
void increment() {
|
||||
if(m_count == N){
|
||||
m_count = 0;
|
||||
return;
|
||||
}
|
||||
++m_count;
|
||||
++(this->base_reference());
|
||||
}
|
||||
CharType dereference() const {
|
||||
if(m_count == N)
|
||||
return '\n';
|
||||
return * (this->base_reference());
|
||||
}
|
||||
unsigned int m_count;
|
||||
public:
|
||||
// make composible buy using templated constructor
|
||||
template<class T>
|
||||
insert_linebreaks(T start) :
|
||||
super_t(Base(static_cast< T >(start))),
|
||||
m_count(0)
|
||||
{}
|
||||
// intel 7.1 doesn't like default copy constructor
|
||||
insert_linebreaks(const insert_linebreaks & rhs) :
|
||||
super_t(rhs.base_reference()),
|
||||
m_count(rhs.m_count)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_INSERT_LINEBREAKS_HPP
|
92
third_party/boost/boost/archive/iterators/istream_iterator.hpp
vendored
Normal file
92
third_party/boost/boost/archive/iterators/istream_iterator.hpp
vendored
Normal file
|
@ -0,0 +1,92 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// istream_iterator.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// note: this is a custom version of the standard istream_iterator.
|
||||
// This is necessary as the standard version doesn't work as expected
|
||||
// for wchar_t based streams on systems for which wchar_t not a true
|
||||
// type but rather a synonym for some integer type.
|
||||
|
||||
#include <cstddef> // NULL
|
||||
#include <istream>
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
// given a type, make an input iterator based on a pointer to that type
|
||||
template<class Elem = char>
|
||||
class istream_iterator :
|
||||
public boost::iterator_facade<
|
||||
istream_iterator<Elem>,
|
||||
Elem,
|
||||
std::input_iterator_tag,
|
||||
Elem
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
typedef istream_iterator this_t ;
|
||||
typedef typename boost::iterator_facade<
|
||||
istream_iterator<Elem>,
|
||||
Elem,
|
||||
std::input_iterator_tag,
|
||||
Elem
|
||||
> super_t;
|
||||
typedef typename std::basic_istream<Elem> istream_type;
|
||||
|
||||
bool equal(const this_t & rhs) const {
|
||||
// note: only works for comparison against end of stream
|
||||
return m_istream == rhs.m_istream;
|
||||
}
|
||||
|
||||
//Access the value referred to
|
||||
Elem dereference() const {
|
||||
return static_cast<Elem>(m_istream->peek());
|
||||
}
|
||||
|
||||
void increment(){
|
||||
if(NULL != m_istream){
|
||||
m_istream->ignore(1);
|
||||
}
|
||||
}
|
||||
|
||||
istream_type *m_istream;
|
||||
Elem m_current_value;
|
||||
public:
|
||||
istream_iterator(istream_type & is) :
|
||||
m_istream(& is)
|
||||
{
|
||||
//increment();
|
||||
}
|
||||
|
||||
istream_iterator() :
|
||||
m_istream(NULL),
|
||||
m_current_value(NULL)
|
||||
{}
|
||||
|
||||
istream_iterator(const istream_iterator<Elem> & rhs) :
|
||||
m_istream(rhs.m_istream),
|
||||
m_current_value(rhs.m_current_value)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_ISTREAM_ITERATOR_HPP
|
142
third_party/boost/boost/archive/iterators/mb_from_wchar.hpp
vendored
Normal file
142
third_party/boost/boost/archive/iterators/mb_from_wchar.hpp
vendored
Normal file
|
@ -0,0 +1,142 @@
|
|||
#ifndef BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP
|
||||
#define BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// mb_from_wchar.hpp
|
||||
|
||||
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <cstddef> // size_t
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar> // mbstate_t
|
||||
#endif
|
||||
#include <boost/config.hpp>
|
||||
#if defined(BOOST_NO_STDC_NAMESPACE)
|
||||
namespace std{
|
||||
using ::mbstate_t;
|
||||
} // namespace std
|
||||
#endif
|
||||
|
||||
#include <boost/archive/detail/utf8_codecvt_facet.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace archive {
|
||||
namespace iterators {
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// class used by text archives to translate wide strings and to char
|
||||
// strings of the currently selected locale
|
||||
template<class Base> // the input iterator
|
||||
class mb_from_wchar
|
||||
: public boost::iterator_adaptor<
|
||||
mb_from_wchar<Base>,
|
||||
Base,
|
||||
wchar_t,
|
||||
single_pass_traversal_tag,
|
||||
char
|
||||
>
|
||||
{
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
typedef typename boost::iterator_adaptor<
|
||||
mb_from_wchar<Base>,
|
||||
Base,
|
||||
wchar_t,
|
||||
single_pass_traversal_tag,
|
||||
char
|
||||
> super_t;
|
||||
|
||||
typedef mb_from_wchar<Base> this_t;
|
||||
|
||||
char dereference_impl() {
|
||||
if(! m_full){
|
||||
fill();
|
||||
m_full = true;
|
||||
}
|
||||
return m_buffer[m_bnext];
|
||||
}
|
||||
|
||||
char dereference() const {
|
||||
return (const_cast<this_t *>(this))->dereference_impl();
|
||||
}
|
||||
// test for iterator equality
|
||||
bool equal(const mb_from_wchar<Base> & rhs) const {
|
||||
// once the value is filled, the base_reference has been incremented
|
||||
// so don't permit comparison anymore.
|
||||
return
|
||||
0 == m_bend
|
||||
&& 0 == m_bnext
|
||||
&& this->base_reference() == rhs.base_reference()
|
||||
;
|
||||
}
|
||||
|
||||
void fill(){
|
||||
wchar_t value = * this->base_reference();
|
||||
const wchar_t *wend;
|
||||
char *bend;
|
||||
BOOST_VERIFY(
|
||||
m_codecvt_facet.out(
|
||||
m_mbs,
|
||||
& value, & value + 1, wend,
|
||||
m_buffer, m_buffer + sizeof(m_buffer), bend
|
||||
)
|
||||
==
|
||||
std::codecvt_base::ok
|
||||
);
|
||||
m_bnext = 0;
|
||||
m_bend = bend - m_buffer;
|
||||
}
|
||||
|
||||
void increment(){
|
||||
if(++m_bnext < m_bend)
|
||||
return;
|
||||
m_bend =
|
||||
m_bnext = 0;
|
||||
++(this->base_reference());
|
||||
m_full = false;
|
||||
}
|
||||
|
||||
boost::archive::detail::utf8_codecvt_facet m_codecvt_facet;
|
||||
std::mbstate_t m_mbs;
|
||||
// buffer to handle pending characters
|
||||
char m_buffer[9 /* MB_CUR_MAX */];
|
||||
std::size_t m_bend;
|
||||
std::size_t m_bnext;
|
||||
bool m_full;
|
||||
|
||||
public:
|
||||
// make composible buy using templated constructor
|
||||
template<class T>
|
||||
mb_from_wchar(T start) :
|
||||
super_t(Base(static_cast< T >(start))),
|
||||
m_mbs(std::mbstate_t()),
|
||||
m_bend(0),
|
||||
m_bnext(0),
|
||||
m_full(false)
|
||||
{}
|
||||
// intel 7.1 doesn't like default copy constructor
|
||||
mb_from_wchar(const mb_from_wchar & rhs) :
|
||||
super_t(rhs.base_reference()),
|
||||
m_bend(rhs.m_bend),
|
||||
m_bnext(rhs.m_bnext),
|
||||
m_full(rhs.m_full)
|
||||
{}
|
||||
};
|
||||
|
||||
} // namespace iterators
|
||||
} // namespace archive
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ARCHIVE_ITERATORS_MB_FROM_WCHAR_HPP
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue