/*============================================================================= Copyright (c) 2001-2010 Hartmut Kaiser Copyright (c) 2001-2010 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_TEST_MATCH_MANIP_HPP) #define BOOST_SPIRIT_TEST_MATCH_MANIP_HPP #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /////////////////////////////////////////////////////////////////////////////// template bool test(Char const *toparse, Expr const& expr) { namespace spirit = boost::spirit; BOOST_SPIRIT_ASSERT_MATCH(spirit::qi::domain, Expr); std::istringstream istrm(toparse); istrm.unsetf(std::ios::skipws); istrm >> spirit::qi::compile(expr); return istrm.good() || istrm.eof(); } template bool test(Char const *toparse, boost::spirit::qi::detail::match_manip< Expr, CopyExpr, CopyAttr, Skipper, Attribute> const& mm) { std::istringstream istrm(toparse); istrm.unsetf(std::ios::skipws); istrm >> mm; return istrm.good() || istrm.eof(); } /////////////////////////////////////////////////////////////////////////////// bool is_list_ok(std::list const& l) { std::list::const_iterator cit = l.begin(); if (cit == l.end() || *cit != 'a') return false; if (++cit == l.end() || *cit != 'b') return false; return ++cit != l.end() && *cit == 'c'; } #endif