|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55379 - in trunk/boost/spirit: home/karma home/karma/detail home/karma/operator home/karma/stream home/karma/string include
From: hartmut.kaiser_at_[hidden]
Date: 2009-08-02 22:28:29
Author: hkaiser
Date: 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
New Revision: 55379
URL: http://svn.boost.org/trac/boost/changeset/55379
Log:
Spirit: renamed traits::properties to traits::properties_of, added missing files
Added:
trunk/boost/spirit/include/karma_and_predicate.hpp (contents, props changed)
trunk/boost/spirit/include/karma_list.hpp (contents, props changed)
trunk/boost/spirit/include/karma_not_predicate.hpp (contents, props changed)
trunk/boost/spirit/include/karma_optional.hpp (contents, props changed)
Text files modified:
trunk/boost/spirit/home/karma/detail/pass_container.hpp | 11 ++++++---
trunk/boost/spirit/home/karma/detail/string_generate.hpp | 42 +++++++++++++++++++++++++++++++++++++++
trunk/boost/spirit/home/karma/generate.hpp | 12 +++++-----
trunk/boost/spirit/home/karma/generate_attr.hpp | 10 ++++----
trunk/boost/spirit/home/karma/generator.hpp | 2
trunk/boost/spirit/home/karma/operator/and_predicate.hpp | 3 +
trunk/boost/spirit/home/karma/operator/not_predicate.hpp | 3 +
trunk/boost/spirit/home/karma/operator/sequence.hpp | 2
trunk/boost/spirit/home/karma/stream/format_manip.hpp | 2
trunk/boost/spirit/home/karma/string/lit.hpp | 2
10 files changed, 67 insertions(+), 22 deletions(-)
Modified: trunk/boost/spirit/home/karma/detail/pass_container.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/pass_container.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/pass_container.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -122,14 +122,14 @@
// This handles the case where the attribute of the component
// is not a STL container or which elements are not
- // convertible to the target attribute's (Attr) value_type.
+ // convertible to the target attribute (Attr) value_type.
template <typename Component>
bool dispatch_main(Component const& component, mpl::false_) const
{
// we need to dispatch again depending on the type of the attribute
// of the current element (component). If this is has no attribute
- // we shouldn't use an element of the container but unused_type as
- // well
+ // we shouldn't use an element of the container but unused_type
+ // instead
typedef traits::is_not_unused<
typename traits::attribute_of<Component, context_type>::type
> predicate;
@@ -143,7 +143,10 @@
template <typename Component>
bool dispatch_main(Component const& component, mpl::true_) const
{
- return f(component, make_iterator_range(iter, traits::end(attr)));
+ bool result = f(component, make_iterator_range(iter, traits::end(attr)));
+ if (result)
+ iter = traits::end(attr); // adjust current iter to the end
+ return result;
}
// Dispatches to dispatch_main depending on the attribute type
Modified: trunk/boost/spirit/home/karma/detail/string_generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/detail/string_generate.hpp (original)
+++ trunk/boost/spirit/home/karma/detail/string_generate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -13,7 +13,7 @@
#include <string>
#include <boost/spirit/home/support/char_class.hpp>
#include <boost/spirit/home/karma/detail/generate_to.hpp>
-#include <boost/foreach.hpp>
+#include <boost/range/iterator_range.hpp>
namespace boost { namespace spirit { namespace karma { namespace detail
{
@@ -40,6 +40,19 @@
return string_generate(sink, str.c_str());
}
+ template <typename OutputIterator, typename Iterator>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
+ {
+ *sink = *it;
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
+ }
+
///////////////////////////////////////////////////////////////////////////
// generate a string given by a pointer, converting according using a
// given character class and case tag
@@ -75,6 +88,20 @@
return string_generate(sink, str.c_str(), ce, tag);
}
+ template <typename OutputIterator, typename Iterator, typename CharEncoding
+ , typename Tag>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r, CharEncoding ce, Tag tag)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
+ {
+ *sink = spirit::char_class::convert<CharEncoding>::to(Tag(), *it);
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
+ }
+
template <typename OutputIterator, typename Char, typename Traits
, typename Allocator>
inline bool string_generate(OutputIterator& sink
@@ -84,6 +111,19 @@
return string_generate(sink, str.c_str());
}
+ template <typename OutputIterator, typename Iterator>
+ inline bool string_generate(OutputIterator& sink
+ , boost::iterator_range<Iterator> const& r, unused_type, unused_type)
+ {
+ Iterator end = r.end();
+ for (Iterator it = r.begin(); it != end; ++it)
+ {
+ *sink = *it;
+ ++sink;
+ }
+ return detail::sink_is_good(sink);
+ }
+
}}}}
#endif
Modified: trunk/boost/spirit/home/karma/generate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generate.hpp (original)
+++ trunk/boost/spirit/home/karma/generate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -40,7 +40,7 @@
// then the expression (expr) is not a valid spirit karma expression.
BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
@@ -76,7 +76,7 @@
// then the expression (expr) is not a valid spirit karma expression.
BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr);
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
@@ -141,10 +141,10 @@
, BOOST_SCOPED_ENUM(delimit_flag) pre_delimit =
delimit_flag::dont_predelimit)
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Delimiter>::type
> delimiter_properties;
@@ -197,10 +197,10 @@
, BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
, Attribute const& attr)
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Delimiter>::type
> delimiter_properties;
Modified: trunk/boost/spirit/home/karma/generate_attr.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generate_attr.hpp (original)
+++ trunk/boost/spirit/home/karma/generate_attr.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -66,7 +66,7 @@
, Expr const& expr
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
@@ -122,10 +122,10 @@
, BOOST_SCOPED_ENUM(delimit_flag) pre_delimit
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Delimiter>::type
> delimiter_properties;
@@ -146,10 +146,10 @@
, Delimiter const& delimiter
, BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& attr))
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Expr>::type
> properties;
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Delimiter>::type
> delimiter_properties;
Modified: trunk/boost/spirit/home/karma/generator.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/generator.hpp (original)
+++ trunk/boost/spirit/home/karma/generator.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -151,7 +151,7 @@
// check for generator properties
template <typename T>
- struct properties : T::properties {};
+ struct properties_of : T::properties {};
}}}
Modified: trunk/boost/spirit/home/karma/operator/and_predicate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/and_predicate.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/and_predicate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -36,7 +36,8 @@
{
typedef Subject subject_type;
typedef mpl::int_<
- generator_properties::countingbuffer | subject_type::properties::value
+ generator_properties::countingbuffer |
+ subject_type::properties::value
> properties;
template <typename Context, typename Iterator>
Modified: trunk/boost/spirit/home/karma/operator/not_predicate.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/not_predicate.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/not_predicate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -37,7 +37,8 @@
typedef Subject subject_type;
typedef mpl::int_<
- generator_properties::countingbuffer | subject_type::properties::value
+ generator_properties::countingbuffer |
+ subject_type::properties::value
> properties;
template <typename Context, typename Iterator>
Modified: trunk/boost/spirit/home/karma/operator/sequence.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/operator/sequence.hpp (original)
+++ trunk/boost/spirit/home/karma/operator/sequence.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -62,7 +62,7 @@
template <typename F, typename Element>
struct result<F(Element)>
{
- typedef properties<Element> type;
+ typedef properties_of<Element> type;
};
};
Modified: trunk/boost/spirit/home/karma/stream/format_manip.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/stream/format_manip.hpp (original)
+++ trunk/boost/spirit/home/karma/stream/format_manip.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -97,7 +97,7 @@
inline std::basic_ostream<Char, Traits> &
operator<< (std::basic_ostream<Char, Traits> &os, generator<Derived> const& g)
{
- typedef traits::properties<
+ typedef traits::properties_of<
typename result_of::compile<karma::domain, Derived>::type
> properties;
typedef karma::detail::ostream_iterator<Char, Char, Traits> outiter_type;
Modified: trunk/boost/spirit/home/karma/string/lit.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/string/lit.hpp (original)
+++ trunk/boost/spirit/home/karma/string/lit.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -101,7 +101,7 @@
static bool generate(OutputIterator&, Context&, Delimiter const&,
unused_type const&)
{
- // It is not possible (doesn't make sense) to use char_ without
+ // It is not possible (doesn't make sense) to use string without
// providing any attribute, as the generator doesn't 'know' what
// character to output. The following assertion fires if this
// situation is detected in your code.
Added: trunk/boost/spirit/include/karma_and_predicate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_and_predicate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ 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_SPIRIT_INCLUDE_KARMA_AND_PREDICATE
+#define BOOST_SPIRIT_INCLUDE_KARMA_AND_PREDICATE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/operator/and_predicate.hpp>
+
+#endif
Added: trunk/boost/spirit/include/karma_list.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_list.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ 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_SPIRIT_INCLUDE_KARMA_LIST
+#define BOOST_SPIRIT_INCLUDE_KARMA_LIST
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/operator/list.hpp>
+
+#endif
Added: trunk/boost/spirit/include/karma_not_predicate.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_not_predicate.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ 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_SPIRIT_INCLUDE_KARMA_NOT_PREDICATE
+#define BOOST_SPIRIT_INCLUDE_KARMA_NOT_PREDICATE
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/operator/not_predicate.hpp>
+
+#endif
Added: trunk/boost/spirit/include/karma_optional.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/include/karma_optional.hpp 2009-08-02 22:28:27 EDT (Sun, 02 Aug 2009)
@@ -0,0 +1,18 @@
+/*=============================================================================
+ Copyright (c) 2001-2009 Joel de Guzman
+ Copyright (c) 2001-2009 Hartmut Kaiser
+ http://spirit.sourceforge.net/
+
+ 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_SPIRIT_INCLUDE_KARMA_OPTIONAL
+#define BOOST_SPIRIT_INCLUDE_KARMA_OPTIONAL
+
+#if defined(_MSC_VER)
+#pragma once
+#endif
+
+#include <boost/spirit/home/karma/operator/optional.hpp>
+
+#endif
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk