annotate DEPENDENCIES/generic/include/boost/spirit/home/qi/reference.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 /*=============================================================================
Chris@16 2 Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3
Chris@16 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 ==============================================================================*/
Chris@16 7 #if !defined(BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM)
Chris@16 8 #define BOOST_SPIRIT_REFERENCE_OCTOBER_31_2008_1218AM
Chris@16 9
Chris@16 10 #if defined(_MSC_VER)
Chris@16 11 #pragma once
Chris@16 12 #endif
Chris@16 13
Chris@16 14 #include <boost/spirit/home/qi/meta_compiler.hpp>
Chris@16 15 #include <boost/spirit/home/qi/parser.hpp>
Chris@16 16 #include <boost/spirit/home/support/info.hpp>
Chris@16 17 #include <boost/spirit/home/support/handles_container.hpp>
Chris@16 18 #include <boost/type_traits/remove_const.hpp>
Chris@16 19 #include <boost/ref.hpp>
Chris@16 20
Chris@16 21 namespace boost { namespace spirit { namespace qi
Chris@16 22 {
Chris@16 23 ///////////////////////////////////////////////////////////////////////////
Chris@16 24 // reference is a parser that references another parser (its Subject)
Chris@16 25 ///////////////////////////////////////////////////////////////////////////
Chris@16 26 template <typename Subject>
Chris@16 27 struct reference : parser<reference<Subject> >
Chris@16 28 {
Chris@16 29 typedef Subject subject_type;
Chris@16 30
Chris@16 31 reference(Subject& subject)
Chris@16 32 : ref(subject) {}
Chris@16 33
Chris@16 34 template <typename Context, typename Iterator>
Chris@16 35 struct attribute : Subject::template attribute<Context, Iterator> {};
Chris@16 36
Chris@16 37 template <typename Iterator, typename Context
Chris@16 38 , typename Skipper, typename Attribute>
Chris@16 39 bool parse(Iterator& first, Iterator const& last
Chris@16 40 , Context& context, Skipper const& skipper
Chris@16 41 , Attribute& attr_) const
Chris@16 42 {
Chris@16 43 return ref.get().parse(first, last, context, skipper, attr_);
Chris@16 44 }
Chris@16 45
Chris@16 46 template <typename Context>
Chris@16 47 info what(Context& context) const
Chris@16 48 {
Chris@16 49 // the reference is transparent (does not add any info)
Chris@16 50 return ref.get().what(context);
Chris@16 51 }
Chris@16 52
Chris@16 53 boost::reference_wrapper<Subject> ref;
Chris@16 54 };
Chris@16 55 }}}
Chris@16 56
Chris@16 57 namespace boost { namespace spirit { namespace traits
Chris@16 58 {
Chris@16 59 ///////////////////////////////////////////////////////////////////////////
Chris@16 60 template <typename Subject, typename Attribute, typename Context
Chris@16 61 , typename Iterator>
Chris@16 62 struct handles_container<qi::reference<Subject>, Attribute, Context
Chris@16 63 , Iterator>
Chris@16 64 : handles_container<typename remove_const<Subject>::type
Chris@16 65 , Attribute, Context, Iterator>
Chris@16 66 {};
Chris@16 67 }}}
Chris@16 68
Chris@16 69 #endif