Chris@16: // Copyright (c) 2001-2011 Hartmut Kaiser Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #if !defined(BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM) Chris@16: #define BOOST_SPIRIT_KARMA_AS_STRING_DEC_18_0644PM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: namespace boost { namespace spirit { namespace traits Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // This file contains the attribute to string conversion utility. The Chris@16: // utility provided also accept spirit's unused_type; all no-ops. Compiler Chris@16: // optimization will easily strip these away. Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: inline typename spirit::result_of::attribute_as::type Chris@16: as(Attribute const& attr) Chris@16: { Chris@16: return attribute_as::call(attr); Chris@16: } Chris@16: Chris@16: template Chris@16: inline unused_type as(unused_type) Chris@16: { Chris@16: return unused; Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: template Chris@16: inline bool valid_as(Attribute const& attr) Chris@16: { Chris@16: return attribute_as::is_valid(attr); Chris@16: } Chris@16: Chris@16: template Chris@16: inline bool valid_as(unused_type) Chris@16: { Chris@16: return true; Chris@16: } Chris@16: }}} Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: namespace boost { namespace spirit { namespace result_of Chris@16: { Chris@16: template Chris@16: struct attribute_as Chris@16: : traits::attribute_as Chris@16: {}; Chris@16: Chris@16: template Chris@16: struct attribute_as Chris@16: { Chris@16: typedef unused_type type; Chris@16: }; Chris@16: Chris@16: template Chris@16: struct attribute_as Chris@16: { Chris@16: typedef unused_type type; Chris@16: }; Chris@16: }}} Chris@16: Chris@16: #endif