Boost logo

Boost-Commit :

From: joel_at_[hidden]
Date: 2008-04-18 19:41:49


Author: djowel
Date: 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
New Revision: 44561
URL: http://svn.boost.org/trac/boost/changeset/44561

Log:
put virtual_component_base outside detail namespace plus a few renames
Added:
   trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp (contents, props changed)
Text files modified:
   trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp | 10 ++--
   trunk/boost/spirit/home/qi/debug/detail/debug_handler.hpp | 8 ++--
   trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp | 4 +-
   trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp | 80 ++-------------------------------------
   trunk/boost/spirit/home/qi/nonterminal/rule.hpp | 2
   5 files changed, 17 insertions(+), 87 deletions(-)

Modified: trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp (original)
+++ trunk/boost/spirit/home/karma/nonterminal/detail/rule.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -36,12 +36,12 @@
     template <typename OutputIterator, typename Context, typename Delimiter>
     struct virtual_component_base
     {
- struct no_delimiter {};
+ struct take_no_delimiter {};
 
         typedef typename
             mpl::eval_if<
                 is_same<Delimiter, unused_type>,
- mpl::identity<no_delimiter>,
+ mpl::identity<take_no_delimiter>,
                 result_of::as_component<karma::domain, Delimiter>
>::type
         delimiter_type;
@@ -205,7 +205,7 @@
             virtual_component_base<OutputIterator, Context, Delimiter>
         base_type;
         typedef typename base_type::delimiter_type delimiter_type;
- typedef typename base_type::no_delimiter no_delimiter;
+ typedef typename base_type::take_no_delimiter take_no_delimiter;
 
         virtual_component(Component const& component)
           : component(component)
@@ -237,7 +237,7 @@
         }
 
         bool
- generate_main(OutputIterator& /*sink*/, Context& /*context*/, no_delimiter,
+ generate_main(OutputIterator& /*sink*/, Context& /*context*/, take_no_delimiter,
             mpl::false_)
         {
             BOOST_ASSERT(false); // this should never be called
@@ -245,7 +245,7 @@
         }
 
         bool
- generate_main(OutputIterator& /*sink*/, Context& /*context*/, no_delimiter,
+ generate_main(OutputIterator& /*sink*/, Context& /*context*/, take_no_delimiter,
             mpl::true_)
         {
             BOOST_ASSERT(false); // this should never be called

Modified: trunk/boost/spirit/home/qi/debug/detail/debug_handler.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/debug/detail/debug_handler.hpp (original)
+++ trunk/boost/spirit/home/qi/debug/detail/debug_handler.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -8,7 +8,7 @@
 #if !defined(BOOST_SPIRIT_DEBUG_HANDLER_NOV_12_2007_0926AM)
 #define BOOST_SPIRIT_DEBUG_HANDLER_NOV_12_2007_0926AM
 
-#include <boost/spirit/home/qi/nonterminal/detail/rule.hpp>
+#include <boost/spirit/home/qi/nonterminal/virtual_component_base.hpp>
 
 namespace boost { namespace spirit { namespace qi { namespace debug
 {
@@ -45,10 +45,10 @@
         typename PreParseF, typename PostParseF
>
     struct debug_handler
- : qi::detail::virtual_component_base<Iterator, Context, Skipper>
+ : virtual_component_base<Iterator, Context, Skipper>
     {
         typedef
- qi::detail::virtual_component_base<Iterator, Context, Skipper>
+ virtual_component_base<Iterator, Context, Skipper>
         base_type;
         typedef intrusive_ptr<base_type> pointer_type;
         typedef typename base_type::skipper_type skipper_type;
@@ -104,7 +104,7 @@
             Iterator& first
           , Iterator const& last
           , Context& context
- , accept_unused_only)
+ , no_skipper)
         {
             return parse_main(first, last, context, unused);
         }

Modified: trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/detail/error_handler.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -7,7 +7,7 @@
 #if !defined(BOOST_SPIRIT_ERROR_HANDLER_APR_29_2007_1042PM)
 #define BOOST_SPIRIT_ERROR_HANDLER_APR_29_2007_1042PM
 
-#include <boost/spirit/home/qi/nonterminal/detail/rule.hpp>
+#include <boost/spirit/home/qi/nonterminal/virtual_component_base.hpp>
 #include <boost/spirit/home/qi/nonterminal/error_handler_result.hpp>
 #include <boost/spirit/home/qi/operator/expect.hpp>
 #include <boost/fusion/include/vector.hpp>
@@ -87,7 +87,7 @@
             Iterator& first
           , Iterator const& last
           , Context& context
- , accept_unused_only)
+ , no_skipper)
         {
             return parse_main(first, last, context, unused);
         }

Modified: trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/detail/rule.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -7,81 +7,11 @@
 #if !defined(BOOST_SPIRIT_RULE_FEB_12_2007_0440PM)
 #define BOOST_SPIRIT_RULE_FEB_12_2007_0440PM
 
-#include <boost/spirit/home/support/unused.hpp>
-#include <boost/spirit/home/support/component.hpp>
-#include <boost/intrusive_ptr.hpp>
-#include <boost/detail/atomic_count.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/identity.hpp>
-#include <boost/type_traits/is_same.hpp>
-#include <boost/utility/enable_if.hpp>
-#include <boost/function_types/is_function.hpp>
+#include <boost/spirit/home/qi/nonterminal/virtual_component_base.hpp>
 #include <boost/assert.hpp>
-#include <algorithm>
 
 namespace boost { namespace spirit { namespace qi { namespace detail
 {
- struct accept_unused_only
- {
- // this struct accepts only unused types and
- // nothing else.
- accept_unused_only(unused_type) {}
- };
-
- template <typename Iterator, typename Context, typename Skipper>
- struct virtual_component_base
- {
- struct no_skipper {};
-
- typedef typename
- mpl::eval_if<
- is_same<Skipper, unused_type>
- , mpl::identity<no_skipper>
- , result_of::as_component<qi::domain, Skipper>
- >::type
- skipper_type;
-
- virtual_component_base()
- : use_count(0)
- {
- }
-
- virtual ~virtual_component_base()
- {
- }
-
- virtual bool
- parse(
- Iterator& first
- , Iterator const& last
- , Context& context
- , skipper_type const& skipper) = 0;
-
- virtual bool
- parse(
- Iterator& first
- , Iterator const& last
- , Context& context
- , accept_unused_only) = 0;
-
- boost::detail::atomic_count use_count;
- };
-
- template <typename Iterator, typename Context, typename Skipper>
- inline void
- intrusive_ptr_add_ref(virtual_component_base<Iterator, Context, Skipper>* p)
- {
- ++p->use_count;
- }
-
- template <typename Iterator, typename Context, typename Skipper>
- inline void
- intrusive_ptr_release(virtual_component_base<Iterator, Context, Skipper>* p)
- {
- if (--p->use_count == 0)
- delete p;
- }
-
     template <
         typename Iterator, typename Component
       , typename Context, typename Skipper
@@ -91,7 +21,7 @@
     {
         typedef virtual_component_base<Iterator, Context, Skipper> base_type;
         typedef typename base_type::skipper_type skipper_type;
- typedef typename base_type::no_skipper no_skipper;
+ typedef typename base_type::take_no_skipper take_no_skipper;
 
         virtual_component(Component const& component)
           : component(component)
@@ -158,7 +88,7 @@
             Iterator& /*first*/
           , Iterator const& /*last*/
           , Context&
- , no_skipper
+ , take_no_skipper
           , mpl::false_)
         {
             BOOST_ASSERT(false); // this should never be called
@@ -169,7 +99,7 @@
             Iterator& /*first*/
           , Iterator const& /*last*/
           , Context& /*context*/
- , no_skipper
+ , take_no_skipper
           , mpl::true_)
         {
             BOOST_ASSERT(false); // this should never be called
@@ -191,7 +121,7 @@
             Iterator& first
           , Iterator const& last
           , Context& context
- , accept_unused_only)
+ , no_skipper)
         {
             return parse_main(first, last, context, unused, Auto());
         }

Modified: trunk/boost/spirit/home/qi/nonterminal/rule.hpp
==============================================================================
--- trunk/boost/spirit/home/qi/nonterminal/rule.hpp (original)
+++ trunk/boost/spirit/home/qi/nonterminal/rule.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -47,7 +47,7 @@
         typedef rule<Iterator, T0, T1, T2> self_type;
 
         typedef
- detail::virtual_component_base<
+ virtual_component_base<
                 Iterator
               , typename base_type::context_type
               , skipper_type

Added: trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/spirit/home/qi/nonterminal/virtual_component_base.hpp 2008-04-18 19:41:48 EDT (Fri, 18 Apr 2008)
@@ -0,0 +1,85 @@
+/*=============================================================================
+ Copyright (c) 2001-2007 Joel de Guzman
+
+ 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_VIRTUAL_COMPONENT_BASE_FEB_12_2007_0440PM)
+#define BOOST_SPIRIT_VIRTUAL_COMPONENT_BASE_FEB_12_2007_0440PM
+
+#include <boost/spirit/home/support/unused.hpp>
+#include <boost/spirit/home/support/component.hpp>
+#include <boost/intrusive_ptr.hpp>
+#include <boost/detail/atomic_count.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+namespace boost { namespace spirit { namespace qi
+{
+ struct no_skipper
+ {
+ // this struct accepts only unused types and
+ // nothing else. This is used by the second
+ // pure virtual parse member function of
+ // virtual_component_base below.
+
+ no_skipper(unused_type) {}
+ };
+
+ template <typename Iterator, typename Context, typename Skipper>
+ struct virtual_component_base
+ {
+ struct take_no_skipper {};
+
+ typedef typename
+ mpl::eval_if<
+ is_same<Skipper, unused_type>
+ , mpl::identity<take_no_skipper>
+ , result_of::as_component<qi::domain, Skipper>
+ >::type
+ skipper_type;
+
+ virtual_component_base()
+ : use_count(0)
+ {
+ }
+
+ virtual ~virtual_component_base()
+ {
+ }
+
+ virtual bool
+ parse(
+ Iterator& first
+ , Iterator const& last
+ , Context& context
+ , skipper_type const& skipper) = 0;
+
+ virtual bool
+ parse(
+ Iterator& first
+ , Iterator const& last
+ , Context& context
+ , no_skipper) = 0;
+
+ boost::detail::atomic_count use_count;
+ };
+
+ template <typename Iterator, typename Context, typename Skipper>
+ inline void
+ intrusive_ptr_add_ref(virtual_component_base<Iterator, Context, Skipper>* p)
+ {
+ ++p->use_count;
+ }
+
+ template <typename Iterator, typename Context, typename Skipper>
+ inline void
+ intrusive_ptr_release(virtual_component_base<Iterator, Context, Skipper>* p)
+ {
+ if (--p->use_count == 0)
+ delete p;
+ }
+}}}
+
+#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