annotate DEPENDENCIES/generic/include/boost/spirit/home/karma/detail/as.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Copyright (c) 2001-2011 Hartmut Kaiser
Chris@16 2 //
Chris@16 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 5
Chris@16 6 #if !defined(BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM)
Chris@16 7 #define BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM
Chris@16 8
Chris@16 9 #if defined(_MSC_VER)
Chris@16 10 #pragma once
Chris@16 11 #endif
Chris@16 12
Chris@16 13 #include <boost/spirit/home/support/unused.hpp>
Chris@16 14 #include <boost/spirit/home/support/attributes_fwd.hpp>
Chris@16 15
Chris@16 16 ///////////////////////////////////////////////////////////////////////////////
Chris@16 17 namespace boost { namespace spirit { namespace traits
Chris@16 18 {
Chris@16 19 ///////////////////////////////////////////////////////////////////////////
Chris@16 20 // This file contains the attribute to string conversion utility. The
Chris@16 21 // utility provided also accept spirit's unused_type; all no-ops. Compiler
Chris@16 22 // optimization will easily strip these away.
Chris@16 23 ///////////////////////////////////////////////////////////////////////////
Chris@16 24
Chris@16 25 ///////////////////////////////////////////////////////////////////////////
Chris@16 26 template <typename T, typename Attribute>
Chris@16 27 inline typename spirit::result_of::attribute_as<T, Attribute>::type
Chris@16 28 as(Attribute const& attr)
Chris@16 29 {
Chris@16 30 return attribute_as<T, Attribute>::call(attr);
Chris@16 31 }
Chris@16 32
Chris@16 33 template <typename T>
Chris@16 34 inline unused_type as(unused_type)
Chris@16 35 {
Chris@16 36 return unused;
Chris@16 37 }
Chris@16 38
Chris@16 39 ///////////////////////////////////////////////////////////////////////////
Chris@16 40 template <typename T, typename Attribute>
Chris@16 41 inline bool valid_as(Attribute const& attr)
Chris@16 42 {
Chris@16 43 return attribute_as<T, Attribute>::is_valid(attr);
Chris@16 44 }
Chris@16 45
Chris@16 46 template <typename T>
Chris@16 47 inline bool valid_as(unused_type)
Chris@16 48 {
Chris@16 49 return true;
Chris@16 50 }
Chris@16 51 }}}
Chris@16 52
Chris@16 53 ///////////////////////////////////////////////////////////////////////////////
Chris@16 54 namespace boost { namespace spirit { namespace result_of
Chris@16 55 {
Chris@16 56 template <typename T, typename Attribute>
Chris@16 57 struct attribute_as
Chris@16 58 : traits::attribute_as<T, Attribute>
Chris@16 59 {};
Chris@16 60
Chris@16 61 template <typename T>
Chris@16 62 struct attribute_as<T, unused_type>
Chris@16 63 {
Chris@16 64 typedef unused_type type;
Chris@16 65 };
Chris@16 66
Chris@16 67 template <typename T>
Chris@16 68 struct attribute_as<T, unused_type const>
Chris@16 69 {
Chris@16 70 typedef unused_type type;
Chris@16 71 };
Chris@16 72 }}}
Chris@16 73
Chris@16 74 #endif