File indexing completed on 2025-01-18 09:53:49
0001
0002
0003
0004
0005
0006
0007
0008 #ifndef BOOST_XPRESSIVE_DETAIL_CORE_ADAPTOR_HPP_EAN_10_04_2005
0009 #define BOOST_XPRESSIVE_DETAIL_CORE_ADAPTOR_HPP_EAN_10_04_2005
0010
0011
0012 #if defined(_MSC_VER)
0013 # pragma once
0014 #endif
0015
0016 #include <boost/ref.hpp>
0017 #include <boost/implicit_cast.hpp>
0018 #include <boost/intrusive_ptr.hpp>
0019 #include <boost/xpressive/detail/detail_fwd.hpp>
0020 #include <boost/xpressive/detail/dynamic/matchable.hpp>
0021
0022 namespace boost { namespace xpressive { namespace detail
0023 {
0024
0025
0026
0027
0028
0029
0030 template<typename Xpr, typename Base>
0031 struct xpression_adaptor
0032 : Base
0033 {
0034 typedef typename Base::iterator_type iterator_type;
0035 typedef typename iterator_value<iterator_type>::type char_type;
0036
0037 Xpr xpr_;
0038
0039 xpression_adaptor(Xpr const &xpr)
0040 #if BOOST_WORKAROUND(__GNUC__, BOOST_TESTED_AT(4))
0041
0042
0043 __attribute__((__noinline__))
0044 #endif
0045 : xpr_(xpr)
0046 {
0047 }
0048
0049 virtual bool match(match_state<iterator_type> &state) const
0050 {
0051 typedef typename boost::unwrap_reference<Xpr const>::type xpr_type;
0052 return implicit_cast<xpr_type &>(this->xpr_).match(state);
0053 }
0054
0055 void link(xpression_linker<char_type> &linker) const
0056 {
0057 this->xpr_.link(linker);
0058 }
0059
0060 void peek(xpression_peeker<char_type> &peeker) const
0061 {
0062 this->xpr_.peek(peeker);
0063 }
0064
0065 private:
0066 xpression_adaptor &operator =(xpression_adaptor const &);
0067 };
0068
0069
0070
0071
0072 template<typename Base, typename Xpr>
0073 inline intrusive_ptr<Base const> make_adaptor(Xpr const &xpr)
0074 {
0075 return intrusive_ptr<Base const>(new xpression_adaptor<Xpr, Base>(xpr));
0076 }
0077
0078 }}}
0079
0080 #endif