// Copyright (c) 2001-2010 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_FORMAT_MANIP_MAY_01_2007_1211PM) #define BOOST_SPIRIT_KARMA_FORMAT_MANIP_MAY_01_2007_1211PM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include #include /////////////////////////////////////////////////////////////////////////////// namespace boost { namespace spirit { namespace karma { /////////////////////////////////////////////////////////////////////////// template inline typename detail::format::type format(Expr const& expr) { return detail::format::call(expr); } template inline detail::format_manip format( Expr const& expr , Attribute const& attr) { using karma::detail::format_manip; // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, // then the expression (expr) is not a valid spirit karma expression. BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr); return format_manip( expr, unused, attr); } /////////////////////////////////////////////////////////////////////////// template inline typename detail::format_delimited::type format_delimited( Expr const& expr , Delimiter const& d , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit = delimit_flag::dont_predelimit) { return detail::format_delimited::call(expr, d, pre_delimit); } template inline detail::format_manip format_delimited( Expr const& xpr , Delimiter const& d , BOOST_SCOPED_ENUM(delimit_flag) pre_delimit , Attribute const& attr) { using karma::detail::format_manip; // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, // then the expression (expr) is not a valid spirit karma expression. BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr); BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter); return format_manip( xpr, d, pre_delimit, attr); } template inline detail::format_manip format_delimited( Expr const& xpr , Delimiter const& d , Attribute const& attr) { using karma::detail::format_manip; // Report invalid expression error as early as possible. // If you got an error_invalid_expression error message here, // then the expression (expr) is not a valid spirit karma expression. BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Expr); BOOST_SPIRIT_ASSERT_MATCH(karma::domain, Delimiter); return format_manip( xpr, d, delimit_flag::dont_predelimit, attr); } /////////////////////////////////////////////////////////////////////////// template inline std::basic_ostream & operator<< (std::basic_ostream &os, generator const& g) { typedef traits::properties_of< typename result_of::compile::type > properties; typedef karma::ostream_iterator outiter_type; outiter_type target_sink(os); karma::detail::output_iterator sink(target_sink); if (!g.derived().generate(sink, unused, unused, unused)) { os.setstate(std::ios_base::failbit); } return os; } }}} #endif