Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:34:42

0001 /*=============================================================================
0002     Copyright (c) 1999-2003 Jaakko Jarvi
0003     Copyright (c) 1999-2003 Jeremiah Willcock
0004     Copyright (c) 2001-2011 Joel de Guzman
0005 
0006     Distributed under the Boost Software License, Version 1.0. (See accompanying 
0007     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0008 ==============================================================================*/
0009 #if !defined(FUSION_IN_05052005_0121)
0010 #define FUSION_IN_05052005_0121
0011 
0012 #include <boost/fusion/support/config.hpp>
0013 #include <boost/fusion/sequence/io/detail/manip.hpp>
0014 
0015 #include <boost/mpl/bool.hpp>
0016 #include <boost/fusion/sequence/intrinsic/begin.hpp>
0017 #include <boost/fusion/sequence/intrinsic/end.hpp>
0018 #include <boost/fusion/iterator/deref.hpp>
0019 #include <boost/fusion/iterator/next.hpp>
0020 #include <boost/fusion/iterator/equal_to.hpp>
0021 
0022 namespace boost { namespace fusion { namespace detail
0023 {
0024     template <typename Tag>
0025     struct delimiter_in
0026     {
0027         // read a delimiter
0028         template <typename IS>
0029         static void
0030         read(IS& is, char const* delim, mpl::false_ = mpl::false_())
0031         {
0032             detail::string_ios_manip<Tag, IS> manip(is);
0033             manip.read(delim);
0034         }
0035 
0036         template <typename IS>
0037         static void
0038         read(IS&, char const*, mpl::true_)
0039         {
0040         }
0041     };
0042 
0043     struct read_sequence_loop
0044     {
0045         template <typename IS, typename First, typename Last>
0046         static void
0047         call(IS&, First const&, Last const&, mpl::true_)
0048         {
0049         }
0050 
0051         template <typename IS, typename First, typename Last>
0052         static void
0053         call(IS& is, First const& first, Last const& last, mpl::false_)
0054         {
0055             result_of::equal_to<
0056                 typename result_of::next<First>::type
0057               , Last
0058             >
0059             is_last;
0060 
0061             is >> *first;
0062             delimiter_in<tuple_delimiter_tag>::read(is, " ", is_last);
0063             call(is, fusion::next(first), last, is_last);
0064         }
0065 
0066         template <typename IS, typename First, typename Last>
0067         static void
0068         call(IS& is, First const& first, Last const& last)
0069         {
0070             result_of::equal_to<First, Last> eq;
0071             call(is, first, last, eq);
0072         }
0073     };
0074 
0075     template <typename IS, typename Sequence>
0076     inline void
0077     read_sequence(IS& is, Sequence& seq)
0078     {
0079         delimiter_in<tuple_open_tag>::read(is, "(");
0080         read_sequence_loop::call(is, fusion::begin(seq), fusion::end(seq));
0081         delimiter_in<tuple_close_tag>::read(is, ")");
0082     }
0083 }}}
0084 
0085 #endif