// 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_KARMA_META_GRAMMAR_MAY_01_2007_0313PM) #define BOOST_SPIRIT_KARMA_META_GRAMMAR_MAY_01_2007_0313PM #if defined(_MSC_VER) && (_MSC_VER >= 1020) #pragma once // MS compatible compilers support #pragma once #endif #include #include #include namespace boost { namespace spirit { namespace karma { /////////////////////////////////////////////////////////////////////////// // forwards /////////////////////////////////////////////////////////////////////////// template struct any_stream; template struct stream_director; struct main_meta_grammar; template struct is_valid_expr; template struct expr_transform; /////////////////////////////////////////////////////////////////////////// // get the director for a stream /////////////////////////////////////////////////////////////////////////// template struct extract_any_stream_director; template <> struct extract_any_stream_director { typedef any_stream type; }; template <> struct extract_any_stream_director { typedef any_stream type; }; /////////////////////////////////////////////////////////////////////////// template struct extract_stream_director; template struct extract_stream_director { typedef stream_director type; }; template struct extract_stream_director { typedef stream_director type; }; /////////////////////////////////////////////////////////////////////////// // utility meta-grammar /////////////////////////////////////////////////////////////////////////// struct utility_meta_grammar : proto::or_< // stream, wstream meta_grammar::compose_empty< proto::if_< is_stream_tag() >, karma::domain, mpl::identity > >, // stream(T), wstream(T) meta_grammar::compose_function1_eval< proto::function< proto::if_< is_stream_tag() >, proto::_ >, karma::domain, mpl::identity > > > { }; /////////////////////////////////////////////////////////////////////////// // These specializations non-intrusively hook into the Karma meta-grammar. // (see karma/meta_grammar.hpp) /////////////////////////////////////////////////////////////////////////// template struct is_valid_expr< Expr, typename enable_if< proto::matches >::type > : mpl::true_ { }; template struct expr_transform< Expr, typename enable_if< proto::matches >::type > : mpl::identity { }; }}} #endif