Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:47:37

0001 //  Copyright (c) 2001-2011 Hartmut Kaiser
0002 // 
0003 //  Distributed under the Boost Software License, Version 1.0. (See accompanying 
0004 //  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0005 
0006 #if !defined(BOOST_SPIRIT_KARMA_BOOL_UTILS_SEP_28_2009_0644PM)
0007 #define BOOST_SPIRIT_KARMA_BOOL_UTILS_SEP_28_2009_0644PM
0008 
0009 #if defined(_MSC_VER)
0010 #pragma once
0011 #endif
0012 
0013 #include <boost/spirit/home/support/char_class.hpp>
0014 #include <boost/spirit/home/support/unused.hpp>
0015 #include <boost/spirit/home/karma/detail/generate_to.hpp>
0016 #include <boost/spirit/home/karma/detail/string_generate.hpp>
0017 #include <boost/spirit/home/karma/numeric/detail/numeric_utils.hpp>
0018 #include <boost/detail/workaround.hpp>
0019 
0020 namespace boost { namespace spirit { namespace karma 
0021 { 
0022     ///////////////////////////////////////////////////////////////////////////
0023     //
0024     //  The bool_inserter template takes care of the boolean to string 
0025     //  conversion. The Policies template parameter is used to allow
0026     //  customization of the formatting process
0027     //
0028     ///////////////////////////////////////////////////////////////////////////
0029     template <typename T>
0030     struct bool_policies;
0031 
0032     template <typename T
0033       , typename Policies = bool_policies<T>
0034       , typename CharEncoding = unused_type
0035       , typename Tag = unused_type>
0036     struct bool_inserter
0037     {
0038         template <typename OutputIterator, typename U>
0039         static bool
0040         call (OutputIterator& sink, U b, Policies const& p = Policies())
0041         {
0042 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
0043             (void)p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
0044 #endif
0045             return p.template call<bool_inserter>(sink, T(b), p);
0046         }
0047 
0048         ///////////////////////////////////////////////////////////////////////
0049         //  This is the workhorse behind the real generator
0050         ///////////////////////////////////////////////////////////////////////
0051         template <typename OutputIterator, typename U>
0052         static bool
0053         call_n (OutputIterator& sink, U b, Policies const& p)
0054         {
0055 #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1600))
0056             (void)p; // suppresses warning: C4100: 'p' : unreferenced formal parameter
0057 #endif
0058             if (b) 
0059                 return p.template generate_true<CharEncoding, Tag>(sink, b);
0060             return p.template generate_false<CharEncoding, Tag>(sink, b);
0061         }
0062     };
0063 
0064 }}}
0065 
0066 #endif
0067