1 // Copyright (c) 2001-2011 Hartmut Kaiser
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 #if !defined(BOOST_SPIRIT_KARMA_BOOL_UTILS_SEP_28_2009_0644PM)
7 #define BOOST_SPIRIT_KARMA_BOOL_UTILS_SEP_28_2009_0644PM
13 #include <boost/spirit/home/support/char_class.hpp>
14 #include <boost/spirit/home/support/unused.hpp>
15 #include <boost/spirit/home/karma/detail/generate_to.hpp>
16 #include <boost/spirit/home/karma/detail/string_generate.hpp>
17 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
18 #include <boost/detail/workaround.hpp>
20 namespace boost { namespace spirit { namespace karma
22 ///////////////////////////////////////////////////////////////////////////
24 // The bool_inserter template takes care of the boolean to string
25 // conversion. The Policies template parameter is used to allow
26 // customization of the formatting process
28 ///////////////////////////////////////////////////////////////////////////
33 , typename Policies = bool_policies<T>
34 , typename CharEncoding = unused_type
35 , typename Tag = unused_type>
38 template <typename OutputIterator, typename U>
40 call (OutputIterator& sink, U b, Policies const& p = Policies())
42 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
43 p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
45 return p.template call<bool_inserter>(sink, T(b), p);
48 ///////////////////////////////////////////////////////////////////////
49 // This is the workhorse behind the real generator
50 ///////////////////////////////////////////////////////////////////////
51 template <typename OutputIterator, typename U>
53 call_n (OutputIterator& sink, U b, Policies const& p)
55 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
56 p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
59 return p.template generate_true<CharEncoding, Tag>(sink, b);
60 return p.template generate_false<CharEncoding, Tag>(sink, b);