Merged boost 1.35 branch to trunk.

This commit is contained in:
Daniel Önnerby 2008-05-09 12:33:25 +00:00
parent 42d3a4e097
commit 41fdcd8eba
1092 changed files with 81792 additions and 42811 deletions

View File

@ -150,30 +150,6 @@
<Filter
Name="boost"
>
<Filter
Name="libs"
>
<Filter
Name="system"
>
<Filter
Name="src"
>
<File
RelativePath=".\src\boost\libs\system\src\error_code.cpp"
>
</File>
</Filter>
</Filter>
</Filter>
<Filter
Name="sigslot"
>
<File
RelativePath=".\include\sigslot\sigslot.h"
>
</File>
</Filter>
</Filter>
<Filter
Name="sqlite"
@ -199,6 +175,14 @@
>
</File>
</Filter>
<Filter
Name="sigslot"
>
<File
RelativePath=".\include\sigslot\sigslot.h"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>

View File

@ -1,11 +1,12 @@
// Boost string_algo library string_algo.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-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)
// Copyright Pavol Droba 2002-2004.
//
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_ALGO_HPP
#define BOOST_STRING_ALGO_HPP
@ -20,7 +21,6 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/algorithm/string/find.hpp>
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/classification.hpp>

View File

@ -1,11 +1,12 @@
// Boost string_algo library case_conv.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CASE_CONV_HPP
#define BOOST_STRING_CASE_CONV_HPP
@ -15,6 +16,7 @@
#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>
@ -55,11 +57,10 @@ namespace boost {
const RangeT& Input,
const std::locale& Loc=std::locale())
{
return std::transform(
begin(Input),
end(Input),
Output,
::boost::algorithm::detail::to_lowerF<
return ::boost::algorithm::detail::transform_range_copy(
Output,
as_literal(Input),
::boost::algorithm::detail::to_lowerF<
typename range_value<RangeT>::type >(Loc));
}
@ -72,15 +73,10 @@ namespace boost {
const SequenceT& Input,
const std::locale& Loc=std::locale())
{
return SequenceT(
make_transform_iterator(
begin(Input),
::boost::algorithm::detail::to_lowerF<
typename range_value<SequenceT>::type >(Loc)),
make_transform_iterator(
end(Input),
::boost::algorithm::detail::to_lowerF<
typename range_value<SequenceT>::type >(Loc)));
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
Input,
::boost::algorithm::detail::to_lowerF<
typename range_value<SequenceT>::type >(Loc));
}
//! Convert to lower case
@ -96,10 +92,8 @@ namespace boost {
WritableRangeT& Input,
const std::locale& Loc=std::locale())
{
std::transform(
begin(Input),
end(Input),
begin(Input),
::boost::algorithm::detail::transform_range(
as_literal(Input),
::boost::algorithm::detail::to_lowerF<
typename range_value<WritableRangeT>::type >(Loc));
}
@ -128,11 +122,10 @@ namespace boost {
const RangeT& Input,
const std::locale& Loc=std::locale())
{
return std::transform(
begin(Input),
end(Input),
Output,
::boost::algorithm::detail::to_upperF<
return ::boost::algorithm::detail::transform_range_copy(
Output,
as_literal(Input),
::boost::algorithm::detail::to_upperF<
typename range_value<RangeT>::type >(Loc));
}
@ -145,16 +138,10 @@ namespace boost {
const SequenceT& Input,
const std::locale& Loc=std::locale())
{
return SequenceT(
make_transform_iterator(
begin(Input),
::boost::algorithm::detail::to_upperF<
typename range_value<SequenceT>::type >(Loc)),
make_transform_iterator(
end(Input),
::boost::algorithm::detail::to_upperF<
typename range_value<SequenceT>::type >(Loc)));
return ::boost::algorithm::detail::transform_range_copy<SequenceT>(
Input,
::boost::algorithm::detail::to_upperF<
typename range_value<SequenceT>::type >(Loc));
}
//! Convert to upper case
@ -170,10 +157,8 @@ namespace boost {
WritableRangeT& Input,
const std::locale& Loc=std::locale())
{
std::transform(
begin(Input),
end(Input),
begin(Input),
::boost::algorithm::detail::transform_range(
as_literal(Input),
::boost::algorithm::detail::to_upperF<
typename range_value<WritableRangeT>::type >(Loc));
}

View File

@ -1,11 +1,12 @@
// Boost string_algo library classification.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CLASSIFICATION_HPP
#define BOOST_STRING_CLASSIFICATION_HPP
@ -13,9 +14,11 @@
#include <algorithm>
#include <locale>
#include <boost/range/value_type.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/detail/classification.hpp>
#include <boost/algorithm/string/predicate_facade.hpp>
/*! \file
Classification predicates are included in the library to give
some more convenience when using algorithms like \c trim() and \c all().
@ -200,7 +203,7 @@ namespace boost {
is_any_of( const RangeT& Set )
{
return detail::is_any_ofF<
BOOST_STRING_TYPENAME range_value<RangeT>::type>(Set);
BOOST_STRING_TYPENAME range_value<RangeT>::type>(as_literal(Set));
}
//! is_from_range predicate

View File

@ -1,11 +1,12 @@
// Boost string_algo library compare.hpp header file -------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_COMPARE_HPP
#define BOOST_STRING_COMPARE_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library concept.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CONCEPT_HPP
#define BOOST_STRING_CONCEPT_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library config.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CONFIG_HPP
#define BOOST_STRING_CONFIG_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library constants.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CONSTANTS_HPP
#define BOOST_STRING_CONSTANTS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library string_funct.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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
@ -60,6 +61,49 @@ namespace boost {
const std::locale& m_Loc;
};
// 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(
begin(Input),
end(Input),
Output,
Functor);
}
// Transform a range (in-place)
template<typename RangeT, typename FunctorT>
void transform_range(
const RangeT& Input,
FunctorT Functor)
{
std::transform(
begin(Input),
end(Input),
begin(Input),
Functor);
}
template<typename SequenceT, typename RangeT, typename FunctorT>
inline SequenceT transform_range_copy(
const RangeT& Input,
FunctorT Functor)
{
return SequenceT(
make_transform_iterator(
begin(Input),
Functor),
make_transform_iterator(
end(Input),
Functor));
}
} // namespace detail
} // namespace algorithm
} // namespace boost

View File

@ -1,11 +1,12 @@
// Boost string_algo library classification.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_CLASSIFICATION_DETAIL_HPP
#define BOOST_STRING_CLASSIFICATION_DETAIL_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library find_format.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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

View File

@ -1,11 +1,12 @@
// Boost string_algo library find_format_all.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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

View File

@ -1,11 +1,12 @@
// Boost string_algo library find_format_store.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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

View File

@ -1,11 +1,12 @@
// Boost string_algo library find_iterator.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FIND_ITERATOR_DETAIL_HPP
#define BOOST_STRING_FIND_ITERATOR_DETAIL_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library finder.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FINDER_DETAIL_HPP
#define BOOST_STRING_FINDER_DETAIL_HPP
@ -18,6 +19,7 @@
#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 {

View File

@ -1,9 +1,10 @@
// Boost string_algo library formatter.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.

View File

@ -1,11 +1,12 @@
// Boost string_algo library predicate.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_PREDICATE_DETAIL_HPP
#define BOOST_STRING_PREDICATE_DETAIL_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library replace_storage.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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

View File

@ -1,11 +1,12 @@
// Boost string_algo library sequence.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_DETAIL_SEQUENCE_HPP
#define BOOST_STRING_DETAIL_SEQUENCE_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library trim.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_TRIM_DETAIL_HPP
#define BOOST_STRING_TRIM_DETAIL_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library util.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_UTIL_DETAIL_HPP
#define BOOST_STRING_UTIL_DETAIL_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library erase.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_ERASE_HPP
#define BOOST_STRING_ERASE_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library find.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FIND_HPP
#define BOOST_STRING_FIND_HPP
@ -16,8 +17,7 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/finder.hpp>
#include <boost/algorithm/string/compare.hpp>
@ -48,19 +48,21 @@ namespace boost {
*/
template<typename RangeT, typename FinderT>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
find(
RangeT& Input,
FinderT Finder)
const FinderT& Finder)
{
return Finder(begin(Input),end(Input));
iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(as_literal(Input));
return Finder(begin(lit_input),end(lit_input));
}
// find_first -----------------------------------------------//
//! Find first algorithm
/*!
Search for the first occurence of the substring in the input.
Search for the first occurrence of the substring in the input.
\param Input A string which will be searched.
\param Search A substring to be searched for.
@ -74,13 +76,12 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
find_first(
Range1T& Input,
const Range2T& Search)
{
return first_finder(Search)(
begin(Input),end(Input));
return find(Input, first_finder(Search));
}
//! Find first algorithm ( case insensitive )
@ -101,21 +102,20 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
ifind_first(
Range1T& Input,
const Range2T& Search,
const std::locale& Loc=std::locale())
{
return first_finder(Search,is_iequal(Loc))(
begin(Input),end(Input));
return find(Input, first_finder(Search,is_iequal(Loc)));
}
// find_last -----------------------------------------------//
//! Find last algorithm
/*!
Search for the last occurence of the substring in the input.
Search for the last occurrence of the substring in the input.
\param Input A string which will be searched.
\param Search A substring to be searched for.
@ -129,13 +129,12 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
find_last(
Range1T& Input,
const Range2T& Search)
{
return last_finder(Search)(
begin(Input),end(Input));
return find(Input, last_finder(Search));
}
//! Find last algorithm ( case insensitive )
@ -156,21 +155,20 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
ifind_last(
Range1T& Input,
const Range2T& Search,
const std::locale& Loc=std::locale())
{
return last_finder(Search, is_iequal(Loc))(
begin(Input),end(Input));
return find(Input, last_finder(Search, is_iequal(Loc)));
}
// find_nth ----------------------------------------------------------------------//
//! Find n-th algorithm
/*!
Search for the n-th (zero-indexed) occurence of the substring in the
Search for the n-th (zero-indexed) occurrence of the substring in the
input.
\param Input A string which will be searched.
@ -185,14 +183,13 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
find_nth(
Range1T& Input,
const Range2T& Search,
int Nth)
{
return nth_finder(Search,Nth)(
begin(Input),end(Input));
return find(Input, nth_finder(Search,Nth));
}
//! Find n-th algorithm ( case insensitive ).
@ -216,15 +213,14 @@ namespace boost {
*/
template<typename Range1T, typename Range2T>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<Range1T>::type>
BOOST_STRING_TYPENAME range_iterator<Range1T>::type>
ifind_nth(
Range1T& Input,
const Range2T& Search,
int Nth,
const std::locale& Loc=std::locale())
{
return nth_finder(Search,Nth,is_iequal(Loc))(
begin(Input),end(Input));
return find(Input, nth_finder(Search,Nth,is_iequal(Loc)));
}
// find_head ----------------------------------------------------------------------//
@ -249,13 +245,12 @@ namespace boost {
*/
template<typename RangeT>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
find_head(
RangeT& Input,
int N)
{
return head_finder(N)(
begin(Input),end(Input));
return find(Input, head_finder(N));
}
// find_tail ----------------------------------------------------------------------//
@ -281,13 +276,12 @@ namespace boost {
*/
template<typename RangeT>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
find_tail(
RangeT& Input,
int N)
{
return tail_finder(N)(
begin(Input),end(Input));
return find(Input, tail_finder(N));
}
// find_token --------------------------------------------------------------------//
@ -311,14 +305,13 @@ namespace boost {
*/
template<typename RangeT, typename PredicateT>
inline iterator_range<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
find_token(
RangeT& Input,
PredicateT Pred,
token_compress_mode_type eCompress=token_compress_off)
{
return token_finder(Pred, eCompress)(
begin(Input),end(Input));
return find(Input, token_finder(Pred, eCompress));
}
} // namespace algorithm

View File

@ -1,11 +1,12 @@
// Boost string_algo library find_format.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FIND_FORMAT_HPP
#define BOOST_STRING_FIND_FORMAT_HPP
@ -16,6 +17,7 @@
#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>
@ -68,11 +70,13 @@ namespace boost {
FormatterT,
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(as_literal(Input));
return detail::find_format_copy_impl(
Output,
Input,
lit_input,
Formatter,
Finder( begin(Input), end(Input) ) );
Finder( begin(lit_input), end(lit_input) ) );
}
//! Generic replace algorithm
@ -176,12 +180,14 @@ namespace boost {
FormatterT,
FinderT,BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(as_literal(Input));
return detail::find_format_all_copy_impl(
Output,
Input,
lit_input,
Finder,
Formatter,
Finder(begin(Input), end(Input)));
Finder(begin(lit_input), end(lit_input)));
}
//! Generic replace all algorithm

View File

@ -1,10 +1,12 @@
// Boost string_algo library find_iterator.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-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 http://www.boost.org for updates, documentation, and revision history.
// Copyright Pavol Droba 2002-2004.
//
// 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_ITERATOR_HPP
#define BOOST_STRING_FIND_ITERATOR_HPP
@ -16,7 +18,8 @@
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/detail/find_iterator.hpp>
@ -114,10 +117,12 @@ namespace boost {
find_iterator(
RangeT& Col,
FinderT Finder ) :
detail::find_iterator_base<IteratorT>(Finder,0),
m_Match(begin(Col),begin(Col)),
m_End(end(Col))
detail::find_iterator_base<IteratorT>(Finder,0)
{
iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_col(as_literal(Col));
m_Match=make_iterator_range(begin(lit_col), begin(lit_col));
m_End=end(lit_col);
increment();
}
@ -180,13 +185,13 @@ namespace boost {
*/
template<typename RangeT, typename FinderT>
inline find_iterator<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
make_find_iterator(
RangeT& Collection,
FinderT Finder)
{
return find_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
begin(Collection), end(Collection), Finder);
return find_iterator<BOOST_STRING_TYPENAME range_iterator<RangeT>::type>(
Collection, Finder);
}
// split iterator -----------------------------------------------//
@ -278,11 +283,13 @@ namespace boost {
RangeT& Col,
FinderT Finder ) :
detail::find_iterator_base<IteratorT>(Finder,0),
m_Match(begin(Col),begin(Col)),
m_Next(begin(Col)),
m_End(end(Col)),
m_bEof(false)
{
iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_col(as_literal(Col));
m_Match=make_iterator_range(begin(lit_col), begin(lit_col));
m_Next=begin(lit_col);
m_End=end(lit_col);
increment();
}
@ -356,13 +363,13 @@ namespace boost {
*/
template<typename RangeT, typename FinderT>
inline split_iterator<
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>
BOOST_STRING_TYPENAME range_iterator<RangeT>::type>
make_split_iterator(
RangeT& Collection,
FinderT Finder)
{
return split_iterator<BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type>(
begin(Collection), end(Collection), Finder);
return split_iterator<BOOST_STRING_TYPENAME range_iterator<RangeT>::type>(
Collection, Finder);
}

View File

@ -1,11 +1,12 @@
// Boost string_algo library finder.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FINDER_HPP
#define BOOST_STRING_FINDER_HPP
@ -45,35 +46,35 @@ namespace boost {
\param Comp An element comparison predicate
\return An instance of the \c first_finder object
*/
template<typename ContainerT>
template<typename RangeT>
inline detail::first_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
is_equal>
first_finder( const ContainerT& Search )
first_finder( const RangeT& Search )
{
return
detail::first_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
is_equal>( Search, is_equal() ) ;
range_const_iterator<RangeT>::type,
is_equal>( as_literal(Search), is_equal() ) ;
}
//! "First" finder
/*!
\overload
*/
template<typename ContainerT,typename PredicateT>
template<typename RangeT,typename PredicateT>
inline detail::first_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
PredicateT>
first_finder(
const ContainerT& Search, PredicateT Comp )
const RangeT& Search, PredicateT Comp )
{
return
detail::first_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Comp );
range_const_iterator<RangeT>::type,
PredicateT>( as_literal(Search), Comp );
}
//! "Last" finder
@ -86,33 +87,33 @@ namespace boost {
\param Comp An element comparison predicate
\return An instance of the \c last_finder object
*/
template<typename ContainerT>
template<typename RangeT>
inline detail::last_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
is_equal>
last_finder( const ContainerT& Search )
last_finder( const RangeT& Search )
{
return
detail::last_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
is_equal>( Search, is_equal() );
range_const_iterator<RangeT>::type,
is_equal>( as_literal(Search), is_equal() );
}
//! "Last" finder
/*!
\overload
*/
template<typename ContainerT, typename PredicateT>
template<typename RangeT, typename PredicateT>
inline detail::last_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
PredicateT>
last_finder( const ContainerT& Search, PredicateT Comp )
last_finder( const RangeT& Search, PredicateT Comp )
{
return
detail::last_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Comp ) ;
range_const_iterator<RangeT>::type,
PredicateT>( as_literal(Search), Comp ) ;
}
//! "Nth" finder
@ -126,38 +127,38 @@ namespace boost {
\param Comp An element comparison predicate
\return An instance of the \c nth_finder object
*/
template<typename ContainerT>
template<typename RangeT>
inline detail::nth_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
is_equal>
nth_finder(
const ContainerT& Search,
const RangeT& Search,
int Nth)
{
return
detail::nth_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
is_equal>( Search, Nth, is_equal() ) ;
range_const_iterator<RangeT>::type,
is_equal>( as_literal(Search), Nth, is_equal() ) ;
}
//! "Nth" finder
/*!
\overload
*/
template<typename ContainerT, typename PredicateT>
template<typename RangeT, typename PredicateT>
inline detail::nth_finderF<
BOOST_STRING_TYPENAME range_const_iterator<ContainerT>::type,
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type,
PredicateT>
nth_finder(
const ContainerT& Search,
const RangeT& Search,
int Nth,
PredicateT Comp )
{
return
detail::nth_finderF<
BOOST_STRING_TYPENAME
range_const_iterator<ContainerT>::type,
PredicateT>( Search, Nth, Comp );
range_const_iterator<RangeT>::type,
PredicateT>( as_literal(Search), Nth, Comp );
}
//! "Head" finder

View File

@ -1,11 +1,12 @@
// Boost string_algo library formatter.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FORMATTER_HPP
#define BOOST_STRING_FORMATTER_HPP
@ -13,6 +14,7 @@
#include <boost/detail/iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/detail/formatter.hpp>
@ -41,10 +43,14 @@ namespace boost {
\return An instance of the \c const_formatter object.
*/
template<typename RangeT>
inline detail::const_formatF<RangeT>
inline detail::const_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
const_formatter(const RangeT& Format)
{
return detail::const_formatF<RangeT>(Format);
return detail::const_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >(as_literal(Format));
}
//! Identity formatter
@ -55,10 +61,14 @@ namespace boost {
\return An instance of the \c identity_formatter object.
*/
template<typename RangeT>
inline detail::identity_formatF<RangeT>
inline detail::identity_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >
identity_formatter()
{
return detail::identity_formatF<RangeT>();
return detail::identity_formatF<
iterator_range<
BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> >();
}
//! Empty formatter

View File

@ -1,11 +1,12 @@
// Boost string_algo library iter_find.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_ITER_FIND_HPP
#define BOOST_STRING_ITER_FIND_HPP
@ -18,8 +19,9 @@
#include <boost/range/iterator_range.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/result_iterator.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/value_type.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/algorithm/string/concept.hpp>
#include <boost/algorithm/string/find_iterator.hpp>
@ -74,24 +76,26 @@ namespace boost {
{
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
BOOST_STRING_TYPENAME range_iterator<RangeT>::type> >();
iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(as_literal(Input));
typedef BOOST_STRING_TYPENAME
range_result_iterator<RangeT>::type input_iterator_type;
range_iterator<RangeT>::type input_iterator_type;
typedef find_iterator<input_iterator_type> find_iterator_type;
typedef detail::copy_iterator_rangeF<
BOOST_STRING_TYPENAME
range_value<SequenceSequenceT>::type,
input_iterator_type> copy_range_type;
input_iterator_type InputEnd=end(Input);
input_iterator_type InputEnd=end(lit_input);
typedef transform_iterator<copy_range_type, find_iterator_type>
transform_iter_type;
transform_iter_type itBegin=
make_transform_iterator(
find_iterator_type( begin(Input), InputEnd, Finder ),
find_iterator_type( begin(lit_input), InputEnd, Finder ),
copy_range_type());
transform_iter_type itEnd=
@ -141,24 +145,26 @@ namespace boost {
{
function_requires<
FinderConcept<FinderT,
BOOST_STRING_TYPENAME range_result_iterator<RangeT>::type> >();
BOOST_STRING_TYPENAME range_iterator<RangeT>::type> >();
iterator_range<BOOST_STRING_TYPENAME range_iterator<RangeT>::type> lit_input(as_literal(Input));
typedef BOOST_STRING_TYPENAME
range_result_iterator<RangeT>::type input_iterator_type;
range_iterator<RangeT>::type input_iterator_type;
typedef split_iterator<input_iterator_type> find_iterator_type;
typedef detail::copy_iterator_rangeF<
BOOST_STRING_TYPENAME
range_value<SequenceSequenceT>::type,
input_iterator_type> copy_range_type;
input_iterator_type InputEnd=end(Input);
input_iterator_type InputEnd=end(lit_input);
typedef transform_iterator<copy_range_type, find_iterator_type>
transform_iter_type;
transform_iter_type itBegin=
make_transform_iterator(
find_iterator_type( begin(Input), InputEnd, Finder ),
find_iterator_type( begin(lit_input), InputEnd, Finder ),
copy_range_type() );
transform_iter_type itEnd=

View File

@ -1,11 +1,12 @@
// Boost string_algo library predicate.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_PREDICATE_HPP
#define BOOST_STRING_PREDICATE_HPP
@ -15,6 +16,8 @@
#include <boost/range/end.hpp>
#include <boost/range/iterator.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/algorithm/string/compare.hpp>
#include <boost/algorithm/string/find.hpp>
@ -56,16 +59,19 @@ namespace boost {
const Range2T& Test,
PredicateT Comp)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(as_literal(Input));
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(as_literal(Test));
typedef BOOST_STRING_TYPENAME
range_const_iterator<Range1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME
range_const_iterator<Range2T>::type Iterator2T;
Iterator1T InputEnd=end(Input);
Iterator2T TestEnd=end(Test);
Iterator1T InputEnd=end(lit_input);
Iterator2T TestEnd=end(lit_test);
Iterator1T it=begin(Input);
Iterator2T pit=begin(Test);
Iterator1T it=begin(lit_input);
Iterator2T pit=begin(lit_test);
for(;
it!=InputEnd && pit!=TestEnd;
++it,++pit)
@ -135,6 +141,9 @@ namespace boost {
const Range2T& Test,
PredicateT Comp)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(as_literal(Input));
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(as_literal(Test));
typedef BOOST_STRING_TYPENAME
range_const_iterator<Range1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME boost::detail::
@ -142,10 +151,10 @@ namespace boost {
return detail::
ends_with_iter_select(
begin(Input),
end(Input),
begin(Test),
end(Test),
begin(lit_input),
end(lit_input),
begin(lit_test),
end(lit_test),
Comp,
category());
}
@ -206,14 +215,17 @@ namespace boost {
const Range2T& Test,
PredicateT Comp)
{
if (empty(Test))
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(as_literal(Input));
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(as_literal(Test));
if (empty(lit_test))
{
// Empty range is contained always
return true;
}
// Use the temporary variable to make VACPP happy
bool bResult=(first_finder(Test,Comp)(begin(Input), end(Input)));
bool bResult=(first_finder(lit_test,Comp)(begin(lit_input), end(lit_input)));
return bResult;
}
@ -274,16 +286,19 @@ namespace boost {
const Range2T& Test,
PredicateT Comp)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_input(as_literal(Input));
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_test(as_literal(Test));
typedef BOOST_STRING_TYPENAME
range_const_iterator<Range1T>::type Iterator1T;
typedef BOOST_STRING_TYPENAME
range_const_iterator<Range2T>::type Iterator2T;
Iterator1T InputEnd=end(Input);
Iterator2T TestEnd=end(Test);
Iterator1T InputEnd=end(lit_input);
Iterator2T TestEnd=end(lit_test);
Iterator1T it=begin(Input);
Iterator2T pit=begin(Test);
Iterator1T it=begin(lit_input);
Iterator2T pit=begin(lit_test);
for(;
it!=InputEnd && pit!=TestEnd;
++it,++pit)
@ -357,11 +372,14 @@ namespace boost {
const Range2T& Arg2,
PredicateT Pred)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range1T>::type> lit_arg1(as_literal(Arg1));
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<Range2T>::type> lit_arg2(as_literal(Arg2));
return std::lexicographical_compare(
begin(Arg1),
end(Arg1),
begin(Arg2),
end(Arg2),
begin(lit_arg1),
end(lit_arg1),
begin(lit_arg2),
end(lit_arg2),
Pred);
}
@ -374,12 +392,7 @@ namespace boost {
const Range1T& Arg1,
const Range2T& Arg2)
{
return std::lexicographical_compare(
begin(Arg1),
end(Arg1),
begin(Arg2),
end(Arg2),
is_less());
return lexicographical_compare(Arg1, Arg2, is_less());
}
//! Lexicographical compare predicate (case-insensitive)
@ -393,6 +406,7 @@ namespace boost {
\param Arg1 First argument
\param Arg2 Second argument
\param Loc A locale used for case insensitive comparison
\return The result of the test
\note This function provides the strong exception-safety guarantee
@ -400,14 +414,10 @@ namespace boost {
template<typename Range1T, typename Range2T>
inline bool ilexicographical_compare(
const Range1T& Arg1,
const Range2T& Arg2)
const Range2T& Arg2,
const std::locale& Loc=std::locale())
{
return std::lexicographical_compare(
begin(Arg1),
end(Arg1),
begin(Arg2),
end(Arg2),
is_iless());
return lexicographical_compare(Arg1, Arg2, is_iless(Loc));
}
@ -429,11 +439,13 @@ namespace boost {
const RangeT& Input,
PredicateT Pred)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_input(as_literal(Input));
typedef BOOST_STRING_TYPENAME
range_const_iterator<RangeT>::type Iterator1T;
Iterator1T InputEnd=end(Input);
for( Iterator1T It=begin(Input); It!=InputEnd; ++It)
Iterator1T InputEnd=end(lit_input);
for( Iterator1T It=begin(lit_input); It!=InputEnd; ++It)
{
if (!Pred(*It))
return false;

View File

@ -1,11 +1,12 @@
// Boost string_algo library predicate_facade.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_PREDICATE_FACADE_HPP
#define BOOST_STRING_PREDICATE_FACADE_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library replace.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_REPLACE_HPP
#define BOOST_STRING_REPLACE_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library sequence_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_SEQUENCE_TRAITS_HPP
#define BOOST_STRING_SEQUENCE_TRAITS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library split.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2006. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_SPLIT_HPP
#define BOOST_STRING_SPLIT_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library list_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_STD_LIST_TRAITS_HPP
#define BOOST_STRING_STD_LIST_TRAITS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library slist_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_STD_SLIST_TRAITS_HPP
#define BOOST_STRING_STD_SLIST_TRAITS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library string_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_STD_STRING_TRAITS_HPP
#define BOOST_STRING_STD_STRING_TRAITS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library std_containers_traits.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_STD_CONTAINERS_TRAITS_HPP
#define BOOST_STRING_STD_CONTAINERS_TRAITS_HPP

View File

@ -1,11 +1,12 @@
// Boost string_algo library trim.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// See http://www.boost.org/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_TRIM_HPP
#define BOOST_STRING_TRIM_HPP
@ -15,6 +16,8 @@
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/const_iterator.hpp>
#include <boost/range/as_literal.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/algorithm/string/detail/trim.hpp>
#include <boost/algorithm/string/classification.hpp>
@ -60,12 +63,14 @@ namespace boost {
const RangeT& Input,
PredicateT IsSpace)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(as_literal(Input));
std::copy(
::boost::algorithm::detail::trim_begin(
begin(Input),
end(Input),
begin(lit_range),
end(lit_range),
IsSpace ),
end(Input),
end(lit_range),
Output);
return Output;
@ -166,11 +171,13 @@ namespace boost {
const RangeT& Input,
PredicateT IsSpace )
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(as_literal(Input));
std::copy(
begin(Input),
begin(lit_range),
::boost::algorithm::detail::trim_end(
begin(Input),
end(Input),
begin(lit_range),
end(lit_range),
IsSpace ),
Output );
@ -276,16 +283,18 @@ namespace boost {
const RangeT& Input,
PredicateT IsSpace)
{
iterator_range<BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> lit_range(as_literal(Input));
BOOST_STRING_TYPENAME
range_const_iterator<RangeT>::type TrimEnd=
::boost::algorithm::detail::trim_end(
begin(Input),
end(Input),
begin(lit_range),
end(lit_range),
IsSpace);
std::copy(
detail::trim_begin(
begin(Input), TrimEnd, IsSpace),
begin(lit_range), TrimEnd, IsSpace),
TrimEnd,
Output
);

View File

@ -1,11 +1,12 @@
// Boost string_algo library yes_no_type.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-2003. 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)
// 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.
// 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

View File

@ -0,0 +1,132 @@
#ifndef BOOST_ARCHIVE_ARRAY_IARCHIVE_HPP
#define BOOST_ARCHIVE_ARRAY_IARCHIVE_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/archive/basic_archive.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/pfto.hpp>
namespace boost { namespace archive { namespace array {
// To conveniently array-optimize an input archive X:
//
// * Derive it from iarchive<X, Impl>, where Impl is an
// archive implementation base class from
// Boost.Serialization
//
// * add a member function template that implements the
// procedure for serializing arrays of T (for appropriate T)
//
// template <class T>
// load_array(serialization::array<T> &, unsigned int)
//
// * add a unary MPL lambda expression member called
// use_array_optimization whose result is convertible to
// mpl::true_ iff array elements of type T can be serialized
// with the load_array member function, and to mpl::false_ if
// the unoptimized procedure must be used.
template <class Archive>
class iarchive
: public archive::detail::common_iarchive<Archive>
{
typedef archive::detail::common_iarchive<Archive> Base;
public:
iarchive(unsigned int flags)
: archive::detail::common_iarchive<Archive>(flags)
{}
// save_override for std::vector and serialization::array dispatches to
// save_optimized with an additional argument.
//
// If that argument is of type mpl::true_, an optimized serialization is provided
// If it is false, we just forward to the default serialization in the base class
//the default version dispatches to the base class
template<class T>
void load_optimized(T &t, unsigned int version, mpl::false_)
{
Base::load_override(t, version);
}
// the optimized implementation for vector uses serialization::array
// template<class U, class Allocator>
// void load_optimized(
// std::vector<U, Allocator> &t, unsigned int version, mpl::true_)
// {
// t.clear();
// // retrieve number of elements
// serialization::collection_size_type count;
// *this->This() >> BOOST_SERIALIZATION_NVP(count);
// t.resize(count);
// if (!t.empty())
// * this->This() >> serialization::make_array(serialization::detail::get_data(t),t.size());
// }
// the optimized implementation for serialization::array uses save_array
template<class ValueType>
void load_optimized(
serialization::array<ValueType> &t, unsigned int version, mpl::true_)
{
this->This()->load_array(t,version);
}
// to load a vector:
// if the value type is trivially constructable or an optimized array save exists,
// then we can use the optimized version
// template<class ValueType, class Allocator>
// void load_override(std::vector<ValueType,Allocator> &x, unsigned int version)
// {
// typedef typename mpl::and_<
// mpl::not_<is_same<ValueType,bool> >,
// mpl::apply1<
// BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
// , ValueType>
// >::type use_optimized;
// load_optimized(x,version, use_optimized() );
// }
// dispatch loading of arrays to the optimized version where supported
template<class ValueType>
void load_override(serialization::array<ValueType> const& x, unsigned int version)
{
typedef typename mpl::apply1<
BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
, ValueType
>::type use_optimized;
load_optimized(const_cast<serialization::array<ValueType>&>(x),version,use_optimized());
}
// Load everything else in the usual way, forwarding on to the base class
template<class T>
void load_override(T & x, unsigned BOOST_PFTO int version)
{
Base::load_override(x, static_cast<unsigned int>(version));
}
};
} } } // end namespace boost::archive::array
#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP

View File

@ -0,0 +1,130 @@
#ifndef BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
#define BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP
// (C) Copyright 2005 Matthias Troyer and Dave Abrahams
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/archive/basic_archive.hpp>
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/detail/get_data.hpp>
#include <boost/type_traits/remove_const.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/apply.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/pfto.hpp>
namespace boost { namespace archive { namespace array {
// To conveniently array-optimize an output archive X:
//
// * Derive it from oarchive<X, Impl>, where Impl is an
// archive implementation base class from
// Boost.Serialization
//
// * add a member function template that implements the
// procedure for serializing arrays of T (for appropriate T)
//
// template <class T>
// save_array(serialization::array<T> const &, unsigned int)
//
// * add a unary MPL lambda expression member called
// use_array_optimization whose result is convertible to
// mpl::true_ iff array elements of type T can be serialized
// with the load_array member function, and to mpl::false_ if
// the unoptimized procedure must be used.
template <class Archive>
class oarchive
: public archive::detail::common_oarchive<Archive>
{
typedef archive::detail::common_oarchive<Archive> Base;
public:
oarchive(unsigned int flags)
: archive::detail::common_oarchive<Archive>(flags)
{}
// save_override for std::vector and serialization::array dispatches to
// save_optimized with an additional argument.
//
// If that argument is of type mpl::true_, an optimized serialization is provided
// If it is false, we just forward to the default serialization in the base class
//the default version dispatches to the base class
template<class T>
void save_optimized(T const &t, unsigned int version, mpl::false_)
{
Base::save_override(t, version);
}
// the optimized implementation for vector uses serialization::array
// template<class ValueType, class Allocator>
// void save_optimized(
// const std::vector<ValueType, Allocator> &t, unsigned int, mpl::true_)
// {
// const serialization::collection_size_type count(t.size());
// * this->This() << BOOST_SERIALIZATION_NVP(count);
// if (!t.empty())
// * this->This() << serialization::make_array(serialization::detail::get_data(t),t.size());
// }
// the optimized implementation for serialization::array uses save_array
template<class ValueType>
void save_optimized(
const serialization::array<ValueType> &t, unsigned int version, mpl::true_)
{
this->This()->save_array(t,version);
}
// to save a vector:
// if the value type is trivially constructable or an optimized array save exists,
// then we can use the optimized version
// template<class ValueType, class Allocator>
// void save_override(std::vector<ValueType,Allocator> const &x, unsigned int version)
// {
// typedef BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type value_type;
// typedef typename mpl::and_<
// mpl::not_<is_same<value_type,bool> >,
// mpl::apply1<
// BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
// , value_type>
// >::type use_optimized;
// save_optimized(x,version,use_optimized() );
// }
// dispatch saving of arrays to the optimized version where supported
template<class ValueType>
void save_override(serialization::array<ValueType> const& x, unsigned int version)
{
typedef typename mpl::apply1<
BOOST_DEDUCED_TYPENAME Archive::use_array_optimization
, BOOST_DEDUCED_TYPENAME remove_const<ValueType>::type
>::type use_optimized;
save_optimized(x,version,use_optimized());
}
// Load everything else in the usual way, forwarding on to the
// Base class
template<class T>
void save_override(T const& x, unsigned BOOST_PFTO int version)
{
Base::save_override(x, static_cast<unsigned int>(version));
}
};
} } } // end namespace boost::archive::array
#endif // BOOST_ARCHIVE_ARRAY_OARCHIVE_HPP

View File

@ -117,14 +117,4 @@ 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)
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// Make sure that the export.hpp header isn't included before any archive header
// Doing so would inhibit construction of correct mpl list of known archive
// types which in turn would inhibit instantiation of all combinations of
// serialization/archive types.
#ifdef BOOST_SERIALIZATION_EXPORT_HPP
#error "export.hpp must not be included before any archive header"
#endif
#endif //BOOST_ARCHIVE_BASIC_ARCHIVE_HPP

View File

@ -28,9 +28,9 @@
#include <boost/detail/workaround.hpp>
#include <boost/pfto.hpp>
#include <boost/archive/detail/common_iarchive.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/archive/array/iarchive.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@ -40,7 +40,7 @@ namespace archive {
// class basic_binary_iarchive - read serialized objects from a input binary stream
template<class Archive>
class basic_binary_iarchive :
public detail::common_iarchive<Archive>
public array::iarchive<Archive>
{
protected:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@ -56,11 +56,10 @@ public:
// 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;
typedef array::iarchive<Archive> array_iarchive;
template<class T>
void load_override(T & t, BOOST_PFTO int)
{
this->detail_common_iarchive::load_override(t, 0);
void load_override(T & t, BOOST_PFTO int){
this->array_iarchive::load_override(t, 0);
}
// binary files don't include the optional information
void load_override(class_id_optional_type & /* t */, int){}
@ -69,39 +68,44 @@ public:
// for these pseudo prmitive types.
void load_override(version_type & t, int){
// upto 255 versions
unsigned char x;
unsigned char x=0;
* this->This() >> x;
t = version_type(x);
}
void load_override(class_id_type & t, int){
// upto 32K classes
int_least16_t x;
int_least16_t x=0;
* this->This() >> x;
t = class_id_type(x);
}
void load_override(class_id_reference_type & t, int){
// upto 32K classes
int_least16_t x;
int_least16_t x=0;
* this->This() >> x;
t = class_id_reference_type(x);
}
void load_override(object_id_type & t, int){
// upto 2G objects
uint_least32_t x;
uint_least32_t x=0;
* this->This() >> x;
t = object_id_type(x);
}
void load_override(object_reference_type & t, int){
// upto 2G objects
uint_least32_t x;
uint_least32_t x=0;
* this->This() >> x;
t = object_reference_type(x);
}
void load_override(tracking_type & t, int){
char x;
char x=0;
* this->This() >> x;
t = (0 != x);
}
void load_override(serialization::collection_size_type & t, int){
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, int);
@ -109,7 +113,7 @@ public:
init();
basic_binary_iarchive(unsigned int flags) :
detail::common_iarchive<Archive>(flags)
array_iarchive(flags)
{}
};

View File

@ -48,6 +48,9 @@ namespace std{
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@ -86,6 +89,7 @@ public:
load_binary(& t, sizeof(t));
int i = t;
assert(0 == i || 1 == i);
(void)i; // warning suppression for release builds.
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
load(std::string &s);
@ -108,6 +112,21 @@ public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~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>
struct apply : public serialization::is_bitwise_serializable<T> {};
};
// the optimized load_array dispatches to load_binary
template <class ValueType>
void load_array(serialization::array<ValueType>& a, unsigned int)
{
load_binary(a.address(),a.count()*sizeof(ValueType));
}
void
load_binary(void *address, std::size_t count);
};
@ -146,7 +165,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
static_cast<Elem *>(address),
s
);
if(count != static_cast<std::size_t>(s))
if(scount != static_cast<std::streamsize>(s))
boost::throw_exception(
archive_exception(archive_exception::stream_error)
);
@ -157,7 +176,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load_binary(
// boost::throw_exception(archive_exception(archive_exception::stream_error));
Elem t;
scount = m_sb.sgetn(& t, 1);
if(count != 1)
if(scount != 1)
boost::throw_exception(
archive_exception(archive_exception::stream_error)
);

View File

@ -27,8 +27,10 @@
#include <boost/pfto.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/archive/detail/common_oarchive.hpp>
#include <boost/archive/array/oarchive.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/archive/array/oarchive.hpp>
namespace boost {
namespace archive {
@ -41,12 +43,9 @@ namespace archive {
// 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.
/////////////////////////////////////////////////////////////////////////
// class basic_text_iarchive - read serialized objects from a input text stream
template<class Archive>
class basic_binary_oarchive :
public detail::common_oarchive<Archive>
public array::oarchive<Archive>
{
protected:
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
@ -59,10 +58,14 @@ public:
friend class detail::interface_oarchive<Archive>;
#endif
// any datatype not specifed below will be handled by base class
typedef detail::common_oarchive<Archive> detail_common_oarchive;
typedef array::oarchive<Archive> array_oarchive;
template<class T>
void save_override(const T & t, BOOST_PFTO int){
this->array_oarchive::save_override(t, 0);
}
template<class T>
void save_override(T & t, BOOST_PFTO int){
this->detail_common_oarchive::save_override(t, 0);
this->save_override(const_cast<const T &>(t), 0);
}
// binary files don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
@ -70,22 +73,22 @@ public:
void save_override(const version_type & t, int){
// upto 255 versions
// note:t.t resolves borland ambguity
unsigned char x = t.t;
const unsigned char x = t.t;
* this->This() << x;
}
void save_override(const class_id_type & t, int){
// upto 32K classes
int_least16_t x = t.t;
const int_least16_t x = t.t;
* this->This() << x;
}
void save_override(const class_id_reference_type & t, int){
// upto 32K classes
int_least16_t x = t.t;
const int_least16_t x = t.t;
* this->This() << x;
}
void save_override(const object_id_type & t, int){
// upto 2G objects
uint_least32_t x = t.t;
const uint_least32_t x = t.t;
* this->This() << x;
}
void save_override(const object_reference_type & t, int){
@ -94,7 +97,7 @@ public:
* this->This() << x;
}
void save_override(const tracking_type & t, int){
char x = t.t;
const char x = t.t;
* this->This() << x;
}
@ -104,11 +107,17 @@ public:
* this->This() << s;
}
void save_override(const serialization::collection_size_type & t, int){
// for backward compatibility, 64 bit integer or variable length integer would be preferred
unsigned int x = t.t;
* this->This() << x;
}
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
basic_binary_oarchive(unsigned int flags) :
detail::common_oarchive<Archive>(flags)
array_oarchive(flags)
{}
};

View File

@ -46,6 +46,9 @@ namespace std{
#include <boost/archive/basic_streambuf_locale_saver.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/serialization/is_bitwise_serializable.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/serialization/array.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@ -101,6 +104,7 @@ public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
init();
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
basic_binary_oprimitive(
std::basic_streambuf<Elem, Tr> & sb,
@ -109,6 +113,24 @@ public:
BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY())
~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>
struct apply : public serialization::is_bitwise_serializable<T> {};
};
// the optimized save_array dispatches to save_binary
template <class ValueType>
void save_array(serialization::array<ValueType> const& a, unsigned int)
{
save_binary(a.address(),a.count()*sizeof(ValueType));
}
void save_binary(const void *address, std::size_t count);
};

View File

@ -61,7 +61,7 @@ public:
{
this->detail_common_iarchive::load_override(t, 0);
}
#if 0
// Borland compilers has a problem with strong type. Try to fix this here
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
void load_override(version_type & t, int){
@ -70,7 +70,7 @@ public:
t.t = version_type(x);
}
#endif
#endif
// text file don't include the optional information
void load_override(class_id_optional_type & /*t*/, int){}

View File

@ -78,36 +78,39 @@ public:
// start new objects on a new line
void save_override(const object_id_type & t, int){
this->This()->newline();
// and and invoke prmitive to underlying value
// note extra .t to funciton with Borland 5.51 compiler
// and invoke prmitive to underlying value
this->This()->save(t.t);
}
void save_override(const object_reference_type & t, int){
this->This()->newline();
// and and invoke prmitive to underlying value
// note extra .t to funciton with Borland 5.51 compiler
// and invoke prmitive to underlying value
this->This()->save(t.t);
}
// note the following four overrides are necessary for some borland
// compilers(5.51) which don't handle BOOST_STRONG_TYPE properly.
void save_override(const version_type & t, int){
// note:t.t resolves borland ambguity
const unsigned int x = t.t;
* this->This() << x;
}
void save_override(const class_id_type & t, int){
// note:t.t resolves borland ambguity
const int x = t.t;
* this->This() << x;
}
void save_override(const class_id_reference_type & t, int){
// note:t.t resolves borland ambguity
const int x = t.t;
* this->This() << x;
}
// text file don't include the optional information
void save_override(const class_id_optional_type & /* t */, int){}
// note the following four overrides are necessary for some borland
// compilers which don't handle BOOST_STRONG_TYPE properly.
void save_override(const version_type & t, int){
// note:t.t resolves borland ambguity
unsigned int x = t.t;
* this->This() << x;
}
void save_override(const class_id_type & t, int){
// note:t.t resolves borland ambguity
int x = t.t;
* this->This() << x;
}
void save_override(const class_id_reference_type & t, int){
// note:t.t resolves borland ambguity
int x = t.t;
* this->This() << x;
}
void save_override(const class_name_type & t, int){
const std::string s(t);
* this->This() << s;

View File

@ -89,10 +89,8 @@ public:
void save(const bool t){
// trap usage of invalid uninitialized boolean which would
// otherwise crash on load.
#ifndef NDEBUG
int i = t;
assert(0 == i || 1 == i);
#endif
if(os.fail())
boost::throw_exception(archive_exception(archive_exception::stream_error));
os << t;

View File

@ -36,7 +36,7 @@ public:
xml_archive_tag_mismatch,
xml_archive_tag_name_error
} exception_code;
xml_archive_exception(exception_code /* c */)
xml_archive_exception(exception_code c)
{}
virtual const char *what( ) const throw( )
{

View File

@ -25,6 +25,8 @@
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/string.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
@ -60,7 +62,8 @@ public:
// If your program fails to compile here, its most likely due to
// not specifying an nvp wrapper around the variable to
// be serialized.
BOOST_STATIC_ASSERT(0 == sizeof(T));
BOOST_MPL_ASSERT((serialization::is_wrapper<T>));
this->detail_common_iarchive::load_override(t, 0);
}
// Anything not an attribute - see below - should be a name value

View File

@ -24,8 +24,11 @@
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/string.hpp>
#include <boost/mpl/assert.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
namespace boost {
namespace archive {
@ -42,8 +45,10 @@ public:
// for some inexplicable reason insertion of "class" generates compile erro
// on msvc 7.1
friend detail::interface_oarchive<Archive>;
friend class save_access;
#else
friend class detail::interface_oarchive<Archive>;
friend class save_access;
#endif
// special stuff for xml output
unsigned int depth;
@ -80,7 +85,8 @@ public:
// If your program fails to compile here, its most likely due to
// not specifying an nvp wrapper around the variable to
// be serialized.
BOOST_STATIC_ASSERT(0 == sizeof(T));
BOOST_MPL_ASSERT((serialization::is_wrapper<T>));
this->detail_common_oarchive::save_override(t, 0);
}
// special treatment for name-value pairs.

View File

@ -22,6 +22,43 @@
namespace boost {
namespace archive {
// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
// same as binary_iarchive below - without the shared_ptr_helper
class naked_binary_iarchive :
public binary_iarchive_impl<
boost::archive::naked_binary_iarchive,
std::istream::char_type,
std::istream::traits_type
>
{
public:
naked_binary_iarchive(std::istream & is, unsigned int flags = 0) :
binary_iarchive_impl<
naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
>(is, flags)
{}
naked_binary_iarchive(std::streambuf & bsb, unsigned int flags = 0) :
binary_iarchive_impl<
naked_binary_iarchive, std::istream::char_type, std::istream::traits_type
>(bsb, flags)
{}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
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.
@ -30,7 +67,8 @@ class binary_iarchive :
boost::archive::binary_iarchive,
std::istream::char_type,
std::istream::traits_type
>
>,
public detail::shared_ptr_helper
{
public:
binary_iarchive(std::istream & is, unsigned int flags = 0) :
@ -48,8 +86,7 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_iarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_iarchive)
#endif // BOOST_ARCHIVE_BINARY_IARCHIVE_HPP

View File

@ -43,11 +43,12 @@ public:
{}
};
typedef binary_oarchive naked_binary_oarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_oarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_oarchive)
#endif // BOOST_ARCHIVE_BINARY_OARCHIVE_HPP

View File

@ -27,9 +27,43 @@
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.
// same as binary_wiarchive below - without the shared_ptr_helper
class naked_binary_wiarchive :
public binary_iarchive_impl<
boost::archive::naked_binary_wiarchive,
std::wistream::char_type,
std::wistream::traits_type
>
{
public:
naked_binary_wiarchive(std::wistream & is, unsigned int flags = 0) :
binary_iarchive_impl<
naked_binary_wiarchive,
std::wistream::char_type,
std::wistream::traits_type
>(is, flags)
{}
naked_binary_wiarchive(std::wstreambuf & bsb, unsigned int flags = 0) :
binary_iarchive_impl<
naked_binary_wiarchive,
std::wistream::char_type,
std::wistream::traits_type
>(bsb, flags)
{}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class binary_wiarchive :
public binary_iarchive_impl<
binary_wiarchive, std::wistream::char_type, std::wistream::traits_type
@ -51,9 +85,8 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_wiarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_wiarchive)
#endif // BOOST_NO_STD_WSTREAMBUF
#endif // BOOST_ARCHIVE_BINARY_WIARCHIVE_HPP

View File

@ -48,12 +48,13 @@ public:
{}
};
typedef binary_woarchive naked_binary_woarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::binary_woarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::binary_woarchive)
#endif // BOOST_NO_STD_WSTREAMBUF
#endif // BOOST_ARCHIVE_BINARY_WOARCHIVE_HPP

View File

@ -20,19 +20,22 @@
#include <cstddef>
#include <boost/config.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
namespace std{
#if defined(__LIBCOMO__)
using ::mbstate_t;
#elif defined(__QNXNTO__)
using std::mbstate_t;
//using std::mbstate_t;
#elif defined(BOOST_DINKUMWARE_STDLIB) && BOOST_DINKUMWARE_STDLIB == 1
using ::mbstate_t;
#elif defined(__SGI_STL_PORT)
#elif defined(BOOST_NO_STDC_NAMESPACE)
using ::codecvt;
using ::mbstate_t;
#endif
#elif defined(BOOST_RWSTD_VER)
using ::mbstate_t;
#endif
} // namespace std
namespace boost {
@ -56,7 +59,7 @@ public:
template<>
class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
{
virtual std::codecvt_base::result
virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
do_out(
std::mbstate_t & state,
const wchar_t * first1,
@ -66,7 +69,7 @@ class codecvt_null<wchar_t> : public std::codecvt<wchar_t, char, std::mbstate_t>
char * last2,
char * & next2
) const;
virtual std::codecvt_base::result
virtual BOOST_ARCHIVE_DECL(std::codecvt_base::result)
do_in(
std::mbstate_t & state,
const char * first1,

View File

@ -13,3 +13,8 @@
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660 4275)
#endif
#if defined( __BORLANDC__ )
#pragma nopushoptwarn
#endif

View File

@ -12,3 +12,8 @@
#pragma warning(pop)
#endif
#include <boost/config/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
#if defined( __BORLANDC__ )
#pragma nopushoptwarn
#endif

View File

@ -65,16 +65,8 @@ protected:
public:
// note: NOT part of the public API.
void next_object_pointer(void *t);
void register_basic_serializer(const basic_iserializer & bis);
void
lookup_basic_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
);
void
insert_basic_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
void register_basic_serializer(
const basic_iserializer & bis
);
void load_object(
void *t,

View File

@ -62,7 +62,7 @@ class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_oarchive
virtual void vsave(const class_name_type & t) = 0;
virtual void vsave(const tracking_type t) = 0;
protected:
basic_oarchive(unsigned int flags);
basic_oarchive(unsigned int flags = 0);
// account for bogus gcc warning
#if defined(__GNUC__)
virtual
@ -70,16 +70,8 @@ protected:
~basic_oarchive();
public:
// note: NOT part of the public interface
void register_basic_serializer(const basic_oserializer & bos);
void
lookup_basic_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
);
void
insert_basic_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
void register_basic_serializer(
const basic_oserializer & bos
);
void save_object(
const void *x,

View File

@ -19,6 +19,7 @@
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
#include <boost/archive/detail/iserializer.hpp>
#include <boost/archive/detail/register_archive.hpp>
#include <boost/pfto.hpp>
namespace boost {
@ -31,6 +32,7 @@ class common_iarchive :
public basic_iarchive,
public interface_iarchive<Archive>
{
friend class interface_iarchive<Archive>;
private:
virtual void vload(version_type & t){
* this->This() >> t;
@ -61,7 +63,7 @@ protected:
void load_start(const char *name){}
void load_end(const char *name){}
// default archive initialization
common_iarchive(unsigned int flags) :
common_iarchive(unsigned int flags = 0) :
basic_iarchive(flags),
interface_iarchive<Archive>()
{}

View File

@ -19,6 +19,7 @@
#include <boost/archive/detail/basic_oarchive.hpp>
#include <boost/archive/detail/interface_oarchive.hpp>
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/register_archive.hpp>
namespace boost {
namespace archive {
@ -30,6 +31,7 @@ class common_oarchive :
public basic_oarchive,
public interface_oarchive<Archive>
{
friend class interface_oarchive<Archive>;
private:
virtual void vsave(const version_type t){
* this->This() << t;
@ -61,10 +63,9 @@ protected:
void save_override(T & t, BOOST_PFTO int){
archive::save(* this->This(), t);
}
void save_start(const char *name){}
void save_end(const char *name){}
common_oarchive(unsigned int flags) :
common_oarchive(unsigned int flags = 0) :
basic_oarchive(flags),
interface_oarchive<Archive>()
{}

View File

@ -0,0 +1,45 @@
// 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_DYNAMICALLY_INITIALIZED_DWA2006524_HPP
# define BOOST_ARCHIVE_DETAIL_DYNAMICALLY_INITIALIZED_DWA2006524_HPP
# include <boost/serialization/force_include.hpp>
namespace boost { namespace archive { namespace detail {
//
// Provides a dynamically-initialized (singleton) instance of T in a
// way that avoids LNK1179 on vc6. See http://tinyurl.com/ljdp8 or
// http://lists.boost.org/Archives/boost/2006/05/105286.php for
// details.
//
template <class T>
struct dynamically_initialized
{
protected:
static T& instance;
private:
static T& get_instance();
#if defined(__GNUC__)
// Workaround "warning: all member functions in class `
// boost::archive::detail::dynamically_initialized<T>' are private"
public:
void work_around_gcc_warning();
#endif
};
template <class T>
T& dynamically_initialized<T>::instance
= dynamically_initialized<T>::get_instance();
template <class T>
T& dynamically_initialized<T>::get_instance()
{
static T instance_;
return instance_;
}
}}} // namespace boost::archive::detail
#endif // BOOST_ARCHIVE_DETAIL_DYNAMICALLY_INITIALIZED_DWA2006524_HPP

View File

@ -28,10 +28,11 @@ class shared_ptr;
namespace serialization {
class extended_type_info;
} // namespace serialization
namespace archive {
namespace detail {
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_iserializer;
template<class Archive>
class interface_iarchive
@ -50,28 +51,13 @@ public:
}
template<class T>
const basic_pointer_iserializer * register_type(T * = NULL){
const basic_pointer_iserializer *
register_type(T * = NULL){
const basic_pointer_iserializer & bpis =
instantiate_pointer_iserializer(
static_cast<Archive *>(NULL),
static_cast<T *>(NULL)
);
pointer_iserializer<Archive, T>::get_instance();
this->This()->register_basic_serializer(bpis.get_basic_serializer());
return & bpis;
}
void lookup_helper(
const boost::serialization::extended_type_info * const eti,
boost::shared_ptr<void> & sph
){
this->This()->lookup_basic_helper(eti, sph);
}
void insert_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
){
this->This()->insert_basic_helper(eti, sph);
}
template<class T>
Archive & operator>>(T & t){
this->This()->load_override(t, 0);

View File

@ -32,7 +32,7 @@ namespace serialization {
namespace archive {
namespace detail {
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
class BOOST_ARCHIVE_OR_WARCHIVE_DECL(BOOST_PP_EMPTY()) basic_pointer_oserializer;
template<class Archive>
class interface_oarchive
@ -51,29 +51,14 @@ public:
}
template<class T>
const basic_pointer_oserializer * register_type(const T * = NULL){
const basic_pointer_oserializer *
register_type(const T * = NULL){
const basic_pointer_oserializer & bpos =
instantiate_pointer_oserializer(
static_cast<Archive *>(NULL),
static_cast<T *>(NULL)
);
pointer_oserializer<Archive, T>::get_instance();
this->This()->register_basic_serializer(bpos.get_basic_serializer());
return & bpos;
}
void lookup_helper(
const boost::serialization::extended_type_info * const eti,
boost::shared_ptr<void> & sph
){
this->This()->lookup_basic_helper(eti, sph);
}
void insert_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
){
this->This()->insert_basic_helper(eti, sph);
}
template<class T>
Archive & operator<<(T & t){
this->This()->save_override(t, 0);

View File

@ -44,6 +44,7 @@ namespace std{
#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_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
#include <boost/mpl/eval_if.hpp>
@ -57,6 +58,7 @@ namespace std{
#include <boost/mpl/list.hpp>
#include <boost/mpl/empty.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/bool.hpp>
#ifndef BOOST_SERIALIZATION_DEFAULT_TYPE_INFO
#include <boost/serialization/extended_type_info_typeid.hpp>
@ -65,7 +67,7 @@ namespace std{
#include <boost/archive/detail/basic_iarchive.hpp>
#include <boost/archive/detail/basic_iserializer.hpp>
#include <boost/archive/detail/archive_pointer_iserializer.hpp>
#include <boost/archive/archive_exception.hpp>
#include <boost/archive/detail/dynamically_initialized.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
@ -74,9 +76,9 @@ namespace std{
#include <boost/serialization/tracking.hpp>
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/binary_object.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
namespace boost {
namespace serialization {
@ -127,7 +129,7 @@ public:
return boost::serialization::tracking_level<T>::value
== boost::serialization::track_always
|| boost::serialization::tracking_level<T>::value
== boost::serialization::track_selectivly
== boost::serialization::track_selectively
&& serialized_as_pointer();
}
virtual unsigned int version() const {
@ -140,7 +142,7 @@ public:
>::type::is_polymorphic::type typex;
return typex::value;
}
static iserializer & instantiate(){
static iserializer & get_instance(){
static iserializer instance;
return instance;
}
@ -162,15 +164,14 @@ BOOST_DLLEXPORT void iserializer<Archive, T>::load_object_data(
);
}
// instantiation of this template creates a static object. Note inversion of
// normal argument order to workaround bizarre error in MSVC 6.0 which only
// manifests iftself during compiler time.
template<class T, class Archive>
class pointer_iserializer : public archive_pointer_iserializer<Archive>
template<class Archive, class T>
class pointer_iserializer
: public archive_pointer_iserializer<Archive>
, public dynamically_initialized<pointer_iserializer<Archive,T> >
{
private:
virtual const basic_iserializer & get_basic_serializer() const {
return iserializer<Archive, T>::instantiate();
return iserializer<Archive, T>::get_instance();
}
virtual BOOST_DLLEXPORT void load_object_ptr(
basic_iarchive & ar,
@ -182,32 +183,18 @@ public:
#endif
// private constructor to inhibit any existence other than the
// static one. Note GCC doesn't permit constructor to be private
explicit BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
static const pointer_iserializer instance;
BOOST_DLLEXPORT pointer_iserializer() BOOST_USED;
friend struct dynamically_initialized<pointer_iserializer<Archive,T> >;
public:
// at least one compiler (CW) seems to require that serialize_adl
// be explicitly instantiated. Still under investigation.
#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#if !defined(__BORLANDC__)
void (* const m)(Archive &, T &, const unsigned);
boost::serialization::extended_type_info * (* e)();
#endif
static BOOST_DLLEXPORT const pointer_iserializer & instantiate() BOOST_USED;
virtual ~pointer_iserializer(){};
BOOST_DLLEXPORT static const pointer_iserializer & get_instance() BOOST_USED;
};
template<class T, class Archive>
BOOST_DLLEXPORT const pointer_iserializer<T, Archive> &
pointer_iserializer<T, Archive>::instantiate() {
return instance;
}
// note: instances of this template to be constructed before the main
// is called in order for things to be initialized properly. For this
// reason, hiding the instance in a static function as was done above
// won't work here so we created a free instance here.
template<class T, class Archive>
const pointer_iserializer<T, Archive> pointer_iserializer<T, Archive>::instance;
// note trick to be sure that operator new is using class specific
// version if such exists. Due to Peter Dimov.
// note: the following fails if T has no default constructor.
@ -278,19 +265,15 @@ private:
T* m_p;
};
template<class T, class Archive>
BOOST_DLLEXPORT void pointer_iserializer<T, Archive>::load_object_ptr(
template<class Archive, class T>
BOOST_DLLEXPORT void pointer_iserializer<Archive, T>::load_object_ptr(
basic_iarchive & ar,
void * & x,
const unsigned int file_version
) const {
) const
{
Archive & ar_impl = boost::smart_cast_reference<Archive &>(ar);
// if(0 != (ar.get_flags() & no_object_creation)){
// ar_impl >> boost::serialization::make_nvp(NULL, * static_cast<T *>(x));
// return;
// }
auto_ptr_with_deleter<T> ap(heap_allocator<T>::invoke());
if(NULL == ap.get())
boost::throw_exception(std::bad_alloc()) ;
@ -312,6 +295,7 @@ BOOST_DLLEXPORT void pointer_iserializer<T, Archive>::load_object_ptr(
);
}
BOOST_CATCH(...){
ap.release();
BOOST_RETHROW;
}
BOOST_CATCH_END
@ -320,25 +304,32 @@ BOOST_DLLEXPORT void pointer_iserializer<T, Archive>::load_object_ptr(
ap.release();
}
template<class T, class Archive>
#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
BOOST_DLLEXPORT pointer_iserializer<T, Archive>::pointer_iserializer() :
template<class Archive, class T>
#if !defined(__BORLANDC__)
BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
archive_pointer_iserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
),
m(boost::serialization::serialize_adl<Archive, T>),
e(boost::serialization::type_info_implementation<T>::type::get_instance)
#else
BOOST_DLLEXPORT pointer_iserializer<T, Archive>::pointer_iserializer() :
BOOST_DLLEXPORT pointer_iserializer<Archive, T>::pointer_iserializer() :
archive_pointer_iserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
#endif
{
iserializer<Archive, T> & bis = iserializer<Archive, T>::instantiate();
iserializer<Archive, T> & bis = iserializer<Archive, T>::get_instance();
bis.set_bpis(this);
}
template<class Archive, class T>
BOOST_DLLEXPORT const pointer_iserializer<Archive, T> &
pointer_iserializer<Archive, T>::get_instance() {
// note: comeau complains without full qualification
return dynamically_initialized<pointer_iserializer<Archive,T> >::instance;
}
template<class Archive, class T>
struct load_non_pointer_type {
// note this bounces the call right back to the archive
@ -370,7 +361,7 @@ struct load_non_pointer_type {
// its not called that way - so fix it her
typedef BOOST_DEDUCED_TYPENAME boost::remove_const<T>::type typex;
void * x = & const_cast<typex &>(t);
ar.load_object(x, iserializer<Archive, T>::instantiate());
ar.load_object(x, iserializer<Archive, T>::get_instance());
}
};
@ -506,6 +497,8 @@ struct load_enum_type {
template<class Archive, class T>
struct load_array_type {
static void invoke(Archive &ar, T &t){
typedef typename remove_all_extents<T>::type value_type;
// convert integers to correct enum to load
int current_count = sizeof(t) / (
static_cast<char *>(static_cast<void *>(&t[1]))
@ -517,12 +510,11 @@ struct load_array_type {
boost::throw_exception(archive::archive_exception(
boost::archive::archive_exception::array_size_too_short
));
int i;
for(i = 0; i < count; ++i)
ar >> boost::serialization::make_nvp("item", t[i]);
ar >> serialization::make_array(static_cast<value_type*>(&t[0]),count);
}
};
#if 0
// note bogus arguments to workaround msvc 6 silent runtime failure
template<class Archive, class T>
BOOST_DLLEXPORT
@ -539,10 +531,9 @@ instantiate_pointer_iserializer(
Archive * /* ar = NULL */,
T * /* t = NULL */
){
// note: reversal of order of arguments to work around msvc 6.0 bug
// that manifests itself while trying to link.
return pointer_iserializer<T, Archive>::instantiate();
return pointer_iserializer<Archive,T>::instance;
}
#endif
} // detail
@ -572,7 +563,7 @@ inline void load(Archive &ar, T &t){
// BORLAND
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
// borland has a couple fo problems
// borland has a couple of problems
// a) if function is partiall specialized - see below
// const paramters are transformed to non-const ones
// b) implementation of base_object can't be made to work
@ -585,21 +576,19 @@ inline void load(Archive &ar, const T & t){
}
#endif
// let wrappers through. (Someday implement is_wrapper)
// let wrappers through.
#ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
template<class Archive, class T>
inline void load(Archive &ar, const serialization::nvp<T> &t){
boost::archive::load(ar, const_cast<serialization::nvp<T> &>(t));
}
template<class Archive>
inline void load(Archive &ar, const serialization::binary_object &t){
boost::archive::load(ar, const_cast<serialization::binary_object &>(t));
inline void load_wrapper(Archive &ar, const T&t, mpl::true_){
boost::archive::load(ar, const_cast<T&>(t));
}
//template<class Archive, class T>
//inline void load(Archive &ar, const serialization::binary_object &t){
// load(ar, const_cast<binary_object &>(t));
//}
#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
template<class Archive, class T>
inline void load(Archive &ar, const T&t){
load_wrapper(ar,t,serialization::is_wrapper<T>());
}
#endif
#endif
} // namespace archive

View File

@ -37,6 +37,7 @@
#include <boost/type_traits/is_volatile.hpp>
#include <boost/type_traits/is_const.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_all_extents.hpp>
#include <boost/serialization/is_abstract.hpp>
#include <boost/mpl/eval_if.hpp>
@ -57,6 +58,7 @@
#include <boost/archive/detail/basic_oarchive.hpp>
#include <boost/archive/detail/basic_oserializer.hpp>
#include <boost/archive/detail/archive_pointer_oserializer.hpp>
#include <boost/archive/detail/dynamically_initialized.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/serialization/serialization.hpp>
@ -66,6 +68,8 @@
#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/void_cast.hpp>
#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/archive/archive_exception.hpp>
@ -100,7 +104,7 @@ class oserializer : public basic_oserializer
private:
// private constructor to inhibit any existence other than the
// static one
explicit oserializer() :
explicit BOOST_DLLEXPORT oserializer() :
basic_oserializer(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
@ -118,7 +122,7 @@ public:
// if(0 != (flags & no_tracking))
// return false;
return boost::serialization::tracking_level<T>::value == boost::serialization::track_always
|| boost::serialization::tracking_level<T>::value == boost::serialization::track_selectivly
|| boost::serialization::tracking_level<T>::value == boost::serialization::track_selectively
&& serialized_as_pointer();
}
virtual unsigned int version() const {
@ -130,7 +134,7 @@ public:
>::type::is_polymorphic::type typex;
return typex::value;
}
static oserializer & instantiate(){
static oserializer & get_instance(){
static oserializer instance;
return instance;
}
@ -151,15 +155,14 @@ BOOST_DLLEXPORT void oserializer<Archive, T>::save_object_data(
);
}
// instantiation of this template creates a static object. Note inversion of
// normal argument order to workaround bizarre error in MSVC 6.0 which only
// manifests iftself during compiler time.
template<class T, class Archive>
class pointer_oserializer : public archive_pointer_oserializer<Archive>
template<class Archive, class T>
class pointer_oserializer
: public archive_pointer_oserializer<Archive>
, public dynamically_initialized<pointer_oserializer<Archive,T> >
{
private:
virtual const basic_oserializer & get_basic_serializer() const {
return oserializer<Archive, T>::instantiate();
return oserializer<Archive, T>::get_instance();
}
virtual BOOST_DLLEXPORT void save_object_ptr(
basic_oarchive & ar,
@ -171,33 +174,19 @@ public:
// private constructor to inhibit any existence other than the
// static one. Note GCC doesn't permit constructor to be private
explicit BOOST_DLLEXPORT pointer_oserializer() BOOST_USED;
static const pointer_oserializer instance;
friend struct dynamically_initialized<pointer_oserializer<Archive,T> >;
public:
#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
#if !defined(__BORLANDC__)
// at least one compiler (CW) seems to require that serialize_adl
// be explicitly instantiated. Still under investigation.
void (* const m)(Archive &, T &, const unsigned);
boost::serialization::extended_type_info * (* e)();
#endif
static BOOST_DLLEXPORT const pointer_oserializer & instantiate() BOOST_USED;
virtual ~pointer_oserializer(){}
BOOST_DLLEXPORT static const pointer_oserializer & get_instance() BOOST_USED;
};
template<class T, class Archive>
BOOST_DLLEXPORT const pointer_oserializer<T, Archive> &
pointer_oserializer<T, Archive>::instantiate(){
return instance;
}
// note: instances of this template to be constructed before the main
// is called in order for things to be initialized properly. For this
// reason, hiding the instance in a static function as was done above
// won't work here so we created a free instance here.
template<class T, class Archive>
const pointer_oserializer<T, Archive> pointer_oserializer<T, Archive>::instance;
template<class T, class Archive>
BOOST_DLLEXPORT void pointer_oserializer<T, Archive>::save_object_ptr(
template<class Archive, class T>
BOOST_DLLEXPORT void pointer_oserializer<Archive, T>::save_object_ptr(
basic_oarchive & ar,
const void * x
) const {
@ -215,26 +204,33 @@ BOOST_DLLEXPORT void pointer_oserializer<T, Archive>::save_object_ptr(
ar_impl << boost::serialization::make_nvp(NULL, * t);
}
template<class T, class Archive>
#if ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582))
BOOST_DLLEXPORT pointer_oserializer<T, Archive>::pointer_oserializer() :
template<class Archive, class T>
#if !defined(__BORLANDC__)
BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
archive_pointer_oserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
),
m(boost::serialization::serialize_adl<Archive, T>),
e(boost::serialization::type_info_implementation<T>::type::get_instance)
#else
BOOST_DLLEXPORT pointer_oserializer<T, Archive>::pointer_oserializer() :
BOOST_DLLEXPORT pointer_oserializer<Archive, T>::pointer_oserializer() :
archive_pointer_oserializer<Archive>(
* boost::serialization::type_info_implementation<T>::type::get_instance()
)
#endif
{
// make sure appropriate member function is instantiated
oserializer<Archive, T> & bos = oserializer<Archive, T>::instantiate();
oserializer<Archive, T> & bos = oserializer<Archive, T>::get_instance();
bos.set_bpos(this);
}
template<class Archive, class T>
BOOST_DLLEXPORT const pointer_oserializer<Archive, T> &
pointer_oserializer<Archive, T>::get_instance() {
// note: comeau complains without full qualification
return dynamically_initialized<pointer_oserializer<Archive,T> >::instance;
}
template<class Archive, class T>
struct save_non_pointer_type {
// note this bounces the call right back to the archive
@ -260,7 +256,7 @@ struct save_non_pointer_type {
// serialization level and class version
struct save_standard {
static void invoke(Archive &ar, const T & t){
ar.save_object(& t, oserializer<Archive, T>::instantiate());
ar.save_object(& t, oserializer<Archive, T>::get_instance());
}
};
@ -481,6 +477,8 @@ template<class Archive, class T>
struct save_array_type
{
static void invoke(Archive &ar, const T &t){
typedef typename remove_all_extents<T>::type value_type;
save_access::end_preamble(ar);
// consider alignment
int count = sizeof(t) / (
@ -488,12 +486,12 @@ struct save_array_type
- static_cast<const char *>(static_cast<const void *>(&t[0]))
);
ar << BOOST_SERIALIZATION_NVP(count);
int i;
for(i = 0; i < count; ++i)
ar << boost::serialization::make_nvp("item", t[i]);
ar << serialization::make_array(static_cast<value_type const*>(&t[0]),count);
}
};
#if 0
// note bogus arguments to workaround msvc 6 silent runtime failure
// declaration to satisfy gcc
template<class Archive, class T>
@ -509,10 +507,9 @@ instantiate_pointer_oserializer(
Archive * /* ar = NULL */,
T * /* t = NULL */
){
// note: reversal of order of arguments to work around msvc 6.0 bug
// that manifests itself while trying to link.
return pointer_oserializer<T, Archive>::instantiate();
return pointer_oserializer<Archive, T>::instance;
}
#endif
} // detail
@ -557,12 +554,13 @@ struct check_tracking {
template<class Archive, class T>
inline void save(Archive & ar, T &t){
// if your program traps here, it indicates taht your doing one of the following:
// if your program traps here, it indicates that your doing one of the following:
// a) serializing an object of a type marked "track_never" through a pointer.
// b) saving an non-const object of a type not markd "track_never)
// Either of these conditions may be an indicator of an error usage of the
// serialization library and should be double checked. See documentation on
// object tracking.
// object tracking. Also, see the "rationale" section of the documenation
// for motivation for this checking.
BOOST_STATIC_ASSERT(check_tracking<T>::value);
save(ar, const_cast<const T &>(t));
}

View File

@ -0,0 +1,47 @@
// 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
# include <boost/type_traits/add_pointer.hpp>
namespace boost { namespace archive { namespace detail {
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;
};
// 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) {}
// 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* ); \
\
}}}
}}} // namespace boost::archive::detail
#endif // BOOST_ARCHIVE_DETAIL_INSTANTIATE_SERIALIZE_DWA2006521_HPP

View File

@ -1,9 +1,8 @@
// Copyright © 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). Permission to copy,
// use, modify, sell and distribute this software is granted provided this
// copyright notice appears in all copies. This software is provided "as is"
// without express or implied warranty, and with no claim as to its suitability
// for any purpose.
// 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

View File

@ -79,7 +79,7 @@ basic_binary_iprimitive<Archive, Elem, Tr>::load(wchar_t * ws)
{
std::size_t l;
this->This()->load(l);
load_binary(ws, l);
load_binary(ws, l * sizeof(wchar_t) / sizeof(char));
ws[l / sizeof(wchar_t)] = L'\0';
}

View File

@ -144,7 +144,7 @@ basic_xml_oarchive<Archive>::end_preamble(){
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)
@ -168,6 +168,29 @@ basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
int i = t.t; // extra .t is for borland
write_attribute(VERSION(), i);
}
#endif
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const object_id_type & t, int)
{
write_attribute(OBJECT_ID(), t, "=\"_");
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(
const object_reference_type & t,
int
){
write_attribute(OBJECT_REFERENCE(), t, "=\"_");
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const version_type & t, int)
{
write_attribute(VERSION(), t);
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const class_id_type & t, int)
@ -199,11 +222,12 @@ basic_xml_oarchive<Archive>::save_override(const class_name_type & t, int)
return;
write_attribute(CLASS_NAME(), key);
}
template<class Archive>
BOOST_ARCHIVE_OR_WARCHIVE_DECL(void)
basic_xml_oarchive<Archive>::save_override(const tracking_type & t, int)
{
write_attribute(TRACKING(), t.t); // extra .t is for borland
write_attribute(TRACKING(), t.t);
}
template<class Archive>

View File

@ -32,6 +32,7 @@ namespace std{
#include <boost/archive/detail/iserializer.hpp>
#include <boost/archive/detail/interface_iarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/archive/detail/register_archive.hpp>
// determine if its necessary to handle (u)int64_t specifically
// i.e. that its not a synonym for (unsigned) long
@ -54,7 +55,9 @@ namespace detail {
class basic_iserializer;
}
class polymorphic_iarchive :
class polymorphic_iarchive;
class polymorphic_iarchive_impl :
public detail::interface_iarchive<polymorphic_iarchive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@ -98,21 +101,13 @@ public:
virtual void load_start(const char * name) = 0;
virtual void load_end(const char * name) = 0;
virtual void register_basic_serializer(const detail::basic_iserializer & bis) = 0;
virtual void lookup_basic_helper(
const boost::serialization::extended_type_info * const eti,
boost::shared_ptr<void> & sph
) = 0;
virtual void insert_basic_helper(
const boost::serialization::extended_type_info * const eti,
boost::shared_ptr<void> & sph
) = 0;
// msvc and borland won't automatically pass these to the base class so
// make it explicit here
template<class T>
void load_override(T & t, BOOST_PFTO int)
{
archive::load(* this, t);
archive::load(* this->This(), t);
}
// special treatment for name-value pairs.
template<class T>
@ -124,9 +119,11 @@ public:
int
){
load_start(t.name());
archive::load(* this, t.value());
archive::load(* this->This(), t.value());
load_end(t.name());
}
protected:
virtual ~polymorphic_iarchive_impl(){}
public:
// utility function implemented by all legal archives
virtual void set_library_version(unsigned int archive_library_version) = 0;
@ -157,8 +154,24 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::polymorphic_iarchive)
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class polymorphic_iarchive :
public polymorphic_iarchive_impl,
public detail::shared_ptr_helper
{};
} // namespace archive
} // namespace boost
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_iarchive)
#endif // BOOST_ARCHIVE_POLYMORPHIC_IARCHIVE_HPP

View File

@ -31,6 +31,7 @@ namespace std{
#include <boost/archive/detail/oserializer.hpp>
#include <boost/archive/detail/interface_oarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/archive/detail/register_archive.hpp>
// determine if its necessary to handle (u)int64_t specifically
// i.e. that its not a synonym for (unsigned) long
@ -53,7 +54,9 @@ namespace detail {
class basic_oserializer;
}
class polymorphic_oarchive :
class polymorphic_oarchive;
class polymorphic_oarchive_impl :
public detail::interface_oarchive<polymorphic_oarchive>
{
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
@ -97,14 +100,6 @@ public:
virtual void save_start(const char * name) = 0;
virtual void save_end(const char * name) = 0;
virtual void register_basic_serializer(const detail::basic_oserializer & bos) = 0;
virtual void lookup_basic_helper(
const boost::serialization::extended_type_info * const eti,
boost::shared_ptr<void> & sph
) = 0;
virtual void insert_basic_helper(
const boost::serialization::extended_type_info * const eti,
shared_ptr<void> & sph
) = 0;
virtual void end_preamble() = 0;
@ -113,7 +108,7 @@ public:
template<class T>
void save_override(T & t, BOOST_PFTO int)
{
archive::save(* this, t);
archive::save(* this->This(), t);
}
// special treatment for name-value pairs.
template<class T>
@ -124,9 +119,11 @@ public:
::boost::serialization::nvp<T> & t, int
){
save_start(t.name());
archive::save(* this, t.const_value());
archive::save(* this->This(), t.const_value());
save_end(t.name());
}
protected:
virtual ~polymorphic_oarchive_impl(){}
public:
// utility functions implemented by all legal archives
virtual unsigned int get_flags() const = 0;
@ -143,11 +140,15 @@ public:
) = 0;
};
// note: preserve naming symmetry
class polymorphic_oarchive :
public polymorphic_oarchive_impl
{};
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::polymorphic_oarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::polymorphic_oarchive)
#endif // BOOST_ARCHIVE_POLYMORPHIC_OARCHIVE_HPP

View File

@ -0,0 +1,149 @@
#ifndef BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP
#define BOOST_ARCHIVE_SHARED_PTR_HELPER_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
// shared_ptr.hpp: serialization for boost shared pointer
// (C) Copyright 2004 Robert Ramey and Martin Ecker
// 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 <map>
#include <list>
#include <boost/config.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/serialization/shared_ptr_132.hpp>
#include <boost/throw_exception.hpp>
#include <boost/archive/archive_exception.hpp>
namespace boost_132 {
template<class T> class shared_ptr;
}
namespace boost {
template<class T> class shared_ptr;
namespace serialization {
class extended_type_info;
template<class Archive, class T>
inline void load(
Archive & ar,
boost::shared_ptr<T> &t,
const unsigned int file_version
);
}
namespace archive{
namespace detail {
struct null_deleter {
void operator()(void const *) const {}
};
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// a common class for holding various types of shared pointers
class shared_ptr_helper {
typedef std::map<void*, shared_ptr<void> > collection_type;
typedef collection_type::const_iterator iterator_type;
// list of shared_pointers create accessable by raw pointer. This
// is used to "match up" shared pointers loaded at different
// points in the archive. Note, we delay construction until
// it is actually used since this is by default included as
// a "mix-in" even if shared_ptr isn't used.
collection_type * m_pointers;
#ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
public:
#else
template<class Archive, class T>
friend inline void boost::serialization::load(
Archive & ar,
boost::shared_ptr<T> &t,
const unsigned int file_version
);
#endif
// list of loaded pointers. This is used to be sure that the pointers
// stay around long enough to be "matched" with other pointers loaded
// by the same archive. These are created with a "null_deleter" so that
// when this list is destroyed - the underlaying raw pointers are not
// destroyed. This has to be done because the pointers are also held by
// new system which is disjoint from this set. This is implemented
// by a change in load_construct_data below. It makes this file suitable
// only for loading pointers into a 1.33 or later boost system.
std::list<boost_132::shared_ptr<void> > * m_pointers_132;
// return a void pointer to the most derived type
template<class T>
void * object_identifier(T * t) const {
const boost::serialization::extended_type_info * true_type
= boost::serialization::type_info_implementation<T>::type
::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::throw_exception(
boost::archive::archive_exception(
boost::archive::archive_exception::unregistered_class
)
);
const boost::serialization::extended_type_info * this_type
= boost::serialization::type_info_implementation<T>::type::get_instance();
void * vp = void_downcast(*true_type, *this_type, t);
return vp;
}
template<class T>
void reset(shared_ptr<T> & s, T * r){
if(NULL == r){
s.reset();
return;
}
// get pointer to the most derived object. This is effectively
// the object identifer
void * od = object_identifier(r);
if(NULL == m_pointers)
m_pointers = new collection_type;
iterator_type it = m_pointers->find(od);
if(it == m_pointers->end()){
s.reset(r);
m_pointers->insert(collection_type::value_type(od,s));
}
else{
s = static_pointer_cast<T>((*it).second);
}
}
void append(const boost_132::shared_ptr<void> & t){
if(NULL == m_pointers_132)
m_pointers_132 = new std::list<boost_132::shared_ptr<void> >;
m_pointers_132->push_back(t);
}
public:
shared_ptr_helper() :
m_pointers(NULL),
m_pointers_132(NULL)
{}
~shared_ptr_helper(){
if(NULL != m_pointers)
delete m_pointers;
if(NULL != m_pointers_132)
delete m_pointers_132;
}
};
} // namespace detail
} // namespace serialization
} // namespace boost
#endif // BOOST_ARCHIVE_SHARED_PTR_HELPER_HPP

View File

@ -21,6 +21,7 @@
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/archive/basic_text_iprimitive.hpp>
#include <boost/archive/basic_text_iarchive.hpp>
#include <boost/config.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
@ -73,14 +74,38 @@ protected:
~text_iarchive_impl(){};
};
// do not derive from this class. If you want to extend this functionality
// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
class text_iarchive :
public text_iarchive_impl<text_iarchive>
// same as text_iarchive below - without the shared_ptr_helper
class naked_text_iarchive :
public text_iarchive_impl<naked_text_iarchive>
{
public:
naked_text_iarchive(std::istream & is, unsigned int flags = 0) :
text_iarchive_impl<naked_text_iarchive>(is, flags)
{}
~naked_text_iarchive(){}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class text_iarchive :
public text_iarchive_impl<text_iarchive>,
public detail::shared_ptr_helper
{
public:
text_iarchive(std::istream & is, unsigned int flags = 0) :
text_iarchive_impl<text_iarchive>(is, flags)
{}
@ -90,9 +115,8 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_iarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_iarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -88,12 +88,13 @@ public:
~text_oarchive(){}
};
typedef text_oarchive naked_text_oarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_oarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_oarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -72,11 +72,36 @@ protected:
~text_wiarchive_impl(){};
};
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from text_wiarchive_impl instead. This will
// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
// same as text_wiarchive below - without the shared_ptr_helper
class naked_text_wiarchive :
public text_wiarchive_impl<naked_text_wiarchive>
{
public:
naked_text_wiarchive(std::wistream & is, unsigned int flags = 0) :
text_wiarchive_impl<naked_text_wiarchive>(is, flags)
{}
~naked_text_wiarchive(){}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class text_wiarchive :
public text_wiarchive_impl<text_wiarchive>
public text_wiarchive_impl<text_wiarchive>,
public detail::shared_ptr_helper
{
public:
text_wiarchive(std::wistream & is, unsigned int flags = 0) :
@ -88,9 +113,8 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_wiarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_wiarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -114,12 +114,13 @@ public:
~text_woarchive(){}
};
typedef text_woarchive naked_text_woarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::text_woarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::text_woarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -83,14 +83,36 @@ protected:
~xml_iarchive_impl();
};
// we use the following because we can't use
// typedef xml_iarchive_impl<xml_iarchive_impl<...> > xml_iarchive;
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from xml_iarchive_impl instead. This will
// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
// same as xml_iarchive below - without the shared_ptr_helper
class naked_xml_iarchive :
public xml_iarchive_impl<naked_xml_iarchive>
{
public:
naked_xml_iarchive(std::istream & is, unsigned int flags = 0) :
xml_iarchive_impl<naked_xml_iarchive>(is, flags)
{}
~naked_xml_iarchive(){}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class xml_iarchive :
public xml_iarchive_impl<xml_iarchive>
public xml_iarchive_impl<xml_iarchive>,
public detail::shared_ptr_helper
{
public:
xml_iarchive(std::istream & is, unsigned int flags = 0) :
@ -102,9 +124,8 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_iarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_iarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -48,9 +48,9 @@ public:
friend class save_access;
protected:
#endif
void end_preamble(){
basic_xml_oarchive<Archive>::end_preamble();
}
//void end_preamble(){
// basic_xml_oarchive<Archive>::end_preamble();
//}
template<class T>
void save(const T & t){
basic_text_oprimitive<std::ostream>::save(t);
@ -101,12 +101,13 @@ public:
~xml_oarchive(){}
};
typedef xml_oarchive naked_xml_oarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_oarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_oarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -87,14 +87,36 @@ protected:
~xml_wiarchive_impl();
};
// we use the following because we can't use
// typedef xml_wiarchive_impl<xml_wiarchive_impl<...> > xml_wiarchive;
// do not derive from this class. If you want to extend this functionality
// via inhertance, derived from xml_wiarchive_impl instead. This will
// do not derive from the classes below. If you want to extend this functionality
// via inhertance, derived from text_iarchive_impl instead. This will
// preserve correct static polymorphism.
// same as xml_wiarchive below - without the shared_ptr_helper
class naked_xml_wiarchive :
public xml_wiarchive_impl<naked_xml_wiarchive>
{
public:
naked_xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
xml_wiarchive_impl<naked_xml_wiarchive>(is, flags)
{}
~naked_xml_wiarchive(){}
};
} // namespace archive
} // namespace boost
// note special treatment of shared_ptr. This type needs a special
// structure associated with every archive. We created a "mix-in"
// class to provide this functionality. Since shared_ptr holds a
// special esteem in the boost library - we included it here by default.
#include <boost/archive/shared_ptr_helper.hpp>
namespace boost {
namespace archive {
class xml_wiarchive :
public xml_wiarchive_impl<xml_wiarchive>
public xml_wiarchive_impl<xml_wiarchive>,
public detail::shared_ptr_helper
{
public:
xml_wiarchive(std::wistream & is, unsigned int flags = 0) :
@ -106,9 +128,8 @@ public:
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_wiarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_wiarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -58,9 +58,9 @@ public:
friend class save_access;
protected:
#endif
void end_preamble(){
basic_xml_oarchive<Archive>::end_preamble();
}
//void end_preamble(){
// basic_xml_oarchive<Archive>::end_preamble();
//}
template<class T>
void
save(const T & t){
@ -113,12 +113,13 @@ public:
~xml_woarchive(){}
};
typedef xml_woarchive naked_xml_woarchive;
} // namespace archive
} // namespace boost
// required by smart_cast for compilers not implementing
// partial template specialization
BOOST_BROKEN_COMPILER_TYPE_TRAITS_SPECIALIZATION(boost::archive::xml_woarchive)
// required by export
BOOST_SERIALIZATION_REGISTER_ARCHIVE(boost::archive::xml_woarchive)
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas

View File

@ -157,7 +157,7 @@ namespace boost {
// check range (may be private because it is static)
static void rangecheck (size_type i) {
if (i >= size()) {
throw std::range_error("array<>: index out of range");
throw std::out_of_range("array<>: index out of range");
}
}
@ -271,7 +271,7 @@ namespace boost {
// check range (may be private because it is static)
static reference failed_rangecheck () {
std::range_error e("attempt to access element of an empty array");
std::out_of_range e("attempt to access element of an empty array");
boost::throw_exception(e);
//
// We need to return something here to keep

View File

@ -2,7 +2,7 @@
// asio.hpp
// ~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_datagram_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_deadline_timer.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_io_object.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_socket.hpp
// ~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)
@ -17,6 +17,10 @@
#include <boost/asio/detail/push_options.hpp>
#include <boost/asio/detail/push_options.hpp>
#include <boost/config.hpp>
#include <boost/asio/detail/pop_options.hpp>
#include <boost/asio/basic_io_object.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/socket_base.hpp>
@ -296,7 +300,40 @@ public:
* will be passed the boost::asio::error::operation_aborted error.
*
* @throws boost::system::system_error Thrown on failure.
*
* @note Calls to cancel() will always fail with
* boost::asio::error::operation_not_supported when run on Windows XP, Windows
* Server 2003, and earlier versions of Windows, unless
* BOOST_ASIO_ENABLE_CANCELIO is defined. However, the CancelIo function has
* two issues that should be considered before enabling its use:
*
* @li It will only cancel asynchronous operations that were initiated in the
* current thread.
*
* @li It can appear to complete without error, but the request to cancel the
* unfinished operations may be silently ignored by the operating system.
* Whether it works or not seems to depend on the drivers that are installed.
*
* For portable cancellation, consider using one of the following
* alternatives:
*
* @li Disable asio's I/O completion port backend by defining
* BOOST_ASIO_DISABLE_IOCP.
*
* @li Use the close() function to simultaneously cancel the outstanding
* operations and close the socket.
*
* When running on Windows Vista, Windows Server 2008, and later, the
* CancelIoEx function is always used. This function does not have the
* problems described above.
*/
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) \
&& (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \
&& !defined(BOOST_ASIO_ENABLE_CANCELIO)
__declspec(deprecated("By default, this function always fails with "
"operation_not_supported when used on Windows XP, Windows Server 2003, "
"or earlier. Consult documentation for details."))
#endif
void cancel()
{
boost::system::error_code ec;
@ -311,7 +348,40 @@ public:
* will be passed the boost::asio::error::operation_aborted error.
*
* @param ec Set to indicate what error occurred, if any.
*
* @note Calls to cancel() will always fail with
* boost::asio::error::operation_not_supported when run on Windows XP, Windows
* Server 2003, and earlier versions of Windows, unless
* BOOST_ASIO_ENABLE_CANCELIO is defined. However, the CancelIo function has
* two issues that should be considered before enabling its use:
*
* @li It will only cancel asynchronous operations that were initiated in the
* current thread.
*
* @li It can appear to complete without error, but the request to cancel the
* unfinished operations may be silently ignored by the operating system.
* Whether it works or not seems to depend on the drivers that are installed.
*
* For portable cancellation, consider using one of the following
* alternatives:
*
* @li Disable asio's I/O completion port backend by defining
* BOOST_ASIO_DISABLE_IOCP.
*
* @li Use the close() function to simultaneously cancel the outstanding
* operations and close the socket.
*
* When running on Windows Vista, Windows Server 2008, and later, the
* CancelIoEx function is always used. This function does not have the
* problems described above.
*/
#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1400) \
&& (!defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600) \
&& !defined(BOOST_ASIO_ENABLE_CANCELIO)
__declspec(deprecated("By default, this function always fails with "
"operation_not_supported when used on Windows XP, Windows Server 2003, "
"or earlier. Consult documentation for details."))
#endif
boost::system::error_code cancel(boost::system::error_code& ec)
{
return this->service.cancel(this->implementation, ec);

View File

@ -2,7 +2,7 @@
// basic_socket_acceptor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_socket_iostream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)
@ -49,6 +49,7 @@
: std::basic_iostream<char>(&this->boost::base_from_member< \
basic_socket_streambuf<Protocol, StreamSocketService> >::member) \
{ \
tie(this); \
if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \
this->setstate(std::ios_base::failbit); \
} \
@ -89,6 +90,7 @@ public:
: std::basic_iostream<char>(&this->boost::base_from_member<
basic_socket_streambuf<Protocol, StreamSocketService> >::member)
{
tie(this);
}
#if defined(GENERATING_DOCUMENTATION)

View File

@ -2,7 +2,7 @@
// basic_socket_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_stream_socket.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// basic_streambuf.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// buffer.hpp
// ~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)
@ -393,7 +393,12 @@ public:
~buffer_debug_check()
{
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
// MSVC's string iterator checking may crash in a std::string::iterator
// object's destructor when the iterator points to an already-destroyed
// std::string object, unless the iterator is cleared first.
iter_ = Iterator();
#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
}
void operator()()

View File

@ -2,7 +2,7 @@
// buffered_read_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// buffered_read_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// buffered_stream.hpp
// ~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// buffered_stream_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

View File

@ -2,7 +2,7 @@
// buffered_write_stream.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2007 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)

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