PageRenderTime 24ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/spirit/home/phoenix/operator/detail/io.hpp

http://hadesmem.googlecode.com/
C++ Header | 78 lines | 62 code | 10 blank | 6 comment | 2 complexity | fb8e4aa29fddc4b8844f8a4b8bf58828 MD5 | raw file
 1/*=============================================================================
 2    Copyright (c) 2001-2007 Joel de Guzman
 3
 4    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 5    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 6==============================================================================*/
 7#ifndef PHOENIX_OPERATOR_DETAIL_IO_HPP
 8#define PHOENIX_OPERATOR_DETAIL_IO_HPP
 9
10#include <boost/spirit/home/phoenix/operator/bitwise.hpp>
11#include <boost/spirit/home/phoenix/core/reference.hpp>
12#include <boost/utility/addressof.hpp>
13#include <boost/utility/enable_if.hpp>
14#include <iostream>
15
16namespace boost { namespace phoenix { namespace detail
17{
18    typedef char(&no)[1];
19    typedef char(&yes)[2];
20
21    template <typename CharType, typename CharTrait>
22    yes ostream_test(std::basic_ostream<CharType, CharTrait>*);
23    no ostream_test(...);
24
25    template <typename CharType, typename CharTrait>
26    yes istream_test(std::basic_istream<CharType, CharTrait>*);
27    no istream_test(...);
28
29    template <typename T>
30    struct is_ostream
31    {
32        static T x;
33        BOOST_STATIC_CONSTANT(bool,
34            value = sizeof(detail::ostream_test(boost::addressof(x))) == sizeof(yes));
35    };
36
37    template <typename T>
38    struct is_istream
39    {
40        static T x;
41        BOOST_STATIC_CONSTANT(bool,
42            value = sizeof(detail::istream_test(boost::addressof(x))) == sizeof(yes));
43    };
44
45    template <typename T0, typename T1>
46    struct enable_if_ostream :
47        enable_if<
48            detail::is_ostream<T0>
49          , actor<
50                typename as_composite<
51                    shift_left_eval
52                  , actor<reference<T0> >
53                  , actor<T1>
54                >::type
55            >
56        >
57    {};
58
59    template <typename T0, typename T1>
60    struct enable_if_istream :
61        enable_if<
62            detail::is_istream<T0>
63          , actor<
64                typename as_composite<
65                    shift_right_eval
66                  , actor<reference<T0> >
67                  , actor<T1>
68                >::type
69            >
70        >
71    {};
72
73    typedef std::ios_base&  (*iomanip_type)(std::ios_base&);
74    typedef std::istream&   (*imanip_type)(std::istream&);
75    typedef std::ostream&   (*omanip_type)(std::ostream&);
76}}}
77
78#endif