update boost
This commit is contained in:
@@ -145,10 +145,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
T t_;
|
||||
generator_impl_type generator_;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
lit_auto_generator& operator= (lit_auto_generator const&);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/mpl/push_back.hpp>
|
||||
#include <boost/fusion/include/as_vector.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_KARMA_ATTR_CAST_SEP_26_2009_0348PM)
|
||||
#define SPIRIT_KARMA_ATTR_CAST_SEP_26_2009_0348PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_AUXILIARY_ATTR_CAST_HPP
|
||||
#define BOOST_SPIRIT_KARMA_AUXILIARY_ATTR_CAST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -18,12 +18,18 @@
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/lazy.hpp>
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/proto/make_expr.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/mpl/not.hpp>
|
||||
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Expr>
|
||||
struct actor;
|
||||
}}
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -138,10 +144,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
Function func;
|
||||
Modifiers modifiers;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
lazy_generator& operator= (lazy_generator const&);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -194,20 +194,11 @@ namespace boost { namespace spirit { namespace karma
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
template <BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) bits>
|
||||
template <BOOST_SCOPED_ENUM(boost::endian::order) bits>
|
||||
struct what;
|
||||
|
||||
template <>
|
||||
struct what<boost::spirit::endian::endianness::native>
|
||||
{
|
||||
static info is()
|
||||
{
|
||||
return info("native-endian binary");
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct what<boost::spirit::endian::endianness::little>
|
||||
struct what<boost::endian::order::little>
|
||||
{
|
||||
static info is()
|
||||
{
|
||||
@@ -216,7 +207,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
};
|
||||
|
||||
template <>
|
||||
struct what<boost::spirit::endian::endianness::big>
|
||||
struct what<boost::endian::order::big>
|
||||
{
|
||||
static info is()
|
||||
{
|
||||
@@ -226,7 +217,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
|
||||
struct any_binary_generator
|
||||
: primitive_generator<any_binary_generator<T, endian, bits> >
|
||||
{
|
||||
@@ -242,10 +233,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
if (!traits::has_optional_value(attr))
|
||||
return false;
|
||||
|
||||
// Even if the endian types are not pod's (at least not in the
|
||||
// definition of C++03) it seems to be safe to assume they are.
|
||||
// This allows us to treat them as a sequence of consecutive bytes.
|
||||
boost::spirit::endian::endian<endian, typename T::type, bits> p;
|
||||
boost::endian::endian_arithmetic<endian, typename T::type, bits> p;
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
// warning C4244: 'argument' : conversion from 'const int' to 'foo', possible loss of data
|
||||
@@ -258,8 +246,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
unsigned char const* bytes =
|
||||
reinterpret_cast<unsigned char const*>(&p);
|
||||
unsigned char const* bytes = p.data();
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(p); ++i)
|
||||
{
|
||||
@@ -293,7 +280,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
|
||||
struct literal_binary_generator
|
||||
: primitive_generator<literal_binary_generator<T, endian, bits> >
|
||||
{
|
||||
@@ -323,12 +310,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
bool generate(OutputIterator& sink, Context&, Delimiter const& d
|
||||
, Attribute const&) const
|
||||
{
|
||||
// Even if the endian types are not pod's (at least not in the
|
||||
// definition of C++03) it seems to be safe to assume they are
|
||||
// (but in C++0x the endian types _are_ PODs).
|
||||
// This allows us to treat them as a sequence of consecutive bytes.
|
||||
unsigned char const* bytes =
|
||||
reinterpret_cast<unsigned char const*>(&data_);
|
||||
unsigned char const* bytes = data_.data();
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(data_type); ++i)
|
||||
{
|
||||
@@ -344,7 +326,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
return karma::detail::what<endian>::is();
|
||||
}
|
||||
|
||||
typedef boost::spirit::endian::endian<endian, typename T::type,
|
||||
typedef boost::endian::endian_arithmetic<endian, typename T::type,
|
||||
bits> data_type;
|
||||
|
||||
data_type data_;
|
||||
@@ -355,7 +337,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian
|
||||
template <typename T, BOOST_SCOPED_ENUM(boost::endian::order) endian
|
||||
, int bits>
|
||||
struct basic_binary
|
||||
{
|
||||
@@ -368,7 +350,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
};
|
||||
|
||||
template <typename Modifiers, typename T
|
||||
, BOOST_SCOPED_ENUM(boost::spirit::endian::endianness) endian, int bits>
|
||||
, BOOST_SCOPED_ENUM(boost::endian::order) endian, int bits>
|
||||
struct basic_binary_literal
|
||||
{
|
||||
typedef literal_binary_generator<T, endian, bits> result_type;
|
||||
@@ -385,13 +367,13 @@ namespace boost { namespace spirit { namespace karma
|
||||
template <typename Modifiers> \
|
||||
struct make_primitive<tag::name, Modifiers> \
|
||||
: detail::basic_binary<detail::integer<bits>, \
|
||||
boost::spirit::endian::endianness::endiantype, bits> {}; \
|
||||
boost::endian::order::endiantype, bits> {}; \
|
||||
\
|
||||
template <typename Modifiers, typename A0> \
|
||||
struct make_primitive<terminal_ex<tag::name, fusion::vector1<A0> > \
|
||||
, Modifiers> \
|
||||
: detail::basic_binary_literal<Modifiers, detail::integer<bits> \
|
||||
, boost::spirit::endian::endianness::endiantype, bits> {}; \
|
||||
, boost::endian::order::endiantype, bits> {}; \
|
||||
\
|
||||
/***/
|
||||
|
||||
@@ -414,13 +396,13 @@ namespace boost { namespace spirit { namespace karma
|
||||
template <typename Modifiers> \
|
||||
struct make_primitive<tag::name, Modifiers> \
|
||||
: detail::basic_binary<detail::floating_point<bits>, \
|
||||
boost::spirit::endian::endianness::endiantype, bits> {}; \
|
||||
boost::endian::order::endiantype, bits> {}; \
|
||||
\
|
||||
template <typename Modifiers, typename A0> \
|
||||
struct make_primitive<terminal_ex<tag::name, fusion::vector1<A0> > \
|
||||
, Modifiers> \
|
||||
: detail::basic_binary_literal<Modifiers, detail::floating_point<bits> \
|
||||
, boost::spirit::endian::endianness::endiantype, bits> {}; \
|
||||
, boost::endian::order::endiantype, bits> {}; \
|
||||
\
|
||||
/***/
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/container.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM)
|
||||
#define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1124AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DETAIL_ALTERNATIVE_FUNCTION_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DETAIL_ALTERNATIVE_FUNCTION_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -55,7 +55,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
, Delimiter const& d, unused_type, bool&)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
// return true if any of the generators succeed
|
||||
return component.generate(sink, ctx, d, unused);
|
||||
@@ -87,7 +87,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
, Context& ctx, Delimiter const& d, Attribute const& attr, bool&)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
return call(component, sink, ctx, d, attr
|
||||
, spirit::traits::not_is_variant_or_variant_in_optional<Attribute, karma::domain>());
|
||||
@@ -99,7 +99,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::true_)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
return component.generate(sink, ctx, d, attr);
|
||||
}
|
||||
@@ -110,7 +110,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
, Context& ctx, Delimiter const& d, Attribute const& attr, mpl::false_)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
typedef
|
||||
traits::compute_compatible_component<Expected, Attribute, domain>
|
||||
@@ -139,6 +139,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
// will be executed for every generator in a given alternative generator
|
||||
// expression
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template <typename OutputIterator, typename Context, typename Delimiter,
|
||||
typename Attribute, typename Strict>
|
||||
struct alternative_generate_function
|
||||
@@ -190,10 +194,6 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
Context& ctx;
|
||||
Delimiter const& delim;
|
||||
Attribute const& attr;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
alternative_generate_function& operator= (alternative_generate_function const&);
|
||||
};
|
||||
|
||||
// specialization for strict alternatives
|
||||
@@ -240,11 +240,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
Delimiter const& delim;
|
||||
Attribute const& attr;
|
||||
bool failed;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
alternative_generate_function& operator= (alternative_generate_function const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_DETAIL_ATTRIBUTES_APR_18_2010_0453PM)
|
||||
#define SPIRIT_KARMA_DETAIL_ATTRIBUTES_APR_18_2010_0453PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DETAIL_ATTRIBUTES_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DETAIL_ATTRIBUTES_HPP
|
||||
|
||||
#include <boost/spirit/home/karma/domain.hpp>
|
||||
#include <boost/spirit/home/support/attributes_fwd.hpp>
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/attributes_fwd.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM)
|
||||
#define SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0249PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DETAIL_FAIL_FUNCTION_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DETAIL_FAIL_FUNCTION_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template <typename OutputIterator, typename Context, typename Delimiter>
|
||||
struct fail_function
|
||||
{
|
||||
@@ -30,7 +34,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
bool operator()(Component const& component, Attribute const& attr) const
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
// return true if any of the generators fail
|
||||
return !component.generate(sink, ctx, delim, attr);
|
||||
@@ -40,7 +44,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
bool operator()(Component const& component) const
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
(void)component; // suppresses warning: C4100: 'component' : unreferenced formal parameter
|
||||
#endif
|
||||
// return true if any of the generators fail
|
||||
return !component.generate(sink, ctx, delim, unused);
|
||||
@@ -49,11 +53,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
OutputIterator& sink;
|
||||
Context& ctx;
|
||||
Delimiter const& delim;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
fail_function& operator= (fail_function const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
}}}}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_KARMA_INDIRECT_ITERATOR_JAN_19_2011_0814PM)
|
||||
#define SPIRIT_KARMA_INDIRECT_ITERATOR_JAN_19_2011_0814PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DETAIL_INDIRECT_ITERATOR_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DETAIL_INDIRECT_ITERATOR_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
// wchar_t is only 16-bits on Windows. If BOOST_SPIRIT_UNICODE is
|
||||
// defined, the character type is 32-bits wide so we need to make
|
||||
// sure the buffer is at least that wide.
|
||||
#if (defined(_WIN32) || defined(__CYGWIN__)) && defined(BOOST_SPIRIT_UNICODE)
|
||||
#if (defined(_MSC_VER) || defined(__SIZEOF_WCHAR_T__) && __SIZEOF_WCHAR_T__ == 2) && defined(BOOST_SPIRIT_UNICODE)
|
||||
typedef spirit::char_encoding::unicode::char_type buffer_char_type;
|
||||
#else
|
||||
typedef wchar_t buffer_char_type;
|
||||
@@ -237,9 +237,12 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
buffer.begin() + (std::min)(buffer.size(), maxwidth);
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#pragma warning(disable: 4244) // conversion from 'x' to 'y', possible loss of data
|
||||
#endif
|
||||
std::copy(buffer.begin(), end, sink);
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
template <typename RestIterator>
|
||||
@@ -253,9 +256,12 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
buffer.begin() + (std::min)(buffer.size(), start_at);
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#pragma warning(disable: 4244) // conversion from 'x' to 'y', possible loss of data
|
||||
#endif
|
||||
std::copy(begin, buffer.end(), sink);
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -383,7 +389,7 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
, output_iterator<OutputIterator, Properties, Derived>
|
||||
>::type most_derived_type;
|
||||
|
||||
enum { properties = Properties::value };
|
||||
static const generator_properties::enum_type properties = static_cast<generator_properties::enum_type>(Properties::value);
|
||||
|
||||
typedef typename mpl::if_c<
|
||||
(properties & generator_properties::tracking) ? true : false
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
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(SPIRIT_PASS_CONTAINER_MAR_15_2009_0114PM)
|
||||
#define SPIRIT_PASS_CONTAINER_MAR_15_2009_0114PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DETAIL_PASS_CONTAINER_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DETAIL_PASS_CONTAINER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -23,11 +23,9 @@
|
||||
#include <boost/mpl/or.hpp>
|
||||
#include <boost/preprocessor/cat.hpp>
|
||||
#include <boost/preprocessor/repetition/repeat.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/fusion/include/deduce_sequence.hpp>
|
||||
|
||||
#include <boost/mpl/print.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
// Helper meta-function allowing to evaluate weak substitutability and
|
||||
@@ -273,6 +271,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
mutable Iterator end;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template <typename Iterator>
|
||||
struct pass_container_base<Iterator&>
|
||||
{
|
||||
@@ -382,11 +384,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
}
|
||||
|
||||
F f;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
pass_container& operator= (pass_container const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -10,10 +10,8 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <boost/spirit/home/support/char_class.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
|
||||
@@ -10,10 +10,10 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <boost/spirit/home/support/char_class.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
#include <boost/range/const_iterator.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
|
||||
@@ -14,17 +14,20 @@
|
||||
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template <typename Delimiter>
|
||||
struct unused_delimiter : unused_type
|
||||
{
|
||||
unused_delimiter(Delimiter const& delim)
|
||||
: delimiter(delim) {}
|
||||
Delimiter const& delimiter;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
unused_delimiter& operator= (unused_delimiter const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
// If a surrounding verbatim[] directive was specified, the current
|
||||
// delimiter is of the type unused_delimiter. In this case we
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_AS_DEC_18_0510PM)
|
||||
#define SPIRIT_KARMA_AS_DEC_18_0510PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_AS_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_AS_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/spirit/home/karma/meta_compiler.hpp>
|
||||
#include <boost/spirit/home/karma/generator.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/domain.hpp>
|
||||
#include <boost/spirit/home/karma/detail/output_iterator.hpp>
|
||||
#include <boost/spirit/home/karma/detail/as.hpp>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_KARMA_BUFFER_AUG_03_2009_0949AM)
|
||||
#define SPIRIT_KARMA_BUFFER_AUG_03_2009_0949AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_BUFFER_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_BUFFER_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <boost/spirit/home/karma/detail/default_width.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/karma/char/char.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
@@ -92,7 +93,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
unsigned int const width, Padding const& p)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
(void)e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
#endif
|
||||
// wrap the given output iterator to allow left padding
|
||||
detail::enable_buffering<OutputIterator> buffering(sink, width);
|
||||
|
||||
@@ -70,6 +70,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
namespace detail
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
template <typename Delimiter, typename ColumnDelimiter>
|
||||
struct columns_delimiter
|
||||
{
|
||||
@@ -108,11 +112,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
ColumnDelimiter const& column_delimiter;
|
||||
unsigned int const numcolumns;
|
||||
mutable unsigned int count;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
columns_delimiter& operator= (columns_delimiter const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <boost/spirit/home/karma/detail/unused_delimiter.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/karma/char/char.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_KARMA_DUPLICATE_JUL_11_2010_0954AM)
|
||||
#define SPIRIT_KARMA_DUPLICATE_JUL_11_2010_0954AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_DUPLICATE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_DUPLICATE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_ENCODING_MARCH_05_2010_0550PM)
|
||||
#define SPIRIT_KARMA_ENCODING_MARCH_05_2010_0550PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_ENCODING_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_ENCODING_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <boost/spirit/home/karma/detail/default_width.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/karma/char/char.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
@@ -92,7 +93,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
unsigned int const width, Padding const& p)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
(void)e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
#endif
|
||||
// wrap the given output iterator to allow counting
|
||||
detail::enable_counting<OutputIterator> counting(sink);
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
unsigned int const maxwidth, Rest& restdest)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
(void)e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
#endif
|
||||
// wrap the given output iterator to allow buffering, but disable
|
||||
// counting
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_KARMA_OMIT_JUL_20_2009_1008AM)
|
||||
#define SPIRIT_KARMA_OMIT_JUL_20_2009_1008AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_OMIT_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_OMIT_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
#include <boost/spirit/home/karma/detail/output_iterator.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
@@ -73,8 +74,15 @@ namespace boost { namespace spirit { namespace karma
|
||||
// have any other means to verify, whether the passed attribute is
|
||||
// compatible with the subject.
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4127) // conditional expression is constant
|
||||
#endif
|
||||
// omit[] will execute the code, while skip[] doesn't execute it
|
||||
if (Execute) {
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
// wrap the given output iterator to avoid output
|
||||
detail::disable_output<OutputIterator> disable(sink);
|
||||
return subject.generate(sink, ctx, d, attr);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_REPEAT_MAY_18_2009_0926AM)
|
||||
#define SPIRIT_KARMA_REPEAT_MAY_18_2009_0926AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_REPEAT_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_REPEAT_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -77,6 +77,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
using spirit::inf_type;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
// handles repeat(exact)[p]
|
||||
template <typename T>
|
||||
struct exact_iterator
|
||||
@@ -90,10 +94,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
bool got_min(T i) const { return i >= exact; }
|
||||
|
||||
T const exact;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
exact_iterator& operator= (exact_iterator const&);
|
||||
};
|
||||
|
||||
// handles repeat(min, max)[p]
|
||||
@@ -111,10 +111,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
T const min;
|
||||
T const max;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
finite_iterator& operator= (finite_iterator const&);
|
||||
};
|
||||
|
||||
// handles repeat(min, inf)[p]
|
||||
@@ -130,11 +126,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
bool got_min(T i) const { return i >= min; }
|
||||
|
||||
T const min;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
infinite_iterator& operator= (infinite_iterator const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Subject, typename LoopIter, typename Strict
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <boost/spirit/home/karma/detail/default_width.hpp>
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/karma/char/char.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/common_terminals.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
@@ -92,7 +93,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
unsigned int const width, Padding const& p)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
(void)e; // suppresses warning: C4100: 'e' : unreferenced formal parameter
|
||||
#endif
|
||||
// wrap the given output iterator to allow left padding
|
||||
detail::enable_buffering<OutputIterator> buffering(sink, width);
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
// 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(SPIRIT_STRICT_RELAXED_APR_22_2010_0959AM)
|
||||
#define SPIRIT_STRICT_RELAXED_APR_22_2010_0959AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_STRICT_RELAXED_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_STRICT_RELAXED_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_UPPER_LOWER_CASE_JANUARY_19_2009_1142AM)
|
||||
#define SPIRIT_UPPER_LOWER_CASE_JANUARY_19_2009_1142AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_DIRECTIVE_UPPER_LOWER_CASE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_DIRECTIVE_UPPER_LOWER_CASE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <boost/spirit/home/karma/domain.hpp>
|
||||
#include <boost/spirit/home/karma/generator.hpp>
|
||||
#include <boost/spirit/home/support/string_traits.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
#include <boost/spirit/home/karma/nonterminal/rule.hpp>
|
||||
#include <boost/spirit/home/karma/nonterminal/debug_handler_state.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
#include <boost/fusion/include/out.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost { namespace spirit { namespace karma
|
||||
{
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <boost/spirit/home/karma/nonterminal/nonterminal_fwd.hpp>
|
||||
#include <boost/spirit/home/karma/reference.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/proto/extends.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
namespace boost { namespace spirit { namespace karma
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/mpl/vector.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
#include <boost/type_traits/add_reference.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <boost/fusion/include/vector.hpp>
|
||||
@@ -40,6 +38,12 @@
|
||||
#include <boost/spirit/home/karma/nonterminal/detail/generator_binder.hpp>
|
||||
#include <boost/spirit/home/karma/nonterminal/detail/parameterized.hpp>
|
||||
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/proto/extends.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/type_traits/is_const.hpp>
|
||||
#include <boost/type_traits/is_reference.hpp>
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4127) // conditional expression is constant
|
||||
@@ -133,9 +137,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
typedef typename
|
||||
spirit::detail::attr_from_sig<sig_type>::type
|
||||
attr_type;
|
||||
typedef typename add_reference<
|
||||
typename add_const<attr_type>::type>::type
|
||||
attr_reference_type;
|
||||
BOOST_STATIC_ASSERT_MSG(
|
||||
!is_reference<attr_type>::value && !is_const<attr_type>::value,
|
||||
"Const/reference qualifiers on Karma rule attribute are meaningless");
|
||||
typedef attr_type const& attr_reference_type;
|
||||
|
||||
// parameter_types is a sequence of types passed as parameters to the rule
|
||||
typedef typename
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
call (OutputIterator& sink, U b, Policies const& p = Policies())
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
|
||||
(void)p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
|
||||
#endif
|
||||
return p.template call<bool_inserter>(sink, T(b), p);
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
call_n (OutputIterator& sink, U b, Policies const& p)
|
||||
{
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
|
||||
p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
|
||||
(void)p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
|
||||
#endif
|
||||
if (b)
|
||||
return p.template generate_true<CharEncoding, Tag>(sink, b);
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/limits.hpp>
|
||||
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/type_traits/is_integral.hpp>
|
||||
#include <boost/spirit/home/support/char_class.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/numeric_traits.hpp>
|
||||
#include <boost/spirit/home/support/detail/pow10.hpp>
|
||||
#include <boost/spirit/home/support/detail/sign.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
#include <boost/spirit/home/karma/detail/string_generate.hpp>
|
||||
|
||||
#include <boost/core/cmath.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The value BOOST_KARMA_NUMERICS_LOOP_UNROLL specifies, how to unroll the
|
||||
@@ -120,7 +120,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
typedef float type;
|
||||
static type call(float n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? -n : n;
|
||||
return (std::fabs)(n);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
typedef double type;
|
||||
static type call(double n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? -n : n;
|
||||
return (std::fabs)(n);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
typedef long double type;
|
||||
static type call(long double n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? -n : n;
|
||||
return (std::fabs)(n);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -177,7 +177,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(float n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? true : false;
|
||||
return (core::signbit)(n) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(double n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? true : false;
|
||||
return (core::signbit)(n) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(long double n)
|
||||
{
|
||||
return (spirit::detail::signbit)(n) ? true : false;
|
||||
return (core::signbit)(n) ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(float n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_ZERO;
|
||||
return (core::fpclassify)(n) == core::fp_zero;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_ZERO;
|
||||
return (core::fpclassify)(n) == core::fp_zero;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(long double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_ZERO;
|
||||
return (core::fpclassify)(n) == core::fp_zero;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(float n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_NAN;
|
||||
return (core::fpclassify)(n) == core::fp_nan;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_NAN;
|
||||
return (core::fpclassify)(n) == core::fp_nan;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(long double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_NAN;
|
||||
return (core::fpclassify)(n) == core::fp_nan;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -298,9 +298,8 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(T n)
|
||||
{
|
||||
if (!std::numeric_limits<T>::has_infinity)
|
||||
return false;
|
||||
return (n == std::numeric_limits<T>::infinity()) ? true : false;
|
||||
return std::numeric_limits<T>::has_infinity
|
||||
&& n == std::numeric_limits<T>::infinity();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -309,7 +308,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(float n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_INFINITE;
|
||||
return (core::fpclassify)(n) == core::fp_infinite;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -318,7 +317,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_INFINITE;
|
||||
return (core::fpclassify)(n) == core::fp_infinite;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -327,7 +326,7 @@ namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
static bool call(long double n)
|
||||
{
|
||||
return (math::fpclassify)(n) == FP_INFINITE;
|
||||
return (core::fpclassify)(n) == core::fp_infinite;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -575,12 +574,12 @@ namespace boost { namespace spirit { namespace karma
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_KARMA_NUMERICS_INNER_LOOP_PREFIX(z, x, data) \
|
||||
if (!traits::test_zero(n)) { \
|
||||
int ch = radix_type::call(remainder_type::call(n)); \
|
||||
int ch_##x = radix_type::call(remainder_type::call(n)); \
|
||||
n = divide_type::call(n, num, ++exp); \
|
||||
/**/
|
||||
|
||||
#define BOOST_KARMA_NUMERICS_INNER_LOOP_SUFFIX(z, x, data) \
|
||||
*sink = char(ch); \
|
||||
#define BOOST_KARMA_NUMERICS_INNER_LOOP_SUFFIX(z, x, n_rolls_sub1) \
|
||||
*sink = char(BOOST_PP_CAT(ch_, BOOST_PP_SUB(n_rolls_sub1, x))); \
|
||||
++sink; \
|
||||
} \
|
||||
/**/
|
||||
@@ -611,7 +610,8 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
BOOST_PP_REPEAT(
|
||||
BOOST_KARMA_NUMERICS_LOOP_UNROLL,
|
||||
BOOST_KARMA_NUMERICS_INNER_LOOP_SUFFIX, _);
|
||||
BOOST_KARMA_NUMERICS_INNER_LOOP_SUFFIX,
|
||||
BOOST_PP_DEC(BOOST_KARMA_NUMERICS_LOOP_UNROLL));
|
||||
|
||||
*sink = char(ch);
|
||||
++sink;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2001-2011 Hartmut Kaiser
|
||||
// Copyright (c) 2001-2020 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)
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <boost/spirit/home/support/char_class.hpp>
|
||||
#include <boost/spirit/home/support/unused.hpp>
|
||||
#include <boost/spirit/home/support/detail/pow10.hpp>
|
||||
#include <boost/spirit/home/support/detail/sign.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
#include <boost/spirit/home/karma/detail/string_generate.hpp>
|
||||
#include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
|
||||
@@ -84,34 +83,37 @@ namespace boost { namespace spirit { namespace karma
|
||||
|
||||
// get correct precision for generated number
|
||||
unsigned precision = p.precision(n);
|
||||
if (std::numeric_limits<U>::digits10)
|
||||
{
|
||||
// limit generated precision to digits10, if defined
|
||||
precision = (std::min)(precision,
|
||||
(unsigned)std::numeric_limits<U>::digits10 + 1);
|
||||
}
|
||||
|
||||
// allow for ADL to find the correct overloads for log10 et.al.
|
||||
using namespace std;
|
||||
|
||||
bool precexp_offset = false;
|
||||
U dim = 0;
|
||||
if (0 == (Policies::fmtflags::fixed & flags) && !traits::test_zero(n))
|
||||
{
|
||||
dim = log10(n);
|
||||
if (dim > 0)
|
||||
if (dim > 0)
|
||||
n /= spirit::traits::pow10<U>(traits::truncate_to_long::call(dim));
|
||||
else if (n < 1.) {
|
||||
long exp = traits::truncate_to_long::call(-dim);
|
||||
if (exp != -dim)
|
||||
++exp;
|
||||
|
||||
dim = static_cast<U>(-exp);
|
||||
|
||||
// detect and handle denormalized numbers to prevent overflow in pow10
|
||||
if (exp > std::numeric_limits<U>::max_exponent10)
|
||||
{
|
||||
n *= spirit::traits::pow10<U>(std::numeric_limits<U>::max_exponent10);
|
||||
n *= spirit::traits::pow10<U>(exp - std::numeric_limits<U>::max_exponent10);
|
||||
} else
|
||||
}
|
||||
else
|
||||
n *= spirit::traits::pow10<U>(exp);
|
||||
|
||||
if (n < 1.)
|
||||
{
|
||||
n *= 10.;
|
||||
--dim;
|
||||
precexp_offset = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,14 +122,28 @@ namespace boost { namespace spirit { namespace karma
|
||||
U precexp = spirit::traits::pow10<U>(precision);
|
||||
U fractional_part = modf(n, &integer_part);
|
||||
|
||||
fractional_part = floor(fractional_part * precexp + U(0.5));
|
||||
if (fractional_part >= precexp)
|
||||
if (precexp_offset)
|
||||
{
|
||||
fractional_part =
|
||||
floor((fractional_part * precexp + U(0.5)) * U(10.)) / U(10.);
|
||||
}
|
||||
else
|
||||
{
|
||||
fractional_part = floor(fractional_part * precexp + U(0.5));
|
||||
}
|
||||
|
||||
if (fractional_part >= precexp)
|
||||
{
|
||||
fractional_part = floor(fractional_part - precexp);
|
||||
integer_part += 1; // handle rounding overflow
|
||||
if (integer_part >= 10. && 0 == (Policies::fmtflags::fixed & flags))
|
||||
{
|
||||
integer_part /= 10.;
|
||||
++dim;
|
||||
}
|
||||
}
|
||||
|
||||
// if trailing zeros are to be omitted, normalize the precision and
|
||||
// if trailing zeros are to be omitted, normalize the precision and``
|
||||
// fractional part
|
||||
U long_int_part = floor(integer_part);
|
||||
U long_frac_part = fractional_part;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#endif
|
||||
|
||||
#include <boost/config/no_tr1/cmath.hpp>
|
||||
#include <boost/math/special_functions/fpclassify.hpp>
|
||||
#include <boost/type_traits/remove_const.hpp>
|
||||
|
||||
#include <boost/spirit/home/support/char_class.hpp>
|
||||
@@ -162,8 +161,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
//
|
||||
// Note: If the trailing_zeros flag is not in effect additional
|
||||
// comments apply. See the comment for the fraction_part()
|
||||
// function below. Moreover, this precision will be limited
|
||||
// to the value of std::numeric_limits<T>::digits10 + 1
|
||||
// function below.
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
static unsigned precision(T)
|
||||
{
|
||||
@@ -260,7 +258,7 @@ namespace boost { namespace spirit { namespace karma
|
||||
// but it's spelled out to avoid inter-modular dependencies.
|
||||
|
||||
typename remove_const<T>::type digits =
|
||||
(traits::test_zero(n) ? 0 : floor(log10(n))) + 1;
|
||||
(traits::test_zero(n) ? 1 : ceil(log10(n + T(1.))));
|
||||
bool r = true;
|
||||
for (/**/; r && digits < precision_; digits = digits + 1)
|
||||
r = char_inserter<>::call(sink, '0');
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1117AM)
|
||||
#define SPIRIT_KARMA_ALTERNATIVE_MAR_01_2007_1117AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_ALTERNATIVE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_ALTERNATIVE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <boost/fusion/include/for_each.hpp>
|
||||
#include <boost/mpl/accumulate.hpp>
|
||||
#include <boost/mpl/bitor.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM)
|
||||
#define SPIRIT_KARMA_AND_PREDICATE_MAR_22_2009_0412PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_AND_PREDICATE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_AND_PREDICATE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#include <boost/spirit/home/support/container.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_LIST_MAY_01_2007_0229PM)
|
||||
#define SPIRIT_KARMA_LIST_MAY_01_2007_0229PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_LIST_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_LIST_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -24,6 +24,8 @@
|
||||
#include <boost/spirit/home/support/container.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_NOT_PREDICATE_MAR_21_2009_1132AM)
|
||||
#define SPIRIT_KARMA_NOT_PREDICATE_MAR_21_2009_1132AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_NOT_PREDICATE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_NOT_PREDICATE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <boost/spirit/home/support/info.hpp>
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_OPTIONAL_MARCH_31_2007_0852AM)
|
||||
#define SPIRIT_KARMA_OPTIONAL_MARCH_31_2007_0852AM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_OPTIONAL_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_OPTIONAL_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -22,6 +22,8 @@
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/mpl/assert.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
#include <boost/spirit/home/support/has_semantic_action.hpp>
|
||||
#include <boost/spirit/home/support/handles_container.hpp>
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/type_traits/add_const.hpp>
|
||||
|
||||
namespace boost { namespace spirit
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// 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(SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0247PM)
|
||||
#define SPIRIT_KARMA_SEQUENCE_FEB_28_2007_0247PM
|
||||
#ifndef BOOST_SPIRIT_KARMA_OPERATOR_SEQUENCE_HPP
|
||||
#define BOOST_SPIRIT_KARMA_OPERATOR_SEQUENCE_HPP
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <boost/mpl/not.hpp>
|
||||
#include <boost/fusion/include/transform.hpp>
|
||||
#include <boost/mpl/accumulate.hpp>
|
||||
#include <boost/proto/operators.hpp>
|
||||
#include <boost/proto/tags.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -10,18 +10,19 @@
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/spirit/include/version.hpp>
|
||||
|
||||
// we support Phoenix attributes only starting with V2.2
|
||||
#if SPIRIT_VERSION >= 0x2020
|
||||
|
||||
#include <boost/spirit/home/karma/detail/attributes.hpp>
|
||||
#include <boost/spirit/home/karma/detail/indirect_iterator.hpp>
|
||||
#include <boost/spirit/home/support/container.hpp>
|
||||
|
||||
#include <boost/spirit/include/phoenix_core.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace phoenix
|
||||
{
|
||||
template <typename Expr>
|
||||
struct actor;
|
||||
}}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace traits
|
||||
{
|
||||
@@ -121,4 +122,3 @@ namespace boost { namespace spirit { namespace traits
|
||||
}}}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
namespace boost { namespace spirit { namespace karma { 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 Delimiter = unused_type, typename Attribute = unused_type>
|
||||
@@ -42,10 +46,6 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
Delimiter const& delim;
|
||||
BOOST_SCOPED_ENUM(delimit_flag) const pre;
|
||||
Attribute const& attr;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
format_manip& operator= (format_manip const&);
|
||||
};
|
||||
|
||||
template <typename Expr, typename Delimiter, typename Attribute>
|
||||
@@ -62,10 +62,6 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
Delimiter const& delim;
|
||||
BOOST_SCOPED_ENUM(delimit_flag) const pre;
|
||||
Attribute attr;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
format_manip& operator= (format_manip const&);
|
||||
};
|
||||
|
||||
template <typename Expr, typename Delimiter, typename Attribute>
|
||||
@@ -82,11 +78,10 @@ namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
Delimiter const& delim;
|
||||
BOOST_SCOPED_ENUM(delimit_flag) const pre;
|
||||
Attribute const& attr;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
format_manip& operator= (format_manip const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Expr, typename Enable = void>
|
||||
|
||||
@@ -1,55 +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.boist.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM)
|
||||
#define BOOST_SPIRIT_ITERATOR_SINK_MAY_27_2007_0133PM
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit { namespace karma { namespace detail
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <
|
||||
typename OutputIterator, typename Char, typename CharEncoding
|
||||
, typename Tag
|
||||
>
|
||||
struct iterator_sink
|
||||
{
|
||||
typedef boost::iostreams::sink_tag category;
|
||||
typedef Char char_type;
|
||||
|
||||
iterator_sink (OutputIterator& sink_)
|
||||
: sink(sink_)
|
||||
{}
|
||||
|
||||
// Write up to n characters from the buffer s to the output sequence,
|
||||
// returning the number of characters written
|
||||
std::streamsize write (Char const* s, std::streamsize n)
|
||||
{
|
||||
std::streamsize bytes_written = 0;
|
||||
while (n--) {
|
||||
if (!generate_to(sink, *s, CharEncoding(), Tag()))
|
||||
break;
|
||||
++s; ++bytes_written;
|
||||
}
|
||||
return bytes_written;
|
||||
}
|
||||
|
||||
OutputIterator& sink;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
iterator_sink& operator= (iterator_sink const&);
|
||||
};
|
||||
|
||||
}}}}
|
||||
|
||||
#endif
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <boost/spirit/home/karma/delimit_out.hpp>
|
||||
#include <boost/spirit/home/karma/auxiliary/lazy.hpp>
|
||||
#include <boost/spirit/home/karma/stream/detail/format_manip.hpp>
|
||||
#include <boost/spirit/home/karma/stream/detail/iterator_sink.hpp>
|
||||
#include <boost/spirit/home/karma/detail/generate_to.hpp>
|
||||
#include <boost/spirit/home/karma/detail/get_casetag.hpp>
|
||||
#include <boost/spirit/home/karma/detail/extract_from.hpp>
|
||||
#include <boost/fusion/include/at.hpp>
|
||||
@@ -29,8 +29,7 @@
|
||||
#include <boost/fusion/include/cons.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
|
||||
#include <iosfwd>
|
||||
#include <ostream>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace spirit
|
||||
@@ -113,6 +112,36 @@ namespace boost { namespace spirit { namespace karma
|
||||
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 OutputIterator, typename Char, typename CharEncoding
|
||||
, typename Tag>
|
||||
struct psbuf : std::basic_streambuf<Char>
|
||||
{
|
||||
psbuf(OutputIterator& sink) : sink_(sink) {}
|
||||
|
||||
protected:
|
||||
typename psbuf::int_type overflow(typename psbuf::int_type ch) BOOST_OVERRIDE
|
||||
{
|
||||
if (psbuf::traits_type::eq_int_type(ch, psbuf::traits_type::eof()))
|
||||
return psbuf::traits_type::not_eof(ch);
|
||||
|
||||
return detail::generate_to(sink_, psbuf::traits_type::to_char_type(ch),
|
||||
CharEncoding(), Tag()) ? ch : psbuf::traits_type::eof();
|
||||
}
|
||||
|
||||
private:
|
||||
OutputIterator& sink_;
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename Char, typename CharEncoding, typename Tag>
|
||||
struct any_stream_generator
|
||||
@@ -132,10 +161,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
static bool generate(OutputIterator& sink, Context& context
|
||||
, Delimiter const& d, Attribute const& attr)
|
||||
{
|
||||
typedef karma::detail::iterator_sink<
|
||||
OutputIterator, Char, CharEncoding, Tag
|
||||
> sink_device;
|
||||
|
||||
if (!traits::has_optional_value(attr))
|
||||
return false;
|
||||
|
||||
@@ -143,7 +168,8 @@ namespace boost { namespace spirit { namespace karma
|
||||
typedef typename attribute<Context>::type attribute_type;
|
||||
|
||||
{
|
||||
boost::iostreams::stream<sink_device> ostr(sink);
|
||||
detail::psbuf<OutputIterator, Char, CharEncoding, Tag> pseudobuf(sink);
|
||||
std::basic_ostream<Char> ostr(&pseudobuf);
|
||||
ostr << traits::extract_from<attribute_type>(attr, context) << std::flush;
|
||||
|
||||
if (!ostr.good())
|
||||
@@ -168,9 +194,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
typedef karma::detail::output_iterator<
|
||||
karma::ostream_iterator<T, Char, Traits>, Properties
|
||||
> output_iterator;
|
||||
typedef karma::detail::iterator_sink<
|
||||
output_iterator, Char, CharEncoding, Tag
|
||||
> sink_device;
|
||||
|
||||
if (!traits::has_optional_value(attr))
|
||||
return false;
|
||||
@@ -179,7 +202,8 @@ namespace boost { namespace spirit { namespace karma
|
||||
typedef typename attribute<Context>::type attribute_type;
|
||||
|
||||
{
|
||||
boost::iostreams::stream<sink_device> ostr(sink);
|
||||
detail::psbuf<output_iterator, Char, CharEncoding, Tag> pseudobuf(sink);
|
||||
std::basic_ostream<Char> ostr(&pseudobuf);
|
||||
ostr.imbue(sink.get_ostream().getloc());
|
||||
ostr << traits::extract_from<attribute_type>(attr, context)
|
||||
<< std::flush;
|
||||
@@ -236,11 +260,8 @@ namespace boost { namespace spirit { namespace karma
|
||||
bool generate(OutputIterator& sink, Context&, Delimiter const& d
|
||||
, Attribute const&) const
|
||||
{
|
||||
typedef karma::detail::iterator_sink<
|
||||
OutputIterator, Char, CharEncoding, Tag
|
||||
> sink_device;
|
||||
|
||||
boost::iostreams::stream<sink_device> ostr(sink);
|
||||
detail::psbuf<OutputIterator, Char, CharEncoding, Tag> pseudobuf(sink);
|
||||
std::basic_ostream<Char> ostr(&pseudobuf);
|
||||
ostr << t_ << std::flush; // use existing operator<<()
|
||||
|
||||
if (ostr.good())
|
||||
@@ -261,12 +282,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
typedef karma::detail::output_iterator<
|
||||
karma::ostream_iterator<T1, Char, Traits>, Properties
|
||||
> output_iterator;
|
||||
typedef karma::detail::iterator_sink<
|
||||
output_iterator, Char, CharEncoding, Tag
|
||||
> sink_device;
|
||||
|
||||
{
|
||||
boost::iostreams::stream<sink_device> ostr(sink);
|
||||
detail::psbuf<output_iterator, Char, CharEncoding, Tag> pseudobuf(sink);
|
||||
std::basic_ostream<Char> ostr(&pseudobuf);
|
||||
ostr.imbue(sink.get_ostream().getloc());
|
||||
ostr << t_ << std::flush; // use existing operator<<()
|
||||
|
||||
@@ -284,10 +303,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
T t_;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
lit_stream_generator& operator= (lit_stream_generator const&);
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#include <boost/spirit/home/karma/detail/get_casetag.hpp>
|
||||
#include <boost/spirit/home/karma/detail/string_generate.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/proto/extends.hpp>
|
||||
#include <boost/proto/traits.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <map>
|
||||
@@ -383,6 +385,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
struct adder
|
||||
{
|
||||
template <typename, typename = unused_type>
|
||||
@@ -410,10 +416,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
symbols& sym;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
adder& operator= (adder const&);
|
||||
};
|
||||
|
||||
struct remover
|
||||
@@ -443,11 +445,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
symbols& sym;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
remover& operator= (remover const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
adder add;
|
||||
remover remove;
|
||||
@@ -642,6 +643,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4512) // assignment operator could not be generated.
|
||||
#endif
|
||||
struct adder
|
||||
{
|
||||
template <typename, typename = unused_type>
|
||||
@@ -669,10 +674,6 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
symbols& sym;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
adder& operator= (adder const&);
|
||||
};
|
||||
|
||||
struct remover
|
||||
@@ -702,11 +703,10 @@ namespace boost { namespace spirit { namespace karma
|
||||
}
|
||||
|
||||
symbols& sym;
|
||||
|
||||
private:
|
||||
// silence MSVC warning C4512: assignment operator could not be generated
|
||||
remover& operator= (remover const&);
|
||||
};
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
adder add;
|
||||
remover remove;
|
||||
|
||||
Reference in New Issue
Block a user