update boost

This commit is contained in:
2023-11-24 12:56:13 -06:00
parent cfc99971af
commit 19d727037a
9260 changed files with 849256 additions and 299957 deletions

View File

@@ -1,128 +0,0 @@
/*=============================================================================
Copyright (c) 2001-2011 Hartmut Kaiser
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)
==============================================================================*/
#if !defined(BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM)
#define BOOST_SPIRIT_ITERATOR_ISTREAM_MAY_05_2007_0110PM
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/iostreams/stream.hpp>
#include <iterator> // for std::iterator_traits, std::distance
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace qi { namespace detail
{
///////////////////////////////////////////////////////////////////////////
template <typename Iterator>
struct base_iterator_source
{
typedef typename std::iterator_traits<Iterator>::value_type char_type;
typedef boost::iostreams::seekable_device_tag category;
base_iterator_source (Iterator const& first_, Iterator const& last_)
: first(first_), last(last_), pos(0)
{}
// Read up to n characters from the input sequence into the buffer s,
// returning the number of characters read, or -1 to indicate
// end-of-sequence.
std::streamsize read (char_type* s, std::streamsize n)
{
if (first == last)
return -1;
std::streamsize bytes_read = 0;
while (n--) {
*s = *first;
++s; ++bytes_read;
if (++first == last)
break;
}
pos += bytes_read;
return bytes_read;
}
// Write is implemented only to satisfy the requirements of a
// boost::iostreams::seekable_device. We need to have see support to
// be able to figure out how many characters have been actually
// consumed by the stream.
std::streamsize write(const char_type*, std::streamsize)
{
BOOST_ASSERT(false); // not supported
return -1;
}
std::streampos seek(boost::iostreams::stream_offset, std::ios_base::seekdir way)
{
(void)way;
BOOST_ASSERT(way == std::ios_base::cur); // only support queries
return pos; // return current position
}
Iterator first;
Iterator const& last;
std::streamsize pos;
private:
// silence MSVC warning C4512: assignment operator could not be generated
base_iterator_source& operator= (base_iterator_source const&);
};
template <typename Iterator, typename Enable = void>
struct iterator_source : base_iterator_source<Iterator>
{
typedef base_iterator_source<Iterator> base_type;
iterator_source (Iterator const& first_, Iterator const& last_)
: base_type(first_, last_) {}
};
// Specialization for random-access iterators. This also allows compilers
// to fully optimize the case when the source range is contiguous
template <typename Iterator>
struct iterator_source<
Iterator,
typename boost::enable_if_c<boost::is_convertible<
typename std::iterator_traits<Iterator>::iterator_category, std::random_access_iterator_tag>::value>::type
> : base_iterator_source<Iterator>
{
typedef base_iterator_source<Iterator> base_type;
iterator_source (Iterator const& first_, Iterator const& last_)
: base_type(first_, last_) {}
typedef typename base_type::char_type char_type;
using base_type::first;
using base_type::last;
using base_type::pos;
// Read up to n characters from the input sequence into the buffer s,
// returning the number of characters read, or -1 to indicate
// end-of-sequence.
std::streamsize read (char_type* s, std::streamsize n)
{
if (first == last)
return -1;
n = (std::min)(static_cast<std::streamsize>(last - first), n);
typedef typename std::iterator_traits<Iterator>::difference_type diff_type;
// copy_n is only part of c++11, so emulate it
std::copy(first, first + static_cast<diff_type>(n), s);
first += static_cast<diff_type>(n);
pos += n;
return n;
}
};
}}}}
#endif

View File

@@ -16,6 +16,7 @@
#include <boost/spirit/home/support/unused.hpp>
#include <boost/mpl/bool.hpp>
#include <iosfwd>
#include <iterator>
#include <string>
@@ -23,6 +24,10 @@
namespace boost { namespace spirit { namespace qi { namespace detail
{
///////////////////////////////////////////////////////////////////////////
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Expr
, typename CopyExpr = mpl::false_, typename CopyAttr = mpl::false_
, typename Skipper = unused_type, typename Attribute = unused_type const>
@@ -45,10 +50,6 @@ namespace boost { namespace spirit { namespace qi { namespace detail
Skipper const& skipper;
Attribute& attr;
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
private:
// silence MSVC warning C4512: assignment operator could not be generated
match_manip& operator= (match_manip const&);
};
template <typename Expr, typename Skipper, typename Attribute>
@@ -65,10 +66,6 @@ namespace boost { namespace spirit { namespace qi { namespace detail
Skipper const& skipper;
Attribute attr;
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
private:
// silence MSVC warning C4512: assignment operator could not be generated
match_manip& operator= (match_manip const&);
};
template <typename Expr, typename Skipper, typename Attribute>
@@ -85,11 +82,10 @@ namespace boost { namespace spirit { namespace qi { namespace detail
Skipper const& skipper;
Attribute& attr;
BOOST_SCOPED_ENUM(skip_flag) const post_skip;
private:
// silence MSVC warning C4512: assignment operator could not be generated
match_manip& operator= (match_manip const&);
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
///////////////////////////////////////////////////////////////////////////
template <typename Expr, typename Enable = void>

View File

@@ -16,6 +16,7 @@
#include <boost/spirit/home/qi/parser.hpp>
#include <boost/spirit/home/support/unused.hpp>
#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
#include <iosfwd>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit { namespace qi

View File

@@ -13,11 +13,9 @@
#include <boost/spirit/home/qi/detail/string_parse.hpp>
#include <boost/spirit/home/qi/stream/detail/match_manip.hpp>
#include <boost/spirit/home/qi/stream/detail/iterator_source.hpp>
#include <boost/spirit/home/support/detail/hold_any.hpp>
#include <iosfwd>
#include <sstream>
#include <boost/proto/traits.hpp>
#include <istream>
///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit
@@ -44,6 +42,41 @@ namespace boost { namespace spirit { namespace qi
using spirit::stream_type;
using spirit::wstream_type;
namespace detail
{
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4512) // assignment operator could not be generated.
#endif
template <typename Iterator>
struct psbuf
: std::basic_streambuf<typename std::iterator_traits<Iterator>::value_type>
{
psbuf(Iterator first_, Iterator const& last_)
: first(first_), last(last_) {}
protected:
typename psbuf::int_type underflow() BOOST_OVERRIDE
{
return first == last ? psbuf::traits_type::eof()
: psbuf::traits_type::to_int_type(*first);
}
typename psbuf::int_type uflow() BOOST_OVERRIDE
{
return first == last ? psbuf::traits_type::eof()
: psbuf::traits_type::to_int_type(*first++);
}
public:
Iterator first;
Iterator const& last;
};
#ifdef _MSC_VER
# pragma warning(pop)
#endif
}
template <typename Char = char, typename T = spirit::basic_hold_any<char> >
struct stream_parser
: primitive_parser<stream_parser<Char, T> >
@@ -60,25 +93,15 @@ namespace boost { namespace spirit { namespace qi
, Context& /*context*/, Skipper const& skipper
, Attribute& attr_) const
{
typedef qi::detail::iterator_source<Iterator> source_device;
typedef boost::iostreams::stream<source_device> instream;
qi::skip_over(first, last, skipper);
instream in(first, last); // copies 'first'
detail::psbuf<Iterator> pseudobuf(first, last);
std::basic_istream<Char> in(&pseudobuf);
in >> attr_; // use existing operator>>()
// advance the iterator if everything is ok
if (in) {
if (!in.eof()) {
typedef typename
boost::iterator_difference<Iterator>::type diff_type;
diff_type pos = static_cast<diff_type>(in.tellg());
std::advance(first, pos);
} else {
first = last;
}
first = pseudobuf.first;
return true;
}