Project revived from Feb2017
[EroSomnia.git] / deps / boost_1_63_0 / boost / fusion / sequence / io / detail / in.hpp
blobd0a8dc4964a426e0dfcab30743edf0aa84ad1239
1 /*=============================================================================
2 Copyright (c) 1999-2003 Jaakko Jarvi
3 Copyright (c) 1999-2003 Jeremiah Willcock
4 Copyright (c) 2001-2011 Joel de Guzman
6 Distributed under the Boost Software License, Version 1.0. (See accompanying
7 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
8 ==============================================================================*/
9 #if !defined(FUSION_IN_05052005_0121)
10 #define FUSION_IN_05052005_0121
12 #include <boost/fusion/support/config.hpp>
13 #include <istream>
14 #include <boost/fusion/sequence/io/detail/manip.hpp>
16 #include <boost/mpl/bool.hpp>
17 #include <boost/fusion/sequence/intrinsic/begin.hpp>
18 #include <boost/fusion/sequence/intrinsic/end.hpp>
19 #include <boost/fusion/iterator/deref.hpp>
20 #include <boost/fusion/iterator/next.hpp>
21 #include <boost/fusion/iterator/equal_to.hpp>
23 namespace boost { namespace fusion { namespace detail
25 template <typename Tag>
26 struct delimiter_in
28 // read a delimiter
29 template <typename IS>
30 static void
31 read(IS& is, char const* delim, mpl::false_ = mpl::false_())
33 detail::string_ios_manip<Tag, IS> manip(is);
34 manip.read(delim);
37 template <typename IS>
38 static void
39 read(IS&, char const*, mpl::true_)
44 struct read_sequence_loop
46 template <typename IS, typename First, typename Last>
47 static void
48 call(IS&, First const&, Last const&, mpl::true_)
52 template <typename IS, typename First, typename Last>
53 static void
54 call(IS& is, First const& first, Last const& last, mpl::false_)
56 result_of::equal_to<
57 typename result_of::next<First>::type
58 , Last
60 is_last;
62 is >> *first;
63 delimiter_in<tuple_delimiter_tag>::read(is, " ", is_last);
64 call(is, fusion::next(first), last, is_last);
67 template <typename IS, typename First, typename Last>
68 static void
69 call(IS& is, First const& first, Last const& last)
71 result_of::equal_to<First, Last> eq;
72 call(is, first, last, eq);
76 template <typename IS, typename Sequence>
77 inline void
78 read_sequence(IS& is, Sequence& seq)
80 delimiter_in<tuple_open_tag>::read(is, "(");
81 read_sequence_loop::call(is, fusion::begin(seq), fusion::end(seq));
82 delimiter_in<tuple_close_tag>::read(is, ")");
84 }}}
86 #endif