// Copyright (c) 2001-2008 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) #if !defined(BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1202PM) #define BOOST_SPIRIT_FORMAT_MANIP_MAY_05_2007_1202PM #include #include #include #include #include /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { namespace qi { /////////////////////////////////////////////////////////////////////////// template inline detail::match_manip match(Expr const& xpr) { typedef spirit::traits::is_component is_component; // report invalid expression error as early as possible BOOST_MPL_ASSERT_MSG(is_component::value, xpr_is_not_convertible_to_a_parser, (Expr)); return qi::detail::match_manip(xpr, unused, unused); } template inline detail::match_manip match(Expr const& xpr, Attribute& p) { typedef spirit::traits::is_component is_component; // report invalid expression error as early as possible BOOST_MPL_ASSERT_MSG(is_component::value, xpr_is_not_convertible_to_a_parser, (Expr, Attribute)); return qi::detail::match_manip(xpr, p, unused); } /////////////////////////////////////////////////////////////////////////// template inline detail::match_manip phrase_match(Expr const& xpr, Skipper const& s) { typedef spirit::traits::is_component expr_is_component; typedef spirit::traits::is_component skipper_is_component; // report invalid expression errors as early as possible BOOST_MPL_ASSERT_MSG(expr_is_component::value, xpr_is_not_convertible_to_a_parser, (Expr, Skipper)); BOOST_MPL_ASSERT_MSG(skipper_is_component::value, skipper_is_not_convertible_to_a_parser, (Expr, Skipper)); return qi::detail::match_manip( xpr, unused, s); } template inline detail::match_manip phrase_match(Expr const& xpr, Attribute& p, Skipper const& s) { typedef spirit::traits::is_component expr_is_component; typedef spirit::traits::is_component skipper_is_component; // report invalid expression errors as early as possible BOOST_MPL_ASSERT_MSG(expr_is_component::value, xpr_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper)); BOOST_MPL_ASSERT_MSG(skipper_is_component::value, skipper_is_not_convertible_to_a_parser, (Expr, Attribute, Skipper)); return qi::detail::match_manip(xpr, p, s); } /////////////////////////////////////////////////////////////////////////// template inline typename enable_if< spirit::traits::is_component, std::basic_istream & >::type operator>> (std::basic_istream &is, Expr& xpr) { typedef std::istream_iterator input_iterator; input_iterator f(is); input_iterator l; if (!qi::parse (f, l, xpr)) { is.setstate(std::ios_base::failbit); } return is; } }}} #endif